1 //*******************************************************************
2 //
3 // License:  See top level LICENSE.txt file.
4 //
5 // Author: Garrett Potts (gpotts@imagelinks.com)
6 //
7 //********************************************************************
8 // $Id: ossimVpfFeatureClassSchema.h 20936 2012-05-18 14:45:00Z oscarkramer $
9 #ifndef ossimVpfFeatureClassSchema_HEADER
10 #define ossimVpfFeatureClassSchema_HEADER
11 #include <iostream>
12 #include <map>
13 #include <vector>
14 #include <ossim/vec/ossimVpfTable.h>
15 
16 class ossimVpfLibrary;
17 
18 class ossimVpfFeatureClassSchemaNode
19 {
20  public:
21    friend std::ostream& operator <<(std::ostream& out,
22                                const ossimVpfFeatureClassSchemaNode& data)
23       {
24          out << "table    :     " << data.theTable << std::endl
25              << "key      :     " << data.theTableKey << std::endl
26              << "primitive:     " << data.thePrimitiveTable << std::endl
27              << "primitive key: " << data.thePrimitiveTableKey << std::endl;
28          return out;
29       }
30 
31    ossimVpfFeatureClassSchemaNode(const ossimFilename& table=ossimFilename(""),
32                                   const ossimString& tableKey=ossimString(""),
33                                   const ossimFilename& primitiveTable=ossimFilename(""),
34                                   const ossimString& primitiveTableKey=ossimString(""))
theTable(table)35       :theTable(table),
36       theTableKey(tableKey),
37       thePrimitiveTable(primitiveTable),
38       thePrimitiveTableKey(primitiveTableKey)
39    {
40    }
41 
42    ossimFilename theTable;
43    ossimString   theTableKey;
44    ossimFilename thePrimitiveTable;
45    ossimString   thePrimitiveTableKey;
46 };
47 
48 class ossimVpfFeatureClassSchema : public ossimVpfTable
49 {
50 public:
51    ossimVpfFeatureClassSchema();
52 
53    bool openSchema(ossimVpfCoverage* coverage);
54    virtual void closeTable();
55 
56    void getFeatureClasses(std::vector<ossimString>& featureClassArray)const;
57    bool getFeatureClassNode(const ossimString& featureClass,
58                             ossimVpfFeatureClassSchemaNode& featureClassNode)const;
59    ossim_int32 getNumberOfFeatureClasses()const;
60 protected:
61    ossimVpfCoverage* theCoverage;
62    ossimFilename     theSchemaTableName;
63    std::map<ossimString, ossimVpfFeatureClassSchemaNode, ossimStringLtstr> theFeatureClassMap;
64 
65    bool validateColumnNames()const;
66    void setFeatureClassMapping();
67 };
68 
69 #endif
70