EMODnet Quantized Mesh Generator for Cesium
tin_creation_simplification_point_set_hierarchy.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_HIERARCHY_H
22 #define EMODNET_QMGC_TIN_CREATION_SIMPLIFICATION_POINT_SET_HIERARCHY_H
23 
24 #include "tin_creation_simplification_point_set.h"
25 #include "tin_creation_utils.h"
26 
27 namespace TinCreation {
28 
38 {
39 public:
48  TinCreationSimplificationPointSetHierarchy(double borderSimplificationMaxDistance,
49  double borderSimplificationMaxLength,
50  unsigned int minFeaturePolylineSize,
51  unsigned int maxClusterSize,
52  double maxSurfaceVariance)
53  : TinCreationSimplificationPointSet(borderSimplificationMaxDistance,
54  borderSimplificationMaxLength,
55  minFeaturePolylineSize)
56  {
57  m_maxClusterSizePerZoom = std::vector<unsigned int>{maxClusterSize};
58  m_maxSurfaceVariancePerZoom = std::vector<double>{maxSurfaceVariance};
60  }
61 
70  TinCreationSimplificationPointSetHierarchy(const std::vector<double>& borderSimplificationMaxDistancePerZoom,
71  const std::vector<double>& borderSimplificationMaxLengthPerZoom,
72  unsigned int minFeaturePolylineSize,
73  const std::vector<unsigned int>& maxClusterSizePerZoom,
74  const std::vector<double>& maxSurfaceVariancePerZoom)
75  : TinCreationSimplificationPointSet(borderSimplificationMaxDistancePerZoom,
76  borderSimplificationMaxLengthPerZoom,
77  minFeaturePolylineSize)
78  , m_maxClusterSizePerZoom(maxClusterSizePerZoom)
79  , m_maxSurfaceVariancePerZoom(maxSurfaceVariancePerZoom)
80  {
82  }
83 
84  std::vector<Point_3> simplify(const std::vector<Point_3>& pts);
85 
86  void setParamsForZoomConcreteStrategy(const unsigned int& zoom) {
87  m_maxClusterSize = standardHandlingOfThresholdPerZoom(m_maxClusterSizePerZoom, zoom);
88  m_maxSurfaceVariance = standardHandlingOfThresholdPerZoom(m_maxSurfaceVariancePerZoom, zoom);
89  }
90 
91 private:
92  unsigned int m_maxClusterSize;
93  double m_maxSurfaceVariance;
94  std::vector<unsigned int> m_maxClusterSizePerZoom;
95  std::vector<double> m_maxSurfaceVariancePerZoom;
96 };
97 
98 } // End namespace TinCreation
99 
100 #endif //EMODNET_QMGC_TIN_CREATION_SIMPLIFICATION_POINT_SET_HIERARCHY_H
TinCreationSimplificationPointSetHierarchy(const std::vector< double > &borderSimplificationMaxDistancePerZoom, const std::vector< double > &borderSimplificationMaxLengthPerZoom, unsigned int minFeaturePolylineSize, const std::vector< unsigned int > &maxClusterSizePerZoom, const std::vector< double > &maxSurfaceVariancePerZoom)
Definition: tin_creation_simplification_point_set_hierarchy.h:70
T standardHandlingOfThresholdPerZoom(const std::vector< T > &thresholdsPerZoom, const unsigned int &zoom, const bool &downScale=true)
Definition: tin_creation_utils.h:43
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_hierarchy.cpp:29
void setParamsForZoomConcreteStrategy(const unsigned int &zoom)
Definition: tin_creation_simplification_point_set_hierarchy.h:86
Creates a TIN using the Hierarchical point set simplification algorithm.
Definition: tin_creation_simplification_point_set_hierarchy.h:36
Creates a TIN using a point set simplification algorithm.
Definition: tin_creation_simplification_point_set.h:45
TinCreationSimplificationPointSetHierarchy(double borderSimplificationMaxDistance, double borderSimplificationMaxLength, unsigned int minFeaturePolylineSize, unsigned int maxClusterSize, double maxSurfaceVariance)
Definition: tin_creation_simplification_point_set_hierarchy.h:48