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

#include <ossimVpfDatabase.h>

Public Member Functions

 ossimVpfDatabase ()
 
virtual ~ossimVpfDatabase ()
 
virtual bool openDatabase (const ossimFilename &filename)
 
void closeDatabase ()
 
ossimFilename getPath () const
 
long getNumberOfLibraries () const
 
ossimVpfLibrarygetLibrary (unsigned long libraryNumber)
 
ossimVpfLibrarygetLibrary (const ossimString &name)
 
bool isOpened () const
 
vector< ossimStringgetLibraryNames () const
 
vector< ossimStringgetLibraryNamesFullPath () const
 
ossimFilename getLibraryAttributeTable () const
 

Protected Member Functions

void initializeLibraryList ()
 
void deleteLibraryList ()
 

Protected Attributes

ossimFilename theDatabaseHeaderTable
 
ossimFilename theLibraryAttributeTable
 
vector< ossimVpfLibrary * > theVpfLibraryList
 
bool theOpenedFlag
 

Detailed Description

Definition at line 22 of file ossimVpfDatabase.h.

Constructor & Destructor Documentation

◆ ossimVpfDatabase()

ossimVpfDatabase::ossimVpfDatabase ( )

Initializes everything to null;

Definition at line 18 of file ossimVpfDatabase.cpp.

21  theOpenedFlag(false)
22 {
23 }
ossimFilename theDatabaseHeaderTable
ossimFilename theLibraryAttributeTable

◆ ~ossimVpfDatabase()

ossimVpfDatabase::~ossimVpfDatabase ( )
virtual

Destroys any allocated space.

Definition at line 25 of file ossimVpfDatabase.cpp.

References closeDatabase(), and deleteLibraryList().

26 {
28 
29  closeDatabase();
30 }

Member Function Documentation

◆ closeDatabase()

void ossimVpfDatabase::closeDatabase ( )

◆ deleteLibraryList()

void ossimVpfDatabase::deleteLibraryList ( )
protected

Definition at line 181 of file ossimVpfDatabase.cpp.

References theVpfLibraryList.

Referenced by closeDatabase(), initializeLibraryList(), and ~ossimVpfDatabase().

182 {
183  for(long idx = 0; idx <(long)theVpfLibraryList.size(); idx++)
184  {
185  delete theVpfLibraryList[idx];
186  theVpfLibraryList[idx] = 0;
187  }
188 
189  theVpfLibraryList.clear();
190 }
vector< ossimVpfLibrary * > theVpfLibraryList

◆ getLibrary() [1/2]

ossimVpfLibrary * ossimVpfDatabase::getLibrary ( unsigned long  libraryNumber)

Definition at line 97 of file ossimVpfDatabase.cpp.

References theVpfLibraryList.

Referenced by ossimVpfAnnotationLibraryInfo::loadState().

98 {
99 
100  if(libraryNumber < theVpfLibraryList.size())
101  {
102  return theVpfLibraryList[libraryNumber];
103  }
104 
105  return NULL;
106 }
vector< ossimVpfLibrary * > theVpfLibraryList

◆ getLibrary() [2/2]

ossimVpfLibrary * ossimVpfDatabase::getLibrary ( const ossimString name)

Definition at line 108 of file ossimVpfDatabase.cpp.

References theVpfLibraryList.

109 {
110  for(long index = 0; index < (long)theVpfLibraryList.size(); ++index)
111  {
112  if(theVpfLibraryList[index]->getName() == name)
113  {
114  return theVpfLibraryList[index];
115  }
116  }
117 
118  return NULL;
119 }
vector< ossimVpfLibrary * > theVpfLibraryList

◆ getLibraryAttributeTable()

ossimFilename ossimVpfDatabase::getLibraryAttributeTable ( ) const

Definition at line 161 of file ossimVpfDatabase.cpp.

References theLibraryAttributeTable.

Referenced by ossimVpfLibrary::getExtent().

162 {
164 }
ossimFilename theLibraryAttributeTable

◆ getLibraryNames()

vector< ossimString > ossimVpfDatabase::getLibraryNames ( ) const

Definition at line 127 of file ossimVpfDatabase.cpp.

References ossimVpfTable::getColumnValues(), ossimVpfTable::openTable(), and theLibraryAttributeTable.

Referenced by initializeLibraryList().

128 {
129 
130  ossimVpfTable table;
131 
133  {
134  return table.getColumnValues("LIBRARY_NAME");
135  }
136 
137  return vector<ossimString>();
138 }
std::vector< ossimString > getColumnValues(const ossimString &columnName) const
virtual bool openTable(const ossimFilename &tableName)
ossimFilename theLibraryAttributeTable

◆ getLibraryNamesFullPath()

vector< ossimString > ossimVpfDatabase::getLibraryNamesFullPath ( ) const

Definition at line 140 of file ossimVpfDatabase.cpp.

References ossimVpfTable::getColumnValues(), ossimVpfTable::openTable(), ossimFilename::path(), and theLibraryAttributeTable.

141 {
142  vector<ossimString> result;
143 
144  ossimVpfTable table;
145 
147  {
148  result = table.getColumnValues("LIBRARY_NAME");
149  }
150 
151  for(long index=0; index < (long)result.size();index++)
152  {
153  result[index] = ossimString(theLibraryAttributeTable.path()) +
154  ossimString("/") +
155  result[index];
156  }
157 
158  return result;
159 }
std::vector< ossimString > getColumnValues(const ossimString &columnName) const
virtual bool openTable(const ossimFilename &tableName)
ossimFilename theLibraryAttributeTable
ossimFilename path() const

◆ getNumberOfLibraries()

long ossimVpfDatabase::getNumberOfLibraries ( ) const

Definition at line 92 of file ossimVpfDatabase.cpp.

References theVpfLibraryList.

93 {
94  return (long)theVpfLibraryList.size();
95 }
vector< ossimVpfLibrary * > theVpfLibraryList

◆ getPath()

ossimFilename ossimVpfDatabase::getPath ( ) const

Definition at line 86 of file ossimVpfDatabase.cpp.

References ossimFilename::path(), and theLibraryAttributeTable.

Referenced by initializeLibraryList().

87 {
88  // we can use either table name since all we need is the path
90 }
ossimFilename theLibraryAttributeTable
ossimFilename path() const

◆ initializeLibraryList()

void ossimVpfDatabase::initializeLibraryList ( )
protected

Definition at line 166 of file ossimVpfDatabase.cpp.

References deleteLibraryList(), getLibraryNames(), getPath(), ossimVpfLibrary::openLibrary(), and theVpfLibraryList.

Referenced by openDatabase().

167 {
168  // make sure the library list is deleted
170  vector<ossimString> libraryNames = getLibraryNames();
171  for(long index = 0; index < (long)libraryNames.size(); index++)
172  {
173  ossimVpfLibrary *library = new ossimVpfLibrary;
174  library->openLibrary(this,
175  libraryNames[index],
176  getPath().dirCat(libraryNames[index]));
177  theVpfLibraryList.push_back(library);
178  }
179 }
bool openLibrary(ossimVpfDatabase *database, const ossimString &name, const ossimFilename &libraryPath)
vector< ossimVpfLibrary * > theVpfLibraryList
vector< ossimString > getLibraryNames() const
ossimFilename getPath() const

◆ isOpened()

bool ossimVpfDatabase::isOpened ( ) const

Definition at line 122 of file ossimVpfDatabase.cpp.

References theOpenedFlag.

Referenced by ossimVpfAnnotationSource::isOpen(), and ossimVpfAnnotationSource::openDatabase().

123 {
124  return theOpenedFlag;
125 }

◆ openDatabase()

bool ossimVpfDatabase::openDatabase ( const ossimFilename filename)
virtual

This will open a database. This will either be a dht(database header table) table or a library attribut table (lat) file. Both of these files should exist in a vpf database.

Definition at line 32 of file ossimVpfDatabase.cpp.

References ossimFilename::exists(), initializeLibraryList(), ossimVpfTable::openTable(), ossimFilename::path(), theDatabaseHeaderTable, theLibraryAttributeTable, and theOpenedFlag.

Referenced by ossimVpfAnnotationSource::openDatabase().

33 {
34  bool result = true;
35 
36  ossimFilename tempFilename = filename;
37 
38  // tempFilename.convertBackToForwardSlashes();
39 
40  // we should have two table to look at for the database.
41  // 1) database header (dht) 2) and the Library attribute (lat)
42  theDatabaseHeaderTable = ossimFilename(tempFilename.path()).dirCat("dht");
43  theLibraryAttributeTable = ossimFilename(tempFilename.path()).dirCat("lat");
44 
47  {
48  ossimVpfTable table;
49  // now lets see if they are valid tables
50  result = table.openTable(theDatabaseHeaderTable);
51  if(result&&
52  !ossimVpfDatabaseHeaderTableValidator().isValid(table))
53  {
54  result = false;
55  }
56 
57  result = table.openTable(theLibraryAttributeTable);
58  if((result) &&!ossimVpfLibraryAttributeTableValidator().isValid(table))
59  {
60  result = false;
61  }
62  }
63  else
64  {
65  result = false;
66  }
67 
68  if(result)
69  {
70  theOpenedFlag = true;
72  }
73 
74  return result;
75 }
ossimFilename theDatabaseHeaderTable
virtual bool openTable(const ossimFilename &tableName)
bool exists() const
ossimFilename theLibraryAttributeTable
ossimFilename path() const

Member Data Documentation

◆ theDatabaseHeaderTable

ossimFilename ossimVpfDatabase::theDatabaseHeaderTable
protected

This is the complete path to the Database Header Table (dht file).

Definition at line 71 of file ossimVpfDatabase.h.

Referenced by closeDatabase(), and openDatabase().

◆ theLibraryAttributeTable

ossimFilename ossimVpfDatabase::theLibraryAttributeTable
protected

This is the complete path to the library attribute table (lat file).

Definition at line 76 of file ossimVpfDatabase.h.

Referenced by closeDatabase(), getLibraryAttributeTable(), getLibraryNames(), getLibraryNamesFullPath(), getPath(), and openDatabase().

◆ theOpenedFlag

bool ossimVpfDatabase::theOpenedFlag
protected

This jhust specifies whether the database has been opened or not.

Definition at line 86 of file ossimVpfDatabase.h.

Referenced by closeDatabase(), isOpened(), and openDatabase().

◆ theVpfLibraryList

vector<ossimVpfLibrary*> ossimVpfDatabase::theVpfLibraryList
protected

Will hold a constructed set of libraries.

Definition at line 81 of file ossimVpfDatabase.h.

Referenced by deleteLibraryList(), getLibrary(), getNumberOfLibraries(), and initializeLibraryList().


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