diff options
Diffstat (limited to 'src/shared/vmap/CoordModelMapping.h')
-rw-r--r-- | src/shared/vmap/CoordModelMapping.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/shared/vmap/CoordModelMapping.h b/src/shared/vmap/CoordModelMapping.h index 8600620cc99..7684bf1b373 100644 --- a/src/shared/vmap/CoordModelMapping.h +++ b/src/shared/vmap/CoordModelMapping.h @@ -17,32 +17,43 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + #ifndef _COORDMODELMAPPING_H_ #define _COORDMODELMAPPING_H_ + #include <cstdio> #include <G3D/Table.h> #include <G3D/Array.h> + /** This Class is a helper Class to convert the raw vector data into BSP-Trees. We read the directory file of the raw data output and build logical groups. Models with a lot of vectors are not merged into a resulting model, but separated into an additional file. */ + namespace VMAP { + #define MIN_VERTICES_FOR_OWN_CONTAINER_FILE 65000 + // if we are in an instance #define MIN_INST_VERTICES_FOR_OWN_CONTAINER_FILE 40000 + //===================================================== class NameCollection { public: G3D::Array<std::string> iMainFiles; G3D::Array<std::string> iSingeFiles; + void appendToMain(const std::string& pStr) { iMainFiles.append(pStr); } void appendToSingle(const std::string& pStr) { iSingeFiles.append(pStr); } + size_t size() { return (iMainFiles.size() + iSingeFiles.size()); } }; + //===================================================== + class CMappingEntry { private: @@ -50,6 +61,7 @@ namespace VMAP int yPos; unsigned int iMapId; G3D::Array<std::string> iFilenames; + public: CMappingEntry() { }; CMappingEntry(unsigned int pMapId, const int pXPos, const int pYPos) @@ -58,12 +70,17 @@ namespace VMAP xPos = pXPos; yPos = pYPos; }; ~CMappingEntry() {}; + void addFilename(char *pName); const std::string getKeyString() const; inline const G3D::Array<std::string>& getFilenames() const { return(iFilenames); } + static const std::string getKeyString(unsigned int pMapId, int pXPos, int pYPos); + }; + //===================================================== + class CoordModelMapping { private: @@ -72,10 +89,12 @@ namespace VMAP G3D::Array<unsigned int> iMapIds; G3D::Array<unsigned int> iWorldAreaGroups; bool (*iFilterMethod)(char *pName); + inline void addCMappingEntry(CMappingEntry* pCMappingEntry) { iMapObjectFiles.set(pCMappingEntry->getKeyString(), pCMappingEntry); } + inline CMappingEntry* getCMappingEntry(const std::string& pKey) { if(iMapObjectFiles.containsKey(pKey)) @@ -83,14 +102,19 @@ namespace VMAP else return 0; } + public: CoordModelMapping() { iFilterMethod = NULL; } virtual ~CoordModelMapping(); + bool readCoordinateMapping(const std::string& pDirectoryFileName); + const NameCollection getFilenamesForCoordinate(unsigned int pMapId, int xPos, int yPos); + static unsigned int getMapIdFromFilename(const std::string& pName) { size_t spos; + spos = pName.find_last_of('/'); std::string basename = pName.substr(0, spos); spos = basename.find_last_of('/'); @@ -98,9 +122,11 @@ namespace VMAP unsigned int mapId = atoi(groupname.c_str()); return(mapId); } + const G3D::Array<unsigned int>& getMaps() const { return iMapIds; } bool isAlreadyProcessedSingleFile(const std::string& pName) const { return iProcesseSingleFiles.containsKey(pName); } void addAlreadyProcessedSingleFile(const std::string& pName) { iProcesseSingleFiles.set(pName,pName); } + inline void addWorldAreaMap(unsigned int pMapId) { if(!iWorldAreaGroups.contains(pMapId)) @@ -110,6 +136,7 @@ namespace VMAP } inline bool isWorldAreaMap(unsigned int pMapId) { return(iWorldAreaGroups.contains(pMapId)); } void setModelNameFilterMethod(bool (*pFilterMethod)(char *pName)) { iFilterMethod = pFilterMethod; } + }; } #endif /*_COORDMODELMAPPING_H_*/ |