EMODnet Quantized Mesh Generator for Cesium
tin_creation_simplification_point_set_random.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_TIN_CREATION_SIMPLIFICATION_POINT_SET_RANDOM_H
22 #define EMODNET_QMGC_TIN_CREATION_SIMPLIFICATION_POINT_SET_RANDOM_H
23 
24 #include "tin_creation_simplification_point_set.h"
25 #include "tin_creation_utils.h"
26 
27 namespace TinCreation {
28 
37 public:
38 
46 TinCreationSimplificationPointSetRandom(double borderSimplificationMaxDistance,
47  double borderSimplificationMaxLength,
48  unsigned int minFeaturePolylineSize,
49  double removePercentage)
50  : TinCreationSimplificationPointSet(borderSimplificationMaxDistance,
51  borderSimplificationMaxLength,
52  minFeaturePolylineSize)
53 {
54  m_removePercentagePerZoom = std::vector<double>{removePercentage};
56 }
57 
65 TinCreationSimplificationPointSetRandom(std::vector<double> borderSimplificationMaxDistancePerZoom,
66  std::vector<double> borderSimplificationMaxLengthPerZoom,
67  unsigned int minFeaturePolylineSize,
68  std::vector<double> removePercentagePerZoom)
69  : TinCreationSimplificationPointSet(borderSimplificationMaxDistancePerZoom,
70  borderSimplificationMaxLengthPerZoom,
71  minFeaturePolylineSize)
72  , m_removePercentagePerZoom(removePercentagePerZoom)
73 {
75 }
76 
77 std::vector<Point_3> simplify(const std::vector<Point_3> &pts);
78 
79 void setParamsForZoomConcreteStrategy(const unsigned int& zoom) {
80  m_removePercentage = standardHandlingOfThresholdPerZoom(m_removePercentagePerZoom, zoom);
81 }
82 
83 private:
84 // --- Attributes ---
85 double m_removePercentage;
86 std::vector<double> m_removePercentagePerZoom;
87 };
88 
89 } // End namespace TinCreation
90 
91 #endif //EMODNET_QMGC_TIN_CREATION_SIMPLIFICATION_POINT_SET_RANDOM_H
T standardHandlingOfThresholdPerZoom(const std::vector< T > &thresholdsPerZoom, const unsigned int &zoom, const bool &downScale=true)
Definition: tin_creation_utils.h:43
TinCreationSimplificationPointSetRandom(double borderSimplificationMaxDistance, double borderSimplificationMaxLength, unsigned int minFeaturePolylineSize, double removePercentage)
Definition: tin_creation_simplification_point_set_random.h:46
TinCreationSimplificationPointSetRandom(std::vector< double > borderSimplificationMaxDistancePerZoom, std::vector< double > borderSimplificationMaxLengthPerZoom, unsigned int minFeaturePolylineSize, std::vector< double > removePercentagePerZoom)
Definition: tin_creation_simplification_point_set_random.h:65
This namespace contains all the types/classes/functions required to create a TIN out of a regularly g...
std::vector< Point_3 > simplify(const std::vector< Point_3 > &pts)
Definition: tin_creation_simplification_point_set_random.cpp:28
Creates a TIN using a random simplification.
Definition: tin_creation_simplification_point_set_random.h:35
Creates a TIN using a point set simplification algorithm.
Definition: tin_creation_simplification_point_set.h:45
void setParamsForZoomConcreteStrategy(const unsigned int &zoom)
Definition: tin_creation_simplification_point_set_random.h:79