Merge branch 'develop' of github.com:boostorg/geometry into develop

This commit is contained in:
Barend Gehrels
2014-06-12 18:51:44 +02:00
20 changed files with 259 additions and 7 deletions

View File

@@ -15,3 +15,4 @@
[import src/examples/rtree/value_shared_ptr.cpp]
[import src/examples/rtree/value_index.cpp]
[import src/examples/rtree/interprocess.cpp]
[import src/examples/rtree/mapped_file.cpp]

View File

@@ -12,34 +12,50 @@
[section Quick start]
[rtree_quickstart]
[h4 Expected results]
[include ../src/examples/rtree/quick_start_results.qbk]
[endsect]
[section Index of polygons stored in vector]
[rtree_polygons_vector]
[h4 Expected results]
[include ../src/examples/rtree/polygons_vector_results.qbk]
[endsect]
[section Index of shared pointers to polygons]
[rtree_polygons_shared_ptr]
[h4 Expected results]
[include ../src/examples/rtree/polygons_shared_ptr_results.qbk]
[endsect]
[section Index of iterators of a map storing variant geometries]
[rtree_variants_map]
[h4 Expected results]
[include ../src/examples/rtree/variants_map_results.qbk]
[endsect]
[section Specializing index::indexable function object - storing shared pointers in the rtree]
[rtree_value_shared_ptr]
[h4 Expected results]
[include ../src/examples/rtree/value_shared_ptr_results.qbk]
[endsect]
[section Using IndexableGetter function object - storing indexes of external container's elements]
[rtree_value_index]
[h4 Expected results]
[include ../src/examples/rtree/value_index_results.qbk]
[endsect]
[section Index stored in shared memory using Boost.Interprocess]
[rtree_interprocess]
[h4 Expected results]
[include ../src/examples/rtree/interprocess_results.qbk]
[endsect]
[section Index stored in mapped file using Boost.Interprocess]
[rtree_mapped_file]
[h4 Expected results]
[include ../src/examples/rtree/mapped_file_results.qbk]
[endsect]

View File

@@ -100,13 +100,16 @@ Nearest neighbours queries returns `__value__`s which are closest to some Geomet
The examples of k-NN queries are presented below. 5 `__value__`s nearest to the Geometry are orange.
[table
[[nearest(Point, k)] [nearest(Box, k)] [nearest(Segment, k)]]
[[[$img/index/rtree/knn_pt_box.png]] [[$img/index/rtree/knn_box_box.png]] [[$img/index/rtree/knn_seg_box.png]]]
[[nearest(Point, k)] [nearest(Box, k)] [nearest(Point, k)] [nearest(Box, k)]]
[[[$img/index/rtree/knn_pt_box.png]] [[$img/index/rtree/knn_box_box.png]] [[$img/index/rtree/rtree_pt_knn_pt.png]] [[$img/index/rtree/rtree_pt_knn_box.png]]]
]
[table
[[nearest(Point, k)] [nearest(Box, k)] [nearest(Segment, k)] [nearest(Point, k)] [nearest(Box, k)] [nearest(Segment, k)]]
[[[$img/index/rtree/rtree_pt_knn_pt.png]] [[$img/index/rtree/rtree_pt_knn_box.png]] [[$img/index/rtree/rtree_pt_knn_seg.png]]
[[$img/index/rtree/rtree_seg_knn_pt.png]] [[$img/index/rtree/rtree_seg_knn_box.png]] [[$img/index/rtree/rtree_seg_knn_seg.png]]]
[[nearest(Segment, k)]
[nearest(Point, k)] [nearest(Box, k)] [nearest(Segment, k)]
[nearest(Segment, k)]]
[[[$img/index/rtree/knn_seg_box.png]]
[[$img/index/rtree/rtree_seg_knn_pt.png]] [[$img/index/rtree/rtree_seg_knn_box.png]] [[$img/index/rtree/rtree_seg_knn_seg.png]]
[[$img/index/rtree/rtree_pt_knn_seg.png]]]
]
To perform the knn query one must pass the nearest predicate generated by the

View File

@@ -0,0 +1,24 @@
Parent: Constructing container
Parent: Filling container with 100 boxes
Parent: Tree content
[(0, 0)(99.5, 99.5)]
Parent: Running child process
Child: Searching of the container in shared memory
Child: Querying for objects intersecting box = [(45, 45)(55, 55)]
Child: Found objects:
11
[(45, 45)(45.5, 45.5)]
[(46, 46)(46.5, 46.5)]
[(47, 47)(47.5, 47.5)]
[(48, 48)(48.5, 48.5)]
[(49, 49)(49.5, 49.5)]
[(50, 50)(50.5, 50.5)]
[(51, 51)(51.5, 51.5)]
[(52, 52)(52.5, 52.5)]
[(53, 53)(53.5, 53.5)]
[(54, 54)(54.5, 54.5)]
[(55, 55)(55.5, 55.5)]
Child: Destroying container
Parent: Container was properly destroyed by the child process

View File

@@ -0,0 +1,5 @@
0
2
2
4

View File

@@ -69,6 +69,11 @@ int main(void)
std::vector<value> result_n;
rtree.query(bgi::nearest(point(0, 0), 5), std::back_inserter(result_n));
// note: in Boost.Geometry the WKT representation of a box is polygon
// note: the values store the bounding boxes of polygons
// the polygons aren't used for querying but are printed
// display results
std::cout << "spatial query box:" << std::endl;
std::cout << bg::wkt<box>(query_box) << std::endl;

View File

@@ -0,0 +1,29 @@
filling index with polygons shared pointers:
POLYGON((1 0,0.4 0.8,-0.5 0.8,-0.9 0,-0.4 -0.8,0.5 -0.8,1 0))
POLYGON((2 1,1.4 1.8,0.5 1.8,0.1 1,0.6 0.2,1.5 0.2,2 1))
POLYGON((3 2,2.4 2.8,1.5 2.8,1.1 2,1.6 1.2,2.5 1.2,3 2))
POLYGON((4 3,3.4 3.8,2.5 3.8,2.1 3,2.6 2.2,3.5 2.2,4 3))
POLYGON((5 4,4.4 4.8,3.5 4.8,3.1 4,3.6 3.2,4.5 3.2,5 4))
POLYGON((6 5,5.4 5.8,4.5 5.8,4.1 5,4.6 4.2,5.5 4.2,6 5))
POLYGON((7 6,6.4 6.8,5.5 6.8,5.1 6,5.6 5.2,6.5 5.2,7 6))
POLYGON((8 7,7.4 7.8,6.5 7.8,6.1 7,6.6 6.2,7.5 6.2,8 7))
POLYGON((9 8,8.4 8.8,7.5 8.8,7.1 8,7.6 7.2,8.5 7.2,9 8))
POLYGON((10 9,9.4 9.8,8.5 9.8,8.1 9,8.6 8.2,9.5 8.2,10 9))
spatial query box:
POLYGON((0 0,0 5,5 5,5 0,0 0))
spatial query result:
POLYGON((1 0,0.4 0.8,-0.5 0.8,-0.9 0,-0.4 -0.8,0.5 -0.8,1 0))
POLYGON((2 1,1.4 1.8,0.5 1.8,0.1 1,0.6 0.2,1.5 0.2,2 1))
POLYGON((3 2,2.4 2.8,1.5 2.8,1.1 2,1.6 1.2,2.5 1.2,3 2))
POLYGON((4 3,3.4 3.8,2.5 3.8,2.1 3,2.6 2.2,3.5 2.2,4 3))
POLYGON((5 4,4.4 4.8,3.5 4.8,3.1 4,3.6 3.2,4.5 3.2,5 4))
POLYGON((6 5,5.4 5.8,4.5 5.8,4.1 5,4.6 4.2,5.5 4.2,6 5))
knn query point:
POINT(0 0)
knn query result:
POLYGON((5 4,4.4 4.8,3.5 4.8,3.1 4,3.6 3.2,4.5 3.2,5 4))
POLYGON((4 3,3.4 3.8,2.5 3.8,2.1 3,2.6 2.2,3.5 2.2,4 3))
POLYGON((3 2,2.4 2.8,1.5 2.8,1.1 2,1.6 1.2,2.5 1.2,3 2))
POLYGON((1 0,0.4 0.8,-0.5 0.8,-0.9 0,-0.4 -0.8,0.5 -0.8,1 0))
POLYGON((2 1,1.4 1.8,0.5 1.8,0.1 1,0.6 0.2,1.5 0.2,2 1))

View File

@@ -77,6 +77,11 @@ int main(void)
std::vector<value> result_n;
rtree.query(bgi::nearest(point(0, 0), 5), std::back_inserter(result_n));
// note: in Boost.Geometry the WKT representation of a box is polygon
// note: the values store the bounding boxes of polygons
// the polygons aren't used for querying but are printed
// display results
std::cout << "spatial query box:" << std::endl;
std::cout << bg::wkt<box>(query_box) << std::endl;

View File

@@ -0,0 +1,29 @@
generated polygons:
POLYGON((1 0,0.4 0.8,-0.5 0.8,-0.9 0,-0.4 -0.8,0.5 -0.8,1 0))
POLYGON((2 1,1.4 1.8,0.5 1.8,0.1 1,0.6 0.2,1.5 0.2,2 1))
POLYGON((3 2,2.4 2.8,1.5 2.8,1.1 2,1.6 1.2,2.5 1.2,3 2))
POLYGON((4 3,3.4 3.8,2.5 3.8,2.1 3,2.6 2.2,3.5 2.2,4 3))
POLYGON((5 4,4.4 4.8,3.5 4.8,3.1 4,3.6 3.2,4.5 3.2,5 4))
POLYGON((6 5,5.4 5.8,4.5 5.8,4.1 5,4.6 4.2,5.5 4.2,6 5))
POLYGON((7 6,6.4 6.8,5.5 6.8,5.1 6,5.6 5.2,6.5 5.2,7 6))
POLYGON((8 7,7.4 7.8,6.5 7.8,6.1 7,6.6 6.2,7.5 6.2,8 7))
POLYGON((9 8,8.4 8.8,7.5 8.8,7.1 8,7.6 7.2,8.5 7.2,9 8))
POLYGON((10 9,9.4 9.8,8.5 9.8,8.1 9,8.6 8.2,9.5 8.2,10 9))
spatial query box:
POLYGON((0 0,0 5,5 5,5 0,0 0))
spatial query result:
POLYGON((1 0,0.4 0.8,-0.5 0.8,-0.9 0,-0.4 -0.8,0.5 -0.8,1 0))
POLYGON((2 1,1.4 1.8,0.5 1.8,0.1 1,0.6 0.2,1.5 0.2,2 1))
POLYGON((3 2,2.4 2.8,1.5 2.8,1.1 2,1.6 1.2,2.5 1.2,3 2))
POLYGON((4 3,3.4 3.8,2.5 3.8,2.1 3,2.6 2.2,3.5 2.2,4 3))
POLYGON((5 4,4.4 4.8,3.5 4.8,3.1 4,3.6 3.2,4.5 3.2,5 4))
POLYGON((6 5,5.4 5.8,4.5 5.8,4.1 5,4.6 4.2,5.5 4.2,6 5))
knn query point:
POINT(0 0)
knn query result:
POLYGON((5 4,4.4 4.8,3.5 4.8,3.1 4,3.6 3.2,4.5 3.2,5 4))
POLYGON((4 3,3.4 3.8,2.5 3.8,2.1 3,2.6 2.2,3.5 2.2,4 3))
POLYGON((3 2,2.4 2.8,1.5 2.8,1.1 2,1.6 1.2,2.5 1.2,3 2))
POLYGON((1 0,0.4 0.8,-0.5 0.8,-0.9 0,-0.4 -0.8,0.5 -0.8,1 0))
POLYGON((2 1,1.4 1.8,0.5 1.8,0.1 1,0.6 0.2,1.5 0.2,2 1))

View File

@@ -66,6 +66,8 @@ int main(void)
rtree.query(bgi::nearest(point(0, 0), 5), std::back_inserter(result_n));
//]
// note: in Boost.Geometry WKT representation of a box is polygon
//[rtree_quickstart_output
// display results
std::cout << "spatial query box:" << std::endl;

View File

@@ -0,0 +1,18 @@
spatial query box:
POLYGON((0 0,0 5,5 5,5 0,0 0))
spatial query result:
POLYGON((0 0,0 0.5,0.5 0.5,0.5 0,0 0)) - 0
POLYGON((1 1,1 1.5,1.5 1.5,1.5 1,1 1)) - 1
POLYGON((2 2,2 2.5,2.5 2.5,2.5 2,2 2)) - 2
POLYGON((3 3,3 3.5,3.5 3.5,3.5 3,3 3)) - 3
POLYGON((4 4,4 4.5,4.5 4.5,4.5 4,4 4)) - 4
POLYGON((5 5,5 5.5,5.5 5.5,5.5 5,5 5)) - 5
knn query point:
POINT(0 0)
knn query result:
POLYGON((4 4,4 4.5,4.5 4.5,4.5 4,4 4)) - 4
POLYGON((3 3,3 3.5,3.5 3.5,3.5 3,3 3)) - 3
POLYGON((2 2,2 2.5,2.5 2.5,2.5 2,2 2)) - 2
POLYGON((0 0,0 0.5,0.5 0.5,0.5 0,0 0)) - 0
POLYGON((1 1,1 1.5,1.5 1.5,1.5 1,1 1)) - 1

View File

@@ -78,6 +78,8 @@ int main(void)
std::vector<value> result_n;
rtree.query(bgi::nearest(point(0, 0), 5), std::back_inserter(result_n));
// note: in Boost.Geometry the WKT representation of a box is polygon
// display results
std::cout << "spatial query box:" << std::endl;
std::cout << bg::wkt<box>(query_box) << std::endl;

View File

@@ -0,0 +1,29 @@
generated boxes:
POLYGON((0 0,0 0.5,0.5 0.5,0.5 0,0 0))
POLYGON((1 1,1 1.5,1.5 1.5,1.5 1,1 1))
POLYGON((2 2,2 2.5,2.5 2.5,2.5 2,2 2))
POLYGON((3 3,3 3.5,3.5 3.5,3.5 3,3 3))
POLYGON((4 4,4 4.5,4.5 4.5,4.5 4,4 4))
POLYGON((5 5,5 5.5,5.5 5.5,5.5 5,5 5))
POLYGON((6 6,6 6.5,6.5 6.5,6.5 6,6 6))
POLYGON((7 7,7 7.5,7.5 7.5,7.5 7,7 7))
POLYGON((8 8,8 8.5,8.5 8.5,8.5 8,8 8))
POLYGON((9 9,9 9.5,9.5 9.5,9.5 9,9 9))
spatial query box:
POLYGON((0 0,0 5,5 5,5 0,0 0))
spatial query result:
POLYGON((0 0,0 0.5,0.5 0.5,0.5 0,0 0))
POLYGON((1 1,1 1.5,1.5 1.5,1.5 1,1 1))
POLYGON((2 2,2 2.5,2.5 2.5,2.5 2,2 2))
POLYGON((3 3,3 3.5,3.5 3.5,3.5 3,3 3))
POLYGON((4 4,4 4.5,4.5 4.5,4.5 4,4 4))
POLYGON((5 5,5 5.5,5.5 5.5,5.5 5,5 5))
knn query point:
POINT(0 0)
knn query result:
POLYGON((4 4,4 4.5,4.5 4.5,4.5 4,4 4))
POLYGON((3 3,3 3.5,3.5 3.5,3.5 3,3 3))
POLYGON((2 2,2 2.5,2.5 2.5,2.5 2,2 2))
POLYGON((0 0,0 0.5,0.5 0.5,0.5 0,0 0))
POLYGON((1 1,1 1.5,1.5 1.5,1.5 1,1 1))

View File

@@ -72,6 +72,8 @@ int main(void)
std::vector<value> result_n;
rtree.query(bgi::nearest(point(0, 0), 5), std::back_inserter(result_n));
// note: in Boost.Geometry the WKT representation of a box is polygon
// display results
std::cout << "spatial query box:" << std::endl;
std::cout << bg::wkt<box>(query_box) << std::endl;

View File

@@ -0,0 +1,29 @@
filling index with boxes shared pointers:
POLYGON((0 0,0 0.5,0.5 0.5,0.5 0,0 0))
POLYGON((1 1,1 1.5,1.5 1.5,1.5 1,1 1))
POLYGON((2 2,2 2.5,2.5 2.5,2.5 2,2 2))
POLYGON((3 3,3 3.5,3.5 3.5,3.5 3,3 3))
POLYGON((4 4,4 4.5,4.5 4.5,4.5 4,4 4))
POLYGON((5 5,5 5.5,5.5 5.5,5.5 5,5 5))
POLYGON((6 6,6 6.5,6.5 6.5,6.5 6,6 6))
POLYGON((7 7,7 7.5,7.5 7.5,7.5 7,7 7))
POLYGON((8 8,8 8.5,8.5 8.5,8.5 8,8 8))
POLYGON((9 9,9 9.5,9.5 9.5,9.5 9,9 9))
spatial query box:
POLYGON((0 0,0 5,5 5,5 0,0 0))
spatial query result:
POLYGON((0 0,0 0.5,0.5 0.5,0.5 0,0 0))
POLYGON((1 1,1 1.5,1.5 1.5,1.5 1,1 1))
POLYGON((2 2,2 2.5,2.5 2.5,2.5 2,2 2))
POLYGON((3 3,3 3.5,3.5 3.5,3.5 3,3 3))
POLYGON((4 4,4 4.5,4.5 4.5,4.5 4,4 4))
POLYGON((5 5,5 5.5,5.5 5.5,5.5 5,5 5))
knn query point:
POINT(0 0)
knn query result:
POLYGON((4 4,4 4.5,4.5 4.5,4.5 4,4 4))
POLYGON((3 3,3 3.5,3.5 3.5,3.5 3,3 3))
POLYGON((2 2,2 2.5,2.5 2.5,2.5 2,2 2))
POLYGON((0 0,0 0.5,0.5 0.5,0.5 0,0 0))
POLYGON((1 1,1 1.5,1.5 1.5,1.5 1,1 1))

View File

@@ -124,6 +124,11 @@ int main(void)
std::vector<value> result_n;
rtree.query(bgi::nearest(point(0, 0), 5), std::back_inserter(result_n));
// note: in Boost.Geometry the WKT representation of a box is polygon
// note: the values store the bounding boxes of geometries
// the geometries aren't used for querying but are printed
// display results
std::cout << "spatial query box:" << std::endl;
std::cout << bg::wkt<box>(query_box) << std::endl;

View File

@@ -0,0 +1,29 @@
generated geometries:
POLYGON((1 0,0.4 0.8,-0.5 0.8,-0.9 0,-0.4 -0.8,0.5 -0.8))
POLYGON((2 1,1.4 1.8,0.5 1.8,0.1 1,0.6 0.2,1.5 0.2))
POLYGON((3 2,2.4 2.8,1.5 2.8,1.1 2,1.6 1.2,2.5 1.2,3 2))
POLYGON((4 3,3.4 3.8,2.5 3.8,2.1 3,2.6 2.2,3.5 2.2))
LINESTRING(5 4,4.4 4.8,3.5 4.8,3.1 4,3.6 3.2,4.5 3.2)
POLYGON((6 5,5.4 5.8,4.5 5.8,4.1 5,4.6 4.2,5.5 4.2))
POLYGON((7 6,6.4 6.8,5.5 6.8,5.1 6,5.6 5.2,6.5 5.2))
POLYGON((8 7,7.4 7.8,6.5 7.8,6.1 7,6.6 6.2,7.5 6.2,8 7))
POLYGON((9 8,8.4 8.8,7.5 8.8,7.1 8,7.6 7.2,8.5 7.2,9 8))
POLYGON((10 9,9.4 9.8,8.5 9.8,8.1 9,8.6 8.2,9.5 8.2))
spatial query box:
POLYGON((0 0,0 5,5 5,5 0,0 0))
spatial query result:
POLYGON((1 0,0.4 0.8,-0.5 0.8,-0.9 0,-0.4 -0.8,0.5 -0.8))
POLYGON((2 1,1.4 1.8,0.5 1.8,0.1 1,0.6 0.2,1.5 0.2))
POLYGON((3 2,2.4 2.8,1.5 2.8,1.1 2,1.6 1.2,2.5 1.2,3 2))
POLYGON((4 3,3.4 3.8,2.5 3.8,2.1 3,2.6 2.2,3.5 2.2))
LINESTRING(5 4,4.4 4.8,3.5 4.8,3.1 4,3.6 3.2,4.5 3.2)
POLYGON((6 5,5.4 5.8,4.5 5.8,4.1 5,4.6 4.2,5.5 4.2))
knn query point:
POINT(0 0)
knn query result:
LINESTRING(5 4,4.4 4.8,3.5 4.8,3.1 4,3.6 3.2,4.5 3.2)
POLYGON((4 3,3.4 3.8,2.5 3.8,2.1 3,2.6 2.2,3.5 2.2))
POLYGON((3 2,2.4 2.8,1.5 2.8,1.1 2,1.6 1.2,2.5 1.2,3 2))
POLYGON((1 0,0.4 0.8,-0.5 0.8,-0.9 0,-0.4 -0.8,0.5 -0.8))
POLYGON((2 1,1.4 1.8,0.5 1.8,0.1 1,0.6 0.2,1.5 0.2))

View File

@@ -15,5 +15,5 @@
[heading_conformance_ogc __this_function__..Touches]
[? __one_parameter__ The version with one parameter is additional and not described in the OGC standard]
[note only implemented for polygon/multi_polygon]
[note Implemented for Point/Linestring/MultiLinestring/Polygon/MultiPolygon.]

View File

@@ -69,7 +69,26 @@ struct push_back<boost::polygon::polygon_data<CoordinateType> >
}
};
template <typename CoordinateType>
struct resize<boost::polygon::polygon_data<CoordinateType> >
{
typedef boost::polygon::point_data<CoordinateType> point_type;
static inline void apply(boost::polygon::polygon_data<CoordinateType>& data,
std::size_t new_size)
{
// Boost.Polygon's polygons are not resizable. So create a temporary vector,
// resize it and set it to the original. Of course: this is not efficient.
// But there seems no other way (without using a wrapper)
std::vector<point_type> temporary_vector
(
boost::polygon::begin_points(data),
boost::polygon::end_points(data)
);
temporary_vector.resize(new_size);
data.set(temporary_vector.begin(), temporary_vector.end());
}
};
} // namespace traits

View File

@@ -13,7 +13,7 @@ test-suite boost-geometry-geometries
[ run adapted.cpp ]
[ run boost_array_as_point.cpp ]
[ run boost_fusion.cpp ]
# [ run boost_polygon.cpp ]
[ run boost_polygon.cpp ]
[ run boost_range.cpp ]
[ run boost_tuple.cpp ]
[ run box.cpp ]