OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Public Types | Public Member Functions | Protected Attributes | List of all members
ossimNumericProperty Class Reference

#include <ossimNumericProperty.h>

Inheritance diagram for ossimNumericProperty:
ossimProperty ossimObject ossimReferenced

Public Types

enum  ossimNumericPropertyType { ossimNumericPropertyType_INT = 0, ossimNumericPropertyType_UINT, ossimNumericPropertyType_FLOAT32, ossimNumericPropertyType_FLOAT64 }
 
- Public Types inherited from ossimProperty
enum  ossimPropertyChangeType {
  ossimPropertyChangeType_NOTSPECIFIED = 0, ossimPropertyChangeType_CACHE_REFRESH = 1, ossimPropertyChangeType_FULL_REFRESH = 2, ossimPropertyChangeType_AFFECTS_OTHERS = 4,
  ossimPropertyChangeType_ALL = (ossimPropertyChangeType_CACHE_REFRESH|ossimPropertyChangeType_FULL_REFRESH|ossimPropertyChangeType_AFFECTS_OTHERS)
}
 

Public Member Functions

 ossimNumericProperty (const ossimString &name=ossimString(""), const ossimString &value=ossimString("0"))
 
 ossimNumericProperty (const ossimString &name, const ossimString &value, double minValue, double maxValue)
 
 ossimNumericProperty (const ossimNumericProperty &rhs)
 
virtual ossimObjectdup () const
 
virtual const ossimPropertyassign (const ossimProperty &rhs)
 
virtual bool hasConstraints () const
 
double getMinValue () const
 
double getMaxValue () const
 
virtual void clearConstraints ()
 
virtual void setConstraints (double minValue, double maxValue)
 
virtual bool setValue (const ossimString &value)
 
virtual void valueToString (ossimString &valueResult) const
 
virtual ossimNumericPropertyType getNumericType () const
 
virtual void setNumericType (ossimNumericPropertyType type)
 
virtual ossim_float64 asFloat64 () const
 
virtual ossim_float32 asFloat32 () const
 
virtual ossim_uint32 asUInt32 () const
 
virtual ossim_uint16 asUInt16 () const
 
virtual ossim_uint8 asUInt8 () const
 
virtual ossim_sint32 asInt32 () const
 
virtual ossim_sint16 asInt16 () const
 
virtual ossim_sint8 asInt8 () const
 
- Public Member Functions inherited from ossimProperty
 ossimProperty (const ossimString &name=ossimString(""))
 
 ossimProperty (const ossimProperty &rhs)
 
const ossimPropertyoperator= (const ossimProperty &rhs)
 
const ossimStringgetName () const
 
void setName (const ossimString &name)
 
virtual ossimString valueToString () const
 
virtual const ossimContainerPropertyasContainer () const
 
virtual ossimContainerPropertyasContainer ()
 
bool isChangeTypeSet (int type) const
 
void clearChangeType ()
 
void setChangeType (int type, bool on=true)
 
void setFullRefreshBit ()
 
void setCacheRefreshBit ()
 
ossimPropertyChangeType getChangeType () const
 
bool isFullRefresh () const
 
bool isCacheRefresh () const
 
bool isChangeTypeSpecified () const
 
bool affectsOthers () const
 
virtual void setReadOnlyFlag (bool flag)
 
bool getReadOnlyFlag () const
 
bool isReadOnly () const
 
void setModifiedFlag (bool flag)
 
bool getModifiedFlag () const
 
bool isModified () const
 
void clearModifiedFlag ()
 
void setDescription (const ossimString &description)
 
virtual ossimString getDescription () const
 
virtual ossimRefPtr< ossimXmlNodetoXml () const
 
virtual void saveState (ossimKeywordlist &kwl, const ossimString &prefix="") const
 
virtual void accept (ossimVisitor &visitor)
 
- Public Member Functions inherited from ossimObject
 ossimObject ()
 
virtual ~ossimObject ()
 
virtual ossimString getShortName () const
 
virtual ossimString getLongName () const
 
virtual ossimString getClassName () const
 
virtual RTTItypeid getType () const
 
virtual bool canCastTo (ossimObject *obj) const
 
virtual bool canCastTo (const RTTItypeid &id) const
 
virtual bool canCastTo (const ossimString &parentClassName) const
 
virtual bool saveState (ossimKeywordlist &kwl, const char *prefix=0) const
 
virtual bool loadState (const ossimKeywordlist &kwl, const char *prefix=0)
 
virtual std::ostream & print (std::ostream &out) const
 Generic print method. More...
 
virtual bool isEqualTo (const ossimObject &obj, ossimCompareType compareType=OSSIM_COMPARE_FULL) const
 
- Public Member Functions inherited from ossimReferenced
 ossimReferenced ()
 
 ossimReferenced (const ossimReferenced &)
 
ossimReferencedoperator= (const ossimReferenced &)
 
void ref () const
 increment the reference count by one, indicating that this object has another pointer which is referencing it. More...
 
void unref () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
void unref_nodelete () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
int referenceCount () const
 

Protected Attributes

ossimString theValue
 
ossimNumericPropertyType theType
 
std::vector< double > theRangeConstraint
 
- Protected Attributes inherited from ossimProperty
ossimString theName
 
ossimString theDescription
 
bool theReadOnlyFlag
 
ossimPropertyChangeType theChangeType
 
bool theModifiedFlag
 

Additional Inherited Members

- Protected Member Functions inherited from ossimProperty
virtual ~ossimProperty ()
 
- Protected Member Functions inherited from ossimReferenced
virtual ~ossimReferenced ()
 

Detailed Description

Definition at line 13 of file ossimNumericProperty.h.

Member Enumeration Documentation

◆ ossimNumericPropertyType

Constructor & Destructor Documentation

◆ ossimNumericProperty() [1/3]

ossimNumericProperty::ossimNumericProperty ( const ossimString name = ossimString(""),
const ossimString value = ossimString("0") 
)

Definition at line 15 of file ossimNumericProperty.cpp.

Referenced by dup().

17  :ossimProperty(name),
18  theValue(value),
20 {
21 }
ossimProperty(const ossimString &name=ossimString(""))
ossimNumericPropertyType theType

◆ ossimNumericProperty() [2/3]

ossimNumericProperty::ossimNumericProperty ( const ossimString name,
const ossimString value,
double  minValue,
double  maxValue 
)

Definition at line 23 of file ossimNumericProperty.cpp.

References setConstraints().

27  :ossimProperty(name),
28  theValue(value),
30 {
31  setConstraints(minValue,
32  maxValue);
33 }
ossimProperty(const ossimString &name=ossimString(""))
ossimNumericPropertyType theType
virtual void setConstraints(double minValue, double maxValue)

◆ ossimNumericProperty() [3/3]

ossimNumericProperty::ossimNumericProperty ( const ossimNumericProperty rhs)

Definition at line 35 of file ossimNumericProperty.cpp.

36  :ossimProperty(rhs),
37  theValue(rhs.theValue),
38  theType(rhs.theType),
40 {
41 }
ossimProperty(const ossimString &name=ossimString(""))
ossimNumericPropertyType theType
std::vector< double > theRangeConstraint

Member Function Documentation

◆ asFloat32()

ossim_float32 ossimNumericProperty::asFloat32 ( ) const
virtual

Definition at line 176 of file ossimNumericProperty.cpp.

References theValue, and ossimString::toDouble().

Referenced by valueToString().

177 {
178  return (ossim_float32)theValue.toDouble();
179 }
float ossim_float32
double toDouble() const

◆ asFloat64()

ossim_float64 ossimNumericProperty::asFloat64 ( ) const
virtual

Definition at line 171 of file ossimNumericProperty.cpp.

References theValue, and ossimString::toDouble().

Referenced by valueToString().

172 {
173  return (ossim_float64)theValue.toDouble();
174 }
double ossim_float64
double toDouble() const

◆ asInt16()

ossim_sint16 ossimNumericProperty::asInt16 ( ) const
virtual

Definition at line 201 of file ossimNumericProperty.cpp.

References theValue, and ossimString::toInt32().

202 {
203  return (ossim_int16)theValue.toInt32();
204 }
ossim_int32 toInt32() const
short ossim_int16

◆ asInt32()

ossim_sint32 ossimNumericProperty::asInt32 ( ) const
virtual

Definition at line 196 of file ossimNumericProperty.cpp.

References theValue, and ossimString::toInt32().

Referenced by ossimConvolutionFilter1D::setProperty(), and valueToString().

197 {
198  return (ossim_int32)theValue.toInt32();
199 }
ossim_int32 toInt32() const
int ossim_int32

◆ asInt8()

ossim_sint8 ossimNumericProperty::asInt8 ( ) const
virtual

Definition at line 206 of file ossimNumericProperty.cpp.

References theValue, and ossimString::toInt32().

207 {
208  return (ossim_int8)theValue.toInt32();
209 }
char ossim_int8
Previous DLL import export section.
ossim_int32 toInt32() const

◆ assign()

const ossimProperty & ossimNumericProperty::assign ( const ossimProperty rhs)
virtual

Reimplemented from ossimProperty.

Definition at line 48 of file ossimNumericProperty.cpp.

References ossimProperty::assign(), setValue(), theRangeConstraint, theType, theValue, and ossimProperty::valueToString().

49 {
51 
52  const ossimNumericProperty* numericProperty = dynamic_cast<const ossimNumericProperty*>(&rhs);
53  if(numericProperty)
54  {
55  theValue = numericProperty->theValue;
56  theType = numericProperty->theType;
57  theRangeConstraint = numericProperty->theRangeConstraint;
58  }
59  else
60  {
61  ossimString value;
62  rhs.valueToString(value);
63  setValue(value);
64  }
65  return *this;
66 }
virtual void valueToString(ossimString &valueResult) const =0
ossimNumericPropertyType theType
virtual const ossimProperty & assign(const ossimProperty &rhs)
std::vector< double > theRangeConstraint
virtual bool setValue(const ossimString &value)

◆ asUInt16()

ossim_uint16 ossimNumericProperty::asUInt16 ( ) const
virtual

Definition at line 186 of file ossimNumericProperty.cpp.

References theValue, and ossimString::toUInt32().

187 {
188  return (ossim_uint16)theValue.toUInt32();
189 }
ossim_uint32 toUInt32() const
unsigned short ossim_uint16

◆ asUInt32()

ossim_uint32 ossimNumericProperty::asUInt32 ( ) const
virtual

Definition at line 181 of file ossimNumericProperty.cpp.

References theValue, and ossimString::toUInt32().

Referenced by ossimConvolutionFilter1D::setProperty(), and valueToString().

182 {
183  return theValue.toUInt32();
184 }
ossim_uint32 toUInt32() const

◆ asUInt8()

ossim_uint8 ossimNumericProperty::asUInt8 ( ) const
virtual

Definition at line 191 of file ossimNumericProperty.cpp.

References theValue, and ossimString::toUInt32().

192 {
193  return (ossim_uint8)theValue.toUInt32();
194 }
ossim_uint32 toUInt32() const
unsigned char ossim_uint8

◆ clearConstraints()

void ossimNumericProperty::clearConstraints ( )
virtual

Definition at line 93 of file ossimNumericProperty.cpp.

References theRangeConstraint.

94 {
95  theRangeConstraint.clear();
96 }
std::vector< double > theRangeConstraint

◆ dup()

ossimObject * ossimNumericProperty::dup ( ) const
virtual

Reimplemented from ossimObject.

Definition at line 43 of file ossimNumericProperty.cpp.

References ossimNumericProperty().

44 {
45  return new ossimNumericProperty(*this);
46 }
ossimNumericProperty(const ossimString &name=ossimString(""), const ossimString &value=ossimString("0"))

◆ getMaxValue()

double ossimNumericProperty::getMaxValue ( ) const

Definition at line 83 of file ossimNumericProperty.cpp.

References hasConstraints(), and theRangeConstraint.

84 {
85  if(hasConstraints())
86  {
87  return theRangeConstraint[1];
88  }
89 
90  return 0.0;
91 }
std::vector< double > theRangeConstraint
virtual bool hasConstraints() const

◆ getMinValue()

double ossimNumericProperty::getMinValue ( ) const

Definition at line 73 of file ossimNumericProperty.cpp.

References hasConstraints(), and theRangeConstraint.

74 {
75  if(hasConstraints())
76  {
77  return theRangeConstraint[0];
78  }
79 
80  return 0.0;
81 }
std::vector< double > theRangeConstraint
virtual bool hasConstraints() const

◆ getNumericType()

ossimNumericProperty::ossimNumericPropertyType ossimNumericProperty::getNumericType ( ) const
virtual

Definition at line 161 of file ossimNumericProperty.cpp.

References theType.

162 {
163  return theType;
164 }
ossimNumericPropertyType theType

◆ hasConstraints()

bool ossimNumericProperty::hasConstraints ( ) const
virtual

Definition at line 68 of file ossimNumericProperty.cpp.

References theRangeConstraint.

Referenced by getMaxValue(), getMinValue(), and setValue().

69 {
70  return (theRangeConstraint.size() == 2);
71 }
std::vector< double > theRangeConstraint

◆ setConstraints()

void ossimNumericProperty::setConstraints ( double  minValue,
double  maxValue 
)
virtual

Definition at line 98 of file ossimNumericProperty.cpp.

References theRangeConstraint.

Referenced by ossimNumericProperty().

100 {
101  theRangeConstraint.resize(2);
102  theRangeConstraint[0] = minValue;
103  theRangeConstraint[1] = maxValue;
104 
105  if(minValue > maxValue)
106  {
107  std::swap(theRangeConstraint[0],
108  theRangeConstraint[1]);
109  }
110 }
std::vector< double > theRangeConstraint

◆ setNumericType()

void ossimNumericProperty::setNumericType ( ossimNumericPropertyType  type)
virtual

◆ setValue()

bool ossimNumericProperty::setValue ( const ossimString value)
virtual

Implements ossimProperty.

Definition at line 112 of file ossimNumericProperty.cpp.

References hasConstraints(), theRangeConstraint, theValue, and ossimString::toDouble().

Referenced by assign().

113 {
114  bool result = true;
115  if(hasConstraints())
116  {
117  ossim_float64 tempV = (ossim_float64)value.toDouble();
118  if((tempV >= theRangeConstraint[0])&&
119  (tempV <= theRangeConstraint[1]))
120  {
121  theValue = value;
122  }
123  }
124  else
125  {
126  theValue = value;
127  }
128 
129  return result;
130 }
double ossim_float64
double toDouble() const
std::vector< double > theRangeConstraint
virtual bool hasConstraints() const

◆ valueToString()

void ossimNumericProperty::valueToString ( ossimString valueResult) const
virtual

Implements ossimProperty.

Definition at line 132 of file ossimNumericProperty.cpp.

References asFloat32(), asFloat64(), asInt32(), asUInt32(), ossimNumericPropertyType_FLOAT32, ossimNumericPropertyType_FLOAT64, ossimNumericPropertyType_INT, ossimNumericPropertyType_UINT, theType, and ossimString::toString().

133 {
134  switch(theType)
135  {
137  {
138  valueResult = ossimString::toString(asInt32());
139  break;
140  }
142  {
143  valueResult = ossimString::toString(asUInt32());
144  break;
145  }
147  {
148  valueResult = ossimString::toString(asFloat32());
149 
150  break;
151  }
153  {
154  valueResult = ossimString::toString(asFloat64());
155  break;
156  }
157  };
158 }
static ossimString toString(bool aValue)
Numeric to string methods.
ossimNumericPropertyType theType
virtual ossim_uint32 asUInt32() const
virtual ossim_sint32 asInt32() const
virtual ossim_float32 asFloat32() const
virtual ossim_float64 asFloat64() const

Member Data Documentation

◆ theRangeConstraint

std::vector<double> ossimNumericProperty::theRangeConstraint
protected

◆ theType

ossimNumericPropertyType ossimNumericProperty::theType
protected

Definition at line 58 of file ossimNumericProperty.h.

Referenced by assign(), getNumericType(), setNumericType(), and valueToString().

◆ theValue

ossimString ossimNumericProperty::theValue
protected

The documentation for this class was generated from the following files: