VR-Forces 4.1 Class Documentation
gdbTerrainV204Reader.h
Go to the documentation of this file.
1 /*********************************************************************
2 ** Copyright (c) 1999 MaK Technologies, Inc.
3 ** All rights reserved.
4 *********************************************************************/
5 /*********************************************************************
6 ** $RCSfile: gdbTerrainV204Reader.h,v $ $Revision: 1.16 $ $State: Exp $
7 *********************************************************************/
8 
9 #ifndef gdbTerrainV204Reader_H_
10 #define gdbTerrainV204Reader_H_
11 
12 #include "gdb/gdbDefines.h"
13 #include <stdio.h>
14 #include "terrainCS/coordSystem.h"
15 #include "gdb/terModCbInfo.h"
16 #include "gdb/gdbTerrainReader.h"
17 
18 #include "gdb/terrainDb.h"
20 
21 
22 //forward declarations
23 class DtExtent;
24 class DtChord;
25 class DtChordBundle;
28 class DtColor;
29 class DtMemoryManager;
30 class DtAllTypesPolygon;
33 class DtNetworkNode;
35 class DtNetworkEdge;
37 class DtFeature;
38 class DtGroup;
39 class DtSurface;
41 
42 typedef DtGdbNode* (*DtGdbTerrainV204ReaderNodeFcn)(DtGdbNode::DtGdbNodeType, FILE *, DtGdbTerrainV204Reader *, DtGroup *);
43 
44 // class DtGdbTerrainV204Reader:
45 //
46 // DtGdbTerrainV204Reader is responsible for loading the version 204
47 // .gdb files into the system. It is used by the DtGdbTerrainReader.
48 //
49 
51 {
52 public:
53 
54  // default constructor
56 
57  // destructor
58  virtual ~DtGdbTerrainV204Reader();
59 
60 private:
61  // copy constructor and assignment operator not implemented
64 
65 public:
66 
67  static DtTerrainReader* create();
68 
69  // Returns the type of file this database was loaded from.
70  // This class returns "gdb". Override this function in derived
71  // terrain db classes.
72  virtual const DtString dataType() const;
73 
74  virtual bool readFromFile(const DtFilename& basename, DtTerrainDatabase* terrain);
75 
76 protected:
77 
78  // I/O calls.
79 
80  virtual bool readFrom(FILE* fp, DtTerrainDatabase *terrain);
81 
82  virtual bool validityCheckVersionNumber(unsigned int versionNumberFromFile);
83 
84  virtual DtGdbNode *readNode(FILE *fp, DtGroup *parent);
85 
86  virtual bool setReadFcn(DtGdbNode::DtGdbNodeType type, DtGdbTerrainV204ReaderNodeFcn fun);
88 
89  static DtGdbNode *readGroup(DtGdbNode::DtGdbNodeType type, FILE *fp, DtGdbTerrainV204Reader *me, DtGroup *parent);
90  static DtGdbNode *readPolyInd(DtGdbNode::DtGdbNodeType type, FILE *fp, DtGdbTerrainV204Reader *me, DtGroup *parent);
91  static DtGdbNode *readLOD(DtGdbNode::DtGdbNodeType type, FILE *fp, DtGdbTerrainV204Reader *me, DtGroup *parent);
92  static DtGdbNode *readDynamicCoordSys(DtGdbNode::DtGdbNodeType type, FILE *fp, DtGdbTerrainV204Reader *me, DtGroup *parent);
93  static DtGdbNode *readStaticCoordSys(DtGdbNode::DtGdbNodeType type, FILE *fp, DtGdbTerrainV204Reader *me, DtGroup *parent);
94  static DtGdbNode *readTerrainFeature(DtGdbNode::DtGdbNodeType type, FILE *fp, DtGdbTerrainV204Reader *me, DtGroup *parent);
95  static DtGdbNode *readCulturalFeature(DtGdbNode::DtGdbNodeType type, FILE *fp, DtGdbTerrainV204Reader *me, DtGroup *parent);
96  static DtGdbNode *readBuilding(DtGdbNode::DtGdbNodeType type, FILE *fp, DtGdbTerrainV204Reader *me, DtGroup *parent);
97  static DtGdbNode *readTree(DtGdbNode::DtGdbNodeType type, FILE *fp, DtGdbTerrainV204Reader *me, DtGroup *parent);
98  static DtGdbNode *readTriangleInd(DtGdbNode::DtGdbNodeType type, FILE *fp, DtGdbTerrainV204Reader *me, DtGroup *parent);
99  static DtGdbNode *readFileNode(DtGdbNode::DtGdbNodeType type, FILE *fp, DtGdbTerrainV204Reader *me, DtGroup *parent);
100 
101  virtual bool readSurface(FILE *fp, DtSurface &surface);
102  // functions to read vector networks
103  virtual bool readNetworkNode(FILE *fp, DtNetworkNode *node, unsigned int topology, int numEdges);
104  virtual bool readNetworkSpecElement(FILE *fp, DtNetworkSpecElement *elem);
105  virtual bool readNetworkSegment(FILE *fp, DtNetworkSegmentHelper *seg, unsigned int topology);
106  virtual bool readNetworkEdge(FILE* fp,
107  DtNetworkEdge* edge,
108  unsigned int topology,
109  unsigned int& numSegments,
110  std::vector<unsigned int>& segmentIndices,
111  unsigned int& startNodeIndex,
112  unsigned int& endNodeIndex);
113 
114  virtual bool readTerrainData(FILE* fp);
115  virtual bool readFeatureData(FILE* fp);
116 
117  virtual bool readSurfaceManager(FILE *fp);
118  virtual bool readSpecificationManager(FILE *fp);
119  virtual bool readVertexManager(FILE *fp);
120  virtual bool readVectorNetwork(FILE *fp);
121  virtual bool readCoordSys(FILE *fp, DtBaseCoordinateSystem* coordSys);
122 
123  virtual bool readFeature(FILE *fp, DtFeature *feature);
124 
125  // While reading a GDB file, reports whether this database will contain
126  // optional data
127  bool fileHasOptionalData(DtTerrainFileOptionalData optData);
128 
129 protected:
130 
131  // For debugging purposes - prints out the numbers of the different nodes
132  // and other file data (number of specifications, vertices, etc.) read in
133  virtual void printReadNodeCount();
134 
136 
138 };
139 
140 // While reading a GDB file, reports whether this database will contain
141 // optional data
144 {
145  if (myOptionalDataFlagFromFile & optData)
146  {
147  return true;
148  }
149  else
150  {
151  return false;
152  }
153 }
154 
155 #endif

Document ID: Generated on Tue Jan 29 18:21:16 EST 2013 from SVN revision 123193
Copyright © 2005-2013 VT MÄK Inc. All Rights Reserved (www.mak.com)