16 #include "generalmod.h" 36 : ref_(pr), lastval_(
mUdf(float)) {}
37 virtual Property* clone()
const = 0;
38 static Property*
get(
const IOPar&);
40 bool isEqualTo(
const Property&)
const;
41 virtual bool isValue()
const {
return false; }
44 const char* name()
const;
53 virtual bool isUdf()
const = 0;
54 virtual bool dependsOn(
const Property&)
const {
return false; }
56 virtual const char* type()
const = 0;
57 virtual const char* def()
const = 0;
58 virtual void setDef(
const char*) = 0;
80 inline bool isAvg()
const {
return valopt_==Avg; }
81 inline bool isPrev()
const {
return valopt_==Prev;}
82 # define mPropertyEvalAvg Property::EvalOpts(Property::EvalOpts::Avg) 83 # define mPropertyEvalPrev Property::EvalOpts(Property::EvalOpts::Prev) 84 # define mPropertyEvalNew(pos) \ 85 Property::EvalOpts(Property::EvalOpts::New,pos) 91 return eo.isPrev() || !
mIsUdf(lastval_) ? lastval_
92 : (lastval_ = gtVal(eo));
100 virtual float gtVal(
EvalOpts)
const = 0;
119 int indexOf(
const char*,
bool matchaliases=
false)
const;
120 inline bool isPresent(
const char* nm,
bool ma=
false )
const 121 {
return indexOf(nm,ma) >= 0; }
122 Property&
get(
int idx ) {
return *
props_[idx]; }
123 const Property&
get(
int idx )
const {
return *
props_[idx]; }
124 inline const Property*
find(
const char* nm,
bool ma=
false )
const 125 {
return fnd(nm,ma); }
126 inline Property*
find(
const char* nm,
bool ma=
false )
127 {
return fnd(nm,ma); }
152 Property*
fnd(
const char*,
bool)
const;
158 #define mDefPropertyFns(clss,typstr) \ 160 virtual float gtVal(EvalOpts) const; \ 162 static const char* typeStr() { return typstr; } \ 163 virtual const char* type() const { return typeStr(); } \ 164 virtual const char* factoryKeyword() const { return type(); } \ 165 static Property* create( const PropertyRef& r ) { return new clss(r); } \ 166 virtual clss* clone() const { return new clss( *this ); }\ 167 static void initClass() { factory().addCreator(create,typeStr());} \ 168 virtual const char* def() const; \ 169 virtual void setDef(const char*); \ 170 virtual bool isUdf() const 182 , val_(pr.disp_.range_.center()) {}
203 , rg_(pr.disp_.range_) {}
215 float gtAvgVal()
const;
Property * find(const char *nm, bool ma=false)
Definition: property.h:126
Property(const PropertyRef &pr)
Definition: property.h:35
#define mExpClass(module)
Definition: commondefs.h:160
#define mIsUdf(val)
Use mIsUdf to check for undefinedness of simple types.
Definition: undefval.h:287
Definition: propertyref.h:176
ObjectSet< Property > props_
Definition: property.h:149
float relpos_
Definition: property.h:77
float lastval_
Definition: property.h:98
Definition: property.h:105
void erase()
Definition: property.h:140
#define mODTextTranslationClass(clss)
Definition: uistring.h:38
int indexOf(const PropertyRef &pr) const
Definition: property.h:130
virtual uiString errMsg() const
Definition: property.h:49
float relz_
Definition: property.h:78
void usePar(const IOPar &iop, ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:188
bool isPrev() const
Definition: property.h:81
Ref Data for a (usually petrophysical) property.
Definition: propertyref.h:42
uiString errmsg_
Definition: property.h:150
bool isPresent(const char *nm, bool ma=false) const
Definition: property.h:120
virtual bool dependsOn(const Property &) const
Definition: property.h:54
uiString errMsg() const
Definition: property.h:144
static const uiString & emptyString()
Definition: uistring.h:109
Definition: uistring.h:89
bool isEmpty() const
Definition: odset.h:45
ObjectSet< T >::size_type indexOf(const ObjectSet< T > &os, const S &val)
Locate object in set.
Definition: objectset.h:169
PropertySet(const PropertySet &ps)
Definition: property.h:112
bool isAvg() const
Definition: property.h:80
ValueProperty(const PropertyRef &pr, float v)
Definition: property.h:183
RangeProperty(const PropertyRef &pr)
Definition: property.h:201
ValueProperty(const PropertyRef &pr)
Definition: property.h:180
#define mDefineFactory1ParamInClass(T, P, funcname)
Definition: factory.h:447
ValOpt
Definition: property.h:69
size_type size() const
Definition: objectset.h:50
Range of values. pos_ is usually in [0,1].
Definition: property.h:197
const PropertyRef & ref() const
Definition: property.h:43
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:47
EvalOpts(ValOpt vo=New, float relpos=0.5)
Definition: property.h:71
const Property * find(const char *nm, bool ma=false) const
Definition: property.h:124
bool prepareUsage() const
init()'s all Properties
#define mUdf(type)
Use this macro to get the undefined for simple types.
Definition: undefval.h:272
bool isEmpty() const
Definition: property.h:118
const PropertyRef & ref_
Definition: property.h:97
virtual ~Property()
Definition: property.h:39
void fillPar(IOPar &iop, const ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:175
virtual ~PropertySet()
Definition: property.h:114
#define mDefPropertyFns(clss, typstr)
Definition: property.h:158
Property * fnd(const char *, bool) const
BufferString errmsg_
Definition: horizontracker.h:119
PropertySet & operator=(const PropertySet &)
int size() const
Definition: property.h:117
Interval< float > rg_
Definition: property.h:209
Simple, single-value property.
Definition: property.h:176
A (usually petrophysical) property of some object.
Definition: property.h:31
ValOpt valopt_
Definition: property.h:76
float value(EvalOpts eo=EvalOpts()) const
Definition: property.h:89
void getPropertiesOfRefType(PropertyRef::StdType, ObjectSet< Property > &) const
PropertySet()
Definition: property.h:109
RangeProperty(const PropertyRef &pr, Interval< float > rg)
Definition: property.h:204
StdType
Definition: propertyref.h:46
bool add(Property *)
refuses to add with identical name
virtual bool isValue() const
Definition: property.h:186
Definition: property.h:65
void setValue(float v)
Definition: property.h:191
bool isUdf(const T &t)
Definition: undefval.h:243
virtual const OD::String & name() const
Definition: namedobj.h:47
float val_
Definition: property.h:188
virtual bool isValue() const
Definition: property.h:41
virtual void reset()
Definition: property.h:46
virtual size_type indexOf(const T *) const
Definition: objectset.h:337
int indexOf(const Property &p) const
Definition: property.h:128
void replace(int, Property *)
void deepErase(ObjectSet< T > &os)
empty the ObjectSet deleting all objects pointed to.
Definition: objectset.h:118