VR-Forces 5.0.3 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
terrainDbFactory.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2003 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 /*******************************************************************************
6 ** $RCSfile: terrainDbFactory.h,v $ $Revision: 1.18 $ $State: Exp $
7 *******************************************************************************/
8 #ifndef terrainDbFactory_H_
9 #define terrainDbFactory_H_
10 
11 // \file terrainFactory.h
12 // The file contains the terrain database factory, which is used to create
13 // the appropriate terrain importers and exporters depending on the types of
14 // terrain files to import and export.
15 //
16 
18 #include <vlutil/vlHashlist.h>
19 #include <vlutil/vlFilename.h>
20 #include <vector>
21 
22 class DtTerrainDatabase;
23 class DtPaperMapDatabase;
24 class DtPaperMap;
25 class DtTerrainReader;
26 class DtMetafileRecord;
27 class DtVectorDataReader;
30 class DtPaperMapFactory;
33 class Coordinate_System;
34 
35 //
36 // DtTerrainDbFactory are two containers of DtTerrainFactoryEntries and
37 // DtPaperMapFactoryEntries indexed by the DtString type that represents the
38 // type of file able to load.
40 {
41 public:
42  // constructor
44 
45  // copy constructor
47 
48  // assignment operator
49  const DtTerrainDbFactory& operator=(const DtTerrainDbFactory& orig);
50 
51  // Destructor: deletes factory and any entries on the factory.
52  virtual ~DtTerrainDbFactory();
53 
54 
55  // creates the factories calling the functions for each one
56  // and initialize them with default functions.
57  // The functions are used in this order
58 
59  // because the last three need a metafile factory.
60  virtual void init();
61 
62 
63  // function to set/get the factories.
64  // For metafile factory, it replace it into the other factories.
65  virtual void setTerrainReaderFactory(DtTerrainReaderFactory* factory);
66  virtual DtTerrainReaderFactory *terrainReaderFactory();
67 
68  virtual void setTerrainWriterFactory(DtTerrainWriterFactory* factory);
69  virtual DtTerrainWriterFactory *terrainWriterFactory();
70 
71  virtual void setMetafileFactory(DtTdbMetafileFactory* factory);
72  virtual DtTdbMetafileFactory *metafileFactory();
73 
74  virtual void setPaperMapFactory(DtPaperMapFactory* factory);
75  virtual DtPaperMapFactory *paperMapFactory();
76 
77  virtual void setVectorDataFactory(DtVectorDataFactory* factory);
78  virtual DtVectorDataFactory *vectorDataFactory();
79 
80  // creator functions callers
81 
82  virtual DtTerrainReader* createTerrainReader(const DtString &type);
83 
84  virtual DtPaperMap* createPaperMap(const DtString &type);
85 
86  virtual DtVectorDataReader* createVectorDataReader(const DtString &type);
87 
88  // Loads terrain database file fileName, returning data in terrain.
89  // terrain must point to a newly created and initialized
90  // DtTerrainDatabase object before it is passed into this function.
91  // Creates and returns a DtPaperMapDatabase object in paperMapDatabase,
92  // if paper maps are specified in the incoming terrain database file.
93  // searchPaths is a list DtString*s, holding a list of locations in which
94  // to search for the given fileName on the file system.
95  // If there is not enough memory to load the database, it throws std::bad_alloc
96  // \throws std::bad_alloc
97  virtual bool loadDatabase(const DtFilename& fileName,
98  DtTerrainDatabase* terrain, DtPaperMapDatabase*& paperMapDatabase,
99  const DtList& searchPaths);
100 
101  // Loads terrain database file fileName, returning data in terrain.
102  // terrain must point to a newly created and initialized
103  // DtTerrainDatabase object before it is passed into this function.
104  // Creates and returns a DtPaperMapDatabase object in paperMapDatabase,
105  // if paper maps are specified in the incoming terrain database file.
106  // If there is not enough memory to load the database, it throws std::bad_alloc
107  // \throws std::bad_alloc
108  virtual bool loadDatabase(const DtFilename& fileName,
109  DtTerrainDatabase* terrain, DtPaperMapDatabase * &paperMapDatabase,const DtFilename & path=DtFilename::nullFilename());
110 
111  // Given the specified filename, determines and returns the extension.
112  // @return The extension of the specified filename, which is defined as the
113  // string after, but not containing, the last '.' in the filename.
114  //
115  // @note If the filename is "geodetic" then the extension returned will be
116  // "geodetic".
117  virtual const DtString determineFileExtension(const DtFilename& filename);
118 
119  // Loads the specified .map file into the specified terrain database.
120  // @return A boolean indicating success or failure in loading the .map
121  // terrain file.
122  // If there is not enough memory to load the database, it throws std::bad_alloc
123  // \throws std::bad_alloc
124  virtual bool loadMapTerrainFile(DtTerrainDatabase& terrainDb,
125  DtPaperMapDatabase*& paperMapDatabase, const DtFilename& filename,
126  const std::vector<DtFilename>& paths, const DtString& extension);
127 
128  // Loads the specified non-map (.gdb) file into the specified terrain database.
129  // @return A boolean indicating success or failure in loading the terrain file.
130  // If there is not enough memory to load the database, it throws std::bad_alloc
131  // \throws std::bad_alloc
132  virtual bool loadNonMapTerrainFile(DtTerrainDatabase& terrainDb,
133  const DtFilename& filename, const DtString& extension);
134 
135  // Apply simple processing to the database, such as reducing vertices
136  // and creating a spatial subdivision is none exists.
137  virtual bool processTerrainDatabase(DtTerrainDatabase& terrainDb);
138 
139  virtual bool saveDatabase(const DtFilename& fileName, DtTerrainDatabase *terrain);
140 
141  static DtTerrainDbFactory* create();
142 
143  // Calls down to appropriate terrain loader to return optional file flags. Will not load
144  // terrain vectors or polygons
145  virtual int optionalFileFlagsFromTerrainMapFile(const DtFilename& filename,
146  const std::vector<DtFilename>& searchPaths, const DtString& extension);
147 
148  // Calls down to appropriate terrain loader to return optional file flags. Will not load
149  // terrain vectors or polygons
150  // @return Optional file flags from file
151  virtual int optionalFileFlagsFromTerrainFile(const DtFilename& filename, const DtString& extension);
152 
153  // Returns a newly instantiated coordiate system for the specified terrain. This call should not load
154  // any of the underlying vector or polygon information
155  virtual Coordinate_System* coordinateSystemFor(const DtFilename& fileName, const DtFilename & path=DtFilename::nullFilename());
156 
157  // Figures out the terrain to load then calls coordinateSystemFromTerrainFile
158  // @return Coordinate_System that needs to be deleted by caller
159  virtual Coordinate_System* coordinateSystemFromTerrainMapFile(const DtFilename& filename,
160  const std::vector<DtFilename>& searchPaths, const DtString& extension);
161 
162  // Calls down to appropriate terrain loader to return a newly allocated coordinate system. Will not load
163  // terrain vectors or polygons
164  // @return Coordinate_System that needs to be deleted by caller
165  virtual Coordinate_System* coordinateSystemFromTerrainFile(const DtFilename& filename, const DtString& extension);
166 
167  // Returns true if any of the specified flags are set in the database
168  // @return True/false depending on whether or not flags are set
169  virtual bool hasOptionalFlags(int flags, const DtFilename& filename, const DtFilename & path=DtFilename::nullFilename());
170 
171  // Returns the path that contains the filename from the searchpaths
172  virtual DtFilename pathFromFilename(const std::vector<DtFilename>& searchPaths, const DtFilename& filename);
173 
174 protected:
175 
181 };
182 
183 #endif
184 
185 
Definition: terrainDbFactory.h:39
DtTerrainWriterFactory * myTerrainWriterFactory
Definition: terrainDbFactory.h:177
DtTdbMetafileFactory * myMetafileFactory
Definition: terrainDbFactory.h:178
Definition: vectorDataFactory.h:31
DtPaperMapFactory * myPaperMapFactory
Definition: terrainDbFactory.h:179
Definition: coordSystem.h:54
DtTerrainReaderFactory * myTerrainReaderFactory
Definition: terrainDbFactory.h:176
Definition: paperMapFactory.h:33
Definition: paperMapDatabase.h:20
Definition: paperMap.h:31
Definition: tdbMetafileFactory.h:26
#define DT_DLL_terrainDbFactory
Definition: terrainDbFactoryDefines.h:23
Definition: terrainReader.h:41
Definition: terrainWriterFactory.h:25
Definition: terrainReaderFactory.h:32
Definition: metafileRecord.h:28
DT_DLL_DEBUGDRAWRENDERER void init(makVrv::DtDe &de)
Work function for the plugin initialization.
Definition: terrainDatabase.h:148
DtVectorDataFactory * myVectorDataFactory
Definition: terrainDbFactory.h:180
Definition: vectorDataReader.h:20

Document ID: Generated on Thu Jun 1 17:58:13 EDT 2023 from SVN revision 255404
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)