|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r67004 - in sandbox/geometry/libs/geometry/example: . extensions/gis/latlong extensions/gis/projections with_external_libs
From: barend.gehrels_at_[hidden]
Date: 2010-12-04 08:01:32
Author: barendgehrels
Date: 2010-12-04 08:01:26 EST (Sat, 04 Dec 2010)
New Revision: 67004
URL: http://svn.boost.org/trac/boost/changeset/67004
Log:
All samples without cartesian2d now
Text files modified:
sandbox/geometry/libs/geometry/example/01_point_example.cpp | 24 +++++++++++++++++-------
sandbox/geometry/libs/geometry/example/02_linestring_example.cpp | 4 ++--
sandbox/geometry/libs/geometry/example/07_a_graph_route_example.cpp | 2 +-
sandbox/geometry/libs/geometry/example/07_b_graph_route_example.cpp | 2 +-
sandbox/geometry/libs/geometry/example/c03_custom_linestring_example.cpp | 2 +-
sandbox/geometry/libs/geometry/example/c05_custom_point_pointer_example.cpp | 15 +++++++++------
sandbox/geometry/libs/geometry/example/c07_custom_ring_pointer_example.cpp | 19 +++++++++----------
sandbox/geometry/libs/geometry/example/c08_custom_non_std_example.cpp | 10 +++++-----
sandbox/geometry/libs/geometry/example/extensions/gis/latlong/distance_example.cpp | 30 +++++++++++-------------------
sandbox/geometry/libs/geometry/example/extensions/gis/projections/p01_projection_example.cpp | 6 +++---
sandbox/geometry/libs/geometry/example/extensions/gis/projections/p02_projfactory_example.cpp | 8 ++++----
sandbox/geometry/libs/geometry/example/extensions/gis/projections/p03_projmap_example.cpp | 17 +++++++++--------
sandbox/geometry/libs/geometry/example/with_external_libs/x02_gd_example.cpp | 14 +++++++-------
sandbox/geometry/libs/geometry/example/with_external_libs/x03_d_soci_example.cpp | 1 -
sandbox/geometry/libs/geometry/example/with_external_libs/x04_wxwidgets_world_mapper.cpp | 17 +++++++++--------
sandbox/geometry/libs/geometry/example/with_external_libs/x05_shapelib_example.cpp | 12 ++++++------
16 files changed, 94 insertions(+), 89 deletions(-)
Modified: sandbox/geometry/libs/geometry/example/01_point_example.cpp
==============================================================================
--- sandbox/geometry/libs/geometry/example/01_point_example.cpp (original)
+++ sandbox/geometry/libs/geometry/example/01_point_example.cpp 2010-12-04 08:01:26 EST (Sat, 04 Dec 2010)
@@ -13,6 +13,7 @@
#include <boost/geometry/geometry.hpp>
#include <boost/geometry/geometries/adapted/tuple_cartesian.hpp>
#include <boost/geometry/geometries/adapted/c_array_cartesian.hpp>
+#include <boost/geometry/geometries/adapted/boost_array_cartesian.hpp>
int main()
@@ -32,11 +33,16 @@
// 4: it supports normal arrays
double pt4[2];
- // 5: in the past there was a typedef. But users can do that themselves:
+ // 5: it supports boost arrays
+ boost::array<double, 2> pt5;
+
+ // 6: in the past there was a typedef point_2d
+ // But users are now supposted to do that themselves:
typedef model::d2::point_xy<double> point_2d;
- point_2d pt5;
+ point_2d pt6;
+
- // 6: there are more variants, and you can create your own.
+ // 7: there are more variants, and you can create your own.
// (see therefore the custom_point example)
// All these types are handled the same way. We show here
@@ -45,10 +51,14 @@
assign(pt2, 2, 2);
assign(pt3, 3, 3);
assign(pt4, 4, 4);
+ assign(pt5, 5, 5);
+ assign(pt6, 6, 6);
double d1 = distance(pt1, pt2);
double d2 = distance(pt3, pt4);
- std::cout << "Distances: " << d1 << " and " << d2 << std::endl;
+ double d3 = distance(pt5, pt6);
+ std::cout << "Distances: "
+ << d1 << " and " << d2 << " and " << d3 << std::endl;
// (in case you didn't note, distances can be calculated
// from points with different point-types)
@@ -74,7 +84,7 @@
// 3: for any point type, and other geometry objects:
// there is the "make" object generator
// (this one requires to specify the point-type).
- model::d2::point_xy<double> p4 = make<model::d2::point_xy<double>>(1,1);
+ model::d2::point_xy<double> p4 = make<model::d2::point_xy<double> >(1,1);
// 5: for the d2::point_xy<...> type only: constructor with two values
@@ -88,13 +98,13 @@
// 1: using the "get" function following the concepts behind
std::cout << get<0>(p2) << "," << get<1>(p2) << std::endl;
- // 2: for point-2d only
+ // 2: for point_xy only
std::cout << p2.x() << "," << p2.y() << std::endl;
// 3: using boost-tuples you of course can boost-tuple-methods
std::cout << pt3.get<0>() << "," << pt3.get<1>() << std::endl;
- // 4: GGL supports various output formats, e.g. DSV
+ // 4: Boost.Geometry supports various output formats, e.g. DSV
// (delimiter separated values)
std::cout << dsv(pt3) << std::endl;
Modified: sandbox/geometry/libs/geometry/example/02_linestring_example.cpp
==============================================================================
--- sandbox/geometry/libs/geometry/example/02_linestring_example.cpp (original)
+++ sandbox/geometry/libs/geometry/example/02_linestring_example.cpp 2010-12-04 08:01:26 EST (Sat, 04 Dec 2010)
@@ -188,11 +188,11 @@
box_2d cb(point_2d(1.5, 1.5), point_2d(4.5, 2.5));
std::vector<linestring_2d> clipped;
- intersection_inserter<linestring_2d> (cb, ls, std::back_inserter(clipped));
+ intersection(cb, ls, clipped);
// Also possible: clip-output to a vector of vectors
std::vector<std::vector<point_2d> > vector_out;
- intersection_inserter<std::vector<point_2d> >(cb, ls, std::back_inserter(vector_out));
+ intersection(cb, ls, vector_out);
std::cout << "clipped output as vector:" << std::endl;
for (std::vector<std::vector<point_2d> >::const_iterator it
Modified: sandbox/geometry/libs/geometry/example/07_a_graph_route_example.cpp
==============================================================================
--- sandbox/geometry/libs/geometry/example/07_a_graph_route_example.cpp (original)
+++ sandbox/geometry/libs/geometry/example/07_a_graph_route_example.cpp 2010-12-04 08:01:26 EST (Sat, 04 Dec 2010)
@@ -6,7 +6,7 @@
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
-// Example showing GGL combined with Boost.Graph, calculating shortest routes
+// Example showing Boost.Geometry combined with Boost.Graph, calculating shortest routes
// input: two WKT's, provided in subfolder data
// output: text, + an SVG, displayable in e.g. Firefox)
Modified: sandbox/geometry/libs/geometry/example/07_b_graph_route_example.cpp
==============================================================================
--- sandbox/geometry/libs/geometry/example/07_b_graph_route_example.cpp (original)
+++ sandbox/geometry/libs/geometry/example/07_b_graph_route_example.cpp 2010-12-04 08:01:26 EST (Sat, 04 Dec 2010)
@@ -6,7 +6,7 @@
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
-// Example showing GGL combined with Boost.Graph, calculating shortest routes
+// Example showing Boost.Geometry combined with Boost.Graph, calculating shortest routes
// input: two WKT's, provided in subfolder data
// output: text, + an SVG, displayable in e.g. Firefox)
Modified: sandbox/geometry/libs/geometry/example/c03_custom_linestring_example.cpp
==============================================================================
--- sandbox/geometry/libs/geometry/example/c03_custom_linestring_example.cpp (original)
+++ sandbox/geometry/libs/geometry/example/c03_custom_linestring_example.cpp 2010-12-04 08:01:26 EST (Sat, 04 Dec 2010)
@@ -54,7 +54,7 @@
};
-// Register this point as being a recognizable point by the GGL
+// Register this point as being a recognizable point by Boost.Geometry
BOOST_GEOMETRY_REGISTER_POINT_2D(gps_point, double, cs::geographic<degree>, longitude, latitude)
Modified: sandbox/geometry/libs/geometry/example/c05_custom_point_pointer_example.cpp
==============================================================================
--- sandbox/geometry/libs/geometry/example/c05_custom_point_pointer_example.cpp (original)
+++ sandbox/geometry/libs/geometry/example/c05_custom_point_pointer_example.cpp 2010-12-04 08:01:26 EST (Sat, 04 Dec 2010)
@@ -16,7 +16,7 @@
#include <boost/geometry/algorithms/length.hpp>
#include <boost/geometry/algorithms/make.hpp>
#include <boost/geometry/algorithms/intersection.hpp>
-#include <boost/geometry/geometries/cartesian2d.hpp>
+#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/geometries/adapted/std_as_linestring.hpp>
#include <boost/geometry/strategies/strategies.hpp>
@@ -86,16 +86,19 @@
std::cout << boost::geometry::length(myline) << std::endl;
- boost::geometry::model::d2::box cb(boost::geometry::model::d2::point(1.5, 1.5), boost::geometry::model::d2::point(4.5, 4.5));
+ typedef boost::geometry::model::d2::point_xy<double> point_2d;
+ typedef boost::geometry::model::box<point_2d> box_2d;
+ box_2d cb(point_2d(1.5, 1.5), point_2d(4.5, 4.5));
// This will NOT work because would need dynamicly allocating memory for point* in algorithms:
// std::vector<ln> clipped;
- //boost::geometry::intersection(cb, myline, std::back_inserter(clipped));
+ //boost::geometry::intersection(cb, myline, clipped);
// This works because outputs to a normal struct point, no point*
- std::vector<boost::geometry::model::d2::linestring> clipped;
- boost::geometry::strategy::intersection::liang_barsky<boost::geometry::model::d2::box, boost::geometry::model::d2::point> strategy;
- boost::geometry::detail::intersection::clip_range_with_box<boost::geometry::model::d2::linestring>(cb,
+ typedef boost::geometry::model::linestring<point_2d> linestring_2d;
+ std::vector<linestring_2d> clipped;
+ boost::geometry::strategy::intersection::liang_barsky<box_2d, point_2d> strategy;
+ boost::geometry::detail::intersection::clip_range_with_box<linestring_2d>(cb,
myline, std::back_inserter(clipped), strategy);
Modified: sandbox/geometry/libs/geometry/example/c07_custom_ring_pointer_example.cpp
==============================================================================
--- sandbox/geometry/libs/geometry/example/c07_custom_ring_pointer_example.cpp (original)
+++ sandbox/geometry/libs/geometry/example/c07_custom_ring_pointer_example.cpp 2010-12-04 08:01:26 EST (Sat, 04 Dec 2010)
@@ -13,7 +13,6 @@
#include <boost/geometry/geometry.hpp>
-#include <boost/geometry/geometries/cartesian2d.hpp>
#include <boost/geometry/geometries/adapted/std_as_ring.hpp>
// Sample point, having x/y
@@ -95,22 +94,22 @@
// This will NOT work because would need dynamicly allocating memory for point* in algorithms:
//std::vector<ring_type> unioned;
- //boost::geometry::union<ring_type>(a, b, std::back_inserter(unioned));
+ //boost::geometry::union<ring_type>(a, b, unioned);
- std::vector<boost::geometry::model::d2::ring> unioned;
- std::vector<boost::geometry::model::d2::ring> intersected;
+ /* This once worked, using pointers, but has to be fixed or deprecated
+ typedef boost::geometry::model::linear_ring<boost::geometry::model::d2::point_xy<double> > ring_2d;
+ std::vector<ring_2d> unioned;
+ std::vector<ring_2d> intersected;
- // Temporarily not working
- /*
- boost::geometry::intersection_inserter<boost::geometry::d2::ring>(a, b, std::back_inserter(intersected));
- boost::geometry::union_inserter<boost::geometry::d2::ring>(a, b, std::back_inserter(unioned));
+ boost::geometry::intersection(a, b, intersected);
+ boost::geometry::union_(a, b, unioned);
double ai = 0, au = 0;
- BOOST_FOREACH(boost::geometry::d2::ring const& ring, intersected)
+ BOOST_FOREACH(ring_2d const& ring, intersected)
{
ai += boost::geometry::area(ring);
}
- BOOST_FOREACH(boost::geometry::d2::ring const& ring, unioned)
+ BOOST_FOREACH(ring_2d const& ring, unioned)
{
au += boost::geometry::area(ring);
}
Modified: sandbox/geometry/libs/geometry/example/c08_custom_non_std_example.cpp
==============================================================================
--- sandbox/geometry/libs/geometry/example/c08_custom_non_std_example.cpp (original)
+++ sandbox/geometry/libs/geometry/example/c08_custom_non_std_example.cpp 2010-12-04 08:01:26 EST (Sat, 04 Dec 2010)
@@ -72,7 +72,7 @@
};
// ----------------------------------------------------------------------------
-// Adaption: implement iterator and range-extension, and register with GGL
+// Adaption: implement iterator and range-extension, and register with Boost.Geometry
// 1) implement iterator (const and non-const versions)
template <bool IsConst>
@@ -244,7 +244,7 @@
}
-// 4) register with GGL
+// 4) register with Boost.Geometry
BOOST_GEOMETRY_REGISTER_POINT_2D(my_point, double, cs::cartesian, x, y)
BOOST_GEOMETRY_REGISTER_RING(my_polygon)
@@ -297,14 +297,14 @@
std::cout << "Walk using Boost.Range extension" << std::endl << std::endl;
walk_using_range(container1);
- std::cout << "Use it by GGL" << std::endl;
+ std::cout << "Use it by Boost.Geometry" << std::endl;
std::cout << "Area: " << boost::geometry::area(container1) << std::endl;
- // Container 2 will be modified by GGL. Add all points but the last one.
+ // Container 2 will be modified by Boost.Geometry. Add all points but the last one.
my_polygon container2;
for (int i = 0; i < n; i++)
{
- // Use here the std::/GGL way of inserting (but the my_polygon way of getting)
+ // Use here the std:: / Boost.Geometry way of inserting (but the my_polygon way of getting)
*(std::back_inserter(container2)++) = container1.get_point(i);
}
Modified: sandbox/geometry/libs/geometry/example/extensions/gis/latlong/distance_example.cpp
==============================================================================
--- sandbox/geometry/libs/geometry/example/extensions/gis/latlong/distance_example.cpp (original)
+++ sandbox/geometry/libs/geometry/example/extensions/gis/latlong/distance_example.cpp 2010-12-04 08:01:26 EST (Sat, 04 Dec 2010)
@@ -15,17 +15,14 @@
#include <iostream>
#include <boost/geometry/geometry.hpp>
-#include <boost/geometry/geometries/cartesian2d.hpp>
#include <boost/geometry/extensions/gis/latlong/latlong.hpp>
#include <boost/geometry/extensions/gis/geographic/strategies/andoyer.hpp>
#include <boost/geometry/strategies/spherical/distance_cross_track.hpp>
-#ifndef NO_PROJECTION
-# include <boost/geometry/extensions/gis/projections/proj/sterea.hpp>
-# include <boost/geometry/extensions/gis/projections/proj/laea.hpp>
-# include <boost/geometry/extensions/gis/projections/parameters.hpp>
-#endif
+#include <boost/geometry/extensions/gis/projections/proj/sterea.hpp>
+#include <boost/geometry/extensions/gis/projections/proj/laea.hpp>
+#include <boost/geometry/extensions/gis/projections/parameters.hpp>
// BSG 28-10-2010
// TODO: clear up this test
@@ -38,6 +35,7 @@
using namespace boost::geometry;
typedef model::ll::point<degree> latlon_point;
+ typedef model::d2::point_xy<double> xy_point;
latlon_point city1;
// Amsterdam 52 22'23"N 4 53'32"E
@@ -63,26 +61,20 @@
transform(city2, city2_rad);
transform(city3, city3_rad);
-#ifndef NO_PROJECTION
/*
- projection::sterea_ellipsoid<model::ll::point<radian>, model::d2::point> proj
+ projection::sterea_ellipsoid<model::ll::point<radian>, xy_point> proj
(projection::init(
"+lat_0=52.15616055555555 +lon_0=5.38763888888889 +k=0.9999079 +x_0=155000 +y_0=463000 +ellps=bessel +units=m"));
*/
- projection::laea_ellipsoid<model::ll::point<radian>, model::d2::point> proj
+ projection::laea_ellipsoid<model::ll::point<radian>, xy_point> proj
(projection::init(
" +lat_0=52 +lon_0=10 +x_0=4321000 +y_0=3210000 +ellps=GRS80 +units=m"));
- model::d2::point city1_prj, city2_prj, city3_prj;
+ xy_point city1_prj, city2_prj, city3_prj;
proj.forward(city1_rad, city1_prj);
proj.forward(city3_rad, city3_prj);
proj.forward(city2_rad, city2_prj);
-#else
- model::d2::point city1_prj(121267, 487245);
- model::d2::point city2_prj(92526.2, 438324);
- model::d2::point city3_prj(80454.2, 455086);
-#endif
// ------------------------------------------------------------------------------------------
// Distances
@@ -94,7 +86,7 @@
std::cout << "haversine other radius: " << distance(city1, city2, strategy::distance::haversine<latlon_point>(6371.0) ) << " km" << std::endl;
std::cout << "andoyer: " << 0.001 * distance(city1, city2, strategy::distance::andoyer<latlon_point>() ) << " km" << std::endl;
std::cout << "vincenty: " << 0.001 * distance(city1, city2, strategy::distance::vincenty<latlon_point>() ) << " km" << std::endl;
- std::cout << "vincenty rad: " << 0.001 * distance(city1_rad, city2_rad, strategy::distance::vincenty<model::ll::point<radian>>() ) << " km" << std::endl;
+ std::cout << "vincenty rad: " << 0.001 * distance(city1_rad, city2_rad, strategy::distance::vincenty<model::ll::point<radian> >() ) << " km" << std::endl;
std::cout << "Projected, pythagoras: " << 0.001 * distance(city1_prj, city2_prj) << " km" << std::endl;
std::cout << std::endl;
@@ -108,7 +100,7 @@
// ------------------------------------------------------------------------------------------
std::cout << std::endl << city3_name << " - line " << city1_name << "," << city2_name << std::endl;
- model::d2::segment ar_xy(city1_prj, city2_prj);
+ model::segment<xy_point> ar_xy(city1_prj, city2_prj);
double dr = distance(city3_prj, ar_xy);
std::cout << "projected: " << 0.001 * dr << std::endl;
@@ -119,7 +111,7 @@
std::cout << "in LL: " << 0.001 * dr << std::endl;
std::cout << std::endl << city2_name << " - line " << city1_name << "," << city3_name << std::endl;
- dr = distance(city2_prj, model::d2::segment(city1_prj, city3_prj));
+ dr = distance(city2_prj, model::segment<xy_point>(city1_prj, city3_prj));
std::cout << "projected: " << 0.001 * dr << std::endl;
dr = distance(city2, model::segment<latlon_point>(city1, city3));
std::cout << "in LL: " << 0.001 * dr << std::endl;
@@ -150,7 +142,7 @@
std::cout << "length: " << length(line1) << std::endl;
std::cout << "length using Vincenty: " << length(line1, strategy::distance::vincenty<latlon_point>()) << std::endl;
- model::d2::linestring line2;
+ model::linestring<xy_point> line2;
append(line2, city1_prj);
append(line2, city2_prj);
std::cout << "length: " << length(line2) << std::endl;
Modified: sandbox/geometry/libs/geometry/example/extensions/gis/projections/p01_projection_example.cpp
==============================================================================
--- sandbox/geometry/libs/geometry/example/extensions/gis/projections/p01_projection_example.cpp (original)
+++ sandbox/geometry/libs/geometry/example/extensions/gis/projections/p01_projection_example.cpp 2010-12-04 08:01:26 EST (Sat, 04 Dec 2010)
@@ -10,7 +10,6 @@
#include <boost/geometry/geometry.hpp>
#include <boost/geometry/algorithms/parse.hpp>
-#include <boost/geometry/geometries/cartesian2d.hpp>
#include <boost/geometry/extensions/gis/io/wkt/stream_wkt.hpp>
#include <boost/geometry/extensions/gis/latlong/latlong.hpp>
#include <boost/geometry/extensions/gis/projections/parameters.hpp>
@@ -27,13 +26,14 @@
// (This delivers a projection without virtual methods. Note that in p02 example
// the projection is created using a factory, which delivers a projection with virtual methods)
typedef model::ll::point<degree> point_ll_deg;
- projection::robin_spheroid<point_ll_deg, model::d2::point> prj(par);
+ typedef model::d2::point_xy<double> point_xy;
+ projection::robin_spheroid<point_ll_deg, point_xy> prj(par);
// Define Amsterdam / Barcelona in decimal degrees / degrees/minutes
point_ll_deg amsterdam = parse<point_ll_deg>("52.4N", "5.9E");
point_ll_deg barcelona = parse<point_ll_deg>("41 23'N", "2 11'E");
- model::d2::point pa, pb;
+ point_xy pa, pb;
// Now do the projection. "Forward" means from latlong to meters.
// (Note that a map projection might fail. This is not 'exceptional'.
Modified: sandbox/geometry/libs/geometry/example/extensions/gis/projections/p02_projfactory_example.cpp
==============================================================================
--- sandbox/geometry/libs/geometry/example/extensions/gis/projections/p02_projfactory_example.cpp (original)
+++ sandbox/geometry/libs/geometry/example/extensions/gis/projections/p02_projfactory_example.cpp 2010-12-04 08:01:26 EST (Sat, 04 Dec 2010)
@@ -9,7 +9,6 @@
// Projection example 2, using factory
#include <boost/geometry/geometry.hpp>
-#include <boost/geometry/geometries/cartesian2d.hpp>
#include <boost/geometry/extensions/gis/io/wkt/stream_wkt.hpp>
#include <boost/geometry/extensions/gis/latlong/latlong.hpp>
#include <boost/geometry/extensions/gis/projections/parameters.hpp>
@@ -29,8 +28,9 @@
// with virtual methods, which can be used polymorphically. Therefore it is a pointer. For
// convenience we use a boost shared pointer here.
typedef model::ll::point<degree> point_ll_deg;
- projection::factory<point_ll_deg, model::d2::point> fac;
- boost::shared_ptr<projection::projection<point_ll_deg, model::d2::point> > prj(fac.create_new(par));
+ typedef model::d2::point_xy<double> point_xy;
+ projection::factory<point_ll_deg, point_xy> fac;
+ boost::shared_ptr<projection::projection<point_ll_deg, point_xy> > prj(fac.create_new(par));
// Define Amsterdam / Barcelona in decimal degrees / degrees/minutes
point_ll_deg amsterdam(longitude<>(5.9), latitude<>(52.4));
@@ -39,7 +39,7 @@
longitude<>(dms<east>(2, 11))
);
- model::d2::point pa, pb;
+ point_xy pa, pb;
// Do the forward projection
if (prj->forward(amsterdam, pa) && prj->forward(barcelona, pb))
Modified: sandbox/geometry/libs/geometry/example/extensions/gis/projections/p03_projmap_example.cpp
==============================================================================
--- sandbox/geometry/libs/geometry/example/extensions/gis/projections/p03_projmap_example.cpp (original)
+++ sandbox/geometry/libs/geometry/example/extensions/gis/projections/p03_projmap_example.cpp 2010-12-04 08:01:26 EST (Sat, 04 Dec 2010)
@@ -11,7 +11,6 @@
#include <fstream>
#include <boost/geometry/geometry.hpp>
-#include <boost/geometry/geometries/cartesian2d.hpp>
#include <boost/geometry/geometries/adapted/std_as_ring.hpp>
#include <boost/geometry/geometries/register/point.hpp>
#include <boost/geometry/multi/geometries/multi_polygon.hpp>
@@ -31,6 +30,8 @@
typedef model::polygon<point_ll_deg> polygon_ll_deg;
std::vector<polygon_ll_deg> ll_polygons;
+ typedef model::d2::point_xy<double> point_xy;
+
// Read polygons from a Well-Known Text file using the ggl parser
std::ifstream cpp_file(wkt_filename.c_str());
if (! cpp_file.is_open())
@@ -57,28 +58,28 @@
// Our latlong polygon collection will be projected into this vector
// (Of course it is also possible to do this while reading and have one vector)
- std::vector<model::d2::polygon> xy_polygons;
+ std::vector<model::polygon<point_xy> > xy_polygons;
// Declare transformation strategy which contains a projection
projection::project_transformer
<
point_ll_deg,
- model::d2::point_xy<double>
+ point_xy
> projection(projection_parameters);
// Project the polygons, and at the same time get the bounding box (in xy)
- model::d2::box bbox;
+ model::box<point_xy> bbox;
assign_inverse(bbox);
for (std::vector<polygon_ll_deg>::const_iterator it = ll_polygons.begin();
it != ll_polygons.end();
++it)
{
- model::d2::polygon xy_polygon;
+ model::polygon<point_xy> xy_polygon;
if (transform(*it, xy_polygon, projection))
{
// Update bbox with box of this projected polygon
- combine(bbox, make_envelope<model::d2::box>(xy_polygon));
+ combine(bbox, make_envelope<model::box<point_xy> >(xy_polygon));
// Add projected polygon
xy_polygons.push_back(xy_polygon);
@@ -100,7 +101,7 @@
typedef boost::geometry::model::d2::point_xy<int> svg_point;
boost::geometry::strategy::transform::map_transformer
<
- model::d2::point,
+ point_xy,
svg_point,
true,
true
@@ -112,7 +113,7 @@
boost::geometry::assign(box, 0, 0, 800, 600);
out << boost::geometry::svg(box, "fill:rgb(0,0,255)") << std::endl;
- for (std::vector<model::d2::polygon>::const_iterator it = xy_polygons.begin();
+ for (std::vector<model::polygon<point_xy> >::const_iterator it = xy_polygons.begin();
it != xy_polygons.end();
++it)
{
Modified: sandbox/geometry/libs/geometry/example/with_external_libs/x02_gd_example.cpp
==============================================================================
--- sandbox/geometry/libs/geometry/example/with_external_libs/x02_gd_example.cpp (original)
+++ sandbox/geometry/libs/geometry/example/with_external_libs/x02_gd_example.cpp 2010-12-04 08:01:26 EST (Sat, 04 Dec 2010)
@@ -11,9 +11,9 @@
// To build and run this example:
// 1) download GD from http://www.libgd.org (currently gd-2.0.35 is assumed)
-// 2) add 11 files
+// 2) add 11 files
// gd.c, gd_gd.c, gd_gif_out.c, gd_io*.c, gd_security.c, gd_topal.c, gdhelpers.c, gdtables.c
-// to the project or makefile or jamfile
+// to the project or makefile or jamfile
// 3) for windows, add define NONDLL to indicate GD is not used as a DLL
// (Note that steps 2 and 3 are done in the MSVC gd_example project file and property sheets)
@@ -30,7 +30,6 @@
#include <boost/geometry/geometry.hpp>
#include <boost/geometry/multi/multi.hpp>
#include <boost/geometry/algorithms/area.hpp>
-#include <boost/geometry/geometries/cartesian2d.hpp>
#include <boost/geometry/extensions/gis/latlong/latlong.hpp>
#include <boost/geometry/extensions/gis/geographic/strategies/area_huiller_earth.hpp>
@@ -43,7 +42,7 @@
// ----------------------------------------------------------------------------
-// Read an ASCII file containing WKT's
+// Read an ASCII file containing WKT's
// (note this function is shared by various examples)
// ----------------------------------------------------------------------------
template <typename Geometry>
@@ -73,9 +72,10 @@
std::string filename = "../data/world.wkt";
- // The world is measured in latlong (degrees), so latlong (point_ll_deg) is appropriate.
+ // The world is measured in latlong (degrees), so latlong is appropriate.
// We ignore holes in this sample (below)
- typedef bg::model::polygon<bg::model::point_ll_deg> polygon_type;
+ typedef bg::model::ll::point<bg::degree> point_type;
+ typedef bg::model::polygon<point_type> polygon_type;
typedef bg::model::multi_polygon<polygon_type> country_type;
std::vector<country_type> countries;
@@ -105,7 +105,7 @@
BOOST_FOREACH(polygon_type const& polygon, country)
{
// Ignore holes, so take only exterior ring
- bg::model::ring_ll_deg const& ring = bg::exterior_ring(polygon);
+ bg::model::linear_ring<point_type> const& ring = bg::exterior_ring(polygon);
// If wished, suppress too small polygons.
// (Note that even in latlong, area is calculated in square meters)
Modified: sandbox/geometry/libs/geometry/example/with_external_libs/x03_d_soci_example.cpp
==============================================================================
--- sandbox/geometry/libs/geometry/example/with_external_libs/x03_d_soci_example.cpp (original)
+++ sandbox/geometry/libs/geometry/example/with_external_libs/x03_d_soci_example.cpp 2010-12-04 08:01:26 EST (Sat, 04 Dec 2010)
@@ -30,7 +30,6 @@
#include <boost/geometry/geometry.hpp>
#include <boost/geometry/algorithms/area.hpp>
-#include <boost/geometry/geometries/cartesian2d.hpp>
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/extensions/gis/io/wkb/read_wkb.hpp>
#include <boost/geometry/extensions/gis/io/wkb/utility.hpp>
Modified: sandbox/geometry/libs/geometry/example/with_external_libs/x04_wxwidgets_world_mapper.cpp
==============================================================================
--- sandbox/geometry/libs/geometry/example/with_external_libs/x04_wxwidgets_world_mapper.cpp (original)
+++ sandbox/geometry/libs/geometry/example/with_external_libs/x04_wxwidgets_world_mapper.cpp 2010-12-04 08:01:26 EST (Sat, 04 Dec 2010)
@@ -21,7 +21,6 @@
#include <boost/geometry/geometries/register/point.hpp>
#include <boost/geometry/geometries/register/ring.hpp>
#include <boost/geometry/multi/multi.hpp>
-#include <boost/geometry/geometries/cartesian2d.hpp>
#include <boost/geometry/extensions/algorithms/selected.hpp>
#include <boost/geometry/extensions/gis/io/wkt/read_wkt.hpp>
#include <boost/geometry/extensions/gis/io/wkt/read_wkt_multi.hpp>
@@ -39,9 +38,11 @@
#include "wx/dcgraph.h"
#endif
-
+typedef boost::geometry::model::d2::point_xy<double> point_2d;
typedef boost::geometry::model::multi_polygon
- <boost::geometry::model::d2::polygon> country_type;
+ <
+ boost::geometry::model::polygon<point_2d>
+ > country_type;
// Adapt wxWidgets points to Boost.Geometry points such that they can be used
// in e.g. transformations (see below)
@@ -157,19 +158,19 @@
typedef boost::geometry::strategy::transform::map_transformer
<
- boost::geometry::model::d2::point, wxPoint,
+ point_2d, wxPoint,
true, true
> map_transformer_type;
typedef boost::geometry::strategy::transform::inverse_transformer
<
- wxPoint, boost::geometry::model::d2::point
+ wxPoint, point_2d
> inverse_transformer_type;
boost::shared_ptr<map_transformer_type> m_map_transformer;
boost::shared_ptr<inverse_transformer_type> m_inverse_transformer;
- boost::geometry::model::d2::box m_box;
+ boost::geometry::model::box<point_2d> m_box;
std::vector<country_type> m_countries;
int m_focus;
@@ -259,7 +260,7 @@
m_owner->PrepareDC(dc);
// Transform the point to Lon/Lat
- bg::model::d2::point point;
+ point_2d point;
bg::transform(event.GetPosition(), point, *m_inverse_transformer);
// Determine selected object
@@ -353,7 +354,7 @@
{
namespace bg = boost::geometry;
- BOOST_FOREACH(bg::model::d2::polygon const& poly, country)
+ BOOST_FOREACH(bg::model::polygon<point_2d> const& poly, country)
{
// Use only outer, holes are (for the moment) ignored. This would need
// a holey-polygon compatible wx object
Modified: sandbox/geometry/libs/geometry/example/with_external_libs/x05_shapelib_example.cpp
==============================================================================
--- sandbox/geometry/libs/geometry/example/with_external_libs/x05_shapelib_example.cpp (original)
+++ sandbox/geometry/libs/geometry/example/with_external_libs/x05_shapelib_example.cpp 2010-12-04 08:01:26 EST (Sat, 04 Dec 2010)
@@ -20,7 +20,6 @@
#include "shapefil.h"
#include <boost/geometry/geometry.hpp>
-#include <boost/geometry/geometries/cartesian2d.hpp>
#include <boost/geometry/extensions/gis/io/wkt/stream_wkt.hpp>
using namespace boost::geometry;
@@ -84,11 +83,12 @@
{
std::string filename = "c:/data/spatial/shape/world_free/world.shp";
- std::vector<model::d2::polygon> polygons;
+ typedef model::polygon<model::d2::point_xy<double> > polygon_2d;
+ std::vector<polygon_2d> polygons;
try
{
- read_shapefile(filename, polygons, convert<model::d2::polygon>);
+ read_shapefile(filename, polygons, convert<polygon_2d>);
}
catch(const std::string& s)
{
@@ -97,9 +97,9 @@
}
// Do something with the polygons, for example simplify them
- for (std::vector<model::d2::polygon>::iterator it = polygons.begin(); it != polygons.end(); it++)
+ for (std::vector<polygon_2d>::iterator it = polygons.begin(); it != polygons.end(); it++)
{
- model::d2::polygon p;
+ polygon_2d p;
simplify(*it, p, 0.01);
std::cout << it->outer().size() << "," << p.outer().size() << std::endl;
*it = p;
@@ -107,7 +107,7 @@
std::cout << "Simplified " << polygons.size() << std::endl;
double sum = 0;
- for (std::vector<model::d2::polygon>::const_iterator it = polygons.begin(); it != polygons.end(); it++)
+ for (std::vector<polygon_2d>::const_iterator it = polygons.begin(); it != polygons.end(); it++)
{
sum += area(*it);
}
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk