![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /********************************************************************* 00002 ** Copyright (c) 1998 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 *********************************************************************/ 00005 /********************************************************************* 00006 ** $RCSfile: dtedCell.h,v $ $Revision: 1.11 $ $State: Exp $ 00007 *********************************************************************/ 00008 #ifndef dtedCell_H_ 00009 #define dtedCell_H_ 00010 00011 #include "dted/dtedDefines.h" 00012 #include "geometry/point.h" 00013 00014 // Forward declarations 00015 class DtDtedReader; 00016 class DtGroup; 00017 class DtTriangleIndirect; 00018 class DtGdbNode; 00019 class DtUtmReferencePoint; 00020 00021 struct DtUhlRecord 00022 { 00023 public: 00024 char Id[3]; 00025 char Reserved1[1]; 00026 char LonOrigin[8]; 00027 char LatOrigin[8]; 00028 char LonDataInterval[4]; 00029 char LatDataInterval[4]; 00030 char AbsVerticalAcc[4]; 00031 char SecurityCode[3]; 00032 char UniqueRef[12]; 00033 char NumLonLines[4]; 00034 char NumLatLines[4]; 00035 char MultAcc[1]; 00036 char Reserved2[24]; 00037 }; 00038 00039 00040 struct DtDsiRecord 00041 { 00042 public: 00043 char Id[3]; 00044 char SecurityCode[1]; 00045 char SecurityControl[2]; 00046 char SecurityHandling[27]; 00047 char Reserved1[26]; 00048 char DMASeries[5]; 00049 char UniqueRef[15]; 00050 char Reserved2[8]; 00051 char DataEditionNumber[2]; 00052 char MatchMergeVersion[1]; 00053 char MaintenanceDate[4]; 00054 char MatchMergeDate[4]; 00055 char MaintenanceDesc[4]; 00056 char ProducerCode[8]; 00057 char Reserved3[16]; 00058 char ProductSpecification[9]; 00059 char ProductSpecificationAmendment[2]; 00060 char ProductSpecificationDate[4]; 00061 char VerticalDatum[3]; 00062 char HorizontalDatum[5]; 00063 char FreeText[10]; 00064 char CompilationDate[4]; 00065 char Reserved4[22]; 00066 char LatDataOrigin[9]; 00067 char LonDataOrigin[10]; 00068 char LatSWCorner[7]; 00069 char LonSWCorner[8]; 00070 char LatNWCorner[7]; 00071 char LonNWCorner[8]; 00072 char LatNECorner[7]; 00073 char LonNECorner[8]; 00074 char LatSECorner[7]; 00075 char LonSECorner[8]; 00076 char ClockWiseOrientation[9]; 00077 char LatInterval[4]; 00078 char LonInterval[4]; 00079 char NumLatLines[4]; 00080 char NumLonLines[4]; 00081 char PartialCellIndicator[2]; 00082 char Reserved5[101]; 00083 char Reserved6[100]; 00084 char Reserved7[156]; 00085 }; 00086 00087 00088 struct DtAccRecord 00089 { 00090 public: 00091 char Id[3]; 00092 char AbsHorzAcc[4]; 00093 char AbsVertAcc[4]; 00094 char RelHorzAcc[4]; 00095 char RelVertAcc[4]; 00096 char Reserved1[36]; 00097 char MultipleAccOutline[2]; 00098 char Reserved2[2643]; // ??? 00099 }; 00100 00101 00102 struct DtDmaDataRecord 00103 { 00104 public: 00105 char Id[1]; 00106 char BlockCount[3]; 00107 char LonCount[2]; 00108 char LatCount[2]; 00109 }; 00110 00111 00112 class DT_DLL_dted DtMapData 00113 { 00114 public: 00115 short **myElevationGrid; 00116 }; 00117 00118 00119 class DT_DLL_dted DtDtedCellData 00120 { 00121 public: 00122 double SELat; 00123 double SELon; 00124 double SWLat; 00125 double SWLon; 00126 double NELat; 00127 double NELon; 00128 double NWLat; 00129 double NWLon; 00130 double CenterLat; 00131 double CenterLon; 00132 00133 double LatInterval; 00134 double LonInterval; 00135 00136 long NumLatPoints; 00137 long NumLonPoints; 00138 long NumPoints; 00139 00140 short MinElevation; 00141 short MaxElevation; 00142 00143 char Series[6]; 00144 00145 short AbsHorzAcc; 00146 short AbsVertAcc; 00147 short RelHorzAcc; 00148 short RelVertAcc; 00149 }; 00150 00151 00152 // 00153 // Instances of DtDtedCell are individual dted files loaded into memory. 00154 class DT_DLL_dted DtDtedCell 00155 { 00156 public: 00157 // constructor 00158 DtDtedCell(); 00159 00160 // destructor 00161 virtual ~DtDtedCell(); 00162 00163 // Read the Defense Mapping Agency (DMA) terrain elevation file and build 00164 // the data structures for a DtDtedCell file. Convert data to DtDtedCell 00165 // form where necessary. Allocate memory appropriately, and free local 00166 // structures upon completion. 00167 virtual bool readDma(const char* DMAFile); 00168 00169 // the following builds a triangle-based node and returns it. It is the 00170 // responsibility of the receiver to delete the returned object. 00171 virtual DtGdbNode* utmTriNode(const int postSpacing, double lowColorHeight, 00172 double highColorHeight, bool reliefShading, double minLatitude, 00173 double maxLatitude, double minLongitude, double maxLongitude, DtDtedReader* reader); 00174 00175 // the following builds a geodetic triangle-based node and returns it. 00176 // It is the responsibility of the receiver to delete the returned object. 00177 virtual DtGdbNode* geoTriNode(int postSpacing, double lowColorHeight, 00178 double highColorHeight, bool reliefShading, double minLatitude, 00179 double maxLatitude, double minLongitude, double maxLongitude, DtDtedReader* reader); 00180 00181 // the following builds a flat earth triangle-based node and returns it. 00182 // It is the responsibility of the receiver to delete the returned object. 00183 virtual DtGdbNode* flatEarthTriNode(int postSpacing, double lowColorHeight, 00184 double highColorHeight, bool reliefShading, double minLatitude, 00185 double maxLatitude, double minLongitude, double maxLongitude, DtDtedReader* reader); 00186 00187 // get the south west latitude and longitude in degrees 00188 virtual double swLat(); 00189 virtual double swLon(); 00190 00191 protected: 00192 // copy constructor 00193 DtDtedCell(const DtDtedCell& orig); 00194 00195 // assignment operator 00196 DtDtedCell& operator=(const DtDtedCell& orig); 00197 00198 // Extract the DMA Accuracy figure from the ascii data which is in 00199 // the DMA raw data. 00200 virtual short cvDmaAccuracy(char DMAAccuracy[]); 00201 00202 // Extract the DMA Interval figure from the ascii data which is in 00203 // the DMA raw data. 00204 virtual float cvDmaInterval(char DMAInterval[]); 00205 00206 // Extract the DMA Latitude figure from the ascii data which is in 00207 // the DMA raw data. 00208 virtual float cvDmaLat(char DMALat[]); 00209 00210 // Extract the DMA Longitude figure from the ascii data which is in 00211 // the DMA raw data. 00212 virtual float cvDmaLon(char DMALon[]); 00213 00214 // allocate the lowest-level groups and fill each with two triangles 00215 virtual bool fillGroupsWithTris(DtGroup**& groups, int gridWidth, 00216 int gridHeight, double lowColorHeight, double highColorHeight, 00217 bool reliefShading, int vertexIDOffset, DtDtedReader* reader); 00218 00219 // The following fills the reader's terrainDb's vertex manager with 00220 // vertices in UTM coordinates based on the incoming dimensions and 00221 // post spacing. It also calculates and returns the gridWidth 00222 // and gridHeight. 00223 virtual bool buildUTMVertexManager(int& gridWidth, 00224 int& gridHeight, int postSpacing, double minLatitude, 00225 double maxLatitude, double minLongitude, double maxLongitude, 00226 DtDtedReader* reader); 00227 00228 // The following fills the reader's terrainDb's vertex manager with 00229 // vertices in Geodetic coordinates based on the incoming dimensions 00230 // and post spacing. It also calculates and returns the gridWidth 00231 // and gridHeight. 00232 virtual bool buildGeodeticVertexManager(int& gridWidth, 00233 int& gridHeight, int postSpacing, double minLatitude, 00234 double maxLatitude, double minLongitude, double maxLongitude, 00235 DtDtedReader* reader); 00236 00237 // The following fills the reader's terrainDb's vertex manager with 00238 // vertices in Geodetic coordinates based on the incoming dimensions 00239 // and post spacing. It also calculates and returns the gridWidth 00240 // and gridHeight. 00241 virtual bool buildFlatEarthVertexManager(int& gridWidth, 00242 int& gridHeight, int postSpacing, double minLatitude, 00243 double maxLatitude, double minLongitude, double maxLongitude, 00244 DtDtedReader* reader); 00245 00246 // Set the surface for the triangle as a function of vertex heights 00247 virtual bool setTriangleSurface(DtTriangleIndirect* tri, 00248 unsigned int numSurfaces, double lowColorHeight, double highColorHeight, 00249 bool releifShading); 00250 00251 // builds a balanced tree. topGroup is the parent; groups is an array 00252 // of pointers to all the low-level groups; numLonGroups is the total 00253 // number of groups running west to east; numLatGroups is the total 00254 // number of groups running south to north; westLonGroup is the west-most 00255 // group number; eastLonGroup is the east-most group number; southLatGroup 00256 // is the south-most group number; and northLatGroup is the north-most 00257 // group number. 00258 virtual void balance(DtGroup* topGroup, DtGroup** groups, 00259 unsigned int numLatGroups, unsigned int westLonGroup, 00260 unsigned int eastLonGroup, unsigned int southLatGroup, 00261 unsigned int northLatGroup, DtDtedReader* reader); 00262 00263 protected: 00264 DtDtedCellData myHeader; 00265 DtMapData* myMapData; 00266 00267 int myGridpostListWidth; 00268 int myGridpostListHeight; 00269 00270 // The minimum size (along both the width and height dimension) of 00271 // a grid patch. 00272 static const int theGridPatchSizeThreshold; 00273 }; 00274 00275 #endif