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

#include <ossimVpfLibrary.h>

Public Member Functions

 ossimVpfLibrary ()
 
virtual ~ossimVpfLibrary ()
 
bool openLibrary (ossimVpfDatabase *database, const ossimString &name, const ossimFilename &libraryPath)
 
void setDatabase (ossimVpfDatabase *database)
 
ossimVpfDatabasegetDatabase () const
 
bool getCoverage (long coverageNumber, ossimVpfCoverage &coverage)
 
bool getCoverage (const ossimString &name, ossimVpfCoverage &coverage)
 
bool getExtent (ossimVpfExtent &result) const
 
bool hasGazette () const
 
ossimFilename getPath () const
 
ossimString getName () const
 
bool getCoverageNames (std::vector< ossimString > &coverageNames) const
 
int getNumberOfCoverages () const
 
bool hasCoverage (const ossimString &coverageName) const
 
ossimString getTileName (ossim_int32 id) const
 
void getTileNames (std::vector< ossimString > &tileNames) const
 

Private Member Functions

void setCoverageNames ()
 
void setTileNames () const
 

Private Attributes

ossimVpfDatabasetheDatabase
 
ossimString theLibraryName
 
ossimFilename theLibraryNameFullPath
 
ossim_uint32 theNumberOfCoverages
 
std::vector< ossimStringtheCoverageNames
 
std::map< ossim_int32, ossimStringtheTileNameMap
 

Detailed Description

Definition at line 23 of file ossimVpfLibrary.h.

Constructor & Destructor Documentation

◆ ossimVpfLibrary()

ossimVpfLibrary::ossimVpfLibrary ( )

Definition at line 20 of file ossimVpfLibrary.cpp.

21  :theDatabase(0),
22  theLibraryName(""),
25 {
26 }
ossimVpfDatabase * theDatabase
ossim_uint32 theNumberOfCoverages
ossimFilename theLibraryNameFullPath
ossimString theLibraryName

◆ ~ossimVpfLibrary()

ossimVpfLibrary::~ossimVpfLibrary ( )
virtual

Definition at line 28 of file ossimVpfLibrary.cpp.

References theDatabase.

29 {
30  theDatabase = 0;
31 }
ossimVpfDatabase * theDatabase

Member Function Documentation

◆ getCoverage() [1/2]

bool ossimVpfLibrary::getCoverage ( long  coverageNumber,
ossimVpfCoverage coverage 
)

Definition at line 65 of file ossimVpfLibrary.cpp.

References ossimFilename::dirCat(), ossimVpfCoverage::openCoverage(), theCoverageNames, and theLibraryNameFullPath.

Referenced by ossimVpfAnnotationCoverageInfo::buildCoverage(), getCoverage(), and ossimVpfAnnotationCoverageInfo::loadState().

67 {
68 
69  bool result = false;
70 
71  if((coverageNumber >=0) && (coverageNumber < (int)theCoverageNames.size()))
72  {
73  result = coverage.openCoverage(this,
74  theCoverageNames[coverageNumber],
76  }
77 
78  return result;
79 }
std::vector< ossimString > theCoverageNames
bool openCoverage(ossimVpfLibrary *library, const ossimString &name, const ossimFilename &fileName)
ossimFilename dirCat(const ossimFilename &file) const
ossimFilename theLibraryNameFullPath

◆ getCoverage() [2/2]

bool ossimVpfLibrary::getCoverage ( const ossimString name,
ossimVpfCoverage coverage 
)

Definition at line 81 of file ossimVpfLibrary.cpp.

References getCoverage(), and theCoverageNames.

83 {
84  for(int idx = 0; idx < (int)theCoverageNames.size(); ++idx)
85  {
86  if(theCoverageNames[idx] == name)
87  {
88  return getCoverage(idx,
89  coverage);
90  }
91  }
92 
93  return false;
94 }
std::vector< ossimString > theCoverageNames
bool getCoverage(long coverageNumber, ossimVpfCoverage &coverage)

◆ getCoverageNames()

bool ossimVpfLibrary::getCoverageNames ( std::vector< ossimString > &  coverageNames) const

Definition at line 169 of file ossimVpfLibrary.cpp.

References theCoverageNames.

170 {
171  bool result = true;
172 
173  coverageNames = theCoverageNames;
174 
175  return result;
176 }
std::vector< ossimString > theCoverageNames

◆ getDatabase()

ossimVpfDatabase* ossimVpfLibrary::getDatabase ( ) const

◆ getExtent()

bool ossimVpfLibrary::getExtent ( ossimVpfExtent result) const

Definition at line 96 of file ossimVpfLibrary.cpp.

References free_row(), ossimVpfTable::getColumnValueAsString(), ossimVpfDatabase::getLibraryAttributeTable(), ossimVpfTable::getNumberOfRows(), ossimVpfTable::getVpfTableData(), ossimVpfTable::openTable(), read_row(), table_pos(), theDatabase, theLibraryName, ossimString::toDouble(), ossimString::trim(), extent_type::x1, extent_type::x2, extent_type::y1, and extent_type::y2.

97 {
98  bool result = false;
99  ossimVpfTable tempTable;
100 
101 
102  // this code was basically cut paste from vhcl with just
103  // a couple modifications.
104 
105  /* Get library extent from Library Attribute Table (LAT) */
106 /* char* buf;*/
107 /* long int n;*/
108 /* double xmin,ymin,xmax,ymax;*/
109  int libraryNamePosition, xminPosition, yminPosition;
110  int xmaxPosition, ymaxPosition;
111  int i;
112  bool found;
113  row_type row;
114  extent_type libextent;
115 
116  if(!theDatabase)
117  {
118  return false;
119  }
121  if(!tempTable.openTable(file))
122  {
123  return result;
124  }
125  vpf_table_type *table = tempTable.getVpfTableData();
126 
127  libraryNamePosition = table_pos( "LIBRARY_NAME", *table );
128  found = false;
129  for (i=1;(i<=tempTable.getNumberOfRows())&&(!found);i++)
130  {
131  row = read_row( i, *table );
132  ossimString libraryName = tempTable.getColumnValueAsString(row, libraryNamePosition);
133  libraryName = libraryName.trim();
134  if (libraryName == theLibraryName)
135  {
136  xminPosition = table_pos( "XMIN", *table );
137  yminPosition = table_pos( "YMIN", *table );
138  xmaxPosition = table_pos( "XMAX", *table );
139  ymaxPosition = table_pos( "YMAX", *table );
140 
141  libextent.x1 = tempTable.getColumnValueAsString(row, xminPosition).toDouble();
142  libextent.y1 = tempTable.getColumnValueAsString(row, yminPosition).toDouble();
143  libextent.x2 = tempTable.getColumnValueAsString(row, xmaxPosition).toDouble();
144  libextent.y2 = tempTable.getColumnValueAsString(row, ymaxPosition).toDouble();
145  found = true;
146  }
147  else
148  {
149  result = false;
150  }
151  free_row( row, *table );
152  }
153 
154  extent = ossimVpfExtent(libextent);
155  return result;
156 }
void free_row(row_type row, vpf_table_type table)
int getNumberOfRows() const
ossimVpfDatabase * theDatabase
row_type read_row(ossim_int32 row_number, vpf_table_type table)
virtual bool openTable(const ossimFilename &tableName)
ossim_int32 table_pos(const char *field_name, vpf_table_type table)
ossimString trim(const ossimString &valueToTrim=ossimString(" \\)) const
this will strip lead and trailing character passed in.
double toDouble() const
float x2
Definition: vpfview.h:56
float y2
Definition: vpfview.h:56
ossimFilename getLibraryAttributeTable() const
ossimString getColumnValueAsString(row_type &row, long columnNumber) const
vpf_table_type * getVpfTableData()
Definition: ossimVpfTable.h:61
float x1
Definition: vpfview.h:56
float y1
Definition: vpfview.h:56
ossimString theLibraryName

◆ getName()

ossimString ossimVpfLibrary::getName ( ) const

Definition at line 163 of file ossimVpfLibrary.cpp.

References theLibraryName.

164 {
165  return theLibraryName;
166 }
ossimString theLibraryName

◆ getNumberOfCoverages()

int ossimVpfLibrary::getNumberOfCoverages ( ) const

Definition at line 178 of file ossimVpfLibrary.cpp.

References theNumberOfCoverages.

179 {
180  return theNumberOfCoverages;
181 }
ossim_uint32 theNumberOfCoverages

◆ getPath()

ossimFilename ossimVpfLibrary::getPath ( ) const

Definition at line 158 of file ossimVpfLibrary.cpp.

References theLibraryNameFullPath.

159 {
160  return theLibraryNameFullPath;
161 }
ossimFilename theLibraryNameFullPath

◆ getTileName()

ossimString ossimVpfLibrary::getTileName ( ossim_int32  id) const

Definition at line 190 of file ossimVpfLibrary.cpp.

References ossimFilename::dirCat(), ossimFilename::exists(), setTileNames(), theLibraryNameFullPath, and theTileNameMap.

Referenced by ossimVpfAnnotationFeatureInfo::buildEdgFeature(), ossimVpfAnnotationFeatureInfo::buildFaceFeature(), ossimVpfAnnotationFeatureInfo::buildPointFeature(), and ossimVpfAnnotationFeatureInfo::buildTxtFeature().

191 {
192  ossimString result;
193  if(theLibraryNameFullPath.dirCat("tileref").exists())
194  {
195  if(theTileNameMap.size() <1)
196  {
197  setTileNames();
198  }
199  std::map<ossim_int32, ossimString>::iterator tileNameIter = theTileNameMap.find(id);
200 
201  if(tileNameIter != theTileNameMap.end())
202  {
203  result = (*tileNameIter).second;
204  }
205  }
206 
207  return result;
208 }
std::map< ossim_int32, ossimString > theTileNameMap
bool exists() const
ossimFilename dirCat(const ossimFilename &file) const
ossimFilename theLibraryNameFullPath
void setTileNames() const

◆ getTileNames()

void ossimVpfLibrary::getTileNames ( std::vector< ossimString > &  tileNames) const

Definition at line 210 of file ossimVpfLibrary.cpp.

References ossimFilename::dirCat(), ossimFilename::exists(), setTileNames(), theLibraryNameFullPath, and theTileNameMap.

Referenced by ossimVpfCoverage::getExtent().

211 {
212  if(theLibraryNameFullPath.dirCat("tileref").exists())
213  {
214  if(theTileNameMap.size() <1)
215  {
216  setTileNames();
217  }
218  std::map<ossim_int32, ossimString>::iterator tileNameIter = theTileNameMap.begin();
219  while(tileNameIter != theTileNameMap.end())
220  {
221  tileNames.push_back((*tileNameIter).second);
222  ++tileNameIter;
223  }
224  }
225 }
std::map< ossim_int32, ossimString > theTileNameMap
bool exists() const
ossimFilename dirCat(const ossimFilename &file) const
ossimFilename theLibraryNameFullPath
void setTileNames() const

◆ hasCoverage()

bool ossimVpfLibrary::hasCoverage ( const ossimString coverageName) const

Definition at line 183 of file ossimVpfLibrary.cpp.

References theCoverageNames.

184 {
185  return (std::find(theCoverageNames.begin(),
186  theCoverageNames.end(),
187  coverageName)!=theCoverageNames.end());
188 }
std::vector< ossimString > theCoverageNames

◆ hasGazette()

bool ossimVpfLibrary::hasGazette ( ) const

◆ openLibrary()

bool ossimVpfLibrary::openLibrary ( ossimVpfDatabase database,
const ossimString name,
const ossimFilename libraryPath 
)

Definition at line 33 of file ossimVpfLibrary.cpp.

References setCoverageNames(), theCoverageNames, theDatabase, theLibraryName, theLibraryNameFullPath, and theNumberOfCoverages.

Referenced by ossimVpfDatabase::initializeLibraryList().

36 {
37  bool returnCode = true;
38 
40  theLibraryName = "";
42 
43 
44  theLibraryName = name;
45  theLibraryNameFullPath = libraryPath;
46  theDatabase = database;
47 
49  {
50  returnCode = false;
51  }
52  if(returnCode)
53  {
55 
56  ossimVpfTable table;
57 
59  returnCode = (theNumberOfCoverages> 0);
60  }
61 
62  return returnCode;
63 }
std::vector< ossimString > theCoverageNames
ossimVpfDatabase * theDatabase
unsigned int ossim_uint32
ossimFilename theLibraryNameFullPath
ossim_uint32 theNumberOfCoverages
ossimString theLibraryName

◆ setCoverageNames()

void ossimVpfLibrary::setCoverageNames ( )
private

Definition at line 227 of file ossimVpfLibrary.cpp.

References ossimFilename::dirCat(), ossimVpfTable::getColumnValues(), ossimVpfTable::openTable(), theCoverageNames, and theLibraryNameFullPath.

Referenced by openLibrary().

228 {
229  ossimVpfTable table;
230  theCoverageNames.clear();
231  // open up the coverage attribute table for this library
232  if(table.openTable(theLibraryNameFullPath.dirCat("cat")))
233  {
234  // we need to have a coverage attribute table validator before
235  // we proceed but for now assume that it is a good table.
236  //
237  theCoverageNames = table.getColumnValues("COVERAGE_NAME");
238  }
239 }
std::vector< ossimString > theCoverageNames
std::vector< ossimString > getColumnValues(const ossimString &columnName) const
virtual bool openTable(const ossimFilename &tableName)
ossimFilename dirCat(const ossimFilename &file) const
ossimFilename theLibraryNameFullPath

◆ setDatabase()

void ossimVpfLibrary::setDatabase ( ossimVpfDatabase database)

◆ setTileNames()

void ossimVpfLibrary::setTileNames ( ) const
private

Definition at line 241 of file ossimVpfLibrary.cpp.

References ossimFilename::dirCat(), free_row(), ossimVpfTable::getColumnPosition(), ossimVpfTable::getColumnValueAsString(), ossimVpfTable::getNumberOfRows(), ossimVpfTable::getVpfTableData(), ossimVpfTable::openTable(), read_row(), ossimVpfTable::reset(), theLibraryNameFullPath, theTileNameMap, ossimString::toInt32(), and ossimString::trim().

Referenced by getTileName(), and getTileNames().

242 {
243  ossimVpfTable table;
244  theTileNameMap.clear();
245  row_type row;
246  if(table.openTable(theLibraryNameFullPath.dirCat("tileref").dirCat("tileref.aft")))
247  {
248  table.reset();
249  const int ROWS = table.getNumberOfRows();
250  for (int rowIdx = 1; rowIdx <= ROWS; ++rowIdx)
251  {
252  // Note: read_row takes a "one based" index.
253  row = read_row( rowIdx, *(table.getVpfTableData()) );
254  ossim_int32 namePosition = table.getColumnPosition("TILE_NAME");
255  ossim_int32 tileIdPosition = table.getColumnPosition("ID");
256 
257  ossimString tileName = table.getColumnValueAsString(row,
258  namePosition);;
259  ossimString tileId = table.getColumnValueAsString(row,
260  tileIdPosition);
261  theTileNameMap.insert(make_pair(tileId.toInt32(), tileName.trim()));
262  free_row( row, *(table.getVpfTableData()) );
263  }
264  }
265 }
std::map< ossim_int32, ossimString > theTileNameMap
void free_row(row_type row, vpf_table_type table)
int getNumberOfRows() const
row_type read_row(ossim_int32 row_number, vpf_table_type table)
ossim_int32 toInt32() const
virtual bool openTable(const ossimFilename &tableName)
ossim_int32 getColumnPosition(const ossimString &columnName) const
ossimString trim(const ossimString &valueToTrim=ossimString(" \\)) const
this will strip lead and trailing character passed in.
virtual void reset() const
ossimString getColumnValueAsString(row_type &row, long columnNumber) const
vpf_table_type * getVpfTableData()
Definition: ossimVpfTable.h:61
ossimFilename dirCat(const ossimFilename &file) const
ossimFilename theLibraryNameFullPath
int ossim_int32

Member Data Documentation

◆ theCoverageNames

std::vector<ossimString> ossimVpfLibrary::theCoverageNames
private

◆ theDatabase

ossimVpfDatabase* ossimVpfLibrary::theDatabase
private

Definition at line 49 of file ossimVpfLibrary.h.

Referenced by getExtent(), openLibrary(), and ~ossimVpfLibrary().

◆ theLibraryName

ossimString ossimVpfLibrary::theLibraryName
private

Definition at line 50 of file ossimVpfLibrary.h.

Referenced by getExtent(), getName(), and openLibrary().

◆ theLibraryNameFullPath

ossimFilename ossimVpfLibrary::theLibraryNameFullPath
private

◆ theNumberOfCoverages

ossim_uint32 ossimVpfLibrary::theNumberOfCoverages
private

Definition at line 52 of file ossimVpfLibrary.h.

Referenced by getNumberOfCoverages(), and openLibrary().

◆ theTileNameMap

std::map<ossim_int32, ossimString> ossimVpfLibrary::theTileNameMap
mutableprivate

Definition at line 54 of file ossimVpfLibrary.h.

Referenced by getTileName(), getTileNames(), and setTileNames().


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