EMODnet Quantized Mesh Generator for Cesium
quantized_mesh_tiles_pyramid_builder.h
1 // Copyright (c) 2018 Coronis Computing S.L. (Spain)
2 // All rights reserved.
3 //
4 // This file is part of EMODnet Quantized Mesh Generator for Cesium.
5 //
6 // This program is free software: you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation, either version 3 of the License, or
9 // (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program. If not, see <https://www.gnu.org/licenses/>.
18 //
19 // Author: Ricard Campos (ricardcd@gmail.com)
20 
21 #ifndef EMODNET_QMGC_QUANTIZED_MESH_TILES_PYRAMID_BUILDER_H
22 #define EMODNET_QMGC_QUANTIZED_MESH_TILES_PYRAMID_BUILDER_H
23 
24 #include <ctb.hpp>
25 #include "tin_creation/tin_creation_cgal_types.h"
26 #include "quantized_mesh_tiler.h"
27 #include "zoom_tiles_scheduler.h"
28 #include "zoom_tiles_border_vertices_cache.h"
29 #include <iostream>
30 #include <vector>
31 #include <mutex>
32 #include "borders_data.h"
33 
34 
35 
44 {
45  // --- Private typedefs ---
46  typedef typename TinCreation::Point_3 Point_3;
47 
48 public:
49 
55  QuantizedMeshTilesPyramidBuilder(const std::vector<QuantizedMeshTiler>& qmTilers,
56  const ZoomTilesScheduler& scheduler);
57 
65  void createTmsPyramid(const int &startZoom, const int &endZoom, const std::string &outDir, const std::string &debugDir = std::string("")) ;
66 
71  void createTmsPyramidUnconstrainedBorders(const int &startZoom, const int &endZoom, const std::string &outDir, const std::string &debugDir = std::string("")) ;
72 
78  static std::string getTileFileAndCreateDirs( const ctb::TileCoordinate &coord,
79  const std::string &mainOutDir ) ;
80 
90  BordersData createTile( const ctb::TileCoordinate& coord,
91  const int& numThread,
92  const std::string& outDir,
93  const BordersData& bd ) ;
94 
100  bool getNextTileToProcess(ctb::TilePoint& tileXY) ;
101 
102 private:
103  // --- Attributes ---
104  int m_numThreads ;
105  std::vector<QuantizedMeshTiler> m_tilers ;
106  ZoomTilesScheduler m_scheduler ;
107  std::vector<ctb::TilePoint> m_tilesWaitingToProcess ;
108  ZoomTilesBorderVerticesCache m_bordersCache ;
109  bool m_debugMode ;
110  std::string m_debugDir ;
111  std::mutex m_diskWriteMutex;
112 
118  std::string getDebugTileFileAndCreateDirs( const ctb::TileCoordinate &coord ) ;
119 
120 };
121 
122 
123 #endif //EMODNET_QMGC_QUANTIZED_MESH_TILES_PYRAMID_BUILDER_H
static std::string getTileFileAndCreateDirs(const ctb::TileCoordinate &coord, const std::string &mainOutDir)
Check if the tile folder (zoom/x) exists, and creates it otherwise.
Definition: quantized_mesh_tiles_pyramid_builder.cpp:264
BordersData createTile(const ctb::TileCoordinate &coord, const int &numThread, const std::string &outDir, const BordersData &bd)
Create the required tile, in the given thread, and with the given data at the borders to maintain...
Definition: quantized_mesh_tiles_pyramid_builder.cpp:237
Context class: Allows to change the algorithm at runtime.
Definition: zoom_tiles_scheduler.h:84
bool getNextTileToProcess(ctb::TilePoint &tileXY)
Definition: quantized_mesh_tiles_pyramid_builder.cpp:199
Structure storing the data for the borders of a tile. This includes the 4 east-west-north-south borde...
Definition: borders_data.h:30
void createTmsPyramidUnconstrainedBorders(const int &startZoom, const int &endZoom, const std::string &outDir, const std::string &debugDir=std::string(""))
Creates the tile pyramid in quantized-mesh format without taking into account coherence along neighbo...
Definition: quantized_mesh_tiles_pyramid_builder.cpp:129
void createTmsPyramid(const int &startZoom, const int &endZoom, const std::string &outDir, const std::string &debugDir=std::string(""))
Creates the tile pyramid in quantized-mesh format.
Definition: quantized_mesh_tiles_pyramid_builder.cpp:40
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
QuantizedMeshTilesPyramidBuilder(const std::vector< QuantizedMeshTiler > &qmTilers, const ZoomTilesScheduler &scheduler)
Definition: quantized_mesh_tiles_pyramid_builder.cpp:29
Contains the logic to create the pyramid of tiles in quantized mesh format.
Definition: quantized_mesh_tiles_pyramid_builder.h:43