• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Boost.Geometry
2 
3 // Copyright (c) 2019, Oracle and/or its affiliates.
4 
5 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
6 
7 // Licensed under the Boost Software License version 1.0.
8 // http://www.boost.org/users/license.html
9 
10 #include "common.hpp"
11 
12 #include <boost/geometry/algorithms/centroid.hpp>
13 #include <boost/geometry/algorithms/simplify.hpp>
14 
15 template <typename G>
simplify(G const & g1,G & g2)16 inline void simplify(G const& g1, G & g2)
17 {
18     bg::simplify(g1, g2, 1, bg::strategy::simplify::douglas_peucker<geom::point, bg::strategy::distance::projected_point<> >());
19     bg::simplify(g1, g2, 1, bg::strategy::simplify::douglas_peucker<geom::point, bg::strategy::distance::cross_track<> >());
20 
21     // TODO: douglas_peucker does not define a ctor taking distance strategy
22     // which is needed in geographic CS
23     bg::simplify(g1, g2, 1, bg::strategy::simplify::douglas_peucker<geom::point, bg::strategy::distance::geographic_cross_track<> >());
24 }
25 
test_main(int,char * [])26 int test_main(int, char*[])
27 {
28     geom g, o;
29 
30     // this compiles but it shouldn't!
31     // internally default_strategy is defined as not_applicable_strategy for box
32     bg::centroid(g.b, o.pt);
33 
34     ::simplify(g.ls, o.ls);
35     // TODO:
36     //::simplify(g.r, o.r); // area (point order) strategy not propagated
37     //::simplify(g.po, o.po); // area (point order) strategy not propagated
38 
39     return 0;
40 }
41