Merged changes with ifdefs for release branch

[SVN r70920]
This commit is contained in:
Barend Gehrels
2011-04-03 07:55:46 +00:00
parent 0f9eb1c664
commit c5b04559ba
10 changed files with 53 additions and 453 deletions

View File

@@ -34,10 +34,12 @@
// Yes, this example currently uses some extensions:
// For output:
#include <boost/geometry/extensions/io/svg/svg_mapper.hpp>
#if defined(HAVE_SVG)
# include <boost/geometry/extensions/io/svg/svg_mapper.hpp>
#endif
// For distance-calculations over the Earth:
#include <boost/geometry/extensions/gis/geographic/strategies/andoyer.hpp>
//#include <boost/geometry/extensions/gis/geographic/strategies/andoyer.hpp>
@@ -246,10 +248,11 @@ inline void build_route(Graph const& graph,
int main()
{
// Define a point in the Geographic coordinate system
// Define a point in the Geographic coordinate system (currently Spherical)
// (geographic calculations are in an extension; for sample it makes no difference)
typedef boost::geometry::model::point
<
double, 2, boost::geometry::cs::geographic<boost::geometry::degree>
double, 2, boost::geometry::cs::spherical<boost::geometry::degree>
> point_type;
typedef boost::geometry::model::linestring<point_type> line_type;
@@ -291,6 +294,9 @@ int main()
std::cout << "distances, all in KM" << std::endl
<< std::fixed << std::setprecision(0);
// To calculate distance, declare and construct a strategy with average earth radius
boost::geometry::strategy::distance::haversine<point_type> haversine(6372795.0);
// Main functionality: calculate shortest routes from/to all cities
// For the first one, the complete route is stored as a linestring
@@ -317,7 +323,7 @@ int main()
if (! boost::equals(city1.get<1>(), city2.get<1>()))
{
double distance = costs[city2.get<2>()] / km;
double acof = boost::geometry::distance(city1.get<0>(), city2.get<0>()) / km;
double acof = boost::geometry::distance(city1.get<0>(), city2.get<0>(), haversine) / km;
std::cout
<< std::setiosflags (std::ios_base::left) << std::setw(15)
@@ -339,6 +345,7 @@ int main()
}
}
#if defined(HAVE_SVG)
// Create the SVG
std::ofstream stream("routes.svg");
boost::geometry::svg_mapper<point_type> mapper(stream, 600, 600);
@@ -366,6 +373,7 @@ int main()
mapper.text(city.get<0>(), city.get<1>(),
"fill:rgb(0,0,0);font-family:Arial;font-size:10px", 5, 5);
}
#endif
return 0;
}