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

#include <ossimVpfAnnotationLibraryInfo.h>

Public Member Functions

 ossimVpfAnnotationLibraryInfo (const ossimString &libraryName="", bool enabledFlag=true)
 
virtual ~ossimVpfAnnotationLibraryInfo ()
 
bool getEnabledFlag () const
 
void setEnabledFlag (bool flag)
 
const ossimStringgetName () const
 
void setName (const ossimString &libraryName)
 
void setDatabase (ossimVpfDatabase *database)
 
ossimVpfDatabasegetDatabase ()
 
ossimIrect getBoundingProjectedRect () const
 
void transform (ossimImageGeometry *geom)
 
void buildLibrary ()
 
void buildLibrary (const ossimString &coverageName, const ossimString &feature)
 
void deleteAllCoverage ()
 
void drawAnnotations (ossimRgbImage *tile)
 
void getAllFeatures (std::vector< ossimVpfAnnotationFeatureInfo *> &features)
 
virtual bool saveState (ossimKeywordlist &kwl, const char *prefix=0) const
 
virtual bool loadState (const ossimKeywordlist &kwl, const char *prefix=0)
 

Protected Attributes

ossimString theName
 
bool theEnabledFlag
 
ossimVpfDatabasetheDatabase
 
std::vector< ossimVpfAnnotationCoverageInfo * > theCoverageLayerList
 

Detailed Description

Definition at line 11 of file ossimVpfAnnotationLibraryInfo.h.

Constructor & Destructor Documentation

◆ ossimVpfAnnotationLibraryInfo()

ossimVpfAnnotationLibraryInfo::ossimVpfAnnotationLibraryInfo ( const ossimString libraryName = "",
bool  enabledFlag = true 
)

Definition at line 23 of file ossimVpfAnnotationLibraryInfo.cpp.

24  :
25  theName(libraryName),
26  theEnabledFlag(enabledFlag),
27  theDatabase(NULL)
28 {
29 }

◆ ~ossimVpfAnnotationLibraryInfo()

ossimVpfAnnotationLibraryInfo::~ossimVpfAnnotationLibraryInfo ( )
virtual

Member Function Documentation

◆ buildLibrary() [1/2]

void ossimVpfAnnotationLibraryInfo::buildLibrary ( )

Definition at line 132 of file ossimVpfAnnotationLibraryInfo.cpp.

133 {
134  buildLibrary( "", "");
135 }

◆ buildLibrary() [2/2]

void ossimVpfAnnotationLibraryInfo::buildLibrary ( const ossimString coverageName,
const ossimString feature 
)

Definition at line 137 of file ossimVpfAnnotationLibraryInfo.cpp.

138 {
139  if(traceDebug())
140  {
141  ossimNotify(ossimNotifyLevel_DEBUG) << "ossimVpfAnnotationLibraryInfo::buildLibrary DEBUG: entered..." << std::endl;
142  }
144  if(!theDatabase)
145  {
146  return;
147  }
148 
150  if(library)
151  {
152  std::vector<ossimString> coverageNames;
153  library->getCoverageNames(coverageNames);
154  for(ossim_uint32 idx = 0; idx < coverageNames.size(); ++idx)
155  {
156  ossimString s1 = coverageName;
157  ossimString s2 = coverageNames[idx];
158  s1.downcase();
159  s2.downcase();
160  if ( ! coverageName.length() || (s1 == s2) )
161  {
162  ossimVpfAnnotationCoverageInfo* coverageInfo =
164  coverageInfo->setName(coverageNames[idx]);
165  coverageInfo->setLibrary(library);
166  theCoverageLayerList.push_back(coverageInfo);
167  if(traceDebug())
168  {
169  ossimNotify(ossimNotifyLevel_DEBUG) << "coverage name = " << coverageNames[idx] << std::endl;
170  }
171  coverageInfo->buildCoverage(feature);
172  }
173  }
174  }
175  if(traceDebug())
176  {
177  ossimNotify(ossimNotifyLevel_DEBUG) << "ossimVpfAnnotationLibraryInfo::buildLibrary DEBUG: leaving..." << std::endl;
178  }
179 }
void setLibrary(ossimVpfLibrary *library)
std::string::size_type length() const
Definition: ossimString.h:408
unsigned int ossim_uint32
bool getCoverageNames(std::vector< ossimString > &coverageNames) const
static ossimString downcase(const ossimString &aString)
Definition: ossimString.cpp:48
std::vector< ossimVpfAnnotationCoverageInfo * > theCoverageLayerList
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
ossimVpfLibrary * getLibrary(unsigned long libraryNumber)

◆ deleteAllCoverage()

void ossimVpfAnnotationLibraryInfo::deleteAllCoverage ( )

Definition at line 190 of file ossimVpfAnnotationLibraryInfo.cpp.

References theCoverageLayerList.

Referenced by loadState(), and ~ossimVpfAnnotationLibraryInfo().

191 {
192  for(ossim_uint32 idx = 0; idx < theCoverageLayerList.size(); ++idx)
193  {
194  delete theCoverageLayerList[idx];
195  }
196 
197  theCoverageLayerList.clear();
198 }
unsigned int ossim_uint32
std::vector< ossimVpfAnnotationCoverageInfo * > theCoverageLayerList

◆ drawAnnotations()

void ossimVpfAnnotationLibraryInfo::drawAnnotations ( ossimRgbImage tile)

Definition at line 182 of file ossimVpfAnnotationLibraryInfo.cpp.

References theCoverageLayerList.

183 {
184  for(ossim_uint32 idx = 0; idx < theCoverageLayerList.size(); ++idx)
185  {
186  theCoverageLayerList[idx]->drawAnnotations(tile);
187  }
188 }
unsigned int ossim_uint32
std::vector< ossimVpfAnnotationCoverageInfo * > theCoverageLayerList

◆ getAllFeatures()

void ossimVpfAnnotationLibraryInfo::getAllFeatures ( std::vector< ossimVpfAnnotationFeatureInfo *> &  features)

Definition at line 90 of file ossimVpfAnnotationLibraryInfo.cpp.

Referenced by ossimVpfAnnotationSource::loadState().

91 {
92  if(traceDebug())
93  {
94  ossimNotify(ossimNotifyLevel_DEBUG) << "ossimVpfAnnotationLibraryInfo::getAllFeatures DEBUG: entered..." << std::endl;
95  }
96 
97  for(ossim_uint32 idx = 0; idx < theCoverageLayerList.size(); ++idx)
98  {
99  theCoverageLayerList[idx]->getAllFeatures(features);
100  }
101 
102  if(traceDebug())
103  {
104  ossimNotify(ossimNotifyLevel_DEBUG) << "ossimVpfAnnotationLibraryInfo::getAllFeatures DEBUG: leaving..." << std::endl;
105  }
106 }
unsigned int ossim_uint32
std::vector< ossimVpfAnnotationCoverageInfo * > theCoverageLayerList
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ getBoundingProjectedRect()

ossimIrect ossimVpfAnnotationLibraryInfo::getBoundingProjectedRect ( ) const

Definition at line 66 of file ossimVpfAnnotationLibraryInfo.cpp.

References ossimIrect::combine(), ossimIrect::hasNans(), ossimIrect::makeNan(), and theCoverageLayerList.

67 {
68  ossimIrect result;
69  result.makeNan();
70 
71  for(ossim_uint32 idx = 0; idx < theCoverageLayerList.size(); ++idx)
72  {
73  ossimIrect tempRect = theCoverageLayerList[idx]->getBoundingProjectedRect();
74  if(!tempRect.hasNans())
75  {
76  if(result.hasNans())
77  {
78  result = tempRect;
79  }
80  else
81  {
82  result = result.combine(tempRect);
83  }
84  }
85  }
86 
87  return result;
88 }
unsigned int ossim_uint32
void makeNan()
Definition: ossimIrect.h:329
bool hasNans() const
Definition: ossimIrect.h:337
std::vector< ossimVpfAnnotationCoverageInfo * > theCoverageLayerList
ossimIrect combine(const ossimIrect &rect) const
Definition: ossimIrect.cpp:543

◆ getDatabase()

ossimVpfDatabase * ossimVpfAnnotationLibraryInfo::getDatabase ( )

Definition at line 61 of file ossimVpfAnnotationLibraryInfo.cpp.

References theDatabase.

62 {
63  return theDatabase;
64 }

◆ getEnabledFlag()

bool ossimVpfAnnotationLibraryInfo::getEnabledFlag ( ) const

Definition at line 36 of file ossimVpfAnnotationLibraryInfo.cpp.

References theEnabledFlag.

◆ getName()

const ossimString & ossimVpfAnnotationLibraryInfo::getName ( ) const

Definition at line 46 of file ossimVpfAnnotationLibraryInfo.cpp.

References theName.

47 {
48  return theName;
49 }

◆ loadState()

bool ossimVpfAnnotationLibraryInfo::loadState ( const ossimKeywordlist kwl,
const char *  prefix = 0 
)
virtual

Definition at line 219 of file ossimVpfAnnotationLibraryInfo.cpp.

References deleteAllCoverage(), ossimKeywordlist::find(), ossimVpfDatabase::getLibrary(), ossimKeywordlist::getSubstringKeyList(), ossimVpfAnnotationCoverageInfo::loadState(), ossimVpfAnnotationCoverageInfo::setLibrary(), size, theCoverageLayerList, theDatabase, theName, ossimString::toInt(), and ossimString::toString().

Referenced by ossimVpfAnnotationSource::loadState().

221 {
223  theName = kwl.find(prefix, "name");
224 
226 
227  if(!library)
228  {
229  return false;
230  }
231  ossimString regExpression = ossimString("^(") + ossimString(prefix) + "coverage[0-9]+.)";
232  vector<ossimString> keys =
233  kwl.getSubstringKeyList( regExpression );
234  std::vector<int> theNumberList(keys.size());
235  int offset = (int)(ossimString(prefix)+"coverage").size();
236  int idx = 0;
237  for(idx = 0; idx < (int)theNumberList.size();++idx)
238  {
239  ossimString numberStr(keys[idx].begin() + offset,
240  keys[idx].end());
241  theNumberList[idx] = numberStr.toInt();
242  }
243  std::sort(theNumberList.begin(), theNumberList.end());
244 
245  for(idx = 0; idx < (int)keys.size(); ++idx)
246  {
247  ossimString newPrefix = ossimString(prefix);
248  newPrefix += ossimString("coverage");
249  newPrefix += ossimString::toString(theNumberList[idx]);
250  newPrefix += ossimString(".");
252  coverageInfo->setLibrary(library);
253  theCoverageLayerList.push_back(coverageInfo);
254  coverageInfo->loadState(kwl,
255  newPrefix);
256  }
257 
258  return true;
259 }
void setLibrary(ossimVpfLibrary *library)
const char * find(const char *key) const
static ossimString toString(bool aValue)
Numeric to string methods.
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
yy_size_t size
std::vector< ossimString > getSubstringKeyList(const ossimString &regularExpression) const
std::vector< ossimVpfAnnotationCoverageInfo * > theCoverageLayerList
ossimVpfLibrary * getLibrary(unsigned long libraryNumber)

◆ saveState()

bool ossimVpfAnnotationLibraryInfo::saveState ( ossimKeywordlist kwl,
const char *  prefix = 0 
) const
virtual

Definition at line 200 of file ossimVpfAnnotationLibraryInfo.cpp.

References ossimKeywordlist::add(), theCoverageLayerList, theName, and ossimString::toString().

202 {
203  ossim_uint32 idx;
204 
205  kwl.add(prefix,
206  "name",
207  theName,
208  true);
209 
210  for(idx = 0; idx < theCoverageLayerList.size(); ++idx)
211  {
212  theCoverageLayerList[idx]->saveState(kwl,
213  (ossimString(prefix) + "coverage" + ossimString::toString(idx) + ".").c_str());
214  }
215 
216  return true;
217 }
static ossimString toString(bool aValue)
Numeric to string methods.
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
unsigned int ossim_uint32
std::vector< ossimVpfAnnotationCoverageInfo * > theCoverageLayerList

◆ setDatabase()

void ossimVpfAnnotationLibraryInfo::setDatabase ( ossimVpfDatabase database)

Definition at line 56 of file ossimVpfAnnotationLibraryInfo.cpp.

References theDatabase.

Referenced by ossimVpfAnnotationSource::loadState().

57 {
58  theDatabase = database;
59 }

◆ setEnabledFlag()

void ossimVpfAnnotationLibraryInfo::setEnabledFlag ( bool  flag)

Definition at line 41 of file ossimVpfAnnotationLibraryInfo.cpp.

References theEnabledFlag.

◆ setName()

void ossimVpfAnnotationLibraryInfo::setName ( const ossimString libraryName)

Definition at line 51 of file ossimVpfAnnotationLibraryInfo.cpp.

References theName.

52 {
53  theName = libraryName;
54 }

◆ transform()

void ossimVpfAnnotationLibraryInfo::transform ( ossimImageGeometry geom)

Definition at line 108 of file ossimVpfAnnotationLibraryInfo.cpp.

109 {
110  if(traceDebug())
111  {
112  ossimNotify(ossimNotifyLevel_DEBUG) << "ossimVpfAnnotationLibraryInfo::transform DEBUG: entered..." << std::endl;
113  }
114 
115 
116  for(ossim_uint32 idx = 0; idx < theCoverageLayerList.size(); ++idx)
117  {
118  if(traceDebug())
119  {
120  ossimNotify(ossimNotifyLevel_DEBUG) << "transforming coverage = " << theCoverageLayerList[idx]->getName() << std::endl;
121  }
122 
123  theCoverageLayerList[idx]->transform(geom);
124  }
125 
126  if(traceDebug())
127  {
128  ossimNotify(ossimNotifyLevel_DEBUG) << "ossimVpfAnnotationLibraryInfo::transform DEBUG: leaving..." << std::endl;
129  }
130 }
unsigned int ossim_uint32
std::vector< ossimVpfAnnotationCoverageInfo * > theCoverageLayerList
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

Member Data Documentation

◆ theCoverageLayerList

std::vector<ossimVpfAnnotationCoverageInfo*> ossimVpfAnnotationLibraryInfo::theCoverageLayerList
protected

◆ theDatabase

ossimVpfDatabase* ossimVpfAnnotationLibraryInfo::theDatabase
protected

Definition at line 48 of file ossimVpfAnnotationLibraryInfo.h.

Referenced by getDatabase(), loadState(), and setDatabase().

◆ theEnabledFlag

bool ossimVpfAnnotationLibraryInfo::theEnabledFlag
protected

Definition at line 47 of file ossimVpfAnnotationLibraryInfo.h.

Referenced by getEnabledFlag(), and setEnabledFlag().

◆ theName

ossimString ossimVpfAnnotationLibraryInfo::theName
protected

Definition at line 46 of file ossimVpfAnnotationLibraryInfo.h.

Referenced by getName(), loadState(), saveState(), and setName().


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