VR-Forces 4.6.1 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
oldGdbTerrainReader.h
Go to the documentation of this file.
1 /*********************************************************************
2 ** Copyright (c) 1999 MAK Technologies, Inc.
3 ** All rights reserved.
4 *********************************************************************/
5 /*********************************************************************
6 ** $RCSfile: oldGdbTerrainReader.h,v $ $Revision: 1.12 $ $State: Exp $
7 *********************************************************************/
8 #ifndef oldGdbTerrainReader_H_
9 #define oldGdbTerrainReader_H_
10 
11 //
12 // \file oldGdbTerrainReader.h
13 // \brief This file contains the DtOldGdbTerrainReader class declaration and other, related declarations.
14 //
15 
16 #include "gdb/gdbDefines.h"
17 #include "gdb/gdbTerrainReader.h"
18 #include "terrainCS/coordSystem.h"
20 #include "gdb/terrainDatabase.h"
21 #include <vlutil/vlConfig.h>
22 #include <vector>
23 #include <map>
24 
25 
27 class DtSurfaceManager;
30 class DtSurfaceManager;
31 class DtFeature;
32 class DtNodeMap;
33 
34 // Declare a namespace to make sure there are no conflicts with the node types
35 // declared in the DtGdbNode class and that you can use in a forward declaration.
36 namespace DT_GDB_VOLD
37 {
38  typedef enum
39  {
40  NULL_NODE = -1,
41  GRIDPOST_LIST = 0, // = 0
42  VERTEX_LIST, // = 1
43  SURFACE_LIST, // = 2
44  GROUP, // = 3
48  GRID, // = 7
51  TERRAIN_FEATURE, // = 10
53  BUILDING, // = 12
54  TREE, // = 13
57  FILE_NODE, // = 16
58  REF_GROUP, // = 17
60  VECTOR_NETWORK, // = 19
63 }
64 
65 // Declares a function pointer typedef so that users can register reader functions to
66 // process the appropriate nodes while reading the old gdb file.
67 typedef DtGdbNode* (*DtOldGdbTerrainReaderNodeFcn)(DT_GDB_VOLD::DtOldGdbNodeType,
68  FILE *, DtOldGdbTerrainReader *, DtGroup *);
69 
70 
71 //
72 // The DtOldGdbTerrainReader represents an entire database in GDB format.
73 // It is an old and deprecated file format, which can only be read in, not
74 // written out.
76 {
77 public:
78 
79  // default constructor
81 
82  // destructor
83  virtual ~DtOldGdbTerrainReader();
84 
85 private:
86  // Copy constructor and Assignment operator not implemented
89 
90 public:
91 
92  static DtTerrainReader* create();
93 
94  // Returns the type of file this database was loaded from.
95  // This class returns "oldgdb". Override this function in derived
96  // terrain db classes.
97  virtual const DtString dataType() const;
98 
99  virtual bool readFromFile(const DtFilename& basename, DtTerrainDatabase* terrain);
100 
101 protected:
102 
103  // I/O calls.
104  virtual bool readCoordinateSystem(FILE* fp);
105  virtual bool readFrom(FILE* fp, DtTerrainDatabase* terrain);
106  virtual DtGdbNode* readGdbNodePointer(FILE* fp);
107 
108  virtual bool setReadFcn(DT_GDB_VOLD::DtOldGdbNodeType type, DtOldGdbTerrainReaderNodeFcn fun);
110 
111  virtual bool validityCheckVersionNumber(unsigned int versionNumberFromFile);
112  virtual bool readTerrainData(FILE* fp);
113 
114  virtual bool adjustNewIndirectNodes(DtTerrainDatabase* terrainDb);
115 
116  virtual DtGdbNode* readNode(FILE* fp, DtGroup* parent, bool likelyToBeReferenced = false);
117 
118  static DtGdbNode* readGridPostList(DT_GDB_VOLD::DtOldGdbNodeType type, FILE *fp, DtOldGdbTerrainReader *me, DtGroup *parent);
119  static DtGdbNode* readVertexList(DT_GDB_VOLD::DtOldGdbNodeType type, FILE *fp, DtOldGdbTerrainReader *me, DtGroup *parent);
120  static DtGdbNode* readGroup(DT_GDB_VOLD::DtOldGdbNodeType type, FILE *fp, DtOldGdbTerrainReader *me, DtGroup *parent);
121  static DtGdbNode* readPolyInd(DT_GDB_VOLD::DtOldGdbNodeType type, FILE *fp, DtOldGdbTerrainReader *me, DtGroup *parent);
122  static DtGdbNode* readGrid(DT_GDB_VOLD::DtOldGdbNodeType type, FILE *fp, DtOldGdbTerrainReader *me, DtGroup *parent);
123  static DtGdbNode* readFileNode(DT_GDB_VOLD::DtOldGdbNodeType type, FILE *fp, DtOldGdbTerrainReader *me, DtGroup *parent);
124  static DtGdbNode* readRefGroup(DT_GDB_VOLD::DtOldGdbNodeType type, FILE *fp, DtOldGdbTerrainReader *me, DtGroup *parent);
125  static DtGdbNode* readSpecificationList(DT_GDB_VOLD::DtOldGdbNodeType type, FILE *fp, DtOldGdbTerrainReader *me, DtGroup *parent);
126  static DtGdbNode* readVectorNetwork(DT_GDB_VOLD::DtOldGdbNodeType type, FILE *fp, DtOldGdbTerrainReader *me, DtGroup *parent);
127 
128  static DtGdbNode* readSurfaceList(DT_GDB_VOLD::DtOldGdbNodeType type, FILE *fp, DtOldGdbTerrainReader *me, DtGroup *parent);
129  static DtGdbNode *readPolyImm(DT_GDB_VOLD::DtOldGdbNodeType type, FILE *fp, DtOldGdbTerrainReader *me, DtGroup *parent);
130  static DtGdbNode* readLOD(DT_GDB_VOLD::DtOldGdbNodeType type, FILE *fp, DtOldGdbTerrainReader *me, DtGroup *parent);
131  static DtGdbNode* readDynamicCoordSys(DT_GDB_VOLD::DtOldGdbNodeType type, FILE *fp, DtOldGdbTerrainReader *me, DtGroup *parent);
132  static DtGdbNode* readStaticCoordSys(DT_GDB_VOLD::DtOldGdbNodeType type, FILE *fp, DtOldGdbTerrainReader *me, DtGroup *parent);
133  static DtGdbNode* readTerrainFeature(DT_GDB_VOLD::DtOldGdbNodeType type, FILE *fp, DtOldGdbTerrainReader *me, DtGroup *parent);
134  static DtGdbNode* readCulturalFeature(DT_GDB_VOLD::DtOldGdbNodeType type, FILE *fp, DtOldGdbTerrainReader *me, DtGroup *parent);
135  static DtGdbNode* readBuilding(DT_GDB_VOLD::DtOldGdbNodeType type, FILE *fp, DtOldGdbTerrainReader *me, DtGroup *parent);
136  static DtGdbNode* readTree(DT_GDB_VOLD::DtOldGdbNodeType type, FILE *fp, DtOldGdbTerrainReader *me, DtGroup *parent);
137  static DtGdbNode* readTriangleImm(DT_GDB_VOLD::DtOldGdbNodeType type, FILE *fp, DtOldGdbTerrainReader *me, DtGroup *parent);
138  static DtGdbNode* readTriangleInd(DT_GDB_VOLD::DtOldGdbNodeType type, FILE *fp, DtOldGdbTerrainReader *me, DtGroup *parent);
139 
140  virtual bool readSurface(FILE *fp, DtSurface& surface);
141  virtual bool readFeature(FILE *fp, DtFeature* feature);
142 
143  virtual bool readCoordSys(FILE* fp, DtBaseCoordinateSystem* coordSys);
144 
145 protected:
146 
148 
149  typedef std::map<DT_GDB_VOLD::DtOldGdbNodeType, DtOldGdbTerrainReaderNodeFcn> DtNodeReaderFunctions;
150  typedef DtNodeReaderFunctions::iterator DtNodeReaderFcnIter;
151  typedef DtNodeReaderFunctions::const_iterator DtNodeReaderFcnConstIter;
152 
154 
156 
157  // These are used to read in immediate polygons and triangles and to convert
158  // them to indirect without corrupting the indices already stored for existing
159  // indirect polys/tris' vertices and surfaces. Both should be added to the
160  // end of the main VertexManager and SurfaceManager and all IDs updated before
161  // returning from loading.
164 
165  // Array of pointers to all indirect triangle and polygon nodes that were
166  // created from immediate nodes on disk. Use this to go back and adjust
167  // the appropriate IDs (surface...) after all others are loaded.
168  std::vector<DtPolygonIndirect*> myImmPolyNodes;
169  std::vector<DtTriangleIndirect*> myImmTriNodes;
170 };
171 
172 #endif

Document ID: Generated on Wed Jul 25 16:57:45 EDT 2018 from SVN revision 190790
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)