|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r59787 - in sandbox/geometry: boost/geometry boost/geometry/extensions/io/svg libs/geometry/example
From: barend.gehrels_at_[hidden]
Date: 2010-02-20 12:28:55
Author: barendgehrels
Date: 2010-02-20 12:28:53 EST (Sat, 20 Feb 2010)
New Revision: 59787
URL: http://svn.boost.org/trac/boost/changeset/59787
Log:
Updated svg_mapper
Updated 07_graph_route_example.cpp using svg_mapper now
Added:
sandbox/geometry/libs/geometry/example/basic_examples.sln
- copied unchanged from r59784, /sandbox/geometry/libs/geometry/example/ggl_examples.sln
Removed:
sandbox/geometry/libs/geometry/example/ggl_examples.sln
Text files modified:
sandbox/geometry/boost/geometry/extensions/io/svg/svg_mapper.hpp | 24 +++++++++++++++-----
sandbox/geometry/boost/geometry/geometry.hpp | 2 -
sandbox/geometry/libs/geometry/example/07_graph_route_example.cpp | 46 +++++++++++----------------------------
3 files changed, 31 insertions(+), 41 deletions(-)
Modified: sandbox/geometry/boost/geometry/extensions/io/svg/svg_mapper.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/extensions/io/svg/svg_mapper.hpp (original)
+++ sandbox/geometry/boost/geometry/extensions/io/svg/svg_mapper.hpp 2010-02-20 12:28:53 EST (Sat, 20 Feb 2010)
@@ -1,13 +1,12 @@
// Boost.Geometry (aka GGL, Generic Geometry Library) test file
//
-// Copyright Barend Gehrels 2007-2009, Geodan, Amsterdam, the Netherlands
-// Copyright Bruno Lalande 2008, 2009
+// Copyright Barend Gehrels 2009-2010, Geodan, 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)
-#ifndef GGL_TEST_UTIL_SVG_MAPPER_HPP
-#define GGL_TEST_UTIL_SVG_MAPPER_HPP
+#ifndef BOOST_GEOMETRY_IO_SVG_MAPPER_HPP
+#define BOOST_GEOMETRY_IO_SVG_MAPPER_HPP
#include <cstdio>
@@ -32,6 +31,11 @@
#include <boost/geometry/extensions/io/svg/write_svg.hpp>
+namespace boost { namespace geometry
+{
+
+
+
#ifndef DOXYGEN_NO_DISPATCH
namespace dispatch
{
@@ -167,7 +171,14 @@
template <typename P>
class svg_mapper
{
- typedef boost::geometry::strategy::transform::map_transformer<P, boost::geometry::point_xy<int>, true, true> transformer_type;
+ typedef boost::geometry::strategy::transform::map_transformer
+ <
+ P,
+ boost::geometry::point_xy<int>,
+ true,
+ true
+ > transformer_type;
+
boost::geometry::box<P> bbox;
transformer_type* matrix;
std::ostream& stream;
@@ -236,5 +247,6 @@
};
+}} // namespace boost::geometry
-#endif // GGL_TEST_UTIL_SVG_MAPPER_HPP
+#endif // BOOST_GEOMETRY_IO_SVG_MAPPER_HPP
Modified: sandbox/geometry/boost/geometry/geometry.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/geometry.hpp (original)
+++ sandbox/geometry/boost/geometry/geometry.hpp 2010-02-20 12:28:53 EST (Sat, 20 Feb 2010)
@@ -44,7 +44,6 @@
#include <boost/geometry/algorithms/distance.hpp>
#include <boost/geometry/algorithms/envelope.hpp>
#include <boost/geometry/algorithms/for_each.hpp>
-#include <boost/geometry/algorithms/intermediate.hpp>
#include <boost/geometry/algorithms/intersection.hpp>
#include <boost/geometry/algorithms/intersects.hpp>
#include <boost/geometry/algorithms/length.hpp>
@@ -52,7 +51,6 @@
#include <boost/geometry/algorithms/num_points.hpp>
#include <boost/geometry/algorithms/perimeter.hpp>
#include <boost/geometry/algorithms/sectionalize.hpp>
-#include <boost/geometry/algorithms/selected.hpp>
#include <boost/geometry/algorithms/simplify.hpp>
#include <boost/geometry/algorithms/transform.hpp>
#include <boost/geometry/algorithms/union.hpp>
Modified: sandbox/geometry/libs/geometry/example/07_graph_route_example.cpp
==============================================================================
--- sandbox/geometry/libs/geometry/example/07_graph_route_example.cpp (original)
+++ sandbox/geometry/libs/geometry/example/07_graph_route_example.cpp 2010-02-20 12:28:53 EST (Sat, 20 Feb 2010)
@@ -31,7 +31,7 @@
#include <boost/geometry/extensions/gis/io/wkt/read_wkt.hpp>
// For output:
- #include <boost/geometry/extensions/io/svg/write_svg.hpp>
+ #include <boost/geometry/extensions/io/svg/svg_mapper.hpp>
// For distance-calculations over the Earth:
#include <boost/geometry/extensions/gis/geographic/strategies/andoyer.hpp>
@@ -79,18 +79,6 @@
}
}
-// Boilerplate code to initialize the SVG XML.
-// Note that this is (on purpose) not part of the library but of this sample.
-// GGL itself only streams small pieces of SVG, in any coordinate system
-void svg_header(std::ofstream& stream)
-{
- stream << "<?xml version=\"1.0\" standalone=\"no\"?>" << std::endl;
- stream << "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"" << std::endl;
- stream << "\"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">" << std::endl;
-
- stream << "<svg width=\"100%\" height=\"100%\" version=\"1.1\"" << std::endl;
- stream << "xmlns=\"http://www.w3.org/2000/svg\">" << std::endl;
-}
// Code to define properties for Boost Graph's
@@ -361,40 +349,32 @@
}
// Create the SVG
- typedef boost::geometry::point_xy<int> svg_point_type;
std::ofstream stream("routes.svg");
- svg_header(stream);
-
- boost::geometry::strategy::transform::map_transformer
- <
- point_type,
- svg_point_type, true, true
- > matrix(box, 1000, 800);
+ boost::geometry::svg_mapper<point_type> mapper(stream, 600, 600);
// Map roads
BOOST_FOREACH(road_type const& road, roads)
{
- boost::geometry::linestring<svg_point_type> line;
- boost::geometry::transform(road.get<0>(), line, matrix);
- stream << boost::geometry::svg(line, "stroke:rgb(128,128,128);stroke-width:1") << std::endl;
+ mapper.add(road.get<0>());
}
- // Map the calculated route as thicker green transparent markation
+ BOOST_FOREACH(road_type const& road, roads)
{
- boost::geometry::linestring<svg_point_type> line;
- boost::geometry::transform(route, line, matrix);
- stream << boost::geometry::svg(line, "stroke:rgb(0, 255, 0);stroke-width:6;opacity:0.5") << std::endl;
+ mapper.map(road.get<0>(),
+ "stroke:rgb(128,128,128);stroke-width:1");
}
+ mapper.map(route,
+ "stroke:rgb(0, 255, 0);stroke-width:6;opacity:0.5");
+
// Map cities
BOOST_FOREACH(city_type const& city, cities)
{
- svg_point_type point;
- boost::geometry::transform(city.get<0>(), point, matrix);
- stream << boost::geometry::svg(point, "fill:rgb(255,255,0);stroke:rgb(0,0,0);stroke-width:1") << std::endl;
+ mapper.map(city.get<0>(),
+ "fill:rgb(255,255,0);stroke:rgb(0,0,0);stroke-width:1");
+ mapper.text(city.get<0>(), city.get<1>(),
+ "fill:rgb(0,0,0);font-family:Arial;font-size:10px", 5, 5);
}
- stream << "</svg>" << std::endl;
-
return 0;
}
Deleted: sandbox/geometry/libs/geometry/example/ggl_examples.sln
==============================================================================
--- sandbox/geometry/libs/geometry/example/ggl_examples.sln 2010-02-20 12:28:53 EST (Sat, 20 Feb 2010)
+++ (empty file)
@@ -1,49 +0,0 @@
-Microsoft Visual Studio Solution File, Format Version 9.00
-# Visual C++ Express 2005
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "01_point_example", "01_point_example.vcproj", "{E7BFC111-F0E5-420F-869C-1FC3212270B5}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "02_linestring_example", "02_linestring_example.vcproj", "{D5CE1A26-1EB7-44A4-84F9-526CFA8C2B74}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "03_polygon_example", "03_polygon_example.vcproj", "{1E299DA7-CFD1-4586-B0B0-1ABF2A32ED5B}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "06_a_transformation_example", "06_a_transformation_example.vcproj", "{34346EC5-1EE8-49D5-AF24-D915B4D7D144}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "07_graph_route_example", "07_graph_route_example.vcproj", "{47D30DD8-CBB1-4527-811F-F0193E22B317}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "06_b_transformation_example", "06_b_transformation_example.vcproj", "{34346EC5-1EE8-49D5-AC21-D915B4D7D144}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Win32 = Debug|Win32
- Release|Win32 = Release|Win32
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {E7BFC111-F0E5-420F-869C-1FC3212270B5}.Debug|Win32.ActiveCfg = Debug|Win32
- {E7BFC111-F0E5-420F-869C-1FC3212270B5}.Debug|Win32.Build.0 = Debug|Win32
- {E7BFC111-F0E5-420F-869C-1FC3212270B5}.Release|Win32.ActiveCfg = Release|Win32
- {E7BFC111-F0E5-420F-869C-1FC3212270B5}.Release|Win32.Build.0 = Release|Win32
- {D5CE1A26-1EB7-44A4-84F9-526CFA8C2B74}.Debug|Win32.ActiveCfg = Debug|Win32
- {D5CE1A26-1EB7-44A4-84F9-526CFA8C2B74}.Debug|Win32.Build.0 = Debug|Win32
- {D5CE1A26-1EB7-44A4-84F9-526CFA8C2B74}.Release|Win32.ActiveCfg = Release|Win32
- {D5CE1A26-1EB7-44A4-84F9-526CFA8C2B74}.Release|Win32.Build.0 = Release|Win32
- {1E299DA7-CFD1-4586-B0B0-1ABF2A32ED5B}.Debug|Win32.ActiveCfg = Debug|Win32
- {1E299DA7-CFD1-4586-B0B0-1ABF2A32ED5B}.Debug|Win32.Build.0 = Debug|Win32
- {1E299DA7-CFD1-4586-B0B0-1ABF2A32ED5B}.Release|Win32.ActiveCfg = Release|Win32
- {1E299DA7-CFD1-4586-B0B0-1ABF2A32ED5B}.Release|Win32.Build.0 = Release|Win32
- {34346EC5-1EE8-49D5-AF24-D915B4D7D144}.Debug|Win32.ActiveCfg = Debug|Win32
- {34346EC5-1EE8-49D5-AF24-D915B4D7D144}.Debug|Win32.Build.0 = Debug|Win32
- {34346EC5-1EE8-49D5-AF24-D915B4D7D144}.Release|Win32.ActiveCfg = Release|Win32
- {34346EC5-1EE8-49D5-AF24-D915B4D7D144}.Release|Win32.Build.0 = Release|Win32
- {47D30DD8-CBB1-4527-811F-F0193E22B317}.Debug|Win32.ActiveCfg = Debug|Win32
- {47D30DD8-CBB1-4527-811F-F0193E22B317}.Debug|Win32.Build.0 = Debug|Win32
- {47D30DD8-CBB1-4527-811F-F0193E22B317}.Release|Win32.ActiveCfg = Release|Win32
- {47D30DD8-CBB1-4527-811F-F0193E22B317}.Release|Win32.Build.0 = Release|Win32
- {34346EC5-1EE8-49D5-AC21-D915B4D7D144}.Debug|Win32.ActiveCfg = Debug|Win32
- {34346EC5-1EE8-49D5-AC21-D915B4D7D144}.Debug|Win32.Build.0 = Debug|Win32
- {34346EC5-1EE8-49D5-AC21-D915B4D7D144}.Release|Win32.ActiveCfg = Release|Win32
- {34346EC5-1EE8-49D5-AC21-D915B4D7D144}.Release|Win32.Build.0 = Release|Win32
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
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