00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef SOTVIZPREPROCESSING_H
00024 #define SOTVIZPREPROCESSING_H
00025
00026 #include <Inventor/SbLinear.h>
00027 #include <Inventor/SbString.h>
00028 #include <Inventor/SbBox.h>
00029 #include <Inventor/SbPList.h>
00030 #include <TerrainViz/SbTVizTexture.h>
00031
00032 class GeoCoordSys;
00033 class GeoFileReader;
00034 class Array2Duchar4;
00035
00036 class SoDEPRECATED SoTVizPreprocessor
00169 {
00170 public:
00171
00172
00173 enum TVIZUnits {
00177 TVIZ_METERS = 0,
00181 TVIZ_DEGREES,
00185 TVIZ_RADIANS
00186 };
00187
00188
00189
00198 static void setOutputUnits(SoTVizPreprocessor::TVIZUnits units, float heightRatio);
00199
00205 static SoTVizPreprocessor::TVIZUnits getOutputUnits();
00206
00213 static void setEarthRadius(const SbVec2d earthRadius);
00214
00219 static SbVec2d getEarthRadius();
00220
00221
00227 void setDestDirectory(const SbString& destDir);
00228
00233 const SbString& getDestDirectory() const;
00234
00235
00241 void setRegion(const SbBox2d& region, TVIZUnits units);
00242
00247 SoTVizPreprocessor::TVIZUnits getRegion(SbBox2d& region) const;
00248
00253 virtual SbBool process() = 0;
00254
00261 virtual SbBool writeToXML(const SbString& fileName) = 0;
00262
00263 private:
00264
00265 enum fileType {
00266 GEOTIFF,
00267 DTED,
00268 ANYRASTER,
00269 UNKNOWN
00270 };
00271
00272 virtual ~SoTVizPreprocessor();
00273
00274 private:
00275
00276 class TVIZInputFile {
00277 public:
00278 SbString filePath;
00279 SbVec2d orientation;
00280 SbVec2s rasterSize;
00281
00282
00283 SbVec2d geodeticOrigin;
00284 SbVec2d geodeticStep;
00285 SbBox2d geodeticBBox;
00286
00287
00288 SbVec2d origin;
00289 SbVec2d step;
00290 SbBox2d bBox;
00291 TVIZUnits units;
00292
00293 fileType type;
00294 int level;
00295 int nc;
00296 SbBool overlay;
00297 SbBool invert(TVIZInputFile* gf);
00298 };
00299
00300
00301
00302 SoTVizPreprocessor();
00303
00304 SbBool testFile(const SbString& filePath);
00305
00306 SbBool strictIntersect(const SbBox2d& box1, const SbBox2d& box2, SbBox2d* resultBox = NULL);
00307
00308 void writeXMLFooter(FILE* const fd);
00309 FILE* openXML(SbString& fileName);
00310
00311 virtual SbBool isFileNecessary(TVIZInputFile* inFile) = 0;
00312
00313 SbBool readGeoInformation(GeoFileReader* geoFileReader, TVIZInputFile* inFile, SbVec2d& x, SbVec2d& y);
00314
00315 void convertToOutputUnits(SbBox2d& values, TVIZUnits inUnits, TVIZUnits outUnit = outputUnits);
00316 void convertToOutputUnits(SbVec2d& value, TVIZUnits inUnits, TVIZUnits outUnit = outputUnits);
00317
00318
00319 SbBox2d geodeticRoi;
00320 SbBox2d outGeodeticRoi;
00321 TVIZUnits outRoiUnits;
00322 TVIZUnits roiUnits;
00323 SbString destDir;
00324 SbVec2d orientation;
00325 SbPList inFiles;
00326
00327
00328 static float heightRatio;
00329 static TVIZUnits outputUnits;
00330 static SbBool firstTime;
00331
00332 private:
00333 static SbVec2d m_earthRadius;
00334 };
00335
00336
00337 #endif
00338
00339
00340