other.cpp 1.3 KB

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