Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r67778 - in trunk: boost/geometry/algorithms libs/geometry/doc libs/geometry/doc/reference libs/geometry/doc/snippets libs/geometry/doc/src/examples libs/geometry/doc/src/examples/algorithms
From: barend.gehrels_at_[hidden]
Date: 2011-01-08 09:01:12


Author: barendgehrels
Date: 2011-01-08 09:01:04 EST (Sat, 08 Jan 2011)
New Revision: 67778
URL: http://svn.boost.org/trac/boost/changeset/67778

Log:
Moved all other snippets to separate examples
Added:
   trunk/libs/geometry/doc/src/examples/algorithms/intersection_ls_ls_point.cpp (contents, props changed)
   trunk/libs/geometry/doc/src/examples/algorithms/intersection_segment.cpp (contents, props changed)
   trunk/libs/geometry/doc/src/examples/algorithms/intersects_linestring.cpp (contents, props changed)
   trunk/libs/geometry/doc/src/examples/algorithms/length.cpp (contents, props changed)
   trunk/libs/geometry/doc/src/examples/algorithms/length_with_strategy.cpp (contents, props changed)
   trunk/libs/geometry/doc/src/examples/algorithms/simplify.cpp (contents, props changed)
   trunk/libs/geometry/doc/src/examples/algorithms/simplify_inserter.cpp (contents, props changed)
   trunk/libs/geometry/doc/src/examples/quick_start.cpp
      - copied, changed from r67591, /trunk/libs/geometry/doc/snippets/qbk_2.cpp
Removed:
   trunk/libs/geometry/doc/snippets/qbk_1.cpp
   trunk/libs/geometry/doc/snippets/qbk_1.vcproj
   trunk/libs/geometry/doc/snippets/qbk_2.cpp
   trunk/libs/geometry/doc/snippets/qbk_2.vcproj
   trunk/libs/geometry/doc/snippets/qbk_3.cpp
   trunk/libs/geometry/doc/snippets/qbk_3.vcproj
   trunk/libs/geometry/doc/snippets/qbk_4.cpp
   trunk/libs/geometry/doc/snippets/qbk_4.vcproj
   trunk/libs/geometry/doc/snippets/qbk_5.cpp
   trunk/libs/geometry/doc/snippets/qbk_5.vcproj
   trunk/libs/geometry/doc/snippets/qbk_examples.sln
Text files modified:
   trunk/boost/geometry/algorithms/intersection.hpp | 4 +++-
   trunk/boost/geometry/algorithms/intersects.hpp | 2 +-
   trunk/boost/geometry/algorithms/length.hpp | 4 +++-
   trunk/boost/geometry/algorithms/simplify.hpp | 18 ++++--------------
   trunk/libs/geometry/doc/geometry.qbk | 15 ++++++++-------
   trunk/libs/geometry/doc/reference/intersection.qbk | 4 +++-
   trunk/libs/geometry/doc/reference/intersects.qbk | 2 +-
   trunk/libs/geometry/doc/reference/length.qbk | 4 +++-
   trunk/libs/geometry/doc/reference/simplify.qbk | 15 ++++++++++-----
   trunk/libs/geometry/doc/src/examples/algorithms/Jamfile.v2 | 11 +++++++++++
   trunk/libs/geometry/doc/src/examples/quick_start.cpp | 1 -
   11 files changed, 47 insertions(+), 33 deletions(-)

Modified: trunk/boost/geometry/algorithms/intersection.hpp
==============================================================================
--- trunk/boost/geometry/algorithms/intersection.hpp (original)
+++ trunk/boost/geometry/algorithms/intersection.hpp 2011-01-08 09:01:04 EST (Sat, 08 Jan 2011)
@@ -186,8 +186,10 @@
 \param geometry_out The output geometry, either a multi_point, multi_polygon,
     multi_linestring, or a box (for intersection of two boxes)
 
-\qbk{example,intersection_linestring}
+\qbk{example,intersection_ls_ls_point}
+\qbk{example,intersection_ls_ls_point_output}
 \qbk{example,intersection_segment}
+\qbk{example,intersection_segment_output}
 */
 template
 <

Modified: trunk/boost/geometry/algorithms/intersects.hpp
==============================================================================
--- trunk/boost/geometry/algorithms/intersects.hpp (original)
+++ trunk/boost/geometry/algorithms/intersects.hpp 2011-01-08 09:01:04 EST (Sat, 08 Jan 2011)
@@ -82,7 +82,7 @@
 
 \qbk{distinguish,two geometries}
 \qbk{example,intersects_linestring}
-\qbk{example,intersects_segment}
+\qbk{example,intersects_linestring_output}
  */
 template <typename Geometry1, typename Geometry2>
 inline bool intersects(Geometry1 const& geometry1, Geometry2 const& geometry2)

Modified: trunk/boost/geometry/algorithms/length.hpp
==============================================================================
--- trunk/boost/geometry/algorithms/length.hpp (original)
+++ trunk/boost/geometry/algorithms/length.hpp 2011-01-08 09:01:04 EST (Sat, 08 Jan 2011)
@@ -143,6 +143,7 @@
 \qbk{complexity,Linear}
 \qbk{compliance,__ogc__}
 \qbk{example,length}
+\qbk{example,length_output}
  */
 template<typename Geometry>
 inline typename length_result<Geometry>::type length(
@@ -175,7 +176,8 @@
 \return \return_calc{length}
 
 \qbk{distinguish,with strategy}
-\qbk{example,length_strategy}
+\qbk{example,length_with_strategy}
+\qbk{example,length_with_strategy_output}
  */
 template<typename Geometry, typename Strategy>
 inline typename length_result<Geometry>::type length(

Modified: trunk/boost/geometry/algorithms/simplify.hpp
==============================================================================
--- trunk/boost/geometry/algorithms/simplify.hpp (original)
+++ trunk/boost/geometry/algorithms/simplify.hpp 2011-01-08 09:01:04 EST (Sat, 08 Jan 2011)
@@ -286,13 +286,8 @@
 \param max_distance distance (in units of input coordinates) of a vertex
     to other segments to be removed
 
-\par Example:
-Simplify can be used as following:
-\dontinclude doxygen_1.cpp
-\skip example_simplify_linestring1
-\line {
-\until }
-
+\qbk{example,simplify}
+\qbk{example,simplify_output}
  */
 template<typename Geometry, typename Distance>
 inline void simplify(Geometry const& geometry, Geometry& out,
@@ -326,15 +321,8 @@
     to other segments to be removed
 \param strategy simplify strategy to be used for simplification,
     might include point-distance strategy
-\par Example:
-simplify_inserter with strategy is used as following:
-\dontinclude doxygen_1.cpp
-\skip example_simplify_linestring2
-\line {
-\until }
 
 \qbk{distinguish,with strategy}
-\qbk{example,simplify_inserter}
  */
 template<typename Geometry, typename OutputIterator, typename Distance, typename Strategy>
 inline void simplify_inserter(Geometry const& geometry, OutputIterator out,
@@ -360,6 +348,8 @@
 \param max_distance distance (in units of input coordinates) of a vertex
     to other segments to be removed
 
+\qbk{example,simplify_inserter}
+\qbk{example,simplify_inserter_output}
  */
 template<typename Geometry, typename OutputIterator, typename Distance>
 inline void simplify_inserter(Geometry const& geometry, OutputIterator out,

Modified: trunk/libs/geometry/doc/geometry.qbk
==============================================================================
--- trunk/libs/geometry/doc/geometry.qbk (original)
+++ trunk/libs/geometry/doc/geometry.qbk 2011-01-08 09:01:04 EST (Sat, 08 Jan 2011)
@@ -60,18 +60,19 @@
 
 [*In progress]
 
+[import src/examples/quick_start.cpp]
 [import src/examples/algorithms/area.cpp]
 [import src/examples/algorithms/area_with_strategy.cpp]
+[import src/examples/algorithms/length.cpp]
+[import src/examples/algorithms/length_with_strategy.cpp]
+[import src/examples/algorithms/intersection_ls_ls_point.cpp]
+[import src/examples/algorithms/intersection_segment.cpp]
+[import src/examples/algorithms/intersects_linestring.cpp]
+[import src/examples/algorithms/simplify.cpp]
+[import src/examples/algorithms/simplify_inserter.cpp]
 [import src/examples/geometries/point.cpp]
 [import src/examples/geometries/register/point.cpp]
 
-[/obsolete structure]
-[import snippets/qbk_1.cpp]
-[import snippets/qbk_2.cpp]
-[import snippets/qbk_3.cpp]
-[import snippets/qbk_4.cpp]
-[import snippets/qbk_5.cpp]
-
 [include introduction.qbk]
 [include quickstart.qbk]
 

Modified: trunk/libs/geometry/doc/reference/intersection.qbk
==============================================================================
--- trunk/libs/geometry/doc/reference/intersection.qbk (original)
+++ trunk/libs/geometry/doc/reference/intersection.qbk 2011-01-08 09:01:04 EST (Sat, 08 Jan 2011)
@@ -54,8 +54,10 @@
 
 
 [heading Examples]
-[intersection_linestring]
+[intersection_ls_ls_point]
+[intersection_ls_ls_point_output]
 [intersection_segment]
+[intersection_segment_output]
 
 
 [endsect]

Modified: trunk/libs/geometry/doc/reference/intersects.qbk
==============================================================================
--- trunk/libs/geometry/doc/reference/intersects.qbk (original)
+++ trunk/libs/geometry/doc/reference/intersects.qbk 2011-01-08 09:01:04 EST (Sat, 08 Jan 2011)
@@ -44,7 +44,7 @@
 
 [heading Examples]
 [intersects_linestring]
-[intersects_segment]
+[intersects_linestring_output]
 
 
 [endsect]

Modified: trunk/libs/geometry/doc/reference/length.qbk
==============================================================================
--- trunk/libs/geometry/doc/reference/length.qbk (original)
+++ trunk/libs/geometry/doc/reference/length.qbk 2011-01-08 09:01:04 EST (Sat, 08 Jan 2011)
@@ -58,7 +58,8 @@
 Linear
 
 [heading Examples]
-[length_strategy]
+[length_with_strategy]
+[length_with_strategy_output]
 
 
 [endsect]
@@ -108,6 +109,7 @@
 
 [heading Examples]
 [length]
+[length_output]
 
 
 [endsect]

Modified: trunk/libs/geometry/doc/reference/simplify.qbk
==============================================================================
--- trunk/libs/geometry/doc/reference/simplify.qbk (original)
+++ trunk/libs/geometry/doc/reference/simplify.qbk 2011-01-08 09:01:04 EST (Sat, 08 Jan 2011)
@@ -40,6 +40,10 @@
 
 `#include <boost/geometry/algorithms/simplify.hpp>`
 
+[heading Examples]
+[simplify]
+[simplify_output]
+
 
 [endsect]
 
@@ -90,7 +94,7 @@
 [[Type] [Concept] [Name] [Description] ]
 [[Geometry const &] [Any type fulfilling a Geometry Concept ] [geometry] [input geometry, to be simplified ]]
 [[OutputIterator] [] [out] [output iterator, outputs all simplified points ]]
-[[Distance const &] [] [max_distance] [distance (in units of input coordinates) of a vertex to other segments to be removed ]]
+[[Distance const &] [] [max_distance] [distance (in units of input coordinates) of a vertex to other segments to be removed]]
 ]
 
 
@@ -103,6 +107,10 @@
 
 `#include <boost/geometry/algorithms/simplify.hpp>`
 
+[heading Examples]
+[simplify_inserter]
+[simplify_inserter_output]
+
 
 [endsect]
 
@@ -121,7 +129,7 @@
 [[Geometry const &] [Any type fulfilling a Geometry Concept ] [geometry] [input geometry, to be simplified ]]
 [[OutputIterator] [] [out] [output iterator, outputs all simplified points ]]
 [[Distance const &] [] [max_distance] [distance (in units of input coordinates) of a vertex to other segments to be removed ]]
-[[Strategy const &] [] [strategy] [simplify strategy to be used for simplification, might include point-distance strategy ]]
+[[Strategy const &] [] [strategy] [simplify strategy to be used for simplification, might include point-distance strategy]]
 ]
 
 
@@ -134,9 +142,6 @@
 
 `#include <boost/geometry/algorithms/simplify.hpp>`
 
-[heading Examples]
-[simplify_inserter]
-
 
 [endsect]
 

Deleted: trunk/libs/geometry/doc/snippets/qbk_1.cpp
==============================================================================
--- trunk/libs/geometry/doc/snippets/qbk_1.cpp 2011-01-08 09:01:04 EST (Sat, 08 Jan 2011)
+++ (empty file)
@@ -1,530 +0,0 @@
-// Boost.Geometry (aka GGL, Generic Geometry Library)
-//
-// Copyright Barend Gehrels 2010, Geodan, Amsterdam, the Netherlands
-// Copyright Bruno Lalande 2008, 2009
-// 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)
-//
-// Quickbook Examples, referred to from the sources
-
-#include <boost/tuple/tuple.hpp>
-
-#if defined(_MSC_VER)
-// We deliberately mix float/double's here so turn off warning
-#pragma warning( disable : 4244 )
-#endif // defined(_MSC_VER)
-
-#include <boost/geometry/geometry.hpp>
-#include <boost/geometry/geometries/register/segment.hpp>
-#include <boost/geometry/geometries/geometries.hpp>
-#include <boost/geometry/geometries/adapted/std_as_linestring.hpp>
-
-#include <boost/geometry/extensions/gis/io/wkt/wkt.hpp>
-
-
-
-
-
-
-void example_as_wkt_point()
-{
- typedef boost::geometry::model::d2::point_xy<double> P;
- P p(5.12, 6.34);
- // Points can be streamed like this:
- std::cout << boost::geometry::dsv<P>(p) << std::endl;
-
- // or like this:
- std::cout << boost::geometry::dsv(p) << std::endl;
-
- // or (with extension) like this:
- std::cout << boost::geometry::wkt(p) << std::endl;
-}
-
-void example_as_wkt_vector()
-{
- std::vector<boost::geometry::model::d2::point_xy<int> > v;
- boost::geometry::read_wkt<boost::geometry::model::d2::point_xy<int> >("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;
-}
-
-
-void example_centroid_polygon()
-{
- boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double> > 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::model::d2::point_xy<float> center;
- boost::geometry::centroid(poly, center);
- std::cout << "Centroid: " << boost::geometry::dsv(center) << std::endl;
-}
-
-
-void example_distance_point_point()
-{
- boost::geometry::model::d2::point_xy<double> p1(1, 1);
- boost::geometry::model::d2::point_xy<double> p2(2, 3);
- std::cout << "Distance p1-p2 is "
- << boost::geometry::distance(p1, p2)
- << " units" << std::endl;
-
- /*
- Extension, other coordinate system:
- // Read 2 Dutch cities from WKT texts (in decimal degrees)
- boost::geometry::point_ll<double, boost::geometry::cs::geographic<boost::geometry::degree> > a, r;
- boost::geometry::read_wkt("POINT(4.89222 52.3731)", a);
- boost::geometry::read_wkt("POINT(4.47917 51.9308)", r);
-
- std::cout << "Distance Amsterdam-Rotterdam is "
- << boost::geometry::distance(a, r) / 1000.0
- << " kilometers " << std::endl;
- */
-}
-
-void example_distance_point_point_strategy()
-{
- /*
- Extension, other coordinate system:
- typedef boost::geometry::point_ll<double, boost::geometry::cs::geographic<boost::geometry::degree> > LL;
- LL a, r;
- boost::geometry::read_wkt("POINT(4.89222 52.3731)", a);
- boost::geometry::read_wkt("POINT(4.47917 51.9308)", r);
-
- std::cout << "Distance Amsterdam-Rotterdam is "
- << boost::geometry::distance(a, r,
- boost::geometry::strategy::distance::vincenty<LL>() )
- / 1000.0
- << " kilometers " << std::endl;
- */
-}
-
-void example_from_wkt_point()
-{
- boost::geometry::model::d2::point_xy<int> 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<boost::geometry::model::d2::point_xy<int> > v;
- boost::geometry::read_wkt<boost::geometry::model::d2::point_xy<int> >("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::model::linestring<boost::geometry::model::d2::point_xy<double> > 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::model::polygon<boost::geometry::model::d2::point_xy<double> > 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;
-}
-
-void example_point_ll_convert()
-{
- /*
- Extension, other coordinate system:
- boost::geometry::point_ll<double, boost::geometry::cs::geographic<boost::geometry::degree> > deg(boost::geometry::latitude<>(33.0), boost::geometry::longitude<>(-118.0));
- boost::geometry::point_ll<double, boost::geometry::cs::geographic<boost::geometry::radian> > rad;
- boost::geometry::transform(deg, rad);
-
- std::cout << "point in radians: " << rad << std::endl;
- */
-}
-
-void example_intersection_linestring()
-{
- //[intersection_linestring
- typedef boost::geometry::model::d2::point_xy<double> P;
- std::vector<P> line1, line2;
- boost::geometry::read_wkt("linestring(1 1,2 2)", line1);
- boost::geometry::read_wkt("linestring(2 1,1 2)", line2);
-
- std::deque<P> intersection_points;
- boost::geometry::intersection(line1, line2, intersection_points);
- //]
-}
-
-void example_intersects_linestring()
-{
- //[intersects_linestring
- //` Check if two linestrings (here: vectors) intersect each other
- typedef boost::geometry::model::d2::point_xy<double> P;
- std::vector<P> line1, line2;
- boost::geometry::read_wkt("linestring(1 1,2 2)", line1);
- boost::geometry::read_wkt("linestring(2 1,1 2)", line2);
-
- bool b = boost::geometry::intersects(line1, line2);
- //]
-}
-
-
-
-void example_intersection_segment()
-{
- //[intersection_segment
- typedef boost::geometry::model::d2::point_xy<double> P;
- boost::geometry::model::segment<P> segment1, segment2;
- boost::geometry::read_wkt("linestring(1 1,2 2)", segment1);
- boost::geometry::read_wkt("linestring(2 1,1 2)", segment2);
-
- std::vector<P> intersections;
- boost::geometry::intersection(segment1, segment2, intersections);
- //]
-}
-
-void example_intersection_inserter_segment()
-{
- //[intersection_segment_inserter
-
- typedef boost::geometry::model::d2::point_xy<double> P;
- boost::geometry::model::segment<P> segment1, segment2;
- boost::geometry::read_wkt("linestring(1 1,2 2)", segment1);
- boost::geometry::read_wkt("linestring(2 1,1 2)", segment2);
-
- std::vector<P> intersections;
- boost::geometry::intersection_inserter<P>(segment1, segment2, std::back_inserter(intersections));
- //` The vector [*intersection] now contains one point: the intersection of the two segments.
- //` If segments do not intersect, the vector is empty.
- //` If segments happen to be collinear, the vector contains two points.
-
- //]
-}
-
-void example_intersects_segment()
-{
- //[intersects_segment
- //` Check if two segments intersect each other
- typedef boost::geometry::model::d2::point_xy<double> P;
- boost::geometry::model::segment<P> line1, line2;
- boost::geometry::read_wkt("linestring(1 1,2 2)", line1);
- boost::geometry::read_wkt("linestring(2 1,1 2)", line2);
-
- bool b = boost::geometry::intersects(line1, line2);
- //]
-}
-
-
-void example_clip_linestring1()
-{
- typedef boost::geometry::model::d2::point_xy<double> P;
- boost::geometry::model::linestring<P> 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::model::box<P> cb(P(1.5, 1.5), P(4.5, 2.5));
- std::cout << "Clipped linestring(s) " << std::endl;
-
- std::vector<boost::geometry::model::linestring<P> > intersection;
- boost::geometry::intersection_inserter<boost::geometry::model::linestring<P> >(cb, line, std::back_inserter(intersection));
-}
-
-void example_clip_linestring2()
-{
- typedef boost::geometry::model::d2::point_xy<double> P;
- std::vector<P> vector_in;
- boost::geometry::read_wkt<P>("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::model::box<P> cb(P(1.5, 1.5), P(4.5, 2.5));
- typedef std::vector<std::vector<P> > VV;
- VV vector_out;
- boost::geometry::intersection_inserter<std::vector<P> >(cb, vector_in, std::back_inserter(vector_out));
-
- std::cout << "Clipped vector(s) " << std::endl;
- for (VV::const_iterator it = vector_out.begin(); it != vector_out.end(); it++)
- {
- // TODO FIX THIS std::copy(it->begin(), it->end(), std::ostream_iterator<P>(std::cout, " "));
- std::cout << std::endl;
- }
-}
-
-
-
-
-
-void example_intersection_polygon1()
-{
- typedef boost::geometry::model::d2::point_xy<double> P;
- typedef std::vector<boost::geometry::model::polygon<P> > PV;
-
- boost::geometry::model::box<P> cb(P(1.5, 1.5), P(4.5, 2.5));
- boost::geometry::model::polygon<P> 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<boost::geometry::model::polygon<P> >(cb, poly, std::back_inserter(v));
-
- std::cout << "Clipped polygon(s) " << std::endl;
- for (PV::const_iterator it = v.begin(); it != v.end(); it++)
- {
- std::cout << boost::geometry::dsv(*it) << std::endl;
- }
-}
-
-void example_simplify_linestring1()
-{
- //[simplify
- //` Simplify a linestring
- boost::geometry::model::linestring<boost::geometry::model::d2::point_xy<double> > 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
- << " original line: " << boost::geometry::dsv(line) << std::endl
- << "simplified line: " << boost::geometry::dsv(simplified) << std::endl;
- //]
-}
-
-void example_simplify_linestring2()
-{
- //[simplify_inserter
- //` Simplify a linestring using an output iterator
- typedef boost::geometry::model::d2::point_xy<double> P;
- typedef boost::geometry::model::linestring<P> 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<P, P> DS;
- typedef boost::geometry::strategy::simplify::douglas_peucker<P, DS> simplification;
- // TODO FIX THIS boost::geometry::simplify_inserter(line, std::ostream_iterator<P>(std::cout, "\n"), 0.5, simplification());
- //]
-}
-
-
-
-void example_within()
-{
- boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double> > poly;
- boost::geometry::read_wkt("POLYGON((0 0,0 7,4 2,2 0,0 0))", poly);
- boost::geometry::model::d2::point_xy<float> point(3, 3);
- std::cout << "Point is "
- << (boost::geometry::within(point, poly) ? "IN" : "NOT in")
- << " polygon"
- << std::endl;
-}
-
-/*
-void example_within_strategy()
-{
- // TO BE UPDATED/FINISHED
- typedef boost::geometry::model::d2::point_xy<double> P;
- typedef boost::geometry::model::polygon<P> POLY;
- P p;
- std::cout << within(p, poly, strategy::within::cross_count<P>) << std::endl;
-}
-*/
-
-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;
- model::linestring<model::d2::point_xy<double> > line;
- read_wkt("linestring(0 0,1 1,4 8,3 2)", line);
- std::cout << "linestring length is "
- << length(line)
- << " units" << std::endl;
- //]
-
- /*
- Extension, other coordinate system:
- // Linestring in latlong, filled with
- // explicit degree-minute-second values
- typedef point_ll<float, 2, boost::geometry::cs::geographic<boost::geometry::degree> > LL;
- linestring<LL> line_ll;
- line_ll.push_back(LL(
- latitude<float>(dms<north, float>(52, 22, 23)),
- longitude<float>(dms<east, float>(4, 53, 32))));
- line_ll.push_back(LL(
- latitude<float>(dms<north, float>(51, 55, 51)),
- longitude<float>(dms<east, float>(4, 28, 45))));
- line_ll.push_back(LL(
- latitude<float>(dms<north, float>(52, 4, 48)),
- longitude<float>(dms<east, float>(4, 18, 0))));
- std::cout << "linestring length is "
- << length(line_ll) / 1000
- << " kilometers " << std::endl;
- */
-}
-
-void example_length_linestring_iterators2()
-{
- std::vector<boost::geometry::model::d2::point_xy<double> > line;
- boost::geometry::read_wkt<boost::geometry::model::d2::point_xy<double> >("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;
-}
-
-void example_length_linestring_iterators3()
-{
- /*
- Extension, other coordinate system:
- using namespace boost::geometry;
- typedef point_ll<float, boost::geometry::cs::geographic<boost::geometry::degree> > LL;
- std::deque<LL> line;
- boost::geometry::read_wkt<LL>("linestring(0 51,1 51,2 52)", std::back_inserter(line));
- std::cout << "linestring length is "
- << 0.001 * boost::geometry::length(line, boost::geometry::strategy::distance::vincenty<LL>())
- << " kilometers" << std::endl;
- */
-}
-
-
-void example_length_linestring_strategy()
-{
- //[length_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 model::point<float, 2, cs::spherical<degree> > P;
- model::linestring<P> line;
- line.push_back(P(2, 41));
- line.push_back(P(2, 48));
- line.push_back(P(5, 52));
- double const mean_radius = 6371.0; /*< [@http://en.wikipedia.org/wiki/Earth_radius Wiki] >*/
- std::cout << "length is "
- << length(line, strategy::distance::haversine<P>(mean_radius) )
- << " kilometers " << std::endl;
- //]
-}
-
-
-void example_envelope_linestring()
-{
- boost::geometry::model::linestring<boost::geometry::model::d2::point_xy<double> > line;
- boost::geometry::read_wkt("linestring(0 0,1 1,4 8,3 2)", line);
- boost::geometry::model::box<boost::geometry::model::d2::point_xy<double> > box;
- boost::geometry::envelope(line, box);
-
- std::cout << "envelope is " << boost::geometry::dsv(box) << std::endl;
-}
-
-void example_envelope_polygon()
-{
- /*
- Extension, other coordinate system:
- using namespace boost::geometry;
- typedef model::point_ll<double, boost::geometry::cs::geographic<boost::geometry::degree> > LL;
-
- // Wrangel island, 180 meridian crossing island above Siberia.
- model::polygon<LL> wrangel;
- wrangel.outer().push_back(LL(latitude<>(dms<north>(70, 47, 7)), longitude<>(dms<west>(178, 47, 9))));
- wrangel.outer().push_back(LL(latitude<>(dms<north>(71, 14, 0)), longitude<>(dms<east>(177, 28, 33))));
- wrangel.outer().push_back(LL(latitude<>(dms<north>(71, 34, 24)), longitude<>(dms<east>(179, 44, 37))));
- // Close it
- wrangel.outer().push_back(wrangel.outer().front());
-
- boost::geometry::model::box<LL> box;
- boost::geometry::envelope(wrangel, box);
-
- dms<cd_lat> minlat(box.min_corner().lat());
- dms<cd_lon> minlon(box.min_corner().lon());
-
- dms<cd_lat> maxlat(box.max_corner().lat());
- dms<cd_lon> maxlon(box.max_corner().lon());
-
- std::cout << wrangel << std::endl;
- std::cout << "min: " << minlat.get_dms() << " , " << minlon.get_dms() << std::endl;
- std::cout << "max: " << maxlat.get_dms() << " , " << maxlon.get_dms() << std::endl;
- */
-}
-
-
-void example_dms()
-{
- /*
- Extension, other coordinate system:
- // Construction with degree/minute/seconds
- boost::geometry::dms<boost::geometry::east> d1(4, 53, 32.5);
-
- // Explicit conversion to double.
- std::cout << d1.as_value() << std::endl;
-
- // Conversion to string, with optional strings
- std::cout << d1.get_dms(" deg ", " min ", " sec") << std::endl;
-
- // Combination with latitude/longitude and cardinal directions
- {
- using namespace boost::geometry;
- point_ll<double, boost::geometry::cs::geographic<boost::geometry::degree> > canberra(
- latitude<>(dms<south>(35, 18, 27)),
- longitude<>(dms<east>(149, 7, 27.9)));
- std::cout << canberra << std::endl;
- }
- */
-}
-
-void example_point_ll_construct()
-{
- /*
- Extension, other coordinate system:
- using namespace boost::geometry;
- typedef point_ll<double, boost::geometry::cs::geographic<boost::geometry::degree> > ll;
-
- // Constructions in both orders possible
- ll juneau(
- latitude<>(dms<north>(58, 21, 5)),
- longitude<>(dms<west>(134, 30, 42)));
- ll wladiwostok(
- longitude<>(dms<east>(131, 54)),
- latitude<>(dms<north>(43, 8))
- );
- */
-}
-
-
-
-int main(void)
-{
-
- example_centroid_polygon();
-
- example_intersection_linestring();
- example_intersects_linestring();
- example_intersection_segment();
- example_intersection_inserter_segment();
- example_intersects_segment();
-
-
- example_distance_point_point();
- example_distance_point_point_strategy();
-
- example_from_wkt_point();
- example_from_wkt_output_iterator();
- example_from_wkt_linestring();
- example_from_wkt_polygon();
-
- example_as_wkt_point();
-
- example_clip_linestring1();
- example_clip_linestring2();
- example_intersection_polygon1();
-
- example_simplify_linestring1();
- example_simplify_linestring2();
-
- example_length_linestring();
- example_length_linestring_iterators2();
- example_length_linestring_iterators3();
- example_length_linestring_strategy();
-
- example_envelope_linestring();
- example_envelope_polygon();
-
- example_within();
-
- example_point_ll_convert();
- example_point_ll_construct();
- example_dms();
-
-
- return 0;
-}

Deleted: trunk/libs/geometry/doc/snippets/qbk_1.vcproj
==============================================================================
--- trunk/libs/geometry/doc/snippets/qbk_1.vcproj 2011-01-08 09:01:04 EST (Sat, 08 Jan 2011)
+++ (empty file)
@@ -1,180 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="qbk_1"
- ProjectGUID="{861F130D-2849-4B50-B240-049DBD9D3F18}"
- RootNamespace="qbk_1"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)\qbk_1"
- ConfigurationType="1"
- InheritedPropertySheets=".\boost.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../../.."
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
- MinimalRebuild="true"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="kernel32.lib $(NoInherit)"
- LinkIncremental="2"
- GenerateDebugInformation="true"
- SubSystem="1"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)\qbk_1"
- ConfigurationType="1"
- InheritedPropertySheets=".\boost.vsprops"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../../.."
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- DebugInformationFormat="0"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="kernel32.lib $(NoInherit)"
- LinkIncremental="1"
- GenerateDebugInformation="false"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <File
- RelativePath=".\qbk_1.cpp"
- >
- </File>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>

Deleted: trunk/libs/geometry/doc/snippets/qbk_2.cpp
==============================================================================
--- trunk/libs/geometry/doc/snippets/qbk_2.cpp 2011-01-08 09:01:04 EST (Sat, 08 Jan 2011)
+++ (empty file)
@@ -1,167 +0,0 @@
-// Boost.Geometry (aka GGL, Generic Geometry Library)
-//
-// Copyright Barend Gehrels 2007-2009, Geodan, Amsterdam, the Netherlands
-// Copyright Bruno Lalande 2008, 2009
-// 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)
-//
-// Quickbook Examples, for main page
-
-#include <boost/tuple/tuple.hpp>
-
-#if defined(_MSC_VER)
-// We deliberately mix float/double's here so turn off warning
-//#pragma warning( disable : 4244 )
-#endif // defined(_MSC_VER)
-
-#include <boost/geometry/geometry.hpp>
-#include <boost/geometry/algorithms/overlaps.hpp>
-#include <boost/geometry/geometries/geometries.hpp>
-#include <boost/geometry/geometries/cartesian2d.hpp>
-#include <boost/geometry/geometries/register/point.hpp>
-#include <boost/geometry/geometries/adapted/tuple_cartesian.hpp>
-#include <boost/geometry/geometries/adapted/c_array_cartesian.hpp>
-#include <boost/geometry/geometries/adapted/std_as_linestring.hpp>
-
-
-// Small QRect simulations following http://doc.trolltech.com/4.4/qrect.html
-// Todo: once work the traits out further, would be nice if there is a real example of this.
-// However for the example it makes no difference, it will work any way.
-struct QPoint
-{
- int x, y;
- // In Qt these are methods but for example below it makes no difference
-};
-
-struct QRect
-{
- int x, y, width, height;
- QRect(int _x, int _y, int w, int h)
- : x(_x), y(_y), width(w), height(h)
- {}
- // In Qt these are methods but that will work as well, requires changing traits below
-};
-
-
-// Would be get/set with x(),y(),setX(),setY()
-BOOST_GEOMETRY_REGISTER_POINT_2D(QPoint, int, cs::cartesian, x, y)
-
-
-// Register the QT rectangle. The macro(s) does not offer (yet) enough flexibility to do this in one line,
-// but the traits classes do their job perfectly.
-namespace boost { namespace geometry { namespace traits
-{
-
-template <> struct tag<QRect> { typedef box_tag type; };
-template <> struct point_type<QRect> { typedef QPoint type; };
-
-template <size_t C, size_t D>
-struct indexed_access<QRect, C, D>
-{
- static inline int get(const QRect& qr)
- {
- // Would be: x(), y(), width(), height()
- return C == min_corner && D == 0 ? qr.x
- : C == min_corner && D == 1 ? qr.y
- : C == max_corner && D == 0 ? qr.x + qr.width
- : C == max_corner && D == 1 ? qr.y + qr.height
- : 0;
- }
-
- static inline void set(QRect& qr, const int& value)
- {
- // Would be: setX, setY, setWidth, setHeight
- if (C == min_corner && D == 0) qr.x = value;
- else if (C == min_corner && D == 1) qr.y = value;
- else if (C == max_corner && D == 0) qr.width = value - qr.x;
- else if (C == max_corner && D == 1) qr.height = value - qr.y;
- }
-};
-
-
-}}}
-
-
-void example_for_main_page()
-{
-
- //[main1
- //` Snippets below assume the namespace boost::geometry is known
- using namespace boost::geometry;
-
- //` It should be possible to use a very small part of the library, for example only the distance between two points.
- int a[2] = {1,1};
- int b[2] = {2,3};
- double d = distance(a, b);
- std::cout << "Distance a-b is:" << d << std::endl;
-
- //` 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<model::d2::point_xy<double> > poly;
- append(poly, points);
- boost::tuple<double, double> p = boost::make_tuple(3.7, 2.0);
- std::cout << "Point p is in polygon? " << (within(p, poly) ? "YES" : "NO") << std::endl;
-
- //` or area:
- std::cout << "Area: " << area(poly) << std::endl;
-
- //` It is possible, by the nature of a template library, to mix the point types declared above:
- double d2 = distance(a, p);
- std::cout << "Distance a-p is:" << d2 << std::endl;
-
- //]
-
- /***
- Now extension
- point_ll_deg amsterdam, paris;
- parse(amsterdam, "52 22 23 N", "4 53 32 E");
- parse(paris, "48 52 0 N", "2 19 59 E");
- std::cout << "Distance A'dam-Paris: " << distance(amsterdam, paris) / 1000.0 << " kilometers " << std::endl;
- ***/
-
- //[main3
- QRect r1(100, 200, 15, 15);
- QRect r2(110, 210, 20, 20);
- if (overlaps(r1, r2))
- {
- assign(r2, 200, 300, 220, 320);
- }
- //]
-}
-
-
-void example_for_transform()
-{
- using namespace boost::geometry;
-
- typedef model::point<double, 3, cs::cartesian> XYZ;
- typedef model::point<double, 3, cs::spherical<degree> > SPH;
- XYZ p;
-
- SPH sph1, sph2;
- assign(sph1, 12.5, 41.90, 1.0);
- // Go from spherical to Cartesian-3D:
- transform(sph1, p);
- // Go back from Cartesian 3D to spherical:
- transform(p, sph2);
-
- std::cout << dsv(p) << " <-> " << dsv(sph2) << std::endl;
-
- typedef model::d2::point_xy<double> XY;
- typedef model::d2::point_xy<int> PIXEL;
- XY xy(50, 50);
- strategy::transform::map_transformer<XY, PIXEL, false> map(0, 0, 100, 100, 1024, 768);
- PIXEL pix;
- transform(xy, pix, map);
- std::cout << pix.x() << "," << pix.y() << std::endl;
-
-}
-
-
-int main(void)
-{
- example_for_main_page();
- example_for_transform();
- return 0;
-}

Deleted: trunk/libs/geometry/doc/snippets/qbk_2.vcproj
==============================================================================
--- trunk/libs/geometry/doc/snippets/qbk_2.vcproj 2011-01-08 09:01:04 EST (Sat, 08 Jan 2011)
+++ (empty file)
@@ -1,182 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="qbk_2"
- ProjectGUID="{6CF6A521-57E0-4DA4-9D17-ED5D29E4208C}"
- RootNamespace="qbk_2"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)\qbk_2"
- ConfigurationType="1"
- InheritedPropertySheets=".\boost.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../../.."
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
- MinimalRebuild="true"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="kernel32.lib $(NoInherit)"
- LinkIncremental="2"
- GenerateDebugInformation="true"
- SubSystem="1"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine=""
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)\qbk_2"
- ConfigurationType="1"
- InheritedPropertySheets=".\boost.vsprops"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../../.."
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="kernel32.lib $(NoInherit)"
- LinkIncremental="1"
- GenerateDebugInformation="true"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine=""
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <File
- RelativePath=".\qbk_2.cpp"
- >
- </File>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>

Deleted: trunk/libs/geometry/doc/snippets/qbk_3.cpp
==============================================================================
--- trunk/libs/geometry/doc/snippets/qbk_3.cpp 2011-01-08 09:01:04 EST (Sat, 08 Jan 2011)
+++ (empty file)
@@ -1,75 +0,0 @@
-// Boost.Geometry (aka GGL, Generic Geometry Library)
-//
-// Copyright Barend Gehrels 2007-2009, Geodan, Amsterdam, the Netherlands
-// Copyright Bruno Lalande 2008, 2009
-// 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)
-//
-// Quickbook Examples, for e.g. email formal review
-
-#include <boost/foreach.hpp>
-
-#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/std_as_linestring.hpp>
-
-
-
-void example_distance()
-{
- int a[2] = {1,2};
- int b[2] = {3,4};
- double d = boost::geometry::distance(a, b);
- std::cout << d << std::endl;
-}
-
-void example_length1()
-{
- std::vector<boost::tuple<double, double, double> > line;
- line.push_back(boost::make_tuple(1, 2, 3));
- line.push_back(boost::make_tuple(4, 5, 6));
- line.push_back(boost::make_tuple(7, 8, 9));
- double length = boost::geometry::length(line);
- std::cout << length << std::endl;
-}
-
-void example_length2()
-{
- std::vector<boost::tuple<double, double> > line;
- line.push_back(boost::make_tuple(1.1, 2.2));
- line.push_back(boost::make_tuple(3.3, 4.4));
- line.push_back(boost::make_tuple(5.5, 6.6));
- std::cout << boost::geometry::length(
- std::make_pair(boost::begin(line), boost::end(line) + -1)
- )
- << std::endl;
-}
-
-void example_less()
-{
- typedef boost::tuple<double, double> P;
- std::vector<P> line;
- line.push_back(boost::make_tuple(8.1, 1.9));
- line.push_back(boost::make_tuple(4.2, 7.5));
- line.push_back(boost::make_tuple(2.3, 3.6));
- std::sort(line.begin(), line.end(), boost::geometry::less<P>());
-
- // Display ordered points
- BOOST_FOREACH(P const& p, line)
- {
- std::cout << boost::geometry::dsv(p) << std::endl;
- }
-}
-
-
-
-int main(void)
-{
- example_distance();
- example_length1();
- example_length2();
- example_less();
- return 0;
-}

Deleted: trunk/libs/geometry/doc/snippets/qbk_3.vcproj
==============================================================================
--- trunk/libs/geometry/doc/snippets/qbk_3.vcproj 2011-01-08 09:01:04 EST (Sat, 08 Jan 2011)
+++ (empty file)
@@ -1,182 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="qbk_3"
- ProjectGUID="{45D4139F-BC5B-4D48-BAB8-9901C53ECCC9}"
- RootNamespace="qbk_3"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)\qbk_3"
- ConfigurationType="1"
- InheritedPropertySheets=".\boost.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../../.."
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
- MinimalRebuild="true"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="kernel32.lib $(NoInherit)"
- LinkIncremental="2"
- GenerateDebugInformation="true"
- SubSystem="1"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine=""
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)\qbk_3"
- ConfigurationType="1"
- InheritedPropertySheets=".\boost.vsprops"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../../.."
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="kernel32.lib $(NoInherit)"
- LinkIncremental="1"
- GenerateDebugInformation="true"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine=""
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <File
- RelativePath=".\qbk_3.cpp"
- >
- </File>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>

Deleted: trunk/libs/geometry/doc/snippets/qbk_4.cpp
==============================================================================
--- trunk/libs/geometry/doc/snippets/qbk_4.cpp 2011-01-08 09:01:04 EST (Sat, 08 Jan 2011)
+++ (empty file)
@@ -1,326 +0,0 @@
-// Boost.Geometry (aka GGL, Generic Geometry Library)
-//
-// Copyright Barend Gehrels 2007-2009, Geodan, Amsterdam, the Netherlands
-// Copyright Bruno Lalande 2008, 2009
-// 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)
-//
-// Quickbook Examples, for documentation images
-
-#include <fstream>
-
-#include <boost/geometry/geometry.hpp>
-
-#include <boost/geometry/multi/multi.hpp>
-
-#include <boost/geometry/extensions/gis/io/wkt/wkt.hpp>
-#include <boost/geometry/extensions/io/svg/write_svg_multi.hpp>
-
-#include <boost/geometry/extensions/io/svg/svg_mapper.hpp>
-
-
-static const int wkt_countries_count = 1;
-std::string wkt_countries[wkt_countries_count] = {
- "MULTIPOLYGON(((3.369472 51.37461,3.31712 51.33633,3.338228 51.27769,3.476597 51.23314,3.474252 51.2988,3.553989 51.3246,3.720502 51.27535,3.753336 51.2261,3.887015 51.21203,3.983169 51.25659,4.123883 51.28942,4.222384 51.33163,4.311502 51.38792,4.442835 51.35274,4.38655 51.46297,4.541337 51.4747,4.517883 51.40903,4.67267 51.42075,4.759444 51.48642,4.848564 51.48642,4.771171 51.3973,4.968171 51.3973,5.022111 51.48642,5.099504 51.44186,5.06667 51.36447,5.132337 51.26597,5.20973 51.33163,5.219111 51.22141,5.448946 51.26597,5.514612 51.31991,5.592005 51.27769,5.570898 51.21203,5.711612 51.18858,5.800732 51.16747,5.878123 51.13464,5.800732 51.05724,5.767898 50.93763,5.645946 50.86024,5.678778 50.76174,5.821838 50.76174,6.025336 50.75425,6.403867 50.32674,6.13802 50.1329,5.73455 49.89968,5.816617 49.54663,5.477649 49.49361,4.856486 49.79186,4.877701 50.15532,4.148557 49.97853,4.206795 50.27324,3.694881 50.31094,3.139944 50.79072,2.795442 50.72651,2.546947 51.09281,3.369472 51.37461)))"
- //"MULTIPOLYGON(((4.222384 51.33163,4.201276 51.38792,4.13561 51.36447,4.025384 51.40903,4.016003 51.48642,4.091051 51.43013,4.213003 51.42075,4.288051 51.46297,4.234109 51.4958,4.048835 51.52864,3.971442 51.58492,4.058217 51.58492,4.156717 51.58492,4.156717 51.65059,4.255217 51.61776,4.344337 51.63886,4.419384 51.6717,4.574171 51.68342,4.705504 51.70453,4.81573 51.72564,4.750063 51.73736,4.541337 51.71626,4.353717 51.72564,4.255217 51.75847,4.069943 51.83586,3.99255 51.95547,4.180169 52.04459,4.365444 52.18765,4.550717 52.45031,4.67267 52.71298,4.738337 52.94281,4.804003 52.94281,4.881396 52.86542,4.968171 52.89826,5.054944 52.90998,5.111231 52.84431,5.111231 52.77161,5.162826 52.73643,5.228492 52.74582,5.287123 52.74112,5.287123 52.69188,5.233183 52.64497,5.125301 52.61683,5.071361 52.64262,5.015075 52.61214,5.080742 52.49018,5.01742 52.44328,5.080742 52.42921,4.956444 52.35885,5.031492 52.33071,5.120612 52.31898,5.183933 52.30257,5.244909 52.30491,5.341063 52.26739,5.399694 52.23924,5.523993 52.25566
,5.566207 52.3096,5.676433 52.36354,5.793696 52.41279,5.861708 52.47611,5.859363 52.53709,5.796041 52.57227,5.849981 52.59806,5.645946 52.60979,5.58966 52.64262,5.592005 52.75989,5.6436 52.80914,5.716303 52.8279,5.645946 52.84431,5.561516 52.82555,5.484123 52.84197,5.413766 52.83025,5.348099 52.87715,5.404385 52.89826,5.40673 52.9991,5.383279 53.07415,5.448946 53.21721,5.580279 53.30398,5.845291 53.36965,5.976624 53.38138,6.140792 53.39076,6.183005 53.32509,6.206459 53.39076,6.370625 53.40248,6.764627 53.47988,6.851399 53.40248,6.928792 53.33682,7.048399 53.28288,7.158627 53.25004,7.179733 53.17265,7.137519 53.12809,7.179733 52.98738,7.048399 52.87715,7.060126 52.62386,6.973351 52.63559,6.698958 52.64732,6.720066 52.56992,6.675507 52.52536,6.7529 52.47142,6.872507 52.42686,6.994459 52.48315,7.060126 52.38465,7.015567 52.29553,7.060126 52.25331,6.884233 52.13136,6.731792 52.09853,6.687233 52.02114,6.80684 52.01176,6.851399 51.94609,6.797459 51.90153,6.666125 51.90153,6.424565 51.83586,6.281507 51.85697,6.1407
92 51.90153,6.150171 51.83586,5.953171 51.83586,5.953171 51.74909,6.018838 51.70453,6.117339 51.6928,6.107958 51.61776,6.227565 51.51925,6.239291 51.42075,6.194732 51.34336,6.084505 51.25424,6.096231 51.1792,6.173625 51.21203,6.194732 51.14636,5.986005 51.03613,5.943792 51.08069,5.878123 51.03613,5.899231 50.97047,6.030564 50.97047,6.030564 50.9048,6.107958 50.9048,6.096231 50.83913,6.030564 50.82741,6.025336 50.75425,5.821838 50.76174,5.678778 50.76174,5.645946 50.86024,5.767898 50.93763,5.800732 51.05724,5.878123 51.13464,5.800732 51.16747,5.711612 51.18858,5.570898 51.21203,5.592005 51.27769,5.514612 51.31991,5.448946 51.26597,5.219111 51.22141,5.20973 51.33163,5.132337 51.26597,5.06667 51.36447,5.099504 51.44186,5.022111 51.48642,4.968171 51.3973,4.771171 51.3973,4.848564 51.48642,4.759444 51.48642,4.67267 51.42075,4.517883 51.40903,4.541337 51.4747,4.38655 51.46297,4.442835 51.35274,4.311502 51.38792,4.222384 51.33163)),((5.455981 52.55116,5.514612 52.5582,5.573243 52.59103,5.634219 52.59103,5.73272 52.
57462,5.791351 52.56758,5.854672 52.52771,5.8406 52.46908,5.756171 52.41279,5.674088 52.39403,5.573243 52.37058,5.540409 52.31664,5.507576 52.26504,5.397349 52.25097,5.294159 52.30725,5.198003 52.33305,5.134682 52.32836,5.153444 52.39403,5.411421 52.49488,5.455981 52.55116)),((4.222384 51.33163,4.123883 51.28942,3.983169 51.25659,3.887015 51.21203,3.753336 51.2261,3.720502 51.27535,3.553989 51.3246,3.474252 51.2988,3.476597 51.23314,3.338228 51.27769,3.31712 51.33633,3.369472 51.37461,3.467216 51.41137,3.600895 51.37854,3.718157 51.34336,3.840109 51.34805,3.924538 51.36447,3.952681 51.41607,4.011312 51.39496,4.072289 51.35509,4.128574 51.32225,4.222384 51.33163)),((3.40155 51.54036,3.500049 51.58258,3.56337 51.59665,3.619656 51.57554,3.659526 51.5216,3.720502 51.51456,3.781478 51.54036,3.887015 51.54271,3.971442 51.52864,4.016003 51.50753,3.999586 51.43717,3.9433 51.46062,3.879979 51.44186,3.854181 51.38792,3.753336 51.39027,3.65249 51.46062,3.556334 51.44421,3.483632 51.48173,3.429692 51.51456,3.40155 51.54
036)),((3.973788 51.84524,4.037109 51.81241,4.123883 51.7913,4.196586 51.76081,4.269289 51.71391,4.360754 51.69515,4.313848 51.65293,4.248181 51.65293,4.177824 51.67873,4.119193 51.69984,4.044145 51.71391,4.023039 51.7913,3.933919 51.80537,3.870598 51.77958,3.847145 51.83821,3.973788 51.84524)),((3.793204 51.74674,3.933919 51.73502,3.985514 51.68577,4.076979 51.667,4.116848 51.65293,4.023039 51.62714,3.931574 51.6201,3.865907 51.6459,3.826037 51.6928,3.76037 51.69984,3.692358 51.66935,3.647799 51.70922,3.713466 51.73502,3.793204 51.74674)),((4.806348 53.12574,4.879051 53.175,4.92361 53.13278,4.91423 53.0718,4.86967 53.0249,4.801658 52.99676,4.747718 52.97096,4.72192 53.0249,4.754754 53.0765,4.806348 53.12574)),((5.216766 53.39545,5.507576 53.4447,5.559171 53.43766,5.493505 53.41655,5.460672 53.39545,5.387969 53.3931,5.336373 53.37669,5.240219 53.36027,5.183933 53.33682,5.165171 53.36027,5.216766 53.39545)),((3.596204 51.60134,3.720502 51.60134,3.840109 51.61306,3.877634 51.55443,3.774442 51.56147,3.718157 51
.52864,3.645454 51.56147,3.596204 51.60134)),((5.636564 53.46346,5.728029 53.44939,5.852327 53.46112,5.941446 53.45877,5.88985 53.44001,5.800732 53.43063,5.716303 53.43063,5.674088 53.41421,5.622492 53.42828,5.60373 53.45408,5.636564 53.46346)),((5.008039 53.28757,5.050254 53.30398,5.094813 53.31102,5.120612 53.28991,5.001003 53.2688,4.982243 53.24066,4.932992 53.20548,4.862634 53.19845,4.890778 53.22659,4.970516 53.2688,5.008039 53.28757)),((6.138446 53.49395,6.27447 53.50567,6.307303 53.49629,6.236946 53.46815,6.154862 53.46581,6.12672 53.44939,6.100922 53.46581,6.138446 53.49395)),((6.419876 53.54085,6.483197 53.51974,6.42691 53.51506,6.396423 53.53382,6.419876 53.54085)))",
-};
-
-static const int wkt_cities_count = 1;
-std::string wkt_cities[wkt_cities_count] = {
- "MULTIPOINT(( -71.03 42.37), (-87.65 41.90), (-95.35 29.97), (-118.40 33.93), (-80.28 25.82), (-73.98 40.77), (-112.02 33.43), ( -77.04 38.85))"
-};
-
-
-
-// Read an ASCII file containing WKT's, fill a vector of tuples
-// The tuples consist of at least <0> a geometry and <1> an identifying string
-template <typename Geometry, typename Tuple, typename Box>
-void read_wkt(std::string const& filename, std::vector<Tuple>& tuples, Box& box)
-{
- std::ifstream cpp_file(filename.c_str());
- if (cpp_file.is_open())
- {
- while (! cpp_file.eof() )
- {
- std::string line;
- std::getline(cpp_file, line);
- Geometry geometry;
- boost::trim(line);
- if (! line.empty() && ! boost::starts_with(line, "#"))
- {
- std::string name;
-
- // Split at ';', if any
- std::string::size_type pos = line.find(";");
- if (pos != std::string::npos)
- {
- name = line.substr(pos + 1);
- line.erase(pos);
-
- boost::trim(line);
- boost::trim(name);
- }
-
- Geometry geometry;
- boost::geometry::read_wkt(line, geometry);
-
- Tuple tuple(geometry, name);
-
- tuples.push_back(tuple);
- boost::geometry::combine(box, boost::geometry::make_envelope<Box>(geometry));
- }
- }
- }
-}
-
-
-
-
-void svg_simplify_road()
-{
- static const int n = 1;
- std::string wkt[n] = {
- "LINESTRING(-122.191 47.9758,-122.181 47.9958,-122.177 48.0022,-122.171 48.0081,-122.174 48.0402,-122.178 48.0718,-122.181 48.1036,-122.183 48.1361,-122.189 48.143,-122.206 48.205,-122.231 48.2515,-122.261 48.2977,-122.291 48.3592,-122.297 48.4234,-122.299 48.5183,-122.324 48.6237,-122.41 48.7339,-122.407 48.7538,-122.4 48.7749,-122.399 48.793,-122.423 48.8044,-122.45 48.8124,-122.481 48.8304,-122.517 48.8718,-122.521 48.8813,-122.523 48.901,-122.527 48.9105,-122.543 48.919,-122.551 48.9305,-122.561 48.9411,-122.585 48.9471,-122.612 48.9669,-122.638 48.9849,-122.661 49.0022)",
- //"LINESTRING(-122.191 47.9758,-122.204 47.9372,-122.221 47.9019,-122.242 47.8674,-122.266 47.8312)",
- //"LINESTRING(-122.176 47.5801,-122.182 47.5932,-122.185 47.6067,-122.187 47.6202,-122.187 47.6338,-122.187 47.6691,-122.182 47.7052,-122.181 47.7412,-122.192 47.776,-122.2 47.7864,-122.212 47.7945,-122.223 47.8027,-122.232 47.8132,-122.241 47.8168,-122.25 47.821,-122.259 47.8258,-122.266 47.8312)",
- //"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::model::d2::point_xy<double> point_type;
-
- std::ofstream svg("simplify_road.svg");
- boost::geometry::svg_mapper<point_type> mapper(svg, 300, 300);
-
- boost::geometry::model::linestring<point_type> original[n], simplified[n];
-
- for (int i = 0; i < n; i++)
- {
- boost::geometry::read_wkt(wkt[i], original[i]);
- boost::geometry::simplify(original[i], simplified[i], 0.03);
- mapper.add(original[i]);
- mapper.add(simplified[i]);
- std::cout
- << "original: " << boost::size(original[i])
- << " simplified: " << boost::size(simplified[i])
- << std::endl;
- }
-
-
- for (int i = 0; i < n; i++)
- {
- mapper.map(original[i], "opacity:0.8;stroke:rgb(0,0,255);stroke-width:3");
- mapper.map(simplified[i], "opacity:0.8;stroke:rgb(0,255,0);stroke-width:2");
- }
-
-}
-
-
-void svg_simplify_country()
-{
-
- typedef boost::geometry::model::d2::point_xy<double> point_type;
-
- std::ofstream svg("simplify_country.svg");
- boost::geometry::svg_mapper<point_type> mapper(svg, 300, 300);
-
- boost::geometry::model::multi_polygon<boost::geometry::model::polygon<point_type> > original[wkt_countries_count]
- , simplified[wkt_countries_count];
-
- for (int i = 0; i < wkt_countries_count; i++)
- {
- boost::geometry::read_wkt(wkt_countries[i], original[i]);
- boost::geometry::simplify(original[i], simplified[i], 0.1);
- mapper.add(original[i]);
- mapper.add(simplified[i]);
- std::cout
- << "original: " << boost::geometry::num_points(original[i])
- << " simplified: " << boost::geometry::num_points(simplified[i])
- << std::endl;
- }
-
-
- for (int i = 0; i < wkt_countries_count; i++)
- {
- mapper.map(original[i], "opacity:0.8;fill:none;stroke:rgb(0,0,255);stroke-width:3");
- mapper.map(simplified[i], "opacity:0.8;fill:none;stroke:rgb(0,255,0);stroke-width:2");
- }
-}
-
-void svg_convex_hull_country()
-{
-
- typedef boost::geometry::model::d2::point_xy<double> point_type;
-
- std::ofstream svg("convex_hull_country.svg");
- boost::geometry::svg_mapper<point_type> mapper(svg, 300, 300);
-
- boost::geometry::model::multi_polygon<boost::geometry::model::polygon<point_type> > original[wkt_countries_count];
- boost::geometry::model::linear_ring<point_type> hull[wkt_countries_count];
-
- for (int i = 0; i < wkt_countries_count; i++)
- {
- boost::geometry::read_wkt(wkt_countries[i], original[i]);
- boost::geometry::convex_hull_inserter(original[i], std::back_inserter(hull[i]));
- mapper.add(original[i]);
- mapper.add(hull[i]);
- std::cout
- << "original: " << boost::geometry::num_points(original[i])
- << " hull: " << boost::geometry::num_points(hull[i])
- << std::endl;
- }
-
-
- for (int i = 0; i < wkt_countries_count; i++)
- {
- mapper.map(original[i], "opacity:0.8;fill:rgb(255,255,0);stroke:rgb(0,0,0);stroke-width:3");
- mapper.map(hull[i], "opacity:0.8;fill:none;stroke:rgb(255,0,0);stroke-width:3");
- }
-
-}
-
-
-void svg_convex_hull_cities()
-{
-
- typedef boost::geometry::model::d2::point_xy<double> point_type;
-
- std::ofstream svg("convex_hull_cities.svg");
- boost::geometry::svg_mapper<point_type> mapper(svg, 300, 300);
-
- boost::geometry::model::multi_point<point_type> original[wkt_cities_count];
-
- boost::geometry::model::linear_ring<point_type> hull[wkt_cities_count];
-
- for (int i = 0; i < wkt_cities_count; i++)
- {
- boost::geometry::read_wkt(wkt_cities[i], original[i]);
- boost::geometry::convex_hull_inserter(original[i], std::back_inserter(hull[i]));
- mapper.add(original[i]);
- mapper.add(hull[i]);
- std::cout
- << "original: " << boost::geometry::num_points(original[i])
- << " hull: " << boost::geometry::num_points(hull[i])
- << std::endl;
- }
-
-
- for (int i = 0; i < wkt_cities_count; i++)
- {
- mapper.map(original[i], "fill:rgb(255,255,0);stroke:rgb(0,0,100);stroke-width:1", 3);
- mapper.map(hull[i], "opacity:0.8;fill:none;stroke:rgb(255,0,0);stroke-width:3");
- }
-}
-
-void svg_intersection_roads()
-{
- // Read the road network
- typedef boost::geometry::model::d2::point_xy<double> point_type;
- typedef boost::geometry::model::linestring<point_type> line_type;
-
- typedef boost::tuple<line_type, std::string> road_type;
-
- boost::geometry::model::box<point_type> bbox;
- boost::geometry::assign_inverse(bbox);
-
- std::vector<road_type> roads;
- read_wkt<line_type>("../../../example/data/roads.wkt", roads, bbox);
-
- // intersect
- boost::geometry::model::box<point_type> clip;
- std::vector<line_type> intersected;
-
- boost::geometry::assign(clip, -100, 25, -90, 50);
- for (size_t i = 0; i < roads.size(); i++)
- {
- boost::geometry::intersection_inserter<line_type>(clip, roads[i].get<0>(), std::back_inserter(intersected));
- }
-
- // create map
- std::ofstream svg("intersection_roads.svg");
- boost::geometry::svg_mapper<point_type> mapper(svg, 500, 500);
-
- mapper.add(bbox);
-
- for (size_t i = 0; i < roads.size(); i++)
- {
- mapper.map(roads[i].get<0>(), "stroke:rgb(0,0,255);stroke-width:3");
- }
-
- for (size_t i = 0; i < intersected.size(); i++)
- {
- mapper.map(intersected[i], "stroke:rgb(0,255,0);stroke-width:2");
- }
-
- for (size_t i = 0; i < intersected.size(); i++)
- {
- mapper.map(clip, "fill:none;stroke:rgb(128,128,128);stroke-width:2");
- }
-}
-
-
-void svg_intersection_countries()
-{
- // Read the road network
- typedef boost::geometry::model::d2::point_xy<double> point_type;
- typedef boost::geometry::model::polygon<point_type> poly_type;
- typedef boost::geometry::model::multi_polygon<poly_type> mp_type;
-
- typedef boost::tuple<mp_type, std::string> country_type;
-
- boost::geometry::model::box<point_type> bbox;
- boost::geometry::assign_inverse(bbox);
-
- std::vector<country_type> countries;
- read_wkt<mp_type>("../../../example/data/world.wkt", countries, bbox);
-
- // intersect
- boost::geometry::model::box<point_type> clip;
- std::vector<poly_type> intersected;
-
- boost::geometry::assign(clip, -100, -50, 100, 50);
- for (size_t i = 0; i < countries.size(); i++)
- {
- mp_type const& mp = countries[i].get<0>();
- for (size_t j = 0; j < mp.size(); j++)
- {
- boost::geometry::intersection_inserter<poly_type>(clip, mp[j], std::back_inserter(intersected));
- }
- }
-
- // create map
- std::ofstream svg("intersection_countries.svg");
- boost::geometry::svg_mapper<point_type> mapper(svg, 800, 800);
-
- mapper.add(bbox);
-
- for (size_t i = 0; i < countries.size(); i++)
- {
- mapper.map(countries[i].get<0>().front(), "fill:rgb(0,0,255);stroke-width:1");
- }
-
- for (size_t i = 0; i < intersected.size(); i++)
- {
- mapper.map(intersected[i], "fill:rgb(0,255,0);stroke-width:1");
- }
-
- for (size_t i = 0; i < intersected.size(); i++)
- {
- mapper.map(clip, "fill:none;stroke:rgb(128,128,128);stroke-width:2");
- }
-}
-
-
-
-
-
-int main(void)
-{
- svg_intersection_roads();
- svg_intersection_countries();
- svg_simplify_road();
- svg_simplify_country();
- svg_convex_hull_country();
- svg_convex_hull_cities();
- return 0;
-}

Deleted: trunk/libs/geometry/doc/snippets/qbk_4.vcproj
==============================================================================
--- trunk/libs/geometry/doc/snippets/qbk_4.vcproj 2011-01-08 09:01:04 EST (Sat, 08 Jan 2011)
+++ (empty file)
@@ -1,182 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="qbk_4"
- ProjectGUID="{CBEDAEC7-EC87-4F91-9C45-F9505A052A44}"
- RootNamespace="qbk_4"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)\qbk_4"
- ConfigurationType="1"
- InheritedPropertySheets=".\boost.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../../..;../../../test"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
- MinimalRebuild="true"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="kernel32.lib $(NoInherit)"
- LinkIncremental="2"
- GenerateDebugInformation="true"
- SubSystem="1"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine=""
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)\qbk_4"
- ConfigurationType="1"
- InheritedPropertySheets=".\boost.vsprops"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../../..;../../../test"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="kernel32.lib $(NoInherit)"
- LinkIncremental="1"
- GenerateDebugInformation="true"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine=""
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <File
- RelativePath=".\qbk_4.cpp"
- >
- </File>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>

Deleted: trunk/libs/geometry/doc/snippets/qbk_5.cpp
==============================================================================
--- trunk/libs/geometry/doc/snippets/qbk_5.cpp 2011-01-08 09:01:04 EST (Sat, 08 Jan 2011)
+++ (empty file)
@@ -1,136 +0,0 @@
-// Boost.Geometry (aka GGL, Generic Geometry Library)
-//
-// Copyright Barend Gehrels 2007-2009, Geodan, Amsterdam, the Netherlands
-// Copyright Bruno Lalande 2008, 2009
-// 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)
-//
-// Quickbook Examples, for Geometry Concepts
-
-#include <boost/geometry/geometry.hpp>
-#include <boost/geometry/geometries/register/point.hpp>
-#include <boost/geometry/geometries/register/linestring.hpp>
-#include <boost/geometry/geometries/geometries.hpp>
-
-
-
-struct legacy_point1
-{
- double x, y;
-};
-
-// adapt legacy_point1
-namespace boost { namespace geometry { namespace traits
-{
- template <> struct tag<legacy_point1> { typedef point_tag type; };
- template <> struct coordinate_type<legacy_point1> { typedef double type; };
- template <> struct coordinate_system<legacy_point1> { typedef cs::cartesian type; };
- template <> struct dimension<legacy_point1>: boost::mpl::int_<2> {};
- template <> struct access<legacy_point1, 0>
- {
- static double get(legacy_point1 const& p) { return p.x; }
- static void set(legacy_point1& p, double const& value) { p.x = value; }
- };
- template <> struct access<legacy_point1, 1>
- {
- static double get(legacy_point1 const& p) { return p.y; }
- static void set(legacy_point1& p, double const& value) { p.y = value; }
- };
-}}} // namespace boost::geometry::traits
-// end adaptation
-
-namespace example_legacy_point1
-{
- // The first way to check a concept at compile time: checking if the input is parameter
- // or return type is OK.
- template <typename P>
- BOOST_CONCEPT_REQUIRES(((boost::geometry::concept::Point<P>)), (void))
- test1(P& p)
- {
- }
-
- // The second way to check a concept at compile time: checking if the provided type,
- // inside the function, if OK
- template <typename P>
- void test2(P& p)
- {
- BOOST_CONCEPT_ASSERT((boost::geometry::concept::Point<P>));
- }
-
-
- void example()
- {
- legacy_point1 p;
- test1(p);
- test2(p);
- }
-}
-
-// leave comment below for (strange behaviour of) doxygen
-class legacy_point2
-{
-public :
- double x() const;
- double y() const;
-};
-
-// adapt legacy_point2
-BOOST_GEOMETRY_REGISTER_POINT_2D_CONST(legacy_point2, double, boost::geometry::cs::cartesian, x(), y() )
-// end adaptation
-
-
-double legacy_point2::x() const { return 0; }
-double legacy_point2::y() const { return 0; }
-
-namespace example_legacy_point2
-{
- // test it using boost concept requires
-
- template <typename P>
- BOOST_CONCEPT_REQUIRES(((boost::geometry::concept::ConstPoint<P>)), (double))
- test3(P& p)
- {
- return boost::geometry::get<0>(p);
- }
-
- void example()
- {
- legacy_point2 p;
- test3(p);
- }
-}
-
-
-template <typename P>
-struct custom_linestring1 : std::deque<P>
-{
- int id;
-};
-
-// adapt custom_linestring1
-namespace boost { namespace geometry { namespace traits
-{
- template <typename P>
- struct tag< custom_linestring1<P> > { typedef linestring_tag type; };
-}}} // namespace boost::geometry::traits
-// end adaptation
-
-namespace example_custom_linestring1
-{
- void example()
- {
- typedef custom_linestring1<legacy_point1> L;
- BOOST_CONCEPT_ASSERT((boost::geometry::concept::Linestring<L>));
-
- }
-}
-
-int main(void)
-{
- example_legacy_point1::example();
- example_legacy_point2::example();
- example_custom_linestring1::example();
-
- return 0;
-}

Deleted: trunk/libs/geometry/doc/snippets/qbk_5.vcproj
==============================================================================
--- trunk/libs/geometry/doc/snippets/qbk_5.vcproj 2011-01-08 09:01:04 EST (Sat, 08 Jan 2011)
+++ (empty file)
@@ -1,182 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="qbk_5"
- ProjectGUID="{0CDE9E15-C937-4D05-B9BF-A2D96B8EAD33}"
- RootNamespace="qbk_5"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)\qbk_5"
- ConfigurationType="1"
- InheritedPropertySheets=".\boost.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../../..;../../../test"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
- MinimalRebuild="true"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="kernel32.lib $(NoInherit)"
- LinkIncremental="2"
- GenerateDebugInformation="true"
- SubSystem="1"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine=""
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)\qbk_5"
- ConfigurationType="1"
- InheritedPropertySheets=".\boost.vsprops"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../../..;../../../test"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="kernel32.lib $(NoInherit)"
- LinkIncremental="1"
- GenerateDebugInformation="true"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine=""
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <File
- RelativePath=".\qbk_5.cpp"
- >
- </File>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>

Deleted: trunk/libs/geometry/doc/snippets/qbk_examples.sln
==============================================================================
--- trunk/libs/geometry/doc/snippets/qbk_examples.sln 2011-01-08 09:01:04 EST (Sat, 08 Jan 2011)
+++ (empty file)
@@ -1,43 +0,0 @@
-Microsoft Visual Studio Solution File, Format Version 9.00
-# Visual C++ Express 2005
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qbk_1", "qbk_1.vcproj", "{861F130D-2849-4B50-B240-049DBD9D3F18}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qbk_2", "qbk_2.vcproj", "{6CF6A521-57E0-4DA4-9D17-ED5D29E4208C}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qbk_3", "qbk_3.vcproj", "{45D4139F-BC5B-4D48-BAB8-9901C53ECCC9}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qbk_4", "qbk_4.vcproj", "{CBEDAEC7-EC87-4F91-9C45-F9505A052A44}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qbk_5", "qbk_5.vcproj", "{0CDE9E15-C937-4D05-B9BF-A2D96B8EAD33}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Win32 = Debug|Win32
- Release|Win32 = Release|Win32
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {861F130D-2849-4B50-B240-049DBD9D3F18}.Debug|Win32.ActiveCfg = Debug|Win32
- {861F130D-2849-4B50-B240-049DBD9D3F18}.Debug|Win32.Build.0 = Debug|Win32
- {861F130D-2849-4B50-B240-049DBD9D3F18}.Release|Win32.ActiveCfg = Release|Win32
- {861F130D-2849-4B50-B240-049DBD9D3F18}.Release|Win32.Build.0 = Release|Win32
- {6CF6A521-57E0-4DA4-9D17-ED5D29E4208C}.Debug|Win32.ActiveCfg = Debug|Win32
- {6CF6A521-57E0-4DA4-9D17-ED5D29E4208C}.Debug|Win32.Build.0 = Debug|Win32
- {6CF6A521-57E0-4DA4-9D17-ED5D29E4208C}.Release|Win32.ActiveCfg = Release|Win32
- {6CF6A521-57E0-4DA4-9D17-ED5D29E4208C}.Release|Win32.Build.0 = Release|Win32
- {45D4139F-BC5B-4D48-BAB8-9901C53ECCC9}.Debug|Win32.ActiveCfg = Debug|Win32
- {45D4139F-BC5B-4D48-BAB8-9901C53ECCC9}.Debug|Win32.Build.0 = Debug|Win32
- {45D4139F-BC5B-4D48-BAB8-9901C53ECCC9}.Release|Win32.ActiveCfg = Release|Win32
- {45D4139F-BC5B-4D48-BAB8-9901C53ECCC9}.Release|Win32.Build.0 = Release|Win32
- {CBEDAEC7-EC87-4F91-9C45-F9505A052A44}.Debug|Win32.ActiveCfg = Debug|Win32
- {CBEDAEC7-EC87-4F91-9C45-F9505A052A44}.Debug|Win32.Build.0 = Debug|Win32
- {CBEDAEC7-EC87-4F91-9C45-F9505A052A44}.Release|Win32.ActiveCfg = Release|Win32
- {CBEDAEC7-EC87-4F91-9C45-F9505A052A44}.Release|Win32.Build.0 = Release|Win32
- {0CDE9E15-C937-4D05-B9BF-A2D96B8EAD33}.Debug|Win32.ActiveCfg = Debug|Win32
- {0CDE9E15-C937-4D05-B9BF-A2D96B8EAD33}.Debug|Win32.Build.0 = Debug|Win32
- {0CDE9E15-C937-4D05-B9BF-A2D96B8EAD33}.Release|Win32.ActiveCfg = Release|Win32
- {0CDE9E15-C937-4D05-B9BF-A2D96B8EAD33}.Release|Win32.Build.0 = Release|Win32
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal

Modified: trunk/libs/geometry/doc/src/examples/algorithms/Jamfile.v2
==============================================================================
--- trunk/libs/geometry/doc/src/examples/algorithms/Jamfile.v2 (original)
+++ trunk/libs/geometry/doc/src/examples/algorithms/Jamfile.v2 2011-01-08 09:01:04 EST (Sat, 08 Jan 2011)
@@ -13,3 +13,14 @@
 
 exe area : area.cpp ;
 exe area_with_strategy : area_with_strategy.cpp ;
+
+exe intersection_ls_ls_point : intersection_ls_ls_point.cpp ;
+exe intersection_segment : intersection_segment.cpp ;
+
+exe intersects_linestring : intersects_linestring.cpp ;
+
+exe length : length.cpp ;
+exe length_with_strategy : length_with_strategy.cpp ;
+
+exe simplify : length.cpp ;
+exe simplify_inserter : simplify_inserter.cpp ;

Added: trunk/libs/geometry/doc/src/examples/algorithms/intersection_ls_ls_point.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/doc/src/examples/algorithms/intersection_ls_ls_point.cpp 2011-01-08 09:01:04 EST (Sat, 08 Jan 2011)
@@ -0,0 +1,52 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright Barend Gehrels 2011, 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)
+//
+// Quickbook Example
+
+//[intersection_ls_ls_point
+//` Calculate the intersection of two linestrings
+
+#include <iostream>
+#include <deque>
+
+#include <boost/geometry/geometry.hpp>
+#include <boost/geometry/extensions/gis/io/wkt/wkt.hpp>
+#include <boost/geometry/geometries/adapted/std_as_linestring.hpp> /*< Adapts std::vector to linestring concept >*/
+
+#include <boost/foreach.hpp>
+
+
+int main()
+{
+ typedef boost::geometry::model::d2::point_xy<double> P;
+ std::vector<P> line1, line2;
+ boost::geometry::read_wkt("linestring(1 1,2 2,3 1)", line1);
+ boost::geometry::read_wkt("linestring(1 2,2 1,3 2)", line2);
+
+ std::deque<P> intersection_points;
+ boost::geometry::intersection(line1, line2, intersection_points);
+
+ BOOST_FOREACH(P const& p, intersection_points)
+ {
+ std::cout << " " << boost::geometry::wkt(p);
+ }
+ std::cout << std::endl;
+
+ return 0;
+}
+
+//]
+
+
+//[intersection_ls_ls_point_output
+/*`
+Output:
+[pre
+ POINT(1.5 1.5) POINT(2.5 1.5)
+]
+*/
+//]

Added: trunk/libs/geometry/doc/src/examples/algorithms/intersection_segment.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/doc/src/examples/algorithms/intersection_segment.cpp 2011-01-08 09:01:04 EST (Sat, 08 Jan 2011)
@@ -0,0 +1,51 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright Barend Gehrels 2011, 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)
+//
+// Quickbook Example
+
+//[intersection_segment
+//` Calculate the intersection point (or points) of two segments
+
+#include <iostream>
+
+#include <boost/geometry/geometry.hpp>
+#include <boost/geometry/extensions/gis/io/wkt/wkt.hpp>
+#include <boost/geometry/geometries/adapted/std_as_linestring.hpp> /*< Adapts std::vector to linestring concept >*/
+
+#include <boost/foreach.hpp>
+
+
+int main()
+{
+ typedef boost::geometry::model::d2::point_xy<double> P;
+ boost::geometry::model::segment<P> segment1, segment2;
+ boost::geometry::read_wkt("linestring(1 1,2 2)", segment1);
+ boost::geometry::read_wkt("linestring(2 1,1 2)", segment2);
+
+ std::vector<P> intersections;
+ boost::geometry::intersection(segment1, segment2, intersections);
+
+ BOOST_FOREACH(P const& p, intersections)
+ {
+ std::cout << " " << boost::geometry::wkt(p);
+ }
+ std::cout << std::endl;
+
+ return 0;
+}
+
+//]
+
+
+//[intersection_segment_output
+/*`
+Output:
+[pre
+ POINT(1.5 1.5)
+]
+*/
+//]

Added: trunk/libs/geometry/doc/src/examples/algorithms/intersects_linestring.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/doc/src/examples/algorithms/intersects_linestring.cpp 2011-01-08 09:01:04 EST (Sat, 08 Jan 2011)
@@ -0,0 +1,44 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright Barend Gehrels 2011, 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)
+//
+// Quickbook Example
+
+//[intersects_linestring
+//` Check if two linestrings intersect each other
+
+#include <iostream>
+
+#include <boost/geometry/geometry.hpp>
+#include <boost/geometry/extensions/gis/io/wkt/wkt.hpp>
+
+int main()
+{
+ // Calculate the intersects of a cartesian polygon
+ typedef boost::geometry::model::d2::point_xy<double> P;
+ boost::geometry::model::linestring<P> line1, line2;
+
+ boost::geometry::read_wkt("linestring(1 1,2 2,3 3)", line1);
+ boost::geometry::read_wkt("linestring(2 1,1 2,4 0)", line2);
+
+ bool b = boost::geometry::intersects(line1, line2);
+
+ std::cout << "Intersects: " << (b ? "YES" : "NO") << std::endl;
+
+ return 0;
+}
+
+//]
+
+
+//[intersects_linestring_output
+/*`
+Output:
+[pre
+Intersects: YES
+]
+*/
+//]

Added: trunk/libs/geometry/doc/src/examples/algorithms/length.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/doc/src/examples/algorithms/length.cpp 2011-01-08 09:01:04 EST (Sat, 08 Jan 2011)
@@ -0,0 +1,40 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright Barend Gehrels 2011, 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)
+//
+// Quickbook Example
+
+//[length
+ //` The following simple example shows the calculation of the length of a linestring containing three points
+
+#include <iostream>
+#include <boost/geometry/geometry.hpp>
+#include <boost/geometry/extensions/gis/io/wkt/wkt.hpp>
+
+
+int main()
+{
+ using namespace boost::geometry;
+ model::linestring<model::d2::point_xy<double> > line;
+ read_wkt("linestring(0 0,1 1,4 8,3 2)", line);
+ std::cout << "linestring length is "
+ << length(line)
+ << " units" << std::endl;
+
+ return 0;
+}
+
+//]
+
+
+//[length_output
+/*`
+Output:
+[pre
+linestring length is 15.1127 units
+]
+*/
+//]

Added: trunk/libs/geometry/doc/src/examples/algorithms/length_with_strategy.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/doc/src/examples/algorithms/length_with_strategy.cpp 2011-01-08 09:01:04 EST (Sat, 08 Jan 2011)
@@ -0,0 +1,42 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright Barend Gehrels 2011, 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)
+//
+// Quickbook Example
+
+//[length_with_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.
+
+#include <iostream>
+#include <boost/geometry/geometry.hpp>
+
+int main()
+{
+ using namespace boost::geometry;
+ typedef model::point<float, 2, cs::spherical<degree> > P;
+ model::linestring<P> line;
+ line.push_back(P(2, 41));
+ line.push_back(P(2, 48));
+ line.push_back(P(5, 52));
+ double const mean_radius = 6371.0; /*< [@http://en.wikipedia.org/wiki/Earth_radius Wiki] >*/
+ std::cout << "length is "
+ << length(line, strategy::distance::haversine<P>(mean_radius) )
+ << " kilometers " << std::endl;
+
+ return 0;
+}
+
+//]
+
+
+//[length_with_strategy_output
+/*`
+Output:
+[pre
+length is 1272.03 kilometers
+]
+*/
+//]

Added: trunk/libs/geometry/doc/src/examples/algorithms/simplify.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/doc/src/examples/algorithms/simplify.cpp 2011-01-08 09:01:04 EST (Sat, 08 Jan 2011)
@@ -0,0 +1,51 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright Barend Gehrels 2011, 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)
+//
+// Quickbook Example
+
+//[simplify
+//` Example showing how to simplify a linestring
+
+#include <iostream>
+#include <boost/geometry/geometry.hpp>
+
+/*< For this example we use Boost.Assign to add points >*/
+#include <boost/assign.hpp>
+
+using namespace boost::assign;
+
+
+int main()
+{
+ typedef boost::geometry::model::d2::point_xy<double> xy;
+
+ boost::geometry::model::linestring<xy> line;
+ line += xy(1.1, 1.1), xy(2.5, 2.1), xy(3.1, 3.1), xy(4.9, 1.1), xy(3.1, 1.9); /*< With Boost.Assign >*/
+
+ // Simplify it, using distance of 0.5 units
+ boost::geometry::model::linestring<xy> simplified;
+ boost::geometry::simplify(line, simplified, 0.5);
+ std::cout
+ << " original: " << boost::geometry::dsv(line) << std::endl
+ << "simplified: " << boost::geometry::dsv(simplified) << std::endl;
+
+
+ return 0;
+}
+
+//]
+
+
+//[simplify_output
+/*`
+Output:
+[pre
+ original: ((1.1, 1.1), (2.5, 2.1), (3.1, 3.1), (4.9, 1.1), (3.1, 1.9))
+simplified: ((1.1, 1.1), (3.1, 3.1), (4.9, 1.1), (3.1, 1.9))
+]
+*/
+//]

Added: trunk/libs/geometry/doc/src/examples/algorithms/simplify_inserter.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/geometry/doc/src/examples/algorithms/simplify_inserter.cpp 2011-01-08 09:01:04 EST (Sat, 08 Jan 2011)
@@ -0,0 +1,49 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright Barend Gehrels 2011, 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)
+//
+// Quickbook Example
+
+//[simplify_inserter
+//` Simplify a linestring using a back inserter
+
+#include <iostream>
+#include <boost/geometry/geometry.hpp>
+
+int main()
+{
+ typedef boost::geometry::model::d2::point_xy<double> P;
+ typedef boost::geometry::model::linestring<P> L;
+
+ L line;
+ line.push_back(P(1.1, 1.1));
+ line.push_back(P(2.5, 2.1));
+ line.push_back(P(3.1, 3.1));
+ line.push_back(P(4.9, 1.1));
+ line.push_back(P(3.1, 1.9));
+
+ L simplified;
+ boost::geometry::simplify_inserter(line, std::back_inserter(simplified), 0.5);
+
+ std::cout
+ << " original: " << boost::geometry::dsv(line) << std::endl
+ << "simplified: " << boost::geometry::dsv(simplified) << std::endl;
+
+ return 0;
+}
+
+//]
+
+
+//[simplify_inserter_output
+/*`
+Output:
+[pre
+ original: ((1.1, 1.1), (2.5, 2.1), (3.1, 3.1), (4.9, 1.1), (3.1, 1.9))
+simplified: ((1.1, 1.1), (3.1, 3.1), (4.9, 1.1), (3.1, 1.9))
+]
+*/
+//]

Copied: trunk/libs/geometry/doc/src/examples/quick_start.cpp (from r67591, /trunk/libs/geometry/doc/snippets/qbk_2.cpp)
==============================================================================
--- /trunk/libs/geometry/doc/snippets/qbk_2.cpp (original)
+++ trunk/libs/geometry/doc/src/examples/quick_start.cpp 2011-01-08 09:01:04 EST (Sat, 08 Jan 2011)
@@ -18,7 +18,6 @@
 #include <boost/geometry/geometry.hpp>
 #include <boost/geometry/algorithms/overlaps.hpp>
 #include <boost/geometry/geometries/geometries.hpp>
-#include <boost/geometry/geometries/cartesian2d.hpp>
 #include <boost/geometry/geometries/register/point.hpp>
 #include <boost/geometry/geometries/adapted/tuple_cartesian.hpp>
 #include <boost/geometry/geometries/adapted/c_array_cartesian.hpp>


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