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

#include <ossimDoubleGridProperty.h>

Inheritance diagram for ossimDoubleGridProperty:
ossimProperty ossimObject ossimReferenced

Public Member Functions

 ossimDoubleGridProperty (const ossimString &name=ossimString(""), int numberOfRows=0, int numberOfCols=0, const std::vector< double > &values=std::vector< double >())
 
 ossimDoubleGridProperty (const ossimDoubleGridProperty &rhs)
 
virtual ~ossimDoubleGridProperty ()
 
ossimObjectdup () const
 
virtual const ossimPropertyassign (const ossimProperty &rhs)
 
virtual bool setValue (const ossimString &value)
 
virtual void valueToString (ossimString &valueResult) const
 
void clearConstraints ()
 
void setColConstraints (int minNumberOfCols, int maxNumberOfCols)
 
void setRowConstraints (int minNumberOfRows, int maxNumberOfRows)
 
void setContraints (int minNumberOfRows, int maxNumberOfRows, int minNumberOfCols, int maxNumberOfCols)
 
ossim_uint32 getNumberOfRows () const
 
ossim_uint32 getNumberOfCols () const
 
double getValue (ossim_uint32 row, ossim_uint32 col) 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

int theMinNumberOfCols
 
int theMaxNumberOfCols
 
int theMinNumberOfRows
 
int theMaxNumberOfRows
 
std::vector< std::vector< double > > theValues
 
- Protected Attributes inherited from ossimProperty
ossimString theName
 
ossimString theDescription
 
bool theReadOnlyFlag
 
ossimPropertyChangeType theChangeType
 
bool theModifiedFlag
 

Additional Inherited Members

- 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)
}
 
- Protected Member Functions inherited from ossimProperty
virtual ~ossimProperty ()
 
- Protected Member Functions inherited from ossimReferenced
virtual ~ossimReferenced ()
 

Detailed Description

Definition at line 13 of file ossimDoubleGridProperty.h.

Constructor & Destructor Documentation

◆ ossimDoubleGridProperty() [1/2]

ossimDoubleGridProperty::ossimDoubleGridProperty ( const ossimString name = ossimString(""),
int  numberOfRows = 0,
int  numberOfCols = 0,
const std::vector< double > &  values = std::vector<double>() 
)

Definition at line 6 of file ossimDoubleGridProperty.cpp.

Referenced by dup().

10  :ossimProperty(name),
15 {
16 
17 }
ossimProperty(const ossimString &name=ossimString(""))

◆ ossimDoubleGridProperty() [2/2]

ossimDoubleGridProperty::ossimDoubleGridProperty ( const ossimDoubleGridProperty rhs)

◆ ~ossimDoubleGridProperty()

ossimDoubleGridProperty::~ossimDoubleGridProperty ( )
virtual

Definition at line 29 of file ossimDoubleGridProperty.cpp.

30 {
31 }

Member Function Documentation

◆ assign()

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

Reimplemented from ossimProperty.

Definition at line 38 of file ossimDoubleGridProperty.cpp.

References ossimProperty::assign(), setValue(), theMaxNumberOfCols, theMaxNumberOfRows, theMinNumberOfCols, theMinNumberOfRows, theValues, and ossimProperty::valueToString().

39 {
41  const ossimDoubleGridProperty* rhsPtr = dynamic_cast<const ossimDoubleGridProperty*>(&rhs);
42  if(rhsPtr)
43  {
48  theValues = rhsPtr->theValues;
49  }
50  else
51  {
52  setValue(rhs.valueToString());
53  }
54 
55  return *this;
56 }
virtual void valueToString(ossimString &valueResult) const =0
virtual const ossimProperty & assign(const ossimProperty &rhs)
virtual bool setValue(const ossimString &value)
std::vector< std::vector< double > > theValues

◆ clearConstraints()

void ossimDoubleGridProperty::clearConstraints ( )

◆ dup()

ossimObject * ossimDoubleGridProperty::dup ( ) const
virtual

Reimplemented from ossimObject.

Definition at line 33 of file ossimDoubleGridProperty.cpp.

References ossimDoubleGridProperty().

34 {
35  return new ossimDoubleGridProperty(*this);
36 }
ossimDoubleGridProperty(const ossimString &name=ossimString(""), int numberOfRows=0, int numberOfCols=0, const std::vector< double > &values=std::vector< double >())

◆ getNumberOfCols()

ossim_uint32 ossimDoubleGridProperty::getNumberOfCols ( ) const

Definition at line 140 of file ossimDoubleGridProperty.cpp.

References getNumberOfRows(), and theValues.

Referenced by getValue(), and valueToString().

141 {
142  if(getNumberOfRows())
143  {
144  return (ossim_uint32)theValues[0].size();
145  }
146  return 0;
147 }
std::vector< std::vector< double > > theValues
unsigned int ossim_uint32
ossim_uint32 getNumberOfRows() const

◆ getNumberOfRows()

ossim_uint32 ossimDoubleGridProperty::getNumberOfRows ( ) const

Definition at line 135 of file ossimDoubleGridProperty.cpp.

References theValues.

Referenced by getNumberOfCols(), getValue(), and valueToString().

136 {
137  return ((int)theValues.size());
138 }
std::vector< std::vector< double > > theValues

◆ getValue()

double ossimDoubleGridProperty::getValue ( ossim_uint32  row,
ossim_uint32  col 
) const

Definition at line 149 of file ossimDoubleGridProperty.cpp.

References getNumberOfCols(), getNumberOfRows(), and theValues.

Referenced by valueToString().

151 {
152  if((row < getNumberOfRows())&&
153  (col < getNumberOfCols()))
154  {
155  return theValues[(int)row][(int)col];
156  }
157 
158  return 0.0;
159 }
std::vector< std::vector< double > > theValues
ossim_uint32 getNumberOfRows() const
ossim_uint32 getNumberOfCols() const

◆ setColConstraints()

void ossimDoubleGridProperty::setColConstraints ( int  minNumberOfCols,
int  maxNumberOfCols 
)

Setting both values to -1 will say no constraints. if min is constrained and max not then it will not allow the cols to grow any larger than the passed in max.

If the min is -1 and max not then it will not exceed the max number of cols

Definition at line 110 of file ossimDoubleGridProperty.cpp.

References theMaxNumberOfCols, and theMinNumberOfCols.

112 {
113  theMinNumberOfCols = minNumberOfCols;
114  theMaxNumberOfCols = maxNumberOfCols;
115 }

◆ setContraints()

void ossimDoubleGridProperty::setContraints ( int  minNumberOfRows,
int  maxNumberOfRows,
int  minNumberOfCols,
int  maxNumberOfCols 
)

Definition at line 124 of file ossimDoubleGridProperty.cpp.

References theMaxNumberOfCols, theMaxNumberOfRows, theMinNumberOfCols, and theMinNumberOfRows.

128 {
129  theMinNumberOfRows = minNumberOfRows;
130  theMaxNumberOfRows = maxNumberOfRows;
131  theMinNumberOfCols = minNumberOfCols;
132  theMaxNumberOfCols = maxNumberOfCols;
133 }

◆ setRowConstraints()

void ossimDoubleGridProperty::setRowConstraints ( int  minNumberOfRows,
int  maxNumberOfRows 
)

Definition at line 117 of file ossimDoubleGridProperty.cpp.

References theMaxNumberOfRows, and theMinNumberOfRows.

119 {
120  theMinNumberOfRows = minNumberOfRows;
121  theMaxNumberOfRows = maxNumberOfRows;
122 }

◆ setValue()

bool ossimDoubleGridProperty::setValue ( const ossimString value)
virtual

Implements ossimProperty.

Definition at line 59 of file ossimDoubleGridProperty.cpp.

References ossimString::c_str(), theValues, and ossimString::toInt32().

Referenced by assign().

60 {
61  std::istringstream in(value.c_str());
62  ossimString nRows, nCols, v;
63  int numberOfRows=0;
64  int numberOfCols=0;
65  int rowIdx = 0;
66  int colIdx = 0;
67  in >> nRows >> nCols;
68  numberOfRows = nRows.toInt32();
69  numberOfCols = nCols.toInt32();
70  theValues.resize(numberOfRows);
71 
72  for(rowIdx = 0; rowIdx < numberOfRows; ++rowIdx)
73  {
74  theValues[rowIdx].resize(numberOfCols);
75  for(colIdx = 0; colIdx < numberOfCols; ++ colIdx)
76  {
77  in >> v;
78  theValues[rowIdx][colIdx] = v.toDouble();
79  }
80  }
81 
82  return true;
83 }
ossim_int32 toInt32() const
std::vector< std::vector< double > > theValues
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string&#39;s contents...
Definition: ossimString.h:396
std::basic_istringstream< char > istringstream
Class for char input memory streams.
Definition: ossimIosFwd.h:32

◆ valueToString()

void ossimDoubleGridProperty::valueToString ( ossimString valueResult) const
virtual

Implements ossimProperty.

Definition at line 85 of file ossimDoubleGridProperty.cpp.

References getNumberOfCols(), getNumberOfRows(), getValue(), and ossimString::toString().

86 {
88  int rowIdx = 0;
89  int colIdx = 0;
90  out << getNumberOfRows() << " " << getNumberOfCols() << " ";
91 
92  for(rowIdx = 0; rowIdx < (int)getNumberOfRows(); ++rowIdx)
93  {
94  for(colIdx = 0; colIdx < (int)getNumberOfCols(); ++colIdx)
95  {
96  out << ossimString::toString(getValue(rowIdx, colIdx)) << " ";
97  }
98  }
99  valueResult = out.str();
100 }
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
Definition: ossimIosFwd.h:35
static ossimString toString(bool aValue)
Numeric to string methods.
ossim_uint32 getNumberOfRows() const
double getValue(ossim_uint32 row, ossim_uint32 col) const
ossim_uint32 getNumberOfCols() const

Member Data Documentation

◆ theMaxNumberOfCols

int ossimDoubleGridProperty::theMaxNumberOfCols
protected

◆ theMaxNumberOfRows

int ossimDoubleGridProperty::theMaxNumberOfRows
protected

◆ theMinNumberOfCols

int ossimDoubleGridProperty::theMinNumberOfCols
protected

◆ theMinNumberOfRows

int ossimDoubleGridProperty::theMinNumberOfRows
protected

◆ theValues

std::vector< std::vector<double> > ossimDoubleGridProperty::theValues
protected

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