VR-Forces 4.0.4 Class Documentation
include/dted/dfad_data.h
Go to the documentation of this file.
00001 /*******************************************************************************
00002 ** Copyright (c) 2002 MAK Technologies, Inc.
00003 ** All rights reserved.
00004 *******************************************************************************/
00005 /*******************************************************************************
00006 ** $RCSfile: dfad_data.h,v $ $Revision: 1.19 $ $State: Exp $
00007 *******************************************************************************/
00008 #ifndef dfad_data_H_
00009 #define dfad_data_H_
00010 
00011 #include "dted/dtedDefines.h"
00012 #include "dted/dfadInit.h"
00013 #include "geometry/point.h"
00014 #include "geometry/gdbColor.h"
00015 #include "dted/dfad_header.h"
00016 #include "dted/dfad_info.h"
00017 #include "gdb/specMgr.h"
00018 #include "gdb/specification.h"
00019 #include "gdb/vectorDataInitializer.h"
00020 
00021 #include <vlutil/vlFilename.h>
00022 #include <vlutil/vlList.h>
00023 #include <vlutil/vlConfig.h>
00024 #include <list>
00025 
00026 #include "gdb/terrainDb.h"
00027 
00028 class DtVectorNetwork;
00029 class DtSpecificationManager;
00030 
00031 // maximum number of attributes to differentiate a type of feature. See file 
00032 // mapping DFAD to SEDRIS.
00033 const DtU8 SEDRIS_CODE_LIMIT = 10;
00034 
00035 // maximum limit of soil types for a DFAD feature
00036 const DtU8 SMC_CODE_LIMIT = 8;
00037 
00038 // Defines the different type of features coming from a DFAD/DFD file
00039 enum 
00040 {
00041    DFAD_FEATURE_POINT = 0,
00042    DFAD_FEATURE_LINE,
00043    DFAD_FEATURE_AREA,
00044    DFAD_FEATURE_FINAL
00045 };
00046 
00047 // data structure to store the SMC codes in the original format
00048 class SMC
00049 {
00050 public:
00051    SMC() {}
00052 
00053    DtU8 smcCode;
00054    DtString name;
00055 };
00056 
00057 
00058 // data structure to store the information about the different FID codes.
00059 class DT_DLL_dted FID
00060 {
00061 public:
00062    FID() {}
00063 
00064    DtU8 fidCode;
00065    DtString name;
00066    DtU8 soils[SMC_CODE_LIMIT];   // Type of soils available for this FID code
00067    DtU8 entries;                 // How many SEDIRS attributes describe this FID type
00068    DtString sedrisCodes[SEDRIS_CODE_LIMIT];  // SEDIRS codes and names 
00069    DtString sedrisNames[SEDRIS_CODE_LIMIT];
00070    DtColor  color;   // Original color representation for the mapping process
00071 };
00072 
00073 
00074 class DtDfadFeature;
00075 
00076 
00077 class DT_DLL_dted DtDfadData
00078 {
00079 public:
00080    typedef std::list<DtDfadFeature*> DtDfadFeatureContainer;
00081    typedef DtDfadFeatureContainer::iterator DtDfadFeatureIter;
00082    typedef DtDfadFeatureContainer::const_iterator DtDfadFeatureConstIter;
00083 
00084    // Constructor, receives the files to be used for mapping process. By default the different filenames.
00085    // The object is not valid until you call init.
00086    DtDfadData( DtFilename filename = "",                                 // File to be imported
00087                DtFilename dfadSedrisMapFile = 
00088                DtFilename::combine(DtVectorDataInitializer::defaultDfadConfigDirectory(), DtFilename("dfad_sedris_map.txt")),     // Mapping DFAD - SEDRIS
00089                DtFilename sedrisColorMapFile = 
00090                DtFilename::combine(DtVectorDataInitializer::defaultDfadConfigDirectory(), DtFilename("sedris_colormap.txt")),    // Color map for each SEDRIS subcategory
00091                DtFilename fidSmcFile = 
00092                DtFilename::combine(DtVectorDataInitializer::defaultDfadConfigDirectory(), DtFilename("FID-SMC.txt")), //
00093                const DtMapDatum& mapdatum = DtCurrentMapDatum(),         // Datum to use for projections
00094                double projectionScale = 0.9996);                         // Projection scale
00095 
00096 
00097    virtual ~DtDfadData();
00098 
00099    // This function initializes all the data structures and reads the mapping files.
00100    virtual bool init();
00101 
00102    // Set the name of the file to be imported. You can import different DFAD/DFD files
00103    // into a same GDB, but you must be sure to avoid conflicts with the data.
00104    virtual void setDataFile(const DtFilename& filename);
00105 
00106    // Import the data into the specified vector network.
00107    // The function receives a vectorNetwork 
00108    // an array of bools from 0 - 3000.  
00109    // i-pos is true if we want to import features with FID = i 
00110    // Returns true if the import was successful and false if it failed for any reason.
00111    virtual bool import(const DtTerrainDatabase& terrainDatabase,
00112                        DtVectorNetwork& vectorNetwork, 
00113                        const bool* const importTypes);
00114 
00115    // Report functions to create a file with info about all features in the data and about data 
00116    // selected to be imported.
00117    virtual void report(DtFilename fileanme);
00118    virtual void reportImport(DtFilename filename, const bool* const importTypes);
00119 
00120 
00121    // Info about the data coming from DFAD/DFD. How many features, what type 
00122    // and the container of features.
00123    inline unsigned int size() { return myDfadFeatures.size(); }
00124    
00125    inline DtDfadFeatureContainer& featureContainer() { return myDfadFeatures; }
00126    inline const DtDfadFeatureContainer& featureContainer() const { return myDfadFeatures; } 
00127 
00128    inline DtPoint& origin() { return myOrigin; }
00129 
00130 
00131    inline int& areas() { return myAreas; }
00132    inline int& lines() { return myLines; }
00133    inline int& points() { return myAreas; }
00134 
00135    // Function to calculate the extent for area features,
00136    virtual void caculateExtent(const DtPoint& point, DtPoint& minPoint, DtPoint& maxPoint);
00137 
00138    // Adding each different type of feature
00139    virtual bool addArealFeature(DtDfadFeature* pfeature, DtSpecification& spec);
00140    virtual bool addLinearFeature(DtDfadFeature* pfeature, DtSpecification& spec);
00141    virtual bool addPointFeature(DtDfadFeature* pfeature, DtSpecification& spec);
00142 
00143    // Adding a vector into the vectorNetwork. Could be open or closed.
00144    // Returns true if it successfully added the new vector into the network.
00145    virtual bool addNetwork(DtDfadFeature* pfeature, 
00146                            DtSpecificationID specIndex, 
00147                            bool isCloseNetwork);
00148 
00149    virtual DtPoint geoToUtm(const DtPoint& geo) const;
00150 
00151    DtFilename myFilename;
00152    DtFilename myFidSmcFile;
00153    DtFilename mySedrisColorMapFile;
00154    DtFilename myDfadSedrisMapFile;
00155 
00156    const DtTerrainDatabase* myTerrainDatabase;
00157    DtVectorNetwork* myVectorNetwork;
00158 
00159    DtDfadFeatureContainer myDfadFeatures;
00160 
00161    DtDfadHeader myHeader;
00162    DtDfadInfo myInfo;
00163 
00164    int myAreas;
00165    int myLines;
00166    int myPoints;
00167 
00168    std::vector<int> myTypesCount;
00169 
00170    int mySmcCount;
00171    int myFidCount;
00172 
00173    DtPoint myOrigin;
00174 
00175    std::vector<SMC> mySmcs;
00176    std::vector<FID> myFids;
00177 
00178    DtMapDatum  myMapDatum;
00179    double      myProjectionScale;
00180 };
00181 
00182 #endif

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)