Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r66989 - sandbox/geometry/libs/geometry/example/extensions/gis/projections
From: barend.gehrels_at_[hidden]
Date: 2010-12-03 14:58:00


Author: barendgehrels
Date: 2010-12-03 14:57:18 EST (Fri, 03 Dec 2010)
New Revision: 66989
URL: http://svn.boost.org/trac/boost/changeset/66989

Log:
model namespaces, moved point_xy to d2::point_xy, revised point_ll_deg to ll::point<degree> (projection examples)
Text files modified:
   sandbox/geometry/libs/geometry/example/extensions/gis/projections/p01_projection_example.cpp | 9 +++++----
   sandbox/geometry/libs/geometry/example/extensions/gis/projections/p02_projfactory_example.cpp | 11 ++++++-----
   sandbox/geometry/libs/geometry/example/extensions/gis/projections/p03_projmap_example.cpp | 12 +++++++-----
   3 files changed, 18 insertions(+), 14 deletions(-)

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-03 14:57:18 EST (Fri, 03 Dec 2010)
@@ -26,11 +26,12 @@
     // Construct a Robinson projection, using specified point types
     // (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)
- projection::robin_spheroid<model::point_ll_deg, model::d2::point> prj(par);
+ typedef model::ll::point<degree> point_ll_deg;
+ projection::robin_spheroid<point_ll_deg, model::d2::point> prj(par);
 
     // Define Amsterdam / Barcelona in decimal degrees / degrees/minutes
- model::point_ll_deg amsterdam = parse<model::point_ll_deg>("52.4N", "5.9E");
- model::point_ll_deg barcelona = parse<model::point_ll_deg>("41 23'N", "2 11'E");
+ 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;
 
@@ -47,7 +48,7 @@
         // Do the inverse projection. "Inverse" means from meters to latlong
         // It also might fail or might not exist, not all projections
         // have their inverse implemented
- model::point_ll_deg a1;
+ point_ll_deg a1;
         if (prj.inverse(pa, a1))
         {
             std::cout << "Amsterdam (original): " << amsterdam << std::endl

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-03 14:57:18 EST (Fri, 03 Dec 2010)
@@ -28,12 +28,13 @@
     // Note that this is the only difference from p01_projection_example. It constructs a projection
     // with virtual methods, which can be used polymorphically. Therefore it is a pointer. For
     // convenience we use a boost shared pointer here.
- projection::factory<model::point_ll_deg, model::d2::point> fac;
- boost::shared_ptr<projection::projection<model::point_ll_deg, model::d2::point> > prj(fac.create_new(par));
+ 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));
 
     // Define Amsterdam / Barcelona in decimal degrees / degrees/minutes
- model::point_ll_deg amsterdam(longitude<>(5.9), latitude<>(52.4));
- model::point_ll_deg barcelona(
+ point_ll_deg amsterdam(longitude<>(5.9), latitude<>(52.4));
+ point_ll_deg barcelona(
         latitude<>(dms<north>(41, 23)),
         longitude<>(dms<east>(2, 11))
         );
@@ -49,7 +50,7 @@
         std::cout << "Distance ( projected):" << distance(pa, pb) / 1000.0 << " km" << std::endl;
 
         // Get the inverse
- model::point_ll_deg a1;
+ point_ll_deg a1;
         if (prj->inverse(pa, a1))
         {
             std::cout << "Amsterdam (original): " << amsterdam << std::endl

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-03 14:57:18 EST (Fri, 03 Dec 2010)
@@ -27,7 +27,9 @@
     using namespace boost::geometry;
 
     // Declare a vector containing the world countries
- std::vector<model::polygon_ll_deg> ll_polygons;
+ typedef model::ll::point<degree> point_ll_deg;
+ typedef model::polygon<point_ll_deg> polygon_ll_deg;
+ std::vector<polygon_ll_deg> ll_polygons;
 
     // Read polygons from a Well-Known Text file using the ggl parser
     std::ifstream cpp_file(wkt_filename.c_str());
@@ -42,7 +44,7 @@
         std::getline(cpp_file, line);
         if (boost::starts_with(line, "MULTIPOLYGON"))
         {
- typedef boost::geometry::model::multi_polygon<boost::geometry::model::polygon<model::point_ll_deg> > mp_type;
+ typedef boost::geometry::model::multi_polygon<boost::geometry::model::polygon<point_ll_deg> > mp_type;
             mp_type mp;
             boost::geometry::read_wkt(line, mp);
             for (mp_type::const_iterator it = boost::begin(mp);
@@ -60,14 +62,14 @@
     // Declare transformation strategy which contains a projection
     projection::project_transformer
         <
- model::point_ll_deg,
- model::d2::point
+ point_ll_deg,
+ model::d2::point_xy<double>
> projection(projection_parameters);
 
     // Project the polygons, and at the same time get the bounding box (in xy)
     model::d2::box bbox;
     assign_inverse(bbox);
- for (std::vector<model::polygon_ll_deg>::const_iterator it = ll_polygons.begin();
+ for (std::vector<polygon_ll_deg>::const_iterator it = ll_polygons.begin();
          it != ll_polygons.end();
          ++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