OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimVpfFeatureClassSchema.cpp
Go to the documentation of this file.
1 //*******************************************************************
2 // Copyright (C) 2000 ImageLinks Inc.
3 //
4 // License: LGPL
5 //
6 // See LICENSE.txt file in the top level directory for more details.
7 //
8 // Author: Garrett Potts
9 //
10 //********************************************************************
11 // $Id: ossimVpfFeatureClassSchema.cpp 20936 2012-05-18 14:45:00Z oscarkramer $
16 
18  :theCoverage(NULL)
19 {
20 }
21 
23 {
24  theCoverage = coverage;
25  bool result = false;
26 
27  if(theCoverage)
28  {
30 
32  {
33  result = openTable(theSchemaTableName);
34 
35  if(result)
36  {
37  result = validateColumnNames();
38  }
39  if(result)
40  {
42  }
43  }
44  }
45 
46  return result;
47 }
48 
50 {
52  theFeatureClassMap.clear();
53 }
54 
55 void ossimVpfFeatureClassSchema::getFeatureClasses(std::vector<ossimString>& featureClassArray)const
56 {
57  featureClassArray.clear();
58  std::map<ossimString, ossimVpfFeatureClassSchemaNode, ossimStringLtstr>::const_iterator featureClassIter = theFeatureClassMap.begin();
59 
60  while(featureClassIter != theFeatureClassMap.end())
61  {
62  featureClassArray.push_back((*featureClassIter).first);
63  ++featureClassIter;
64  }
65 }
66 
68  ossimVpfFeatureClassSchemaNode& featureClassNode)const
69 {
70  std::map<ossimString, ossimVpfFeatureClassSchemaNode, ossimStringLtstr>::const_iterator fIter = theFeatureClassMap.find(featureClass);
71 
72  if(fIter != theFeatureClassMap.end())
73  {
74  featureClassNode = (*fIter).second;
75  return true;
76  }
77 
78  return false;
79 }
80 
82 {
83  return (ossim_int32)theFeatureClassMap.size();
84 }
85 
87 {
88  if(isClosed()) return false;
89  return ((getColumnPosition("feature_class")>=0)&&
90  (getColumnPosition("table1")>=0)&&
91  (getColumnPosition("table1_key")>=0)&&
92  (getColumnPosition("table2")>=0)&&
93  (getColumnPosition("table2_key")>=0));
94 }
95 
97 {
98  if(!isClosed())
99  {
100  ossim_int32 featureIdx = getColumnPosition("feature_class");
101  ossim_int32 table1Idx = getColumnPosition("table1");
102  ossim_int32 table1KeyIdx = getColumnPosition("table1_key");
103  ossim_int32 table2Idx = getColumnPosition("table2");
104  ossim_int32 table2KeyIdx = getColumnPosition("table2_key");
105  reset();
106  if(getNumberOfRows() > 0)
107  {
108  row_type row;
109  const int ROWS = getNumberOfRows();
110  for(int rowIdx = 1; rowIdx <= ROWS; ++rowIdx)
111  {
112  if(rowIdx == 1)
113  {
114  row = read_row(rowIdx,
116  }
117  else
118  {
120  }
121  ossimFilename primitiveTable = getColumnValueAsString(row,
122  table2Idx);
123  if(ossimVpfFeatureClass::isPrimitive(primitiveTable))
124  {
125  ossimString primitiveTableKey = getColumnValueAsString(row,
126  table2KeyIdx);
128  table1Idx);
129  ossimString tableKey = getColumnValueAsString(row,
130  table1KeyIdx);
131  ossimString featureClass = getColumnValueAsString(row,
132  featureIdx);
134  tableKey,
135  primitiveTable,
136  primitiveTableKey);
137 
138  theFeatureClassMap.insert(make_pair(featureClass,
139  node));
140  }
141 
143  }
144  }
145  }
146 }
147 
148 
vpf_table_type * theTableInformation
Definition: ossimVpfTable.h:81
void free_row(row_type row, vpf_table_type table)
bool openSchema(ossimVpfCoverage *coverage)
virtual void closeTable()
int getNumberOfRows() const
static bool isPrimitive(const ossimString &featureName)
row_type read_row(ossim_int32 row_number, vpf_table_type table)
std::map< ossimString, ossimVpfFeatureClassSchemaNode, ossimStringLtstr > theFeatureClassMap
virtual bool openTable(const ossimFilename &tableName)
ossim_int32 getColumnPosition(const ossimString &columnName) const
virtual bool isClosed() const
const ossimFilename & getPath() const
bool exists() const
virtual void reset() const
ossimString getColumnValueAsString(row_type &row, long columnNumber) const
row_type read_next_row(vpf_table_type table)
ossimFilename dirCat(const ossimFilename &file) const
void getFeatureClasses(std::vector< ossimString > &featureClassArray) const
int ossim_int32
bool getFeatureClassNode(const ossimString &featureClass, ossimVpfFeatureClassSchemaNode &featureClassNode) const