14 #include "generalmod.h" 34 : ref_(pr), lastval_(
mUdf(float)) {}
35 virtual Property* clone()
const = 0;
36 static Property*
get(
const IOPar&);
38 bool isEqualTo(
const Property&)
const;
39 virtual bool isValue()
const {
return false; }
42 const char* name()
const;
51 virtual bool isUdf()
const = 0;
52 virtual bool dependsOn(
const Property&)
const {
return false; }
54 virtual const char* type()
const = 0;
55 virtual const char* def()
const = 0;
56 virtual void setDef(
const char*) = 0;
77 inline bool isAvg()
const {
return valopt_==Avg; }
78 inline bool isPrev()
const {
return valopt_==Prev;}
79 # define mPropertyEvalAvg Property::EvalOpts(Property::EvalOpts::Avg) 80 # define mPropertyEvalPrev Property::EvalOpts(Property::EvalOpts::Prev) 81 # define mPropertyEvalNew(pos) \ 82 Property::EvalOpts(Property::EvalOpts::New,pos) 88 return eo.isPrev() || !
mIsUdf(lastval_) ? lastval_
89 : (lastval_ = gtVal(eo));
97 virtual float gtVal(
EvalOpts)
const = 0;
116 int indexOf(
const char*,
bool matchaliases=
false)
const;
117 inline bool isPresent(
const char* nm,
bool ma=
false )
const 118 {
return indexOf(nm,ma) >= 0; }
119 Property&
get(
int idx ) {
return *
props_[idx]; }
120 const Property&
get(
int idx )
const {
return *
props_[idx]; }
121 inline const Property*
find(
const char* nm,
bool ma=
false )
const 122 {
return fnd(nm,ma); }
123 inline Property*
find(
const char* nm,
bool ma=
false )
124 {
return fnd(nm,ma); }
149 Property*
fnd(
const char*,
bool)
const;
155 #define mDefPropertyFns(clss,typstr) \ 157 virtual float gtVal(EvalOpts) const; \ 159 static const char* typeStr() { return typstr; } \ 160 virtual const char* type() const { return typeStr(); } \ 161 virtual const char* factoryKeyword() const { return type(); } \ 162 static Property* create( const PropertyRef& r ) { return new clss(r); } \ 163 virtual clss* clone() const { return new clss( *this ); }\ 164 static void initClass() { factory().addCreator(create,typeStr());} \ 165 virtual const char* def() const; \ 166 virtual void setDef(const char*); \ 167 virtual bool isUdf() const 179 , val_(pr.disp_.range_.center()) {}
200 , rg_(pr.disp_.range_) {}
Property * find(const char *nm, bool ma=false)
Definition: property.h:123
Property(const PropertyRef &pr)
Definition: property.h:33
#define mExpClass(module)
Definition: commondefs.h:157
#define mIsUdf(val)
Use mIsUdf to check for undefinedness of simple types.
Definition: undefval.h:285
Definition: propertyref.h:174
ObjectSet< Property > props_
Definition: property.h:146
float relpos_
Definition: property.h:74
float lastval_
Definition: property.h:95
float curz_
Definition: property.h:75
Definition: property.h:102
void erase()
Definition: property.h:137
#define mODTextTranslationClass(clss)
Definition: uistring.h:37
int indexOf(const PropertyRef &pr) const
Definition: property.h:127
virtual uiString errMsg() const
Definition: property.h:47
void usePar(const IOPar &iop, ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:200
bool isPrev() const
Definition: property.h:78
Ref Data for a (usually petrophysical) property.
Definition: propertyref.h:40
uiString errmsg_
Definition: property.h:147
bool isPresent(const char *nm, bool ma=false) const
Definition: property.h:117
virtual bool dependsOn(const Property &) const
Definition: property.h:52
uiString errMsg() const
Definition: property.h:141
static const uiString & emptyString()
Definition: uistring.h:107
Definition: uistring.h:88
bool isEmpty() const
Definition: odset.h:43
ObjectSet< T >::size_type indexOf(const ObjectSet< T > &os, const S &val)
Locate object in set.
Definition: objectset.h:173
PropertySet(const PropertySet &ps)
Definition: property.h:109
bool isAvg() const
Definition: property.h:77
ValueProperty(const PropertyRef &pr, float v)
Definition: property.h:180
RangeProperty(const PropertyRef &pr)
Definition: property.h:198
ValueProperty(const PropertyRef &pr)
Definition: property.h:177
#define mDefineFactory1ParamInClass(T, P, funcname)
Definition: factory.h:445
ValOpt
Definition: property.h:67
size_type size() const
Definition: objectset.h:48
Range of values. pos_ is usually in [0,1].
Definition: property.h:194
const PropertyRef & ref() const
Definition: property.h:41
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:53
EvalOpts(ValOpt vo=New, float relpos=0.5)
Definition: property.h:69
const Property * find(const char *nm, bool ma=false) const
Definition: property.h:121
bool prepareUsage() const
init()'s all Properties
#define mUdf(type)
Use this macro to get the undefined for simple types.
Definition: undefval.h:270
bool isEmpty() const
Definition: property.h:115
const PropertyRef & ref_
Definition: property.h:94
virtual ~Property()
Definition: property.h:37
void fillPar(IOPar &iop, const ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:187
virtual ~PropertySet()
Definition: property.h:111
#define mDefPropertyFns(clss, typstr)
Definition: property.h:155
Property * fnd(const char *, bool) const
BufferString errmsg_
Definition: horizontracker.h:117
PropertySet & operator=(const PropertySet &)
int size() const
Definition: property.h:114
Interval< float > rg_
Definition: property.h:206
Simple, single-value property.
Definition: property.h:173
A (usually petrophysical) property of some object.
Definition: property.h:29
ValOpt valopt_
Definition: property.h:73
float value(EvalOpts eo=EvalOpts()) const
Definition: property.h:86
void getPropertiesOfRefType(PropertyRef::StdType, ObjectSet< Property > &) const
PropertySet()
Definition: property.h:106
RangeProperty(const PropertyRef &pr, Interval< float > rg)
Definition: property.h:201
StdType
Definition: propertyref.h:44
bool add(Property *)
refuses to add with identical name
virtual bool isValue() const
Definition: property.h:183
Definition: property.h:63
void setValue(float v)
Definition: property.h:188
bool isUdf(const T &t)
Definition: undefval.h:241
virtual const OD::String & name() const
Definition: namedobj.h:33
float val_
Definition: property.h:185
virtual bool isValue() const
Definition: property.h:39
virtual void reset()
Definition: property.h:44
virtual size_type indexOf(const T *) const
Definition: objectset.h:341
int indexOf(const Property &p) const
Definition: property.h:125
void replace(int, Property *)
void deepErase(ObjectSet< T > &os)
empty the ObjectSet deleting all objects pointed to.
Definition: objectset.h:122