21 #ifndef EMODNET_QMGC_ZOOM_TILES_BORDER_VERTICES_CACHE_H 22 #define EMODNET_QMGC_ZOOM_TILES_BORDER_VERTICES_CACHE_H 25 #include <unordered_map> 26 #include <boost/functional/hash.hpp> 27 #include "tile_border_vertices.h" 28 #include "tin_creation/tin_creation_cgal_types.h" 29 #include "borders_data.h" 41 typedef TinCreation::Point_3 Point_3;
50 : m_mapTileToBorderVertices()
51 , m_zoomBounds(zoomBounds)
52 , m_tileMaxCoord( tileMaxCoord )
53 , m_numProcessedTiles(0)
55 , m_tilesBeingProcessed()
57 m_numTiles = (zoomBounds.getMaxY()-zoomBounds.getMinY()+1)*(zoomBounds.getMaxX()-zoomBounds.getMinX()+1) ;
64 : m_mapTileToBorderVertices()
67 , m_numProcessedTiles(0)
94 const std::vector<Point_3>& easternVerticesToPreserve,
95 const std::vector<Point_3>& westernVerticesToPreserve,
96 const std::vector<Point_3>& northernVerticesToPreserve,
97 const std::vector<Point_3>& southernVerticesToPreserve ) ;
106 bool isTileVisited(
const int& tileX,
const int& tileY ) {
107 std::pair<int,int> tileInd = std::make_pair( tileX, tileY ) ;
108 return isTileVisited(tileInd) ;
119 if (m_tilesVisited.count(tileInd) == 0)
122 return m_tilesVisited[tileInd];
134 std::pair<int,int> tileInd = std::make_pair( tileX, tileY ) ;
146 if (m_tilesBeingProcessed.count(tileInd) == 0)
149 return m_tilesBeingProcessed[tileInd] ;
177 ctb::TileBounds m_zoomBounds ;
180 int m_numProcessedTiles ;
181 std::unordered_map<std::pair<int,int>,
TileBorderVertices, boost::hash<std::pair<int, int>>> m_mapTileToBorderVertices;
182 std::unordered_map<std::pair<int,int>, bool, boost::hash<std::pair<int, int>>> m_tilesVisited;
183 std::unordered_map<std::pair<int,int>, bool, boost::hash<std::pair<int, int>>> m_tilesBeingProcessed;
186 bool isTileInBounds(
const std::pair<int, int>& tileInd )
const {
187 return isTileInBounds(tileInd.first, tileInd.second);
191 bool isTileInBounds(
const int& tileX,
const int& tileY )
const {
192 return (tileX >= m_zoomBounds.getMinX() && tileX <= m_zoomBounds.getMaxX() &&
193 tileY >= m_zoomBounds.getMinY() && tileY <= m_zoomBounds.getMaxY());
197 #endif //EMODNET_QMGC_ZOOM_TILES_BORDER_VERTICES_CACHE_H ZoomTilesBorderVerticesCache(const ctb::TileBounds &zoomBounds, const int &tileMaxCoord)
Definition: zoom_tiles_border_vertices_cache.h:49
Structure storing the data for the borders of a tile. This includes the 4 east-west-north-south borde...
Definition: borders_data.h:30
bool allTilesProcessed() const
Checks if all the tiles in the zoom have been processed.
Definition: zoom_tiles_border_vertices_cache.h:163
int getNumTiles() const
Gets the total amount of tiles to be processed in the zoom.
Definition: zoom_tiles_border_vertices_cache.h:173
bool isTileBeingProcessed(const int &tileX, const int &tileY)
Checks if a tile is being processed.
Definition: zoom_tiles_border_vertices_cache.h:133
bool getConstrainedBorderVerticesForTile(const int &tileX, const int &tileY, BordersData &bd)
Definition: zoom_tiles_border_vertices_cache.cpp:26
Stores the vertices on the borders of a tile.
Definition: tile_border_vertices.h:53
Cache to store/reuse the vertices at the borders for tiles that have been already constructed for a g...
Definition: zoom_tiles_border_vertices_cache.h:38
bool isTileVisited(const std::pair< int, int > &tileInd)
Checks if a tile is visited.
Definition: zoom_tiles_border_vertices_cache.h:118
bool setConstrainedBorderVerticesForTile(const int &tileX, const int &tileY, const std::vector< Point_3 > &easternVerticesToPreserve, const std::vector< Point_3 > &westernVerticesToPreserve, const std::vector< Point_3 > &northernVerticesToPreserve, const std::vector< Point_3 > &southernVerticesToPreserve)
Definition: zoom_tiles_border_vertices_cache.cpp:171
bool canTileStartProcessing(const int &tileX, const int &tileY)
Checks if a tile can start processing.
Definition: zoom_tiles_border_vertices_cache.cpp:236
bool isTileBeingProcessed(const std::pair< int, int > &tileInd)
Checks if a tile is being processed.
Definition: zoom_tiles_border_vertices_cache.h:145
int numCacheEntries()
Definition: zoom_tiles_border_vertices_cache.h:104
int getNumProcessed() const
Gets the number of processed tiles.
Definition: zoom_tiles_border_vertices_cache.h:168
ZoomTilesBorderVerticesCache()
Definition: zoom_tiles_border_vertices_cache.h:63