EMODnet Quantized Mesh Generator for Cesium
tin_creation_simplification_point_set_wlop.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_WLOP_H
22 #define EMODNET_QMGC_TIN_CREATION_SIMPLIFICATION_POINT_SET_WLOP_H
23 
24 #include "tin_creation_simplification_point_set.h"
25 
26 namespace TinCreation {
27 
37 {
38 public:
48  TinCreationSimplificationPointSetWLOP(double borderSimplificationMaxDistance,
49  double borderSimplificationMaxLength,
50  unsigned int minFeaturePolylineSize,
51  double retainPercentage,
52  double radius,
53  unsigned int iterNumber = 35)
54  : TinCreationSimplificationPointSet(borderSimplificationMaxDistance, borderSimplificationMaxLength, minFeaturePolylineSize)
55  , m_iterNumber(iterNumber)
56  {
57  m_retainPercentagePerZoom = std::vector<double>{retainPercentage};
58  m_radiusPerZoom = std::vector<double>{radius};
60  }
61 
71  TinCreationSimplificationPointSetWLOP(std::vector<double> borderSimplificationMaxDistancePerZoom,
72  std::vector<double> borderSimplificationMaxLengthPerZoom,
73  unsigned int minFeaturePolylineSize,
74  std::vector<double> retainPercentagePerZoom,
75  std::vector<double> radiusPerZoom,
76  unsigned int iterNumber = 35)
77  : TinCreationSimplificationPointSet(borderSimplificationMaxDistancePerZoom,
78  borderSimplificationMaxLengthPerZoom,
79  minFeaturePolylineSize)
80  , m_retainPercentagePerZoom(retainPercentagePerZoom)
81  , m_radiusPerZoom(radiusPerZoom)
82  , m_iterNumber(iterNumber)
83  {
85  }
86 
87  std::vector<Point_3> simplify(const std::vector<Point_3>& pts);
88 
89  void setParamsForZoomConcreteStrategy(const unsigned int& zoom) {
90  m_retainPercentage = standardHandlingOfThresholdPerZoom(m_retainPercentagePerZoom, zoom, false);
91  m_radius = standardHandlingOfThresholdPerZoom(m_radiusPerZoom, zoom);
92  }
93 
94 private:
95  // --- Attributes ---
96  double m_retainPercentage;
97  double m_radius;
98  unsigned int m_iterNumber;
99  std::vector<double> m_retainPercentagePerZoom; // percentage of points to retain.
100  std::vector<double> m_radiusPerZoom; // neighbors size.
101 };
102 
103 } // End namespace TinCreation
104 
105 #endif //EMODNET_QMGC_TIN_CREATION_SIMPLIFICATION_POINT_SET_WLOP_H
Creates a TIN using the Weighted Locally Optimal Projection (WLOP) algorithm.
Definition: tin_creation_simplification_point_set_wlop.h:35
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_wlop.cpp:28
void setParamsForZoomConcreteStrategy(const unsigned int &zoom)
Definition: tin_creation_simplification_point_set_wlop.h:89
TinCreationSimplificationPointSetWLOP(std::vector< double > borderSimplificationMaxDistancePerZoom, std::vector< double > borderSimplificationMaxLengthPerZoom, unsigned int minFeaturePolylineSize, std::vector< double > retainPercentagePerZoom, std::vector< double > radiusPerZoom, unsigned int iterNumber=35)
Definition: tin_creation_simplification_point_set_wlop.h:71
Creates a TIN using a point set simplification algorithm.
Definition: tin_creation_simplification_point_set.h:45
TinCreationSimplificationPointSetWLOP(double borderSimplificationMaxDistance, double borderSimplificationMaxLength, unsigned int minFeaturePolylineSize, double retainPercentage, double radius, unsigned int iterNumber=35)
Definition: tin_creation_simplification_point_set_wlop.h:48