diff --git a/circle.yml b/circle.yml
index 20ec47d86..ee8db0f1d 100644
--- a/circle.yml
+++ b/circle.yml
@@ -17,7 +17,7 @@ machine:
# define tests list, if parallelism is enabled they are run in parallel
TESTS: test index/test
TESTS0: test/core test/concepts test/geometries test/arithmetic test/algorithms test/formulas test/iterators
- TESTS1: test/strategies test/policies test/io test/util test/views index/test
+ TESTS1: test/srs test/strategies test/policies test/io test/util test/views index/test
# this is not fully bulletproof, ideally one should check
# if the current branch originates in master or develop
diff --git a/doc/about_documentation.qbk b/doc/about_documentation.qbk
index e2b277851..e3e01fcbb 100644
--- a/doc/about_documentation.qbk
+++ b/doc/about_documentation.qbk
@@ -66,7 +66,7 @@ In the example above a QuickBook include statement is used. But any QuickBook co
\[area_with_strategy_output\]
\[heading Available Strategies\]
-\[link geometry.reference.strategies.strategy_area_surveyor Surveyor (cartesian)\]
+\[link geometry.reference.strategies.strategy_area_cartesian Cartesian\]
}
*/
]
diff --git a/doc/concept/point.qbk b/doc/concept/point.qbk
index 070aa81f6..746ce82ed 100644
--- a/doc/concept/point.qbk
+++ b/doc/concept/point.qbk
@@ -38,6 +38,7 @@ The Point Concept is defined as following:
* [link geometry.reference.models.model_d2_point_xy model::d2::point_xy]
* a lat long point (currently in an extension)
* [link geometry.reference.adapted.c_array C array]
+* [link geometry.reference.adapted.std_array C++ array container]
* [link geometry.reference.adapted.boost_array Boost.Array]
* [link geometry.reference.adapted.boost_fusion Boost.Fusion]
* [link geometry.reference.adapted.boost_polygon Boost.Polygon]
diff --git a/doc/doxy/Doxyfile b/doc/doxy/Doxyfile
index aab8e217b..d031baa5c 100644
--- a/doc/doxy/Doxyfile
+++ b/doc/doxy/Doxyfile
@@ -55,6 +55,7 @@ ALIASES = qbk{1}="\xmlonly \1 \endxmlonly" \
tparam_box_or_segment="Any type fulfilling a Box Concept or a Segment Concept" \
tparam_calculation="numeric type for calculation (e.g. high precision); if [*void] then it is extracted automatically from the coordinate type and (if necessary) promoted to floating point" \
tparam_radius="numeric type for radius (of sphere, earth)" \
+ tparam_radius_or_sphere="numeric type for radius (of sphere, earth) or sphere model" \
tparam_container="container type, for example std::vector, std::deque" \
tparam_dimension_required="Dimension, this template parameter is required. Should contain \\[0 .. n-1\\] for an n-dimensional geometry" \
tparam_functor="Function or class with operator()" \
diff --git a/doc/doxy/doxygen_input/groups/groups.hpp b/doc/doxy/doxygen_input/groups/groups.hpp
index 9889ebd76..fabf1f376 100644
--- a/doc/doxy/doxygen_input/groups/groups.hpp
+++ b/doc/doxy/doxygen_input/groups/groups.hpp
@@ -2,6 +2,10 @@
//
// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// This file was modified by Oracle on 2018.
+// Modifications copyright (c) 2018, Oracle and/or its affiliates.
+// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
+
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
@@ -26,6 +30,7 @@
\defgroup covered_by covered_by: detect if a geometry is inside or on the border of another geometry, a.o. point-in-polygon (border included)
\defgroup crosses crosses: detect if two geometries crosses each other
\defgroup cs coordinate systems
+\defgroup densify densify: add points to geometry, keeping shape
\defgroup difference difference: difference of two geometries
\defgroup disjoint disjoint: detect if geometries are not spatially related
\defgroup distance distance: calculate distance between two geometries
diff --git a/doc/imports.qbk b/doc/imports.qbk
index 6c4863add..284061189 100644
--- a/doc/imports.qbk
+++ b/doc/imports.qbk
@@ -5,6 +5,9 @@
Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
Copyright (c) 2009-2012 Bruno Lalande, Paris, France.
+ Copyright (c) 2018, Oracle and/or its affiliates.
+ Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
+
Use, modification and distribution is subject to the Boost Software License,
Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
@@ -27,6 +30,8 @@
[import src/examples/algorithms/convert.cpp]
[import src/examples/algorithms/convex_hull.cpp]
[import src/examples/algorithms/correct.cpp]
+[import src/examples/algorithms/densify.cpp]
+[import src/examples/algorithms/densify_strategy.cpp]
[import src/examples/algorithms/distance.cpp]
[import src/examples/algorithms/difference.cpp]
[import src/examples/algorithms/envelope.cpp]
@@ -97,6 +102,7 @@
[import src/examples/geometries/segment.cpp]
[import src/examples/geometries/adapted/c_array.cpp]
+[import src/examples/geometries/adapted/std_array.cpp]
[import src/examples/geometries/adapted/boost_array.cpp]
[import src/examples/geometries/adapted/boost_fusion.cpp]
[import src/examples/geometries/adapted/boost_polygon_box.cpp]
diff --git a/doc/make_qbk.py b/doc/make_qbk.py
index cace58ff8..6c092257b 100755
--- a/doc/make_qbk.py
+++ b/doc/make_qbk.py
@@ -5,6 +5,9 @@
# Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
# Copyright (c) 2009-2012 Mateusz Loskot (mateusz@loskot.net), London, UK
# Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland
+#
+# Copyright (c) 2018, Oracle and/or its affiliates.
+# Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
#
# Use, modification and distribution is subject to the Boost Software License,
# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -91,7 +94,7 @@ call_doxygen()
algorithms = ["append", "assign", "make", "clear"
, "area", "buffer", "centroid", "convert", "correct", "covered_by"
- , "convex_hull", "crosses", "difference", "disjoint", "distance"
+ , "convex_hull", "crosses", "densify", "difference", "disjoint", "distance"
, "envelope", "equals", "expand", "for_each", "is_empty"
, "is_simple", "is_valid", "intersection", "intersects", "length"
, "num_geometries", "num_interior_rings", "num_points"
@@ -120,13 +123,7 @@ models = ["point", "linestring", "box"
, "multi_linestring", "multi_point", "multi_polygon", "referring_segment"]
-strategies = ["distance::pythagoras", "distance::pythagoras_box_box"
- , "distance::pythagoras_point_box", "distance::haversine"
- , "distance::cross_track", "distance::cross_track_point_box"
- , "distance::projected_point"
- , "within::winding", "within::franklin", "within::crossings_multiply"
- , "area::surveyor", "area::spherical"
- #, "area::geographic"
+strategies = ["area::cartesian", "area::spherical", "area::geographic"
, "buffer::point_circle", "buffer::point_square"
, "buffer::join_round", "buffer::join_miter"
, "buffer::end_round", "buffer::end_flat"
@@ -134,6 +131,12 @@ strategies = ["distance::pythagoras", "distance::pythagoras_box_box"
, "buffer::side_straight"
, "centroid::bashein_detmer", "centroid::average"
, "convex_hull::graham_andrew"
+ , "densify::cartesian", "densify::geographic", "densify::spherical"
+ , "distance::pythagoras", "distance::pythagoras_box_box"
+ , "distance::pythagoras_point_box", "distance::haversine"
+ , "distance::cross_track", "distance::cross_track_point_box"
+ , "distance::projected_point"
+ , "within::winding", "within::franklin", "within::crossings_multiply"
, "simplify::douglas_peucker"
, "side::side_by_triangle", "side::side_by_cross_track", "side::spherical_side_formula"
, "transform::inverse_transformer", "transform::map_transformer"
diff --git a/doc/quickref.xml b/doc/quickref.xml
index 755fdd255..fcb4bba50 100644
--- a/doc/quickref.xml
+++ b/doc/quickref.xml
@@ -10,8 +10,8 @@
Copyright (c) 2009-2015 Bruno Lalande, Paris, France.
Copyright (c) 2013-2015 Adam Wulkiewicz, Lodz, Poland.
- This file was modified by Oracle on 2014, 2015, 2017.
- Modifications copyright (c) 2014-2017, Oracle and/or its affiliates.
+ This file was modified by Oracle on 2014, 2015, 2017, 2018.
+ Modifications copyright (c) 2014-2018, Oracle and/or its affiliates.
Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@@ -114,6 +114,7 @@
Boost.Polygon's point_data
Boost.Tuple
C arrays
+ C++11 array containers
@@ -389,6 +390,10 @@
+ Densify
+
+ densify
+
Distance
distance
@@ -410,17 +415,16 @@
for each (point, segment)
+
+
Intersection
intersection
-
-
Length
length
-
-
+
Num_ (counting)
num_interior_rings
@@ -428,8 +432,6 @@
num_points
num_segments
-
-
Perimeter
perimeter
@@ -439,12 +441,12 @@
relate
relation
+
+
Reverse
reverse
-
-
Simplify
simplify
@@ -520,9 +522,9 @@
Area
- strategy::area::surveyor
+ strategy::area::cartesian
strategy::area::spherical
-
+ strategy::area::geographic
@@ -554,6 +556,14 @@
strategy::convex_hull::graham_andrew
+
+ Densify
+
+ strategy::densify::cartesian
+ strategy::densify::geographic
+ strategy::densify::spherical
+
+
Distance
@@ -566,6 +576,8 @@
strategy::distance::haversine
+
+
Side
@@ -574,8 +586,6 @@
strategy::side::spherical_side_formula
-
-
Simplify
@@ -593,7 +603,9 @@
strategy::transform::rotate_transformer
-
+
+
+
Within
strategy::winding
diff --git a/doc/reference.qbk b/doc/reference.qbk
index 699712399..39b4227e8 100644
--- a/doc/reference.qbk
+++ b/doc/reference.qbk
@@ -6,8 +6,8 @@
Copyright (c) 2009-2017 Bruno Lalande, Paris, France.
Copyright (c) 2013-2017 Adam Wulkiewicz, Lodz, Poland.
- This file was modified by Oracle on 2014, 2017.
- Modifications copyright (c) 2014-2017, Oracle and/or its affiliates.
+ This file was modified by Oracle on 2014, 2017, 2018.
+ Modifications copyright (c) 2014-2018, Oracle and/or its affiliates.
Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@@ -45,6 +45,7 @@
[section:adapted Adapted models]
[include reference/geometries/adapted/c_array.qbk]
+[include reference/geometries/adapted/std_array.qbk]
[include reference/geometries/adapted/boost_array.qbk]
[include reference/geometries/adapted/boost_fusion.qbk]
[include reference/geometries/adapted/boost_tuple.qbk]
@@ -102,6 +103,10 @@
[include generated/crosses.qbk]
[endsect]
+[section:densify densify]
+[include generated/densify.qbk]
+[endsect]
+
[section:difference difference]
[include generated/difference.qbk]
[endsect]
@@ -332,16 +337,9 @@
[section:strategies Strategies]
-[include generated/distance_pythagoras.qbk]
-[include generated/distance_pythagoras_box_box.qbk]
-[include generated/distance_pythagoras_point_box.qbk]
-[include generated/distance_haversine.qbk]
-[include generated/distance_projected_point.qbk]
-[include generated/distance_cross_track.qbk]
-[include generated/distance_cross_track_point_box.qbk]
-[include generated/area_surveyor.qbk]
+[include generated/area_cartesian.qbk]
[include generated/area_spherical.qbk]
-[/include generated/area_geographic.qbk]
+[include generated/area_geographic.qbk]
[include generated/buffer_join_round.qbk]
[include generated/buffer_join_miter.qbk]
[include generated/buffer_end_round.qbk]
@@ -354,6 +352,16 @@
[include generated/centroid_average.qbk]
[include generated/centroid_bashein_detmer.qbk]
[include generated/convex_hull_graham_andrew.qbk]
+[include generated/densify_cartesian.qbk]
+[include generated/densify_geographic.qbk]
+[include generated/densify_spherical.qbk]
+[include generated/distance_pythagoras.qbk]
+[include generated/distance_pythagoras_box_box.qbk]
+[include generated/distance_pythagoras_point_box.qbk]
+[include generated/distance_haversine.qbk]
+[include generated/distance_projected_point.qbk]
+[include generated/distance_cross_track.qbk]
+[include generated/distance_cross_track_point_box.qbk]
[include generated/side_side_by_triangle.qbk]
[include generated/side_side_by_cross_track.qbk]
[include generated/side_spherical_side_formula.qbk]
diff --git a/doc/reference/algorithms/densify.qbk b/doc/reference/algorithms/densify.qbk
new file mode 100644
index 000000000..676e59a13
--- /dev/null
+++ b/doc/reference/algorithms/densify.qbk
@@ -0,0 +1,25 @@
+[/============================================================================
+ Boost.Geometry
+
+ Copyright (c) 2018, Oracle and/or its affiliates.
+ Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
+
+ Use, modification and distribution is subject to the Boost Software License,
+ Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================/]
+
+[def __this_function__ densify]
+
+[heading_conformance_no_ogc __this_function__]
+[note PostGIS contains an algorithm ST_Segmentize with the same functionality.
+ See the [@http://www.postgis.org/docs/ST_Segmentize.html PostGIS documentation].
+]
+
+[heading Behavior]
+The algorithm divides segments of a geometry if they are longer than passed
+distance into smaller segments.
+
+[note The units of the distance depends on strategy. In order to change the
+default behavior a user has to create a strategy and pass it explicitly into
+the algorithm.]
diff --git a/doc/reference/geometries/adapted/boost_array.qbk b/doc/reference/geometries/adapted/boost_array.qbk
index c2a95998b..54dcc1708 100644
--- a/doc/reference/geometries/adapted/boost_array.qbk
+++ b/doc/reference/geometries/adapted/boost_array.qbk
@@ -20,7 +20,7 @@ A boost::array is (optionally) adapted to the Boost.Geometry
point concept. It can therefore be used in all Boost.Geometry algorithms.
A boost::array can be the point type used by the models linestring, polygon, segment,
-box, and ring
+box, and ring.
[heading Model of]
[link geometry.reference.concepts.concept_point Point Concept]
diff --git a/doc/reference/geometries/adapted/boost_tuple.qbk b/doc/reference/geometries/adapted/boost_tuple.qbk
index a49124382..1fcb19a8e 100644
--- a/doc/reference/geometries/adapted/boost_tuple.qbk
+++ b/doc/reference/geometries/adapted/boost_tuple.qbk
@@ -29,7 +29,7 @@ tuples with 10 elements (though most algorithms do not support so many
dimensions).
A tuple can be the point type used by the models linestring, polygon, segment,
-box, and ring
+box, and ring.
[heading Model of]
[link geometry.reference.concepts.concept_point Point Concept]
diff --git a/doc/reference/geometries/adapted/std_array.qbk b/doc/reference/geometries/adapted/std_array.qbk
new file mode 100644
index 000000000..c3b4b960f
--- /dev/null
+++ b/doc/reference/geometries/adapted/std_array.qbk
@@ -0,0 +1,38 @@
+[/============================================================================
+ Boost.Geometry (aka GGL, Generic Geometry Library)
+
+ Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
+ Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
+ Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
+
+ Use, modification and distribution is subject to the Boost Software License,
+ Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================/]
+
+[section:std_array C++11 Array Container]
+
+C++11 array containers are adapted to the Boost.Geometry point concept
+
+[heading Description]
+
+A C++11 std::array is (optionally) adapted to the Boost.Geometry
+point concept. It can therefore be used in all Boost.Geometry algorithms.
+
+A std::array can be the point type used by the models linestring, polygon, segment,
+box, and ring.
+
+[heading Model of]
+[link geometry.reference.concepts.concept_point Point Concept]
+
+[heading Header]
+`#include `
+
+__not_in_boost_geometry_hpp__
+
+[heading Example]
+[std_array]
+[std_array_output]
+
+[endsect]
+
diff --git a/doc/release_notes.qbk b/doc/release_notes.qbk
index a144628c8..4327b7e2e 100644
--- a/doc/release_notes.qbk
+++ b/doc/release_notes.qbk
@@ -6,8 +6,8 @@
Copyright (c) 2009-2017 Mateusz Loskot , London, UK.
Copyright (c) 2011-2017 Adam Wulkiewicz, Lodz, Poland.
- This file was modified by Oracle on 2015, 2017.
- Modifications copyright (c) 2015-2017, Oracle and/or its affiliates.
+ This file was modified by Oracle on 2015, 2017, 2018.
+ Modifications copyright (c) 2015-2018, Oracle and/or its affiliates.
Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@@ -18,6 +18,35 @@
[section:release_notes Release Notes]
+[/=================]
+[heading Boost 1.67]
+[/=================]
+
+[*Improvements]
+
+* New densify() algorithm.
+* No longer using std::iterator (thanks to Daniela Engert).
+* No longer using allocator directly in the rtree. Replaced with boost::container::allocator_traits (thanks to Daniela Engert).
+* Default rtree allocator changed to boost::container::new_allocator to still support move semantics emulation in C++03 with boost::container::allocator_traits.
+* Area strategies interface changed. This is potentially a breaking change.
+* Radius or Sphere can be passed into spherical strategies.
+* Added Point-Box and Box-Box spherical and geographic distance() strategies.
+* Simplify (multi)polygons will discard output rings of 2 points or (for closed polygons) 3 points, but it tries to avoid creating those
+* Simplify (multi)polygons will omit empty interior rings or polygons from output
+
+[*Solved issues]
+
+* [@https://svn.boost.org/trac10/ticket/13381 13381] Compile error with matrix_transformer in Visual C++ 2015
+* [@https://svn.boost.org/trac10/ticket/13436 13436] Incorrectness in boost::geometry::model::polygon documentation
+
+[*Bugfixes]
+
+* Add missing strategy resolving in length() algorithm, affecting Variant support.
+* Simplify (multi)polygons now simplifies closing point
+
+[*Changes in behavior]
+* Simplify (multi)polygons now usually rotates input rings before simplifying to select a non collinear point on its convex hull. This improves output.
+
[/=================]
[heading Boost 1.66]
[/=================]
@@ -152,7 +181,7 @@
* [@https://svn.boost.org/trac/boost/ticket/11725 11725] union_ fails to create holes
* [@https://svn.boost.org/trac/boost/ticket/11789 11789] Assertion failure or invalid result of set operations for spherical_equatorial coordinate system.
* [@https://svn.boost.org/trac/boost/ticket/11917 11917] Andoyer distance strategy returns 0 for antipodal points (default geographic distance).
-* [@https://svn.boost.org/trac/boost/ticket/11928 11928] Improvement of the accuracy of surveyor area strategy.
+* [@https://svn.boost.org/trac/boost/ticket/11928 11928] Improvement of the accuracy of surveyor (cartesian) area strategy.
* [@https://svn.boost.org/trac/boost/ticket/11966 11966] Compilation error in svg() for box and non-int coordinate type.
* [@https://svn.boost.org/trac/boost/ticket/11984 11984] union_() generates self-intersecting polygon
* [@https://svn.boost.org/trac/boost/ticket/11987 11987] rtree::remove() not compiling for geographic CS.
diff --git a/doc/src/examples/algorithms/Jamfile.v2 b/doc/src/examples/algorithms/Jamfile.v2
index 38c39dbd1..9b62521e1 100644
--- a/doc/src/examples/algorithms/Jamfile.v2
+++ b/doc/src/examples/algorithms/Jamfile.v2
@@ -4,10 +4,11 @@
# Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
# Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
-# This file was modified by Oracle on 2014, 2015.
-# Modifications copyright (c) 2014-2015, Oracle and/or its affiliates.
+# This file was modified by Oracle on 2014, 2015, 2018.
+# Modifications copyright (c) 2014-2018, Oracle and/or its affiliates.
# Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
+# Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
# Use, modification and distribution is subject to the Boost Software License,
# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -40,6 +41,8 @@ exe convert : convert.cpp ;
exe convex_hull : convex_hull.cpp ;
exe correct : correct.cpp ;
+exe densify : densify.cpp ;
+exe densify_strategy : densify_strategy.cpp ;
exe difference : difference.cpp ;
exe distance : distance.cpp ;
diff --git a/doc/src/examples/algorithms/area_with_strategy.cpp b/doc/src/examples/algorithms/area_with_strategy.cpp
index a0171304e..8d7803d8b 100644
--- a/doc/src/examples/algorithms/area_with_strategy.cpp
+++ b/doc/src/examples/algorithms/area_with_strategy.cpp
@@ -3,6 +3,10 @@
// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// This file was modified by Oracle on 2018.
+// Modifications copyright (c) 2018 Oracle and/or its affiliates.
+// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
+
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
@@ -20,16 +24,27 @@ namespace bg = boost::geometry; /*< Convenient namespace alias >*/
int main()
{
- // Calculate the area of a cartesian polygon
- bg::model::polygon > poly;
- bg::read_wkt("POLYGON((0 0,0 7,4 2,2 0,0 0))", poly);
- double area = bg::area(poly);
+ // Create spherical polygon
+ bg::model::polygon > > sph_poly;
+ bg::read_wkt("POLYGON((0 0,0 1,1 0,0 0))", sph_poly);
+
+ // Create spherical strategy with mean Earth radius in meters
+ bg::strategy::area::spherical<> sph_strategy(6371008.8);
+
+ // Calculate the area of a spherical polygon
+ double area = bg::area(sph_poly, sph_strategy);
std::cout << "Area: " << area << std::endl;
- // Calculate the area of a spherical polygon (for latitude: 0 at equator)
- bg::model::polygon > > sph_poly;
- bg::read_wkt("POLYGON((0 0,0 45,45 0,0 0))", sph_poly);
- area = bg::area(sph_poly);
+ // Create geographic polygon
+ bg::model::polygon > > geo_poly;
+ bg::read_wkt("POLYGON((0 0,0 1,1 0,0 0))", geo_poly);
+
+ // Create geographic strategy with WGS84 spheroid
+ bg::srs::spheroid spheroid(6378137.0, 6356752.3142451793);
+ bg::strategy::area::geographic<> geo_strategy(spheroid);
+
+ // Calculate the area of a geographic polygon
+ area = bg::area(geo_poly, geo_strategy);
std::cout << "Area: " << area << std::endl;
return 0;
@@ -42,8 +57,8 @@ int main()
/*`
Output:
[pre
-Area: 16
-Area: 0.339837
+Area: 6.18249e+09
+Area: 6.15479e+09
]
*/
//]
diff --git a/doc/src/examples/algorithms/densify.cpp b/doc/src/examples/algorithms/densify.cpp
new file mode 100644
index 000000000..68f7426c6
--- /dev/null
+++ b/doc/src/examples/algorithms/densify.cpp
@@ -0,0 +1,47 @@
+// Boost.Geometry
+// QuickBook Example
+
+// Copyright (c) 2018, Oracle and/or its affiliates
+// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
+
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+//[densify
+//` Shows how to densify a polygon
+
+#include
+
+#include
+#include
+#include
+
+int main()
+{
+ typedef boost::geometry::model::d2::point_xy point_type;
+ typedef boost::geometry::model::polygon polygon_type;
+
+ polygon_type poly;
+ boost::geometry::read_wkt(
+ "POLYGON((0 0,0 10,10 10,10 0,0 0),(1 1,4 1,4 4,1 4,1 1))", poly);
+
+ polygon_type res;
+
+ boost::geometry::densify(poly, res, 6.0);
+
+ std::cout << "densified: " << boost::geometry::wkt(res) << std::endl;
+
+ return 0;
+}
+
+//]
+
+//[densify_output
+/*`
+Output:
+[pre
+densified: POLYGON((0 0,0 5,0 10,5 10,10 10,10 5,10 0,5 0,0 0),(1 1,4 1,4 4,1 4,1 1))
+]
+*/
+//]
diff --git a/doc/src/examples/algorithms/densify_strategy.cpp b/doc/src/examples/algorithms/densify_strategy.cpp
new file mode 100644
index 000000000..eb9934995
--- /dev/null
+++ b/doc/src/examples/algorithms/densify_strategy.cpp
@@ -0,0 +1,50 @@
+// Boost.Geometry
+// QuickBook Example
+
+// Copyright (c) 2018, Oracle and/or its affiliates
+// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
+
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+//[densify_strategy
+//` Shows how to densify a linestring in geographic coordinate system
+
+#include
+
+#include
+#include
+#include
+
+int main()
+{
+ namespace bg = boost::geometry;
+ typedef bg::model::point > point_type;
+ typedef bg::model::linestring linestring_type;
+
+ linestring_type ls;
+ bg::read_wkt("LINESTRING(0 0,1 1)", ls);
+
+ linestring_type res;
+
+ bg::srs::spheroid spheroid(6378137.0, 6356752.3142451793);
+ bg::strategy::densify::geographic<> strategy(spheroid);
+
+ boost::geometry::densify(ls, res, 50000.0, strategy);
+
+ std::cout << "densified: " << boost::geometry::wkt(res) << std::endl;
+
+ return 0;
+}
+
+//]
+
+//[densify_strategy_output
+/*`
+Output:
+[pre
+densified: LINESTRING(0 0,0.249972 0.250011,0.499954 0.500017,0.749954 0.750013,1 1)
+]
+*/
+//]
diff --git a/doc/src/examples/geometries/adapted/Jamfile.v2 b/doc/src/examples/geometries/adapted/Jamfile.v2
index dd40a2494..359a42511 100644
--- a/doc/src/examples/geometries/adapted/Jamfile.v2
+++ b/doc/src/examples/geometries/adapted/Jamfile.v2
@@ -21,5 +21,6 @@ exe boost_polygon_point : boost_polygon_point.cpp ;
exe boost_polygon_polygon : boost_polygon_polygon.cpp ;
exe boost_polygon_ring : boost_polygon_ring.cpp ;
exe boost_tuple : boost_tuple.cpp ;
+exe std_array : std_array.cpp ;
build-project boost_range ;
diff --git a/doc/src/examples/geometries/adapted/std_array.cpp b/doc/src/examples/geometries/adapted/std_array.cpp
new file mode 100644
index 000000000..043cf6494
--- /dev/null
+++ b/doc/src/examples/geometries/adapted/std_array.cpp
@@ -0,0 +1,63 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+// QuickBook Example
+
+// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
+
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include
+#ifdef BOOST_NO_CXX11_HDR_ARRAY
+
+int main()
+{
+ return 0;
+}
+
+#else //this example needs C++11 std::array
+
+//[std_array
+//` Shows how to use a C++11 std::array using Boost.Geometry's distance, set and assign_values algorithms
+
+#include
+
+#include
+#include
+#include
+
+BOOST_GEOMETRY_REGISTER_STD_ARRAY_CS(cs::cartesian)
+
+int main()
+{
+ std::array a = { {1, 2} };
+ std::array b = { {2, 3} };
+ std::cout << boost::geometry::distance(a, b) << std::endl;
+
+ boost::geometry::set<0>(a, 1.1f);
+ boost::geometry::set<1>(a, 2.2f);
+ std::cout << boost::geometry::distance(a, b) << std::endl;
+
+ boost::geometry::assign_values(b, 2.2, 3.3);
+ std::cout << boost::geometry::distance(a, b) << std::endl;
+
+ boost::geometry::model::linestring > line;
+ line.push_back(b);
+
+ return 0;
+}
+
+//]
+
+#endif //BOOST_NO_CXX11_HDR_ARRAY
+
+//[std_array_output
+/*`
+Output:
+[pre
+1.41421
+1.20416
+1.55563
+]
+*/
+//]
diff --git a/include/boost/geometry/algorithms/area.hpp b/include/boost/geometry/algorithms/area.hpp
index 18aea2403..c6e237e7c 100644
--- a/include/boost/geometry/algorithms/area.hpp
+++ b/include/boost/geometry/algorithms/area.hpp
@@ -3,9 +3,10 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
+// Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.
-// This file was modified by Oracle on 2017.
-// Modifications copyright (c) 2017 Oracle and/or its affiliates.
+// This file was modified by Oracle on 2017, 2018.
+// Modifications copyright (c) 2017-2018 Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
@@ -19,7 +20,6 @@
#define BOOST_GEOMETRY_ALGORITHMS_AREA_HPP
#include
-#include
#include
#include
@@ -43,7 +43,9 @@
#include
#include
+#include
#include
+#include
#include
@@ -56,6 +58,7 @@
namespace boost { namespace geometry
{
+
#ifndef DOXYGEN_NO_DETAIL
namespace detail { namespace area
{
@@ -83,10 +86,10 @@ template
struct ring_area
{
template
- static inline typename Strategy::return_type
+ static inline typename area_result::type
apply(Ring const& ring, Strategy const& strategy)
{
- BOOST_CONCEPT_ASSERT( (geometry::concepts::AreaStrategy) );
+ BOOST_CONCEPT_ASSERT( (geometry::concepts::AreaStrategy) );
assert_dimension();
// Ignore warning (because using static method sometimes) on strategy
@@ -98,7 +101,7 @@ struct ring_area
if (boost::size(ring)
< core_detail::closure::minimum_ring_size::value)
{
- return typename Strategy::return_type();
+ return typename area_result::type();
}
typedef typename reversible_view::type rview_type;
@@ -110,7 +113,7 @@ struct ring_area
rview_type rview(ring);
view_type view(rview);
- typename Strategy::state_type state;
+ typename Strategy::template state state;
iterator_type it = boost::begin(view);
iterator_type end = boost::end(view);
@@ -144,9 +147,13 @@ template
struct area : detail::calculate_null
{
template
- static inline typename Strategy::return_type apply(Geometry const& geometry, Strategy const& strategy)
+ static inline typename area_result::type
+ apply(Geometry const& geometry, Strategy const& strategy)
{
- return calculate_null::apply(geometry, strategy);
+ return calculate_null::apply
+ <
+ typename area_result::type
+ >(geometry, strategy);
}
};
@@ -170,10 +177,11 @@ template
struct area : detail::calculate_polygon_sum
{
template
- static inline typename Strategy::return_type apply(Polygon const& polygon, Strategy const& strategy)
+ static inline typename area_result::type
+ apply(Polygon const& polygon, Strategy const& strategy)
{
return calculate_polygon_sum::apply<
- typename Strategy::return_type,
+ typename area_result::type,
detail::area::ring_area
<
order_as_direction::value>::value,
@@ -188,12 +196,12 @@ template
struct area : detail::multi_sum
{
template
- static inline typename Strategy::return_type
+ static inline typename area_result::type
apply(MultiGeometry const& multi, Strategy const& strategy)
{
return multi_sum::apply
<
- typename Strategy::return_type,
+ typename area_result::type,
area::type>
>(multi, strategy);
}
@@ -204,39 +212,73 @@ struct area : detail::multi_sum
#endif // DOXYGEN_NO_DISPATCH
-namespace resolve_variant {
+namespace resolve_strategy
+{
+
+struct area
+{
+ template
+ static inline typename area_result::type
+ apply(Geometry const& geometry, Strategy const& strategy)
+ {
+ return dispatch::area::apply(geometry, strategy);
+ }
+
+ template
+ static inline typename area_result::type
+ apply(Geometry const& geometry, default_strategy)
+ {
+ typedef typename strategy::area::services::default_strategy
+ <
+ typename cs_tag::type
+ >::type strategy_type;
+
+ return dispatch::area::apply(geometry, strategy_type());
+ }
+};
+
+
+} // namespace resolve_strategy
+
+
+namespace resolve_variant
+{
template
struct area
{
template
- static inline typename Strategy::return_type apply(Geometry const& geometry,
- Strategy const& strategy)
+ static inline typename area_result::type
+ apply(Geometry const& geometry, Strategy const& strategy)
{
- return dispatch::area::apply(geometry, strategy);
+ return resolve_strategy::area::apply(geometry, strategy);
}
};
template
struct area >
{
+ typedef boost::variant variant_type;
+
template
- struct visitor: boost::static_visitor
+ struct visitor
+ : boost::static_visitor::type>
{
Strategy const& m_strategy;
visitor(Strategy const& strategy): m_strategy(strategy) {}
template
- typename Strategy::return_type operator()(Geometry const& geometry) const
+ typename area_result::type
+ operator()(Geometry const& geometry) const
{
return area::apply(geometry, m_strategy);
}
};
template
- static inline typename Strategy::return_type
- apply(boost::variant const& geometry,
+ static inline typename area_result::type
+ apply(variant_type const& geometry,
Strategy const& strategy)
{
return boost::apply_visitor(visitor(strategy), geometry);
@@ -268,22 +310,14 @@ and Geographic as well.
\qbk{[area] [area_output]}
*/
template
-inline typename default_area_result::type area(Geometry const& geometry)
+inline typename area_result::type
+area(Geometry const& geometry)
{
concepts::check();
- // TODO put this into a resolve_strategy stage
- // (and take the return type from resolve_variant)
- typedef typename point_type::type point_type;
- typedef typename strategy::area::services::default_strategy
- <
- typename cs_tag::type,
- point_type
- >::type strategy_type;
-
// detail::throw_on_empty_input(geometry);
- return resolve_variant::area::apply(geometry, strategy_type());
+ return resolve_variant::area::apply(geometry, default_strategy());
}
/*!
@@ -301,19 +335,19 @@ inline typename default_area_result::type area(Geometry const& geometr
\qbk{
[include reference/algorithms/area.qbk]
+[heading Available Strategies]
+\* [link geometry.reference.strategies.strategy_area_cartesian Cartesian]
+\* [link geometry.reference.strategies.strategy_area_spherical Spherical]
+\* [link geometry.reference.strategies.strategy_area_geographic Geographic]
+
[heading Example]
[area_with_strategy]
[area_with_strategy_output]
-
-[heading Available Strategies]
-\* [link geometry.reference.strategies.strategy_area_surveyor Surveyor (cartesian)]
-\* [link geometry.reference.strategies.strategy_area_spherical Spherical]
-[/link geometry.reference.strategies.strategy_area_geographic Geographic]
}
*/
template
-inline typename Strategy::return_type area(
- Geometry const& geometry, Strategy const& strategy)
+inline typename area_result::type
+area(Geometry const& geometry, Strategy const& strategy)
{
concepts::check();
diff --git a/include/boost/geometry/algorithms/convert.hpp b/include/boost/geometry/algorithms/convert.hpp
index 6a8ba1acb..6ccaa0dd4 100644
--- a/include/boost/geometry/algorithms/convert.hpp
+++ b/include/boost/geometry/algorithms/convert.hpp
@@ -5,6 +5,10 @@
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// Copyright (c) 2014 Adam Wulkiewicz, Lodz, Poland.
+// This file was modified by Oracle on 2017.
+// Modifications copyright (c) 2017, Oracle and/or its affiliates.
+// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
+
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
@@ -29,10 +33,8 @@
#include
#include
-#include
#include
#include
-#include
#include
#include
#include
@@ -153,7 +155,23 @@ struct range_to_range
geometry::closure::value
>::type view_type;
+ struct default_policy
+ {
+ template
+ static inline void apply(Point1 const& point1, Point2 & point2)
+ {
+ geometry::detail::conversion::convert_point_to_point(point1, point2);
+ }
+ };
+
static inline void apply(Range1 const& source, Range2& destination)
+ {
+ apply(source, destination, default_policy());
+ }
+
+ template
+ static inline ConvertPointPolicy apply(Range1 const& source, Range2& destination,
+ ConvertPointPolicy convert_point)
{
geometry::clear(destination);
@@ -179,8 +197,12 @@ struct range_to_range
it != boost::end(view) && i < n;
++it, ++i)
{
- geometry::append(destination, *it);
+ typename boost::range_value::type point;
+ convert_point.apply(*it, point);
+ range::push_back(destination, point);
}
+
+ return convert_point;
}
};
diff --git a/include/boost/geometry/algorithms/correct.hpp b/include/boost/geometry/algorithms/correct.hpp
index 07e012faf..21b9977ce 100644
--- a/include/boost/geometry/algorithms/correct.hpp
+++ b/include/boost/geometry/algorithms/correct.hpp
@@ -3,7 +3,7 @@
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
-// Copyright (c) 2014 Adam Wulkiewicz, Lodz, Poland.
+// Copyright (c) 2014-2017 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2017.
// Modifications copyright (c) 2017 Oracle and/or its affiliates.
@@ -144,7 +144,7 @@ struct correct_ring
detail::correct_closure::close_or_open_ring::apply(r);
// Check area
- typedef typename Strategy::return_type area_result_type;
+ typedef typename area_result::type area_result_type;
Predicate predicate;
area_result_type const zero = 0;
if (predicate(ring_area_type::apply(r, strategy), zero))
@@ -322,8 +322,7 @@ inline void correct(Geometry& geometry)
typedef typename strategy::area::services::default_strategy
<
- typename cs_tag::type,
- point_type
+ typename cs_tag::type
>::type strategy_type;
resolve_variant::correct::apply(geometry, strategy_type());
diff --git a/include/boost/geometry/algorithms/densify.hpp b/include/boost/geometry/algorithms/densify.hpp
new file mode 100644
index 000000000..ed948b346
--- /dev/null
+++ b/include/boost/geometry/algorithms/densify.hpp
@@ -0,0 +1,425 @@
+// Boost.Geometry
+
+// Copyright (c) 2017-2018, Oracle and/or its affiliates.
+
+// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
+
+// Licensed under the Boost Software License version 1.0.
+// http://www.boost.org/users/license.html
+
+#ifndef BOOST_GEOMETRY_ALGORITHMS_DENSIFY_HPP
+#define BOOST_GEOMETRY_ALGORITHMS_DENSIFY_HPP
+
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+
+#include
+
+
+namespace boost { namespace geometry
+{
+
+
+#ifndef DOXYGEN_NO_DETAIL
+namespace detail { namespace densify
+{
+
+template
+struct push_back_policy
+{
+ typedef typename boost::range_value::type point_type;
+
+ inline explicit push_back_policy(Range & rng)
+ : m_rng(rng)
+ {}
+
+ inline void apply(point_type const& p)
+ {
+ range::push_back(m_rng, p);
+ }
+
+private:
+ Range & m_rng;
+};
+
+template
+inline void convert_and_push_back(Range & range, Point const& p)
+{
+ typename boost::range_value::type p2;
+ geometry::detail::conversion::convert_point_to_point(p, p2);
+ range::push_back(range, p2);
+}
+
+template
+struct densify_range
+{
+ template
+ static inline void apply(FwdRng const& rng, MutRng & rng_out,
+ T const& len, Strategy const& strategy)
+ {
+ typedef typename boost::range_iterator::type iterator_t;
+ typedef typename boost::range_value::type point_t;
+
+ iterator_t it = boost::begin(rng);
+ iterator_t end = boost::end(rng);
+
+ if (it == end) // empty(rng)
+ {
+ return;
+ }
+
+ push_back_policy policy(rng_out);
+
+ iterator_t prev = it;
+ for ( ++it ; it != end ; prev = it++)
+ {
+ point_t const& p0 = *prev;
+ point_t const& p1 = *it;
+
+ convert_and_push_back(rng_out, p0);
+
+ strategy.apply(p0, p1, policy, len);
+ }
+
+ if (BOOST_GEOMETRY_CONDITION(AppendLastPoint))
+ {
+ convert_and_push_back(rng_out, *prev); // back(rng)
+ }
+ }
+};
+
+template // false, X
+struct densify_ring
+{
+ template
+ static inline void apply(Geometry const& ring, GeometryOut & ring_out,
+ T const& len, Strategy const& strategy)
+ {
+ geometry::detail::densify::densify_range
+ ::apply(ring, ring_out, len, strategy);
+
+ if (boost::size(ring) <= 1)
+ return;
+
+ typedef typename point_type::type point_t;
+ point_t const& p0 = range::back(ring);
+ point_t const& p1 = range::front(ring);
+
+ push_back_policy policy(ring_out);
+
+ strategy.apply(p0, p1, policy, len);
+
+ if (BOOST_GEOMETRY_CONDITION(IsClosed2))
+ {
+ convert_and_push_back(ring_out, p1);
+ }
+ }
+};
+
+template <>
+struct densify_ring
+ : densify_range
+{};
+
+template <>
+struct densify_ring
+ : densify_range
+{};
+
+
+}} // namespace detail::densify
+#endif // DOXYGEN_NO_DETAIL
+
+
+#ifndef DOXYGEN_NO_DISPATCH
+namespace dispatch
+{
+
+
+template
+<
+ typename Geometry,
+ typename GeometryOut,
+ typename Tag1 = typename tag::type,
+ typename Tag2 = typename tag::type
+>
+struct densify
+ : not_implemented
+{};
+
+template
+struct densify
+ : geometry::detail::densify::densify_range<>
+{};
+
+template
+struct densify
+{
+ template
+ static void apply(Geometry const& mls, GeometryOut & mls_out,
+ T const& len, Strategy const& strategy)
+ {
+ std::size_t count = boost::size(mls);
+ range::resize(mls_out, count);
+
+ for (std::size_t i = 0 ; i < count ; ++i)
+ {
+ geometry::detail::densify::densify_range<>
+ ::apply(range::at(mls, i), range::at(mls_out, i),
+ len, strategy);
+ }
+ }
+};
+
+template
+struct densify
+ : geometry::detail::densify::densify_ring
+ <
+ geometry::closure::value != geometry::open,
+ geometry::closure::value != geometry::open
+ >
+{};
+
+template
+struct densify
+{
+ template
+ static void apply(Geometry const& poly, GeometryOut & poly_out,
+ T const& len, Strategy const& strategy)
+ {
+ apply_ring(exterior_ring(poly), exterior_ring(poly_out),
+ len, strategy);
+
+ std::size_t count = boost::size(interior_rings(poly));
+ range::resize(interior_rings(poly_out), count);
+
+ for (std::size_t i = 0 ; i < count ; ++i)
+ {
+ apply_ring(range::at(interior_rings(poly), i),
+ range::at(interior_rings(poly_out), i),
+ len, strategy);
+ }
+ }
+
+ template
+ static void apply_ring(Ring const& ring, RingOut & ring_out,
+ T const& len, Strategy const& strategy)
+ {
+ densify
+ ::apply(ring, ring_out, len, strategy);
+ }
+};
+
+template
+struct densify
+{
+ template
+ static void apply(Geometry const& mpoly, GeometryOut & mpoly_out,
+ T const& len, Strategy const& strategy)
+ {
+ std::size_t count = boost::size(mpoly);
+ range::resize(mpoly_out, count);
+
+ for (std::size_t i = 0 ; i < count ; ++i)
+ {
+ apply_poly(range::at(mpoly, i),
+ range::at(mpoly_out, i),
+ len, strategy);
+ }
+ }
+
+ template
+ static void apply_poly(Poly const& poly, PolyOut & poly_out,
+ T const& len, Strategy const& strategy)
+ {
+ densify::
+ apply(poly, poly_out, len, strategy);
+ }
+};
+
+
+} // namespace dispatch
+#endif // DOXYGEN_NO_DISPATCH
+
+
+namespace resolve_strategy
+{
+
+struct densify
+{
+ template
+ static inline void apply(Geometry const& geometry,
+ Geometry& out,
+ Distance const& max_distance,
+ Strategy const& strategy)
+ {
+ dispatch::densify
+ ::apply(geometry, out, max_distance, strategy);
+ }
+
+ template
+ static inline void apply(Geometry const& geometry,
+ Geometry& out,
+ Distance const& max_distance,
+ default_strategy)
+ {
+ typedef typename strategy::densify::services::default_strategy
+ <
+ typename cs_tag::type
+ >::type strategy_type;
+
+ /*BOOST_CONCEPT_ASSERT(
+ (concepts::DensifyStrategy)
+ );*/
+
+ apply(geometry, out, max_distance, strategy_type());
+ }
+};
+
+} // namespace resolve_strategy
+
+
+namespace resolve_variant {
+
+template
+struct densify
+{
+ template
+ static inline void apply(Geometry const& geometry,
+ Geometry& out,
+ Distance const& max_distance,
+ Strategy const& strategy)
+ {
+ resolve_strategy::densify::apply(geometry, out, max_distance, strategy);
+ }
+};
+
+template
+struct densify >
+{
+ template
+ struct visitor: boost::static_visitor
+ {
+ Distance const& m_max_distance;
+ Strategy const& m_strategy;
+
+ visitor(Distance const& max_distance, Strategy const& strategy)
+ : m_max_distance(max_distance)
+ , m_strategy(strategy)
+ {}
+
+ template
+ void operator()(Geometry const& geometry, Geometry& out) const
+ {
+ densify::apply(geometry, out, m_max_distance, m_strategy);
+ }
+ };
+
+ template
+ static inline void
+ apply(boost::variant const& geometry,
+ boost::variant& out,
+ Distance const& max_distance,
+ Strategy const& strategy)
+ {
+ boost::apply_visitor(
+ visitor(max_distance, strategy),
+ geometry,
+ out
+ );
+ }
+};
+
+} // namespace resolve_variant
+
+
+/*!
+\brief Densify a geometry using a specified strategy
+\ingroup densify
+\tparam Geometry \tparam_geometry
+\tparam Distance A numerical distance measure
+\tparam Strategy A type fulfilling a DensifyStrategy concept
+\param geometry Input geometry, to be densified
+\param out Output geometry, densified version of the input geometry
+\param max_distance Distance threshold (in units depending on strategy)
+\param strategy Densify strategy to be used for densification
+
+\qbk{distinguish,with strategy}
+\qbk{[include reference/algorithms/densify.qbk]}
+
+\qbk{
+[heading Available Strategies]
+\* [link geometry.reference.strategies.strategy_densify_cartesian Cartesian]
+\* [link geometry.reference.strategies.strategy_densify_spherical Spherical]
+\* [link geometry.reference.strategies.strategy_densify_geographic Geographic]
+
+[heading Example]
+[densify_strategy]
+[densify_strategy_output]
+}
+*/
+template
+inline void densify(Geometry const& geometry,
+ Geometry& out,
+ Distance const& max_distance,
+ Strategy const& strategy)
+{
+ concepts::check();
+
+ if (max_distance <= Distance(0))
+ {
+ BOOST_THROW_EXCEPTION(geometry::invalid_input_exception());
+ }
+
+ geometry::clear(out);
+
+ resolve_variant::densify
+ <
+ Geometry
+ >::apply(geometry, out, max_distance, strategy);
+}
+
+
+/*!
+\brief Densify a geometry
+\ingroup densify
+\tparam Geometry \tparam_geometry
+\tparam Distance A numerical distance measure
+\param geometry Input geometry, to be densified
+\param out Output geometry, densified version of the input geometry
+\param max_distance Distance threshold (in units depending on coordinate system)
+
+\qbk{[include reference/algorithms/densify.qbk]}
+
+\qbk{
+[heading Example]
+[densify]
+[densify_output]
+}
+*/
+template
+inline void densify(Geometry const& geometry,
+ Geometry& out,
+ Distance const& max_distance)
+{
+ densify(geometry, out, max_distance, default_strategy());
+}
+
+
+}} // namespace boost::geometry
+
+#endif // BOOST_GEOMETRY_ALGORITHMS_DENSIFY_HPP
diff --git a/include/boost/geometry/algorithms/detail/azimuth.hpp b/include/boost/geometry/algorithms/detail/azimuth.hpp
index a5863d7d2..21007778b 100644
--- a/include/boost/geometry/algorithms/detail/azimuth.hpp
+++ b/include/boost/geometry/algorithms/detail/azimuth.hpp
@@ -15,18 +15,22 @@
#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_AZIMUTH_HPP
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_AZIMUTH_HPP
+
+#include
+
#include
#include
#include
#include
-#include
-
-#include
-
#include
#include
+#include
+
+#include
+
+
namespace boost { namespace geometry
{
diff --git a/include/boost/geometry/algorithms/detail/buffer/buffer_inserter.hpp b/include/boost/geometry/algorithms/detail/buffer/buffer_inserter.hpp
index 990081a86..a969b21cf 100644
--- a/include/boost/geometry/algorithms/detail/buffer/buffer_inserter.hpp
+++ b/include/boost/geometry/algorithms/detail/buffer/buffer_inserter.hpp
@@ -41,10 +41,6 @@
#include
-#if defined(BOOST_GEOMETRY_BUFFER_SIMPLIFY_WITH_AX)
-#include
-#endif
-
namespace boost { namespace geometry
{
@@ -67,45 +63,21 @@ inline void simplify_input(Range const& range,
// sensitive to small scale input features, however the result will
// look better.
// It also gets rid of duplicate points
-#if ! defined(BOOST_GEOMETRY_BUFFER_SIMPLIFY_WITH_AX)
- geometry::simplify(range, simplified, distance.simplify_distance());
-#else
- typedef typename boost::range_value::type point_type;
- typedef strategy::distance::detail::projected_point_ax<> ax_type;
- typedef typename strategy::distance::services::return_type
+ typedef typename geometry::point_type::type point_type;
+ typedef typename strategy::distance::services::default_strategy
<
- strategy::distance::detail::projected_point_ax<>,
- point_type,
- point_type
- >::type return_type;
-
- typedef strategy::distance::detail::projected_point_ax_less
+ point_tag, segment_tag, point_type
+ >::type ds_strategy_type;
+ typedef strategy::simplify::douglas_peucker
<
- return_type
- > comparator_type;
+ point_type, ds_strategy_type
+ > strategy_type;
- typedef strategy::simplify::detail::douglas_peucker
- <
- point_type,
- strategy::distance::detail::projected_point_ax<>,
- comparator_type
- > dp_ax;
+ geometry::detail::simplify::simplify_range<2>::apply(range,
+ simplified, distance.simplify_distance(),
+ strategy_type());
- return_type max_distance(distance.simplify_distance() * 2.0,
- distance.simplify_distance());
- comparator_type comparator(max_distance);
- dp_ax strategy(comparator);
-
- geometry::simplify(range, simplified, max_distance, strategy);
-#endif
-
- if (boost::size(simplified) == 2
- && geometry::equals(geometry::range::front(simplified),
- geometry::range::back(simplified)))
- {
- traits::resize::apply(simplified, 1);
- }
}
diff --git a/include/boost/geometry/algorithms/detail/buffer/buffer_policies.hpp b/include/boost/geometry/algorithms/detail/buffer/buffer_policies.hpp
index 92dcdcc7b..0374b53a9 100644
--- a/include/boost/geometry/algorithms/detail/buffer/buffer_policies.hpp
+++ b/include/boost/geometry/algorithms/detail/buffer/buffer_policies.hpp
@@ -127,6 +127,10 @@ public :
void visit_traverse_reject(Turns const& , Turn const& , Operation const& ,
detail::overlay::traverse_error_type )
{}
+
+ template
+ void visit_generated_rings(Rings const& )
+ {}
};
diff --git a/include/boost/geometry/algorithms/detail/buffer/buffered_piece_collection.hpp b/include/boost/geometry/algorithms/detail/buffer/buffered_piece_collection.hpp
index 1af918eb3..1e0bfe192 100644
--- a/include/boost/geometry/algorithms/detail/buffer/buffered_piece_collection.hpp
+++ b/include/boost/geometry/algorithms/detail/buffer/buffered_piece_collection.hpp
@@ -1,6 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2012-2014 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2016-2017.
// Modifications copyright (c) 2016-2017 Oracle and/or its affiliates.
@@ -155,8 +156,14 @@ struct buffered_piece_collection
robust_point_type
>::type robust_area_strategy_type;
- typedef typename area_strategy_type::return_type area_result_type;
- typedef typename robust_area_strategy_type::return_type robust_area_result_type;
+ typedef typename area_strategy_type::template result_type
+ <
+ point_type
+ >::type area_result_type;
+ typedef typename robust_area_strategy_type::template result_type
+ <
+ robust_point_type
+ >::type robust_area_result_type;
typedef typename geometry::rescale_policy_type
<
diff --git a/include/boost/geometry/algorithms/detail/buffer/turn_in_piece_visitor.hpp b/include/boost/geometry/algorithms/detail/buffer/turn_in_piece_visitor.hpp
index 29e49f9da..eb6fc02c8 100644
--- a/include/boost/geometry/algorithms/detail/buffer/turn_in_piece_visitor.hpp
+++ b/include/boost/geometry/algorithms/detail/buffer/turn_in_piece_visitor.hpp
@@ -36,6 +36,8 @@
#if defined(BOOST_GEOMETRY_BUFFER_USE_SIDE_OF_INTERSECTION)
#include
+#else
+#include
#endif
diff --git a/include/boost/geometry/algorithms/detail/distance/multipoint_to_geometry.hpp b/include/boost/geometry/algorithms/detail/distance/multipoint_to_geometry.hpp
index ccd3aa462..8f1b33cfb 100644
--- a/include/boost/geometry/algorithms/detail/distance/multipoint_to_geometry.hpp
+++ b/include/boost/geometry/algorithms/detail/distance/multipoint_to_geometry.hpp
@@ -193,6 +193,7 @@ struct distance
>
{};
+
template
struct distance
<
diff --git a/include/boost/geometry/algorithms/detail/envelope/segment.hpp b/include/boost/geometry/algorithms/detail/envelope/segment.hpp
index 97f2fc84a..06c64bafc 100644
--- a/include/boost/geometry/algorithms/detail/envelope/segment.hpp
+++ b/include/boost/geometry/algorithms/detail/envelope/segment.hpp
@@ -27,7 +27,6 @@
#include
#include
#include
-#include
#include
#include
#include
diff --git a/include/boost/geometry/algorithms/detail/is_valid/ring.hpp b/include/boost/geometry/algorithms/detail/is_valid/ring.hpp
index 0b9595043..40698155b 100644
--- a/include/boost/geometry/algorithms/detail/is_valid/ring.hpp
+++ b/include/boost/geometry/algorithms/detail/is_valid/ring.hpp
@@ -1,5 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
+// Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.
+
// Copyright (c) 2014-2017, Oracle and/or its affiliates.
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
@@ -107,8 +109,6 @@ struct is_properly_oriented
{
boost::ignore_unused(visitor);
- typedef typename point_type::type point_type;
-
typedef detail::area::ring_area
<
order_as_direction::value>::value,
@@ -117,8 +117,8 @@ struct is_properly_oriented
typedef typename Strategy::template area_strategy
<
- point_type
- >::type::return_type area_result_type;
+ Ring
+ >::type::template result_type::type area_result_type;
typename ring_area_predicate
<
@@ -129,7 +129,7 @@ struct is_properly_oriented
area_result_type const zero = 0;
area_result_type const area
= ring_area_type::apply(ring,
- strategy.template get_area_strategy());
+ strategy.template get_area_strategy());
if (predicate(area, zero))
{
return visitor.template apply();
diff --git a/include/boost/geometry/algorithms/detail/overlay/add_rings.hpp b/include/boost/geometry/algorithms/detail/overlay/add_rings.hpp
index 06d1ec3e5..242e30cbc 100644
--- a/include/boost/geometry/algorithms/detail/overlay/add_rings.hpp
+++ b/include/boost/geometry/algorithms/detail/overlay/add_rings.hpp
@@ -1,6 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2017.
// Modifications copyright (c) 2017, Oracle and/or its affiliates.
@@ -94,7 +95,10 @@ inline OutputIterator add_rings(SelectionMap const& map,
add_rings_error_handling error_handling = add_rings_ignore_unordered)
{
typedef typename SelectionMap::const_iterator iterator;
- typedef typename AreaStrategy::return_type area_type;
+ typedef typename AreaStrategy::template result_type
+ <
+ GeometryOut
+ >::type area_type;
area_type const zero = 0;
std::size_t const min_num_points = core_detail::closure::minimum_ring_size
diff --git a/include/boost/geometry/algorithms/detail/overlay/append_no_dups_or_spikes.hpp b/include/boost/geometry/algorithms/detail/overlay/append_no_dups_or_spikes.hpp
index fb7384079..724996ae3 100644
--- a/include/boost/geometry/algorithms/detail/overlay/append_no_dups_or_spikes.hpp
+++ b/include/boost/geometry/algorithms/detail/overlay/append_no_dups_or_spikes.hpp
@@ -102,6 +102,43 @@ inline void append_no_dups_or_spikes(Range& range, Point const& point,
}
}
+template
+inline void append_no_collinear(Range& range, Point const& point,
+ SideStrategy const& strategy,
+ RobustPolicy const& robust_policy)
+{
+ // Stricter version, not allowing any point in a linear row
+ // (spike, continuation or same point)
+
+ // The code below this condition checks all spikes/dups
+ // for geometries >= 3 points.
+ // So we have to check the first potential duplicate differently
+ if (boost::size(range) == 1
+ && points_equal_or_close(*(boost::begin(range)), point, robust_policy))
+ {
+ return;
+ }
+
+ traits::push_back::apply(range, point);
+
+ // If a point is equal, or forming a spike, remove the pen-ultimate point
+ // because this one caused the spike.
+ // If so, the now-new-pen-ultimate point can again cause a spike
+ // (possibly at a corner). So keep doing this.
+ // Besides spikes it will also avoid adding duplicates.
+ while(boost::size(range) >= 3
+ && point_is_collinear(point,
+ *(boost::end(range) - 3),
+ *(boost::end(range) - 2),
+ strategy,
+ robust_policy))
+ {
+ // Use the Concept/traits, so resize and append again
+ traits::resize::apply(range, boost::size(range) - 2);
+ traits::push_back::apply(range, point);
+ }
+}
+
template
inline void clean_closing_dups_and_spikes(Range& range,
SideStrategy const& strategy,
@@ -137,8 +174,8 @@ inline void clean_closing_dups_and_spikes(Range& range,
}
// Check if closing point is a spike (this is so if the second point is
- // considered as a spike w.r.t. the last segment)
- if (point_is_spike_or_equal(*second, *ultimate, *first, strategy, robust_policy))
+ // considered as collinear w.r.t. the last segment)
+ if (point_is_collinear(*second, *ultimate, *first, strategy, robust_policy))
{
range::erase(range, first);
if (BOOST_GEOMETRY_CONDITION(closed))
diff --git a/include/boost/geometry/algorithms/detail/overlay/assign_parents.hpp b/include/boost/geometry/algorithms/detail/overlay/assign_parents.hpp
index 80bfd11c9..3be539348 100644
--- a/include/boost/geometry/algorithms/detail/overlay/assign_parents.hpp
+++ b/include/boost/geometry/algorithms/detail/overlay/assign_parents.hpp
@@ -1,6 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.
// This file was modified by Oracle on 2017.
// Modifications copyright (c) 2017 Oracle and/or its affiliates.
@@ -238,7 +239,7 @@ inline void assign_parents(Geometry1 const& geometry1,
typedef typename Strategy::template area_strategy
<
point_type
- >::type::return_type area_result_type;
+ >::type::template result_type::type area_result_type;
typedef typename RingMap::iterator map_iterator_type;
diff --git a/include/boost/geometry/algorithms/detail/overlay/enrich_intersection_points.hpp b/include/boost/geometry/algorithms/detail/overlay/enrich_intersection_points.hpp
index 09b015102..a35be052a 100644
--- a/include/boost/geometry/algorithms/detail/overlay/enrich_intersection_points.hpp
+++ b/include/boost/geometry/algorithms/detail/overlay/enrich_intersection_points.hpp
@@ -104,7 +104,8 @@ inline void enrich_sort(Operations& operations,
template
-inline void enrich_assign(Operations& operations, Turns& turns)
+inline void enrich_assign(Operations& operations, Turns& turns,
+ bool check_turns)
{
typedef typename boost::range_value::type turn_type;
typedef typename turn_type::turn_operation_type op_type;
@@ -125,14 +126,17 @@ inline void enrich_assign(Operations& operations, Turns& turns)
turn_type& turn = turns[it->turn_index];
op_type& op = turn.operations[it->operation_index];
- // Normal behaviour: next should point at next turn:
- if (it->turn_index == next->turn_index)
+ if (check_turns && it->turn_index == next->turn_index)
{
+ // Normal behaviour: next points at next turn, increase next.
+ // For dissolve this should not be done, turn_index is often
+ // the same for two consecutive operations
++next;
}
// Cluster behaviour: next should point after cluster, unless
// their seg_ids are not the same
+ // (For dissolve, this is still to be examined - TODO)
while (turn.is_clustered()
&& it->turn_index != next->turn_index
&& turn.cluster_id == turns[next->turn_index].cluster_id
@@ -157,6 +161,11 @@ inline void enrich_assign(Operations& operations, Turns& turns)
// (this is one not circular therefore fraction is considered)
op.enriched.next_ip_index = static_cast(next->turn_index);
}
+
+ if (! check_turns)
+ {
+ ++next;
+ }
}
}
@@ -507,7 +516,7 @@ inline void enrich_intersection_points(Turns& turns,
detail::overlay::enrich_adapt(mit->second, turns);
}
- detail::overlay::enrich_assign(mit->second, turns);
+ detail::overlay::enrich_assign(mit->second, turns, ! is_dissolve);
}
if (has_colocations)
diff --git a/include/boost/geometry/algorithms/detail/overlay/handle_colocations.hpp b/include/boost/geometry/algorithms/detail/overlay/handle_colocations.hpp
index f809ecf80..6bb30fcce 100644
--- a/include/boost/geometry/algorithms/detail/overlay/handle_colocations.hpp
+++ b/include/boost/geometry/algorithms/detail/overlay/handle_colocations.hpp
@@ -31,6 +31,7 @@
#include
#include
#include
+#include
#if defined(BOOST_GEOMETRY_DEBUG_HANDLE_COLOCATIONS)
# include
@@ -313,17 +314,17 @@ inline void assign_cluster_to_turns(Turns& turns,
{
turn_operation_type const& op = turn.operations[i];
segment_fraction_type seg_frac(op.seg_id, op.fraction);
- typename ClusterPerSegment::const_iterator it = cluster_per_segment.find(seg_frac);
- if (it != cluster_per_segment.end())
+ typename ClusterPerSegment::const_iterator cit = cluster_per_segment.find(seg_frac);
+ if (cit != cluster_per_segment.end())
{
#if defined(BOOST_GEOMETRY_DEBUG_HANDLE_COLOCATIONS)
if (turn.is_clustered()
- && turn.cluster_id != it->second)
+ && turn.cluster_id != cit->second)
{
std::cout << " CONFLICT " << std::endl;
}
#endif
- turn.cluster_id = it->second;
+ turn.cluster_id = cit->second;
clusters[turn.cluster_id].turn_indices.insert(turn_index);
}
}
@@ -680,7 +681,7 @@ inline bool handle_colocations(Turns& turns, Clusters& clusters,
// on turns which are discarded afterwards
set_colocation(turns, clusters);
- if (target_operation == operation_intersection)
+ if (BOOST_GEOMETRY_CONDITION(target_operation == operation_intersection))
{
discard_interior_exterior_turns
<
diff --git a/include/boost/geometry/algorithms/detail/overlay/overlay.hpp b/include/boost/geometry/algorithms/detail/overlay/overlay.hpp
index f32ff4720..5094c6c96 100644
--- a/include/boost/geometry/algorithms/detail/overlay/overlay.hpp
+++ b/include/boost/geometry/algorithms/detail/overlay/overlay.hpp
@@ -1,7 +1,7 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
-// Copyright (c) 2013-2015 Adam Wulkiewicz, Lodz, Poland
+// Copyright (c) 2013-2017 Adam Wulkiewicz, Lodz, Poland
// This file was modified by Oracle on 2015, 2017.
// Modifications copyright (c) 2015-2017, Oracle and/or its affiliates.
@@ -49,6 +49,7 @@
#include
+#include
#ifdef BOOST_GEOMETRY_DEBUG_ASSEMBLE
# include
@@ -88,6 +89,10 @@ struct overlay_null_visitor
template
void visit_traverse_reject(Turns const& , Turn const& , Operation const& , traverse_error_type )
{}
+
+ template
+ void visit_generated_rings(Rings const& )
+ {}
};
template
@@ -135,9 +140,9 @@ inline void get_ring_turn_info(TurnInfoMap& turn_info_map, Turns const& turns, C
if (! is_self_turn(turn)
&& (
- (target_operation == operation_union
+ (BOOST_GEOMETRY_CONDITION(target_operation == operation_union)
&& op.enriched.count_left > 0)
- || (target_operation == operation_intersection
+ || (BOOST_GEOMETRY_CONDITION(target_operation == operation_intersection)
&& op.enriched.count_right <= 2)))
{
// Avoid including untraversed rings which have polygons on
@@ -205,7 +210,7 @@ inline OutputIterator return_if_one_input_is_empty(Geometry1 const& geometry1,
typename Strategy::template area_strategy
<
point_type1
- >::type::return_type
+ >::type::template result_type::type
> properties;
// Silence warning C4127: conditional expression is constant
@@ -362,7 +367,7 @@ std::cout << "traverse" << std::endl;
typedef ring_properties
<
point_type,
- typename area_strategy_type::return_type
+ typename area_strategy_type::template result_type::type
> properties;
// Select all rings which are NOT touched by any intersection point
diff --git a/include/boost/geometry/algorithms/detail/overlay/traversal.hpp b/include/boost/geometry/algorithms/detail/overlay/traversal.hpp
index 81056220b..5c547c327 100644
--- a/include/boost/geometry/algorithms/detail/overlay/traversal.hpp
+++ b/include/boost/geometry/algorithms/detail/overlay/traversal.hpp
@@ -23,6 +23,7 @@
#include