P;
P p(5.12, 6.34);
// Points can be streamed like this:
std::cout << boost::geometry::dsv(p) << std::endl;
@@ -121,8 +121,8 @@ void example_as_wkt_point()
void example_as_wkt_vector()
{
- std::vector > v;
- boost::geometry::read_wkt >("linestring(1 1,2 2,3 3,4 4)", std::back_inserter(v));
+ std::vector > v;
+ boost::geometry::read_wkt >("linestring(1 1,2 2,3 3,4 4)", std::back_inserter(v));
std::cout << boost::geometry::dsv(std::make_pair(v.begin(), v.end())) << std::endl;
}
@@ -130,10 +130,10 @@ void example_as_wkt_vector()
void example_centroid_polygon()
{
- boost::geometry::polygon > poly;
+ boost::geometry::model::polygon > poly;
boost::geometry::read_wkt("POLYGON((0 0,0 7,4 2,2 0,0 0))", poly);
// Center of polygon might have different type than points of polygon
- boost::geometry::point_xy center;
+ boost::geometry::model::point_xy center;
boost::geometry::centroid(poly, center);
std::cout << "Centroid: " << boost::geometry::dsv(center) << std::endl;
}
@@ -141,8 +141,8 @@ void example_centroid_polygon()
void example_distance_point_point()
{
- boost::geometry::point_xy p1(1, 1);
- boost::geometry::point_xy p2(2, 3);
+ boost::geometry::model::point_xy p1(1, 1);
+ boost::geometry::model::point_xy p2(2, 3);
std::cout << "Distance p1-p2 is "
<< boost::geometry::distance(p1, p2)
<< " units" << std::endl;
@@ -179,28 +179,28 @@ void example_distance_point_point_strategy()
void example_from_wkt_point()
{
- boost::geometry::point_xy point;
+ boost::geometry::model::point_xy point;
boost::geometry::read_wkt("Point(1 2)", point);
std::cout << point.x() << "," << point.y() << std::endl;
}
void example_from_wkt_output_iterator()
{
- std::vector > v;
- boost::geometry::read_wkt >("linestring(1 1,2 2,3 3,4 4)", std::back_inserter(v));
+ std::vector > v;
+ boost::geometry::read_wkt >("linestring(1 1,2 2,3 3,4 4)", std::back_inserter(v));
std::cout << "vector has " << v.size() << " coordinates" << std::endl;
}
void example_from_wkt_linestring()
{
- boost::geometry::linestring > line;
+ boost::geometry::model::linestring > line;
boost::geometry::read_wkt("linestring(1 1,2 2,3 3,4 4)", line);
std::cout << "linestring has " << line.size() << " coordinates" << std::endl;
}
void example_from_wkt_polygon()
{
- boost::geometry::polygon > poly;
+ boost::geometry::model::polygon > poly;
boost::geometry::read_wkt("POLYGON((0 0,0 1,1 1,1 0,0 0))", poly);
std::cout << "Polygon has " << poly.outer().size() << " coordinates in outer ring" << std::endl;
}
@@ -220,7 +220,7 @@ void example_point_ll_convert()
void example_intersection_linestring()
{
//[intersection_linestring
- typedef boost::geometry::point_xy P;
+ typedef boost::geometry::model::point_xy P;
std::vector line1, line2;
boost::geometry::read_wkt("linestring(1 1,2 2)", line1);
boost::geometry::read_wkt("linestring(2 1,1 2)", line2);
@@ -234,7 +234,7 @@ void example_intersects_linestring()
{
//[intersects_linestring
//` Check if two linestrings (here: vectors) intersect each other
- typedef boost::geometry::point_xy P;
+ typedef boost::geometry::model::point_xy P;
std::vector line1, line2;
boost::geometry::read_wkt("linestring(1 1,2 2)", line1);
boost::geometry::read_wkt("linestring(2 1,1 2)", line2);
@@ -248,7 +248,7 @@ void example_intersects_linestring()
void example_intersection_segment()
{
//[intersection_segment
- typedef boost::geometry::point_xy P;
+ typedef boost::geometry::model::point_xy P;
boost::geometry::model::segment segment1, segment2;
boost::geometry::read_wkt("linestring(1 1,2 2)", segment1);
boost::geometry::read_wkt("linestring(2 1,1 2)", segment2);
@@ -262,7 +262,7 @@ void example_intersection_inserter_segment()
{
//[intersection_segment_inserter
- typedef boost::geometry::point_xy P;
+ typedef boost::geometry::model::point_xy P;
boost::geometry::model::segment segment1, segment2;
boost::geometry::read_wkt("linestring(1 1,2 2)", segment1);
boost::geometry::read_wkt("linestring(2 1,1 2)", segment2);
@@ -280,7 +280,7 @@ void example_intersects_segment()
{
//[intersects_segment
//` Check if two segments intersect each other
- typedef boost::geometry::point_xy P;
+ typedef boost::geometry::model::point_xy P;
boost::geometry::model::segment line1, line2;
boost::geometry::read_wkt("linestring(1 1,2 2)", line1);
boost::geometry::read_wkt("linestring(2 1,1 2)", line2);
@@ -292,24 +292,24 @@ void example_intersects_segment()
void example_clip_linestring1()
{
- typedef boost::geometry::point_xy P;
- boost::geometry::linestring line;
+ typedef boost::geometry::model::point_xy P;
+ boost::geometry::model::linestring line;
boost::geometry::read_wkt("linestring(1.1 1.1, 2.5 2.1, 3.1 3.1, 4.9 1.1, 3.1 1.9)", line);
- boost::geometry::box
cb(P(1.5, 1.5), P(4.5, 2.5));
+ boost::geometry::model::box
cb(P(1.5, 1.5), P(4.5, 2.5));
std::cout << "Clipped linestring(s) " << std::endl;
- std::vector > intersection;
- boost::geometry::intersection_inserter >(cb, line, std::back_inserter(intersection));
+ std::vector > intersection;
+ boost::geometry::intersection_inserter >(cb, line, std::back_inserter(intersection));
}
void example_clip_linestring2()
{
- typedef boost::geometry::point_xy P;
+ typedef boost::geometry::model::point_xy P;
std::vector vector_in;
boost::geometry::read_wkt
("linestring(1.1 1.1, 2.5 2.1, 3.1 3.1, 4.9 1.1, 3.1 1.9)",
std::back_inserter(vector_in));
- boost::geometry::box
cb(P(1.5, 1.5), P(4.5, 2.5));
+ boost::geometry::model::box
cb(P(1.5, 1.5), P(4.5, 2.5));
typedef std::vector > VV;
VV vector_out;
boost::geometry::intersection_inserter >(cb, vector_in, std::back_inserter(vector_out));
@@ -317,7 +317,7 @@ void example_clip_linestring2()
std::cout << "Clipped vector(s) " << std::endl;
for (VV::const_iterator it = vector_out.begin(); it != vector_out.end(); it++)
{
- std::copy(it->begin(), it->end(), std::ostream_iterator(std::cout, " "));
+ // TODO FIX THIS std::copy(it->begin(), it->end(), std::ostream_iterator
(std::cout, " "));
std::cout << std::endl;
}
}
@@ -328,16 +328,16 @@ void example_clip_linestring2()
void example_intersection_polygon1()
{
- typedef boost::geometry::point_xy P;
- typedef std::vector > PV;
+ typedef boost::geometry::model::point_xy P;
+ typedef std::vector > PV;
- boost::geometry::box cb(P(1.5, 1.5), P(4.5, 2.5));
- boost::geometry::polygon
poly;
+ boost::geometry::model::box
cb(P(1.5, 1.5), P(4.5, 2.5));
+ boost::geometry::model::polygon
poly;
boost::geometry::read_wkt("POLYGON((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2,3.7 1.6,3.4 2,4.1 3,5.3 2.6,5.4 1.2,4.9 0.8,2.9 0.7,2 1.3)"
",(4 2,4.2 1.4,4.8 1.9,4.4 2.2,4 2))", poly);
PV v;
- boost::geometry::intersection_inserter >(cb, poly, std::back_inserter(v));
+ boost::geometry::intersection_inserter >(cb, poly, std::back_inserter(v));
std::cout << "Clipped polygon(s) " << std::endl;
for (PV::const_iterator it = v.begin(); it != v.end(); it++)
@@ -350,7 +350,7 @@ void example_simplify_linestring1()
{
//[simplify
//` Simplify a linestring
- boost::geometry::linestring > line, simplified;
+ boost::geometry::model::linestring > line, simplified;
boost::geometry::read_wkt("linestring(1.1 1.1, 2.5 2.1, 3.1 3.1, 4.9 1.1, 3.1 1.9)", line);
boost::geometry::simplify(line, simplified, 0.5); /*< Simplify it, using distance of 0.5 units >*/
std::cout
@@ -363,15 +363,15 @@ void example_simplify_linestring2()
{
//[simplify_inserter
//` Simplify a linestring using an output iterator
- typedef boost::geometry::point_xy P;
- typedef boost::geometry::linestring L;
+ typedef boost::geometry::model::point_xy P;
+ typedef boost::geometry::model::linestring L;
L line;
boost::geometry::read_wkt("linestring(1.1 1.1, 2.5 2.1, 3.1 3.1, 4.9 1.1, 3.1 1.9)", line);
typedef boost::geometry::strategy::distance::projected_point
DS;
typedef boost::geometry::strategy::simplify::douglas_peucker
simplification;
- boost::geometry::simplify_inserter(line, std::ostream_iterator
(std::cout, "\n"), 0.5, simplification());
+ // TODO FIX THIS boost::geometry::simplify_inserter(line, std::ostream_iterator
(std::cout, "\n"), 0.5, simplification());
//]
}
@@ -379,9 +379,9 @@ void example_simplify_linestring2()
void example_within()
{
- boost::geometry::polygon > poly;
+ boost::geometry::model::polygon > poly;
boost::geometry::read_wkt("POLYGON((0 0,0 7,4 2,2 0,0 0))", poly);
- boost::geometry::point_xy point(3, 3);
+ boost::geometry::model::point_xy point(3, 3);
std::cout << "Point is "
<< (boost::geometry::within(point, poly) ? "IN" : "NOT in")
<< " polygon"
@@ -392,8 +392,8 @@ void example_within()
void example_within_strategy()
{
// TO BE UPDATED/FINISHED
- typedef boost::geometry::point_xy P;
- typedef boost::geometry::polygon POLY;
+ typedef boost::geometry::model::point_xy P;
+ typedef boost::geometry::model::polygon POLY;
P p;
std::cout << within(p, poly, strategy::within::cross_count
) << std::endl;
}
@@ -404,7 +404,7 @@ void example_length_linestring()
//[length
//` The following simple example shows the calculation of the length of a linestring containing three points
using namespace boost::geometry;
- linestring > line;
+ model::linestring > line;
read_wkt("linestring(0 0,1 1,4 8,3 2)", line);
std::cout << "linestring length is "
<< length(line)
@@ -434,8 +434,8 @@ void example_length_linestring()
void example_length_linestring_iterators2()
{
- std::vector > line;
- boost::geometry::read_wkt >("linestring(0 0,1 1,4 8,3 2)", std::back_inserter(line));
+ std::vector > line;
+ boost::geometry::read_wkt >("linestring(0 0,1 1,4 8,3 2)", std::back_inserter(line));
std::cout << "linestring length is "
<< boost::geometry::length(line)
<< " units" << std::endl;
@@ -462,8 +462,8 @@ void example_length_linestring_strategy()
//`The following example shows the length measured over a sphere, expressed in kilometers. To do that the radius of the sphere must be specified in the constructor of the strategy.
using namespace boost::geometry;
- typedef point > P;
- linestring line;
+ typedef model::point > P;
+ model::linestring line;
line.push_back(P(2, 41));
line.push_back(P(2, 48));
line.push_back(P(5, 52));
@@ -477,9 +477,9 @@ void example_length_linestring_strategy()
void example_envelope_linestring()
{
- boost::geometry::linestring > line;
+ boost::geometry::model::linestring > line;
boost::geometry::read_wkt("linestring(0 0,1 1,4 8,3 2)", line);
- boost::geometry::box > box;
+ boost::geometry::model::box > box;
boost::geometry::envelope(line, box);
std::cout << "envelope is " << boost::geometry::dsv(box) << std::endl;
@@ -490,17 +490,17 @@ void example_envelope_polygon()
/*
Extension, other coordinate system:
using namespace boost::geometry;
- typedef point_ll > LL;
+ typedef model::point_ll > LL;
// Wrangel island, 180 meridian crossing island above Siberia.
- polygon wrangel;
+ model::polygon wrangel;
wrangel.outer().push_back(LL(latitude<>(dms(70, 47, 7)), longitude<>(dms(178, 47, 9))));
wrangel.outer().push_back(LL(latitude<>(dms(71, 14, 0)), longitude<>(dms(177, 28, 33))));
wrangel.outer().push_back(LL(latitude<>(dms(71, 34, 24)), longitude<>(dms(179, 44, 37))));
// Close it
wrangel.outer().push_back(wrangel.outer().front());
- boost::geometry::box box;
+ boost::geometry::model::box box;
boost::geometry::envelope(wrangel, box);
dms minlat(box.min_corner().lat());
diff --git a/doc/qbk/snippets/qbk_2.cpp b/doc/qbk/snippets/qbk_2.cpp
index dead2b3c1..6c1fc4731 100644
--- a/doc/qbk/snippets/qbk_2.cpp
+++ b/doc/qbk/snippets/qbk_2.cpp
@@ -98,6 +98,7 @@ void example_for_main_page()
//` Other often used algorithms are point-in-polygon:
double points[][2] = {{2.0, 1.3}, {4.1, 3.0}, {5.3, 2.6}, {2.9, 0.7}, {2.0, 1.3}};
+ model::polygon_2d poly;
append(poly, points);
boost::tuple p = boost::make_tuple(3.7, 2.0);
std::cout << "Point p is in polygon? " << (within(p, poly) ? "YES" : "NO") << std::endl;
@@ -134,8 +135,8 @@ void example_for_transform()
{
using namespace boost::geometry;
- typedef point XYZ;
- typedef point > SPH;
+ typedef model::point XYZ;
+ typedef model::point > SPH;
XYZ p;
SPH sph1, sph2;
@@ -147,8 +148,8 @@ void example_for_transform()
std::cout << dsv(p) << " <-> " << dsv(sph2) << std::endl;
- typedef point_xy XY;
- typedef point_xy PIXEL;
+ typedef model::point_xy XY;
+ typedef model::point_xy PIXEL;
XY xy(50, 50);
strategy::transform::map_transformer map(0, 0, 100, 100, 1024, 768);
PIXEL pix;
diff --git a/doc/qbk/snippets/qbk_4.cpp b/doc/qbk/snippets/qbk_4.cpp
index 9aebc5cd6..c44bbf2d0 100644
--- a/doc/qbk/snippets/qbk_4.cpp
+++ b/doc/qbk/snippets/qbk_4.cpp
@@ -87,12 +87,12 @@ void svg_simplify_road()
//"LINESTRING(-122.193 47.5075,-122.192 47.5108,-122.192 47.5147,-122.192 47.5184,-122.192 47.5224,-122.192 47.5265,-122.192 47.5307,-122.192 47.5327,-122.191 47.5348,-122.19 47.5395,-122.189 47.5443,-122.188 47.549,-122.187 47.5538,-122.185 47.5584,-122.183 47.5609,-122.182 47.563,-122.18 47.5667,-122.179 47.5676,-122.178 47.5711,-122.177 47.5726,-122.177 47.5742,-122.177 47.5762,-122.176 47.5781,-122.176 47.5801)"
};
- typedef boost::geometry::point_xy point_type;
+ typedef boost::geometry::model::point_xy point_type;
std::ofstream svg("simplify_road.svg");
boost::geometry::svg_mapper mapper(svg, 300, 300);
- boost::geometry::linestring original[n], simplified[n];
+ boost::geometry::model::linestring original[n], simplified[n];
for (int i = 0; i < n; i++)
{
@@ -119,12 +119,12 @@ void svg_simplify_road()
void svg_simplify_country()
{
- typedef boost::geometry::point_xy point_type;
+ typedef boost::geometry::model::point_xy point_type;
std::ofstream svg("simplify_country.svg");
boost::geometry::svg_mapper mapper(svg, 300, 300);
- boost::geometry::multi_polygon > original[wkt_countries_count]
+ boost::geometry::model::multi_polygon > original[wkt_countries_count]
, simplified[wkt_countries_count];
for (int i = 0; i < wkt_countries_count; i++)
@@ -150,13 +150,13 @@ void svg_simplify_country()
void svg_convex_hull_country()
{
- typedef boost::geometry::point_xy point_type;
+ typedef boost::geometry::model::point_xy point_type;
std::ofstream svg("convex_hull_country.svg");
boost::geometry::svg_mapper mapper(svg, 300, 300);
- boost::geometry::multi_polygon > original[wkt_countries_count];
- boost::geometry::linear_ring hull[wkt_countries_count];
+ boost::geometry::model::multi_polygon > original[wkt_countries_count];
+ boost::geometry::model::linear_ring hull[wkt_countries_count];
for (int i = 0; i < wkt_countries_count; i++)
{
@@ -183,14 +183,14 @@ void svg_convex_hull_country()
void svg_convex_hull_cities()
{
- typedef boost::geometry::point_xy point_type;
+ typedef boost::geometry::model::point_xy point_type;
std::ofstream svg("convex_hull_cities.svg");
boost::geometry::svg_mapper mapper(svg, 300, 300);
- boost::geometry::multi_point original[wkt_cities_count];
+ boost::geometry::model::multi_point original[wkt_cities_count];
- boost::geometry::linear_ring hull[wkt_cities_count];
+ boost::geometry::model::linear_ring hull[wkt_cities_count];
for (int i = 0; i < wkt_cities_count; i++)
{
@@ -215,19 +215,19 @@ void svg_convex_hull_cities()
void svg_intersection_roads()
{
// Read the road network
- typedef boost::geometry::point_xy point_type;
- typedef boost::geometry::linestring line_type;
+ typedef boost::geometry::model::point_xy point_type;
+ typedef boost::geometry::model::linestring line_type;
typedef boost::tuple road_type;
- boost::geometry::box bbox;
+ boost::geometry::model::box bbox;
boost::geometry::assign_inverse(bbox);
std::vector roads;
read_wkt("../../../example/data/roads.wkt", roads, bbox);
// intersect
- boost::geometry::box clip;
+ boost::geometry::model::box clip;
std::vector intersected;
boost::geometry::assign(clip, -100, 25, -90, 50);
@@ -262,20 +262,20 @@ void svg_intersection_roads()
void svg_intersection_countries()
{
// Read the road network
- typedef boost::geometry::point_xy point_type;
- typedef boost::geometry::polygon poly_type;
- typedef boost::geometry::multi_polygon mp_type;
+ typedef boost::geometry::model::point_xy point_type;
+ typedef boost::geometry::model::polygon poly_type;
+ typedef boost::geometry::model::multi_polygon mp_type;
typedef boost::tuple country_type;
- boost::geometry::box bbox;
+ boost::geometry::model::box bbox;
boost::geometry::assign_inverse(bbox);
std::vector countries;
read_wkt("../../../example/data/world.wkt", countries, bbox);
// intersect
- boost::geometry::box clip;
+ boost::geometry::model::box clip;
std::vector intersected;
boost::geometry::assign(clip, -100, -50, 100, 50);