|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r57288 - in sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input: . images pages sourcecode
From: barend.gehrels_at_[hidden]
Date: 2009-11-02 10:54:36
Author: barendgehrels
Date: 2009-11-02 10:54:35 EST (Mon, 02 Nov 2009)
New Revision: 57288
URL: http://svn.boost.org/trac/boost/changeset/57288
Log:
Reflection to changes in GGL
Added:
sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/images/svg_convex_hull_cities.png (contents, props changed)
sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/images/svg_convex_hull_country.png (contents, props changed)
sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/images/svg_intersection_countries.png (contents, props changed)
sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/images/svg_intersection_polygon_box.png (contents, props changed)
sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/images/svg_intersection_polygon_ring.png (contents, props changed)
sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/images/svg_intersection_ring_box.png (contents, props changed)
sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/images/svg_intersection_ring_ring.png (contents, props changed)
sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/images/svg_intersection_roads.png (contents, props changed)
sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/images/svg_simplify_country.png (contents, props changed)
sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/images/svg_simplify_road.png (contents, props changed)
sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/images/svg_union_polygon_box.png (contents, props changed)
sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/images/svg_union_polygon_ring.png (contents, props changed)
sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/images/svg_union_ring_box.png (contents, props changed)
sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/images/svg_union_ring_ring.png (contents, props changed)
sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/pages/doxygen_z_article09.hpp (contents, props changed)
sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/sourcecode/doxygen_3.cpp (contents, props changed)
sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/sourcecode/doxygen_3.vcproj (contents, props changed)
sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/sourcecode/doxygen_4.cpp (contents, props changed)
sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/sourcecode/doxygen_4.vcproj (contents, props changed)
Text files modified:
sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/ggl_doxygen_footer.html | 2
sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/pages/doxygen_design_cross_section.hpp | 18 +++---
sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/sourcecode/doxygen_examples.cpp | 106 ++++++---------------------------------
sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/sourcecode/doxygen_examples.sln | 12 ++++
4 files changed, 41 insertions(+), 97 deletions(-)
Modified: sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/ggl_doxygen_footer.html
==============================================================================
--- sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/ggl_doxygen_footer.html (original)
+++ sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/ggl_doxygen_footer.html 2009-11-02 10:54:35 EST (Mon, 02 Nov 2009)
@@ -3,7 +3,7 @@
<tbody>
<tr>
<td align="left"><small>
-<p>October 13, 2009</p>
+<p>October 30, 2009</p>
</small></td>
<td align="right">
<small>Copyright © 1995-2009 Barend Gehrels, Geodan, Amsterdam<br>
Added: sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/images/svg_convex_hull_cities.png
==============================================================================
Binary file. No diff available.
Added: sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/images/svg_convex_hull_country.png
==============================================================================
Binary file. No diff available.
Added: sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/images/svg_intersection_countries.png
==============================================================================
Binary file. No diff available.
Added: sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/images/svg_intersection_polygon_box.png
==============================================================================
Binary file. No diff available.
Added: sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/images/svg_intersection_polygon_ring.png
==============================================================================
Binary file. No diff available.
Added: sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/images/svg_intersection_ring_box.png
==============================================================================
Binary file. No diff available.
Added: sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/images/svg_intersection_ring_ring.png
==============================================================================
Binary file. No diff available.
Added: sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/images/svg_intersection_roads.png
==============================================================================
Binary file. No diff available.
Added: sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/images/svg_simplify_country.png
==============================================================================
Binary file. No diff available.
Added: sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/images/svg_simplify_road.png
==============================================================================
Binary file. No diff available.
Added: sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/images/svg_union_polygon_box.png
==============================================================================
Binary file. No diff available.
Added: sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/images/svg_union_polygon_ring.png
==============================================================================
Binary file. No diff available.
Added: sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/images/svg_union_ring_box.png
==============================================================================
Binary file. No diff available.
Added: sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/images/svg_union_ring_ring.png
==============================================================================
Binary file. No diff available.
Modified: sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/pages/doxygen_design_cross_section.hpp
==============================================================================
--- sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/pages/doxygen_design_cross_section.hpp (original)
+++ sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/pages/doxygen_design_cross_section.hpp 2009-11-02 10:54:35 EST (Mon, 02 Nov 2009)
@@ -461,7 +461,7 @@
So Cartesian is simple, for geographic we can also select if its coordinates stored in degrees or in radians.
-The distance function now will change: it will select the computation method for the corresponding coordinate system and then call the dispatch struct for distance. We call the computation method specialized for coordinate systems a strategy. So the new version of the distance function is:
+The distance function now will change: it will select the computation method for the corresponding coordinate system and then call the dispatch struct for distance. We call the computation method specialized for coordinate systems a \b strategy. So the new version of the distance function is:
\code
template <typename G1, typename G2>
@@ -488,16 +488,14 @@
The strategy_distance mentioned here is a struct with specializations for different coordinate systems.
\code
-template <typename T1, typename T2,
- typename P1, typename P2, int D>
+template <typename T1, typename T2, typename P1, typename P2, int D>
struct strategy_distance
{
typedef void type;
};
template <typename P1, typename P2, int D>
-struct strategy_distance
-<cartesian, cartesian, P1, P2, D>
+struct strategy_distance<cartesian, cartesian, P1, P2, D>
{
typedef pythagoras<P1, P2, D> type;
};
@@ -519,8 +517,10 @@
\endcode
For geography, we have some alternatives for distance calculation. There is the Andoyer method[*], fast and precise, and there is the Vincenty method[*], slower and more precise, and there are some less precise approaches as well.
-We have to define one strategy as the default strategy.
-Besides that, we modify our design again and add an overload for the distance algorithm, taking a strategy. That enables us to call distance with any strategy, not just the default strategy but also specified strategies.
+
+Per coordinate system, one strategy is defined as the default strategy.
+To be able to use any strategy, we modify our design again and add an overload for the distance algorithm, taking a strategy. That enables us to call distance with another strategy.
+
This new overload distance function also has the advantage that the strategy can be constructed outside the distance function. Because it was constructed inside above, it could not have construction parameters. But for Andoyer or Vincenty, or the haversine formula, it certainly makes sense to have a constructor taking the radius of the earth as a parameter.
So the distance overloaded function is:
@@ -537,7 +537,9 @@
}
\endcode
-The strategy has to have a method apply taking two points as argument. [[[for points!]]]
+The strategy has to have a method apply taking two points as argument (for points). It is not required that it is a static method. A strategy
+might define a constructor, where a configuration value is passed and stored as a member variable. In those cases a static
+method would be inconvenient. It can be implemented as a normal method (with the const qualifier).
We do not list all implementations here, Vincenty would cover half a page of mathematics, but you will understand the idea. We can call distance like this:
\code
Added: sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/pages/doxygen_z_article09.hpp
==============================================================================
--- (empty file)
+++ sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/pages/doxygen_z_article09.hpp 2009-11-02 10:54:35 EST (Mon, 02 Nov 2009)
@@ -0,0 +1,238 @@
+// Generic Geometry Library
+//
+// Copyright Barend Gehrels 1995-2009, Geodan Holding B.V. 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)
+
+#ifndef _DOXYGEN_ARTICLE2009_HPP
+#define _DOXYGEN_ARTICLE2009_HPP
+
+
+//---------------------------------------------------------------------------------------------------
+
+/*!
+\page art09 A Generic Geometry Library (web-copy of article for BoostCon'09)
+
+
+Authors:
+- Barend Gehrels
+- Bruno Lalande
+
+This page is a web-version of the article <b>A Generic Geometry Library</b>, for BoostCon'09.
+
+<i>Note: this article is written December 2008, it is not updated (besides the namespace). There might be some things out of date. But most things are still as described here, be it that the Geographic stuff is moved to an extension.</i>
+
+\section art09_abstract Abstract
+The Generic Geometry Library (GGL) is a library for geometry and geography. It is based on templates and static polymorphism. It is agnostic in coordinate space, coordinate system, and dimensions. The library is non intrusive and uses concepts for geometries for its algorithms. Developers can either use the provided geometries or define or use their own geometry types and specializations. Essential algorithms such as distance calculations, area calculations, point in polygon calculations are available. A geometry library like described would be a valuable addition to the Boost Library Collection.
+
+\section art09_intro Introduction
+The Boost Library Collection currently still does not have any geometry library. In the past years several discussions and previews have been published on the Boost Mailing Lists. There is certainly interest for a library handling geometry within the Boost community; it would be valuable if geometry algorithms are available for the Boost users. Such algorithms are for instance: the distance between two points, the area of a polygon, or determining if a point is in a polygon.
+Geometry is used in many disciplines and there are many approaches possible. Depending on their interest programmers feel other needs. Developers creating games will need other geometries, other algorithms, other dimensions and coordinate representations than developers creating CAD, geographic applications, astronomic or control software for robotics. Besides that, programmers have their personal flavors.
+
+
+It is a major challenge to develop a consistent library containing every aspect of geometry, on which everyone agrees.
+This article describes one attempt of a geometry library. The Generic Geometry Library (GGL) developed and restyled in 2008 has been presented, at the time of writing, as a preview three times. With the feedback from the Boost community the library is enhanced and extended, it has been changed a lot and the library is better than it was before. It is still in preview phase and not yet reviewed nor accepted. There are other candidate libraries for geometry as well. This paper describes the characteristics and basic principles of the Generic Geometry Library.
+The Generic Geometry Library has been initiated by Geodan. Geodan is a company for Geographic Information Systems. Bruno Lalande, who has contributed to Boost libraries before, joined the team of developers.
+
+\section art09_concepts Geometry Concepts
+
+A geometry library should define geometry concepts and should implement algorithms working with those concepts. The library can then handle any geometry type modeled according to the concept.
+The task of selecting geometries and giving them proper names can already be a challenge and a subject for much discussion. The Wikipedia list of geometric shapes contains more than 30 different polygons, furthermore a dozen of triangles, rectangles, squares, kites, trapezoids, circles, ellipses, three dimensional shapes as polyhedrons, spheres. The list is probably never ending.
+The Generic Geometry Library is not attempting to create concepts for all these shapes. Instead, it models four concepts of basic geometries:
+- a point
+- a sequence of points (a linestring)
+- a point sequence which is closed (a (linear) ring)
+- a polygon (an outer ring which can optionally contain inner rings, also called donuts or holes)
+
+With those four concepts, all two dimensional shapes composed of straight line segments (triangles, rectangular and polygonal, etc.) can be built. How to handle curved geometries in two dimensions is not yet worked out. An equivalent system might be used where segments between three points are marked as curved.
+The Generic Geometry Library defines concepts and provides default implementations of these concepts. Besides these predefined types, other types can be handled as well. Any point type that defines the required properties, at compile-time, and thus satisfies the point concept requirements can be used.
+The linear ring and the linestring concepts follow Boost Range Library concepts. Ranges are used to iterate through sequences of points. Therefore algorithms as length or area also work on a std::vector of points. The names of these concepts and of the provided geometries are consistent with the naming system of the OGC, described below. The names are also used for tags related to the tag dispatching mechanism, which is used internally to distinguish geometry types.
+For convenience three other concepts are defined:
+- a box: to be able to select things, for spatial indexing, and to keep track of boundaries of geometries
+- an n-sphere: circle or sphere, to be able to select things
+- a segment: a part of line bounded by two points, to calculate e.g. distances and intersections
+
+Besides defining custom types, library users can make specializations of algorithms for their geometry types and in such way implement support for, for example, triangles. This will be worked out below.
+The Boost Concept Check Library (BCCL) is used internally to check if the developers input follows the concepts expected by the library.
+
+
+
+\section art09_dim Dimensions
+The Generic Geometry Library is basically agnostic in its dimensions. A point is templatized by the number of dimensions, by coordinate type (integer, float, double, GMP), and by the coordinate system.
+Examples:
+- point<double, 2, cartesian>: a point in two dimensions
+- point<double, 3, cartesian>: a point in three dimensions
+- polygon< point<double, 2, spherical<radian> > >: a spherical polygon, measured in radians
+
+Although points of any dimensions can be created, most algorithms are currently not prepared to handle all possible dimensions. Most algorithms that are provided handle points in Cartesian, Geographic or Spherical coordinate systems.
+A template parameter defining how to handle calculations in algorithms using big number types might be added in the future.
+
+
+\section art09_cs Coordinate systems
+A generic library handling geometry should be neutral in its coordinate space. In geography, points can be specified using X and Y (and Z), but also using Latitude and Longitude (and Height). In other disciplines there might be need for other names, for example: red, green and blue (defining colors in a color cube), or right ascension and declination (in astronomy).
+The concepts of the Generic Geometry Library use therefore neutral names (get and set) for accessing and modifying coordinates. Example, setting a point to (3,2):
+\code
+ggl::point<double, 2, cartesian> a;
+ggl::set<0>(a, 3);
+ggl::set<1>(a, 2);
+\endcode
+
+Or, alternatively:
+\code
+ggl::assign(a, 3, 2);
+\endcode
+
+These calls are generic. Library users might also choose to use or define more context targeted methods as a.x() and a.y() for setting and getting coordinates, or non default constructors. This as long as they also provide the specializations needed to enable the library to play with points the way shown above.
+The Generic Geometry Library provides a generic transform algorithm which can transform geometries from one coordinate system to another.
+
+
+\section art09_types Types And Strategies
+
+Algorithms depend on coordinate system. Lets take, for example, the distance calculation between two points. For points in a Cartesian coordinate space the simple and well known Pythagorean theorem applies. For points in the geographic coordinate system (latitude longitude, also known as latlong, lola or ll) the distance can be calculated using the haversine formula (it is possible to select other formulas as well, which is described below).
+The Generic Geometry Library provides a tag dispatching system which selects strategies based on coordinate system. So distances and areas for spherical coordinates are internally calculated differently then distances and areas for Cartesian coordinates. This is, by default, not visible for the library user, it is an automatic tag dispatching system.
+The tag dispatching system is also used to distinguish geometry types internally. So the generic distance algorithm can get two points (in any coordinate system) as input, but also a point and a linestring, a point and a polygon, et cetera.
+
+Example showing different strategies for different coordinate systems:
+\code
+ggl::point_xy<double> a(1,1), b(3,4);
+std::cout << ggl::distance(a, b);
+
+typedef ggl::point_ll<> LL;
+LL A, B;
+// initialize lat-long coordinates
+// e.g., Amsterdam and Barcelona
+// ...
+std::cout << ggl::distance(A, B);
+\endcode
+This example uses two different point types. In the first part the Pythagorean theorem is used to calculate the distance between point a and point b. In the second part the distance along the sphere of earth is used (as the crow flies). Note that the non default constructor shown in the first line is not part of the concept; it is part of the implementation (so part of the example above).
+As described, distance is calculated using strategies for different coordinate systems. The distance algorithm selects automatically right specialization belonging to the geometry type, and then it selects the strategy belonging to the coordinate system. This strategy is then used for calculation.
+Algorithms in the Generic Geometry Library also have an overload where the strategy can be specified by the library user. This is useful for, for example, calculating distance along the earth (or along any sphere). There are several methods for that calculation, using internally either a fast or a precise algorithm. The library user can select such a strategy or can implement his or her own strategy. For example, to use the exact Vincenty geodetic calculation (provided by the library):
+\code
+std::cout << distance(A, B,
+ strategy::distance::vincenty<LL>())
+ << std::endl;
+\endcode
+Algorithms as simplification (removing non important points from point sequences such that shape is preserved) use, internally, distance calculations. The same mechanism is used there. Therefore simplification works for Cartesian polygons the same as for polygons with geographical coordinates. It is exactly the same implementation.
+
+
+\section art09_specializations Specializations
+Besides strategies, library users have also other options for customization. For example: the Generic Geometry Library itself does not support triangles. Instead it supports polygons (which might contain holes) and linear rings. However, if the library user wants to use triangles directly, he can implement his own type. Lets work this example out. A triangle can be represented by three coordinate pairs. The library user can make a triangle of his own points (in this case: custom_point), using e.g. a boost::array.
+\code
+struct triangle : public boost::array<custom_point, 3>
+{};
+\endcode
+The user then has to indicate that this geometry is handled as a linear ring. He therefore has to provide a specialization of the tag metafunction, defining a type for the tag dispatching mechanism. This should reside in the namespace ggl:
+\code
+namespace ggl
+{
+ template <>
+ struct tag<triangle>
+ {
+ typedef ring_tag type;
+ };
+}
+\endcode
+As soon as this is done, the library will automatically select the ring specializations for all triangle algorithms. Because the Generic Geometry Library handles a ring as being a range, the user does not have to provide anything more. The Boost Range library concepts are used internally for all iterations.
+So the area of the users custom-points-triangle will be calculated correctly, using internally an iterator which walks through the point coordinates.
+But wait, for triangle that is not as efficient as possible! No problem, the developer can, if desired, implement a specialization for the area function:
+\code
+template<>
+double area<triangle>(const triangle& t)
+{
+ return 0.5 * (
+ (t[1].x() - t[0].x()) * (t[2].y() - t[0].y())
+ - (t[2].x() - t[0].x()) * (t[1].y() - t[0].y())
+ );
+}
+\endcode
+
+Now this specialization will be used to calculate the area of the developers triangles, while for other algorithms (centroid, within, intersection, et cetera) the generic ring versions still being used.
+The Generic Geometry Library also provides a second way to specialize. Within the dispatch namespace, structs are available for all operations. They can be partially specialized such that, for example, a triangle templatized by point type will be handled correctly by the library.
+
+
+\section art09_conventions Names And Conventions
+
+All geometry types and algorithms are named following the specifications of the Open Geospatial Consortium (OGC). The naming system of the OGC is carefully thought-out and has been agreed upon by a broad community. Additional algorithms and geometry types are named as much as possible using the same conventions and systematics.
+OGC conventions, geometry types and spatial operations are widely used, a.o. in spatial databases, such as PostGreSQL, MySQL, Oracle, and SQL Server.
+The OGC defines the following algorithms:
+- Basic algorithms: dimension, envelope, as_text, as_binary, is_simple, is_empty
+- Query algorithms: equals, disjoint, intersects, touches, crosses, within, contains, overlaps, relate, locate_along, locate_between
+- Analysis algorithms: distance, buffer, convex_hull, intersection, union, difference, sym_difference
+- Geometry type dependant algorithms: area, length, centroid, point_on_surface
+
+All algorithms are planned to be implemented. Besides this there are some other algorithms provided or planned:
+- Simplify, densify, disperse, spline, triangulate
+- Coordinate system conversions: transform
+
+The last one, transform, transforms geometries from any coordinate system to any other coordinate system. For example from radian to degree, but also from spherical to a 3D X,Y,Z coordinate system, or calling a map projection.
+Textual representations of geometries (Well-Known Text or WKT) are also provided by the library, as well as the parsing of them.
+The OGC also defines geometry types containing a collection of geometries, which are planned to be supported:
+- multi_point
+- multi_linestring
+- multi_polygon
+
+The Generic Geometry Library is not OGC compliant in the strict sense. It sometimes deviates from the specifications to enable genericity. It uses Boost Range concepts for the linestring geometry type. The library user can therefore use any standard container or Range compatible type as a linestring (a sequence of points). And the output of intersections is, for example, modeled as an output iterator instead of a multi_polygon or a multi_linestring.
+
+
+\section art09_index Spatial Indexes
+In geometry or GIS, spatial indexes can be used to search geometries or to enhance or speed up determination of geometry relationships. In 2008, a student, within the framework of the Google Summer of Code, has worked out a first version of a spatial indexing library which uses the Generic Geometry Library. This will be worked out and extended in the future.
+The Priority R-Tree, an R-Tree having optimal performance for any query window, will be available for fast searches within a set of geometries.
+
+
+\section art09_proj Map Projections
+
+The Generic Geometry Library can be used as a generic library for Geographic Information Systems (GIS). It therefore contains map projections. Map projections are algorithms to map the spherical earth to a flat piece of paper. There are many ways to do this. The USGS has implemented over the years 92 projection algorithms, collected in an often used PROJ4 package, written in C. This package is recently fitted into the Generic Geometry Library by converting it to a set of C++ templates.
+The projection collection contains both static as dynamic polymorphism. It is possible to instantiate a projection declaring the wished projection itself, for example:
+\code
+typedef ggl::point_ll<double, geographic<> > LL;
+typedef ggl::point_xy<double> XY;
+projection::merc_ellipsoid<LL, XY> prj(
+ "+ellps=WGS84 +lon_0=11.6E");
+
+// Define Amsterdam / Barcelona
+LL amsterdam, barcelona;
+// Initialize A'dam / B'ona
+...
+XY ma, mb; // Declare points
+// and project (from latlong to XY)
+if (prj.forward(amsterdam, ma)
+ && prj.forward(barcelona, mb))
+{ ... }
+\endcode
+
+This will use static polymorphism. Note that the initialization string is conform PROJ4, but it is also possible to initialize projections with e.g. a std::map.
+Static polymorphism is also used if the already mentioned transform algorithm provided by the library is used, a generic algorithm for transforming or projecting geometries:
+
+\code
+// declare type UTM zone 30, Cartesian
+// using EPSG 2040
+typedef ggl::point_xy<double, epsg<2040> > UTM;
+
+// Assign Amsterdam / Barcelona in UTM
+...
+
+// call generic transformation
+ggl::transform (amsterdam, ma);
+ggl::transform (barcelona, mb);
+\endcode
+
+EPSG has defined the accepted standard coding for map projections, worldwide, and an EPSG code can be used as a template parameter in the provided EPSG Cartesian coordinate system.
+Besides specific instantiation, any projection can also be instantiated using a factory:
+
+\code
+projection::factory<LL, XY> fac;
+boost::shared_ptr<projection::projection<LL, XY> > prj(fac.create_new(parameters));
+\endcode
+
+The projection instance can now be any projection, created by the factory according to its parameters (which should contain the name of the projection). The instantiated projection-base-class derived class contains virtual methods for forward and inverse projection, but is still also modeled using template parameters for its point types.
+
+
+\section art09_conclusions Conclusions
+The Generic Geometry Library as described and published in preview is an extensive generic template geometry library containing many algorithms. It can be used for simple algorithms such as distance calculation but it can also be used in larger contexts such as GIS or Web Mapping applications. It is an Open Source library following the Boost Software License. The Boost Community would profit from a geometry library as described in this article.
+
+
+*/
+
+#endif // _DOXYGEN_ARTICLE2009_HPP
Added: sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/sourcecode/doxygen_3.cpp
==============================================================================
--- (empty file)
+++ sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/sourcecode/doxygen_3.cpp 2009-11-02 10:54:35 EST (Mon, 02 Nov 2009)
@@ -0,0 +1,57 @@
+// Generic Geometry Library
+//
+// Copyright Barend Gehrels 1995-2009, Geodan Holding B.V. 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)
+//
+// Doxygen Examples, referred to from the sources
+
+#include <ggl/ggl.hpp>
+#include <ggl/geometries/adapted/tuple_cartesian.hpp>
+#include <ggl/geometries/adapted/c_array_cartesian.hpp>
+#include <ggl/geometries/adapted/std_as_linestring.hpp>
+
+
+
+void example_distance()
+{
+ int a[2] = {1,2};
+ int b[2] = {3,4};
+ double d = ggl::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 = ggl::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 << ggl::length(
+ std::make_pair(boost::begin(line), boost::end(line) + -1)
+ )
+ << std::endl;
+}
+
+
+
+
+int main(void)
+{
+ example_distance();
+ example_length1();
+ example_length2();
+ return 0;
+}
Added: sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/sourcecode/doxygen_3.vcproj
==============================================================================
--- (empty file)
+++ sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/sourcecode/doxygen_3.vcproj 2009-11-02 10:54:35 EST (Mon, 02 Nov 2009)
@@ -0,0 +1,182 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="doxygen_3"
+ ProjectGUID="{45D4139F-BC5B-4D48-BAB8-9901C53ECCC9}"
+ RootNamespace="doxygen_3"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\doxygen_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="../../../../../boost"
+ 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)\doxygen_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="../../../../../boost"
+ 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=".\doxygen_3.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
Added: sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/sourcecode/doxygen_4.cpp
==============================================================================
--- (empty file)
+++ sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/sourcecode/doxygen_4.cpp 2009-11-02 10:54:35 EST (Mon, 02 Nov 2009)
@@ -0,0 +1,326 @@
+// Generic Geometry Library
+//
+// Copyright Barend Gehrels 1995-2009, Geodan Holding B.V. 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)
+//
+// Doxygen Examples, referred to from the sources
+
+#include <fstream>
+
+#include <ggl/ggl.hpp>
+
+#include <ggl/multi/multi.hpp>
+
+#include <ggl/extensions/gis/io/wkt/wkt.hpp>
+#include <ggl/extensions/io/svg/write_svg_multi.hpp>
+
+#include <test_util/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;
+ ggl::read_wkt(line, geometry);
+
+ Tuple tuple(geometry, name);
+
+ tuples.push_back(tuple);
+ ggl::combine(box, ggl::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 ggl::point_xy<double> point_type;
+
+ std::ofstream svg("simplify_road.svg");
+ svg_mapper<point_type> mapper(svg, 300, 300);
+
+ ggl::linestring<point_type> original[n], simplified[n];
+
+ for (int i = 0; i < n; i++)
+ {
+ ggl::read_wkt(wkt[i], original[i]);
+ ggl::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 ggl::point_xy<double> point_type;
+
+ std::ofstream svg("simplify_country.svg");
+ svg_mapper<point_type> mapper(svg, 300, 300);
+
+ ggl::multi_polygon<ggl::polygon<point_type> > original[wkt_countries_count]
+ , simplified[wkt_countries_count];
+
+ for (int i = 0; i < wkt_countries_count; i++)
+ {
+ ggl::read_wkt(wkt_countries[i], original[i]);
+ ggl::simplify(original[i], simplified[i], 0.1);
+ mapper.add(original[i]);
+ mapper.add(simplified[i]);
+ std::cout
+ << "original: " << ggl::num_points(original[i])
+ << " simplified: " << ggl::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 ggl::point_xy<double> point_type;
+
+ std::ofstream svg("convex_hull_country.svg");
+ svg_mapper<point_type> mapper(svg, 300, 300);
+
+ ggl::multi_polygon<ggl::polygon<point_type> > original[wkt_countries_count];
+ ggl::linear_ring<point_type> hull[wkt_countries_count];
+
+ for (int i = 0; i < wkt_countries_count; i++)
+ {
+ ggl::read_wkt(wkt_countries[i], original[i]);
+ ggl::convex_hull_inserter(original[i], std::back_inserter(hull[i]));
+ mapper.add(original[i]);
+ mapper.add(hull[i]);
+ std::cout
+ << "original: " << ggl::num_points(original[i])
+ << " hull: " << ggl::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 ggl::point_xy<double> point_type;
+
+ std::ofstream svg("convex_hull_cities.svg");
+ svg_mapper<point_type> mapper(svg, 300, 300);
+
+ ggl::multi_point<point_type> original[wkt_cities_count];
+
+ ggl::linear_ring<point_type> hull[wkt_cities_count];
+
+ for (int i = 0; i < wkt_cities_count; i++)
+ {
+ ggl::read_wkt(wkt_cities[i], original[i]);
+ ggl::convex_hull_inserter(original[i], std::back_inserter(hull[i]));
+ mapper.add(original[i]);
+ mapper.add(hull[i]);
+ std::cout
+ << "original: " << ggl::num_points(original[i])
+ << " hull: " << ggl::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 ggl::point_xy<double> point_type;
+ typedef ggl::linestring<point_type> line_type;
+
+ typedef boost::tuple<line_type, std::string> road_type;
+
+ ggl::box<point_type> bbox;
+ ggl::assign_inverse(bbox);
+
+ std::vector<road_type> roads;
+ read_wkt<line_type>("../../../example/data/roads.wkt", roads, bbox);
+
+ // intersect
+ ggl::box<point_type> clip;
+ std::vector<line_type> intersected;
+
+ ggl::assign(clip, -100, 25, -90, 50);
+ for (size_t i = 0; i < roads.size(); i++)
+ {
+ ggl::intersection<line_type>(clip, roads[i].get<0>(), std::back_inserter(intersected));
+ }
+
+ // create map
+ std::ofstream svg("intersection_roads.svg");
+ 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 ggl::point_xy<double> point_type;
+ typedef ggl::polygon<point_type> poly_type;
+ typedef ggl::multi_polygon<poly_type> mp_type;
+
+ typedef boost::tuple<mp_type, std::string> country_type;
+
+ ggl::box<point_type> bbox;
+ ggl::assign_inverse(bbox);
+
+ std::vector<country_type> countries;
+ read_wkt<mp_type>("../../../example/data/world.wkt", countries, bbox);
+
+ // intersect
+ ggl::box<point_type> clip;
+ std::vector<poly_type> intersected;
+
+ ggl::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++)
+ {
+ ggl::intersection<poly_type>(clip, mp[j], std::back_inserter(intersected));
+ }
+ }
+
+ // create map
+ std::ofstream svg("intersection_countries.svg");
+ 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;
+}
Added: sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/sourcecode/doxygen_4.vcproj
==============================================================================
--- (empty file)
+++ sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/sourcecode/doxygen_4.vcproj 2009-11-02 10:54:35 EST (Mon, 02 Nov 2009)
@@ -0,0 +1,182 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="doxygen_4"
+ ProjectGUID="{CBEDAEC7-EC87-4F91-9C45-F9505A052A44}"
+ RootNamespace="doxygen_4"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)\doxygen_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="../../../../../boost;../../../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)\doxygen_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="../../../../../boost;../../../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=".\doxygen_4.cpp"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
Modified: sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/sourcecode/doxygen_examples.cpp
==============================================================================
--- sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/sourcecode/doxygen_examples.cpp (original)
+++ sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/sourcecode/doxygen_examples.cpp 2009-11-02 10:54:35 EST (Mon, 02 Nov 2009)
@@ -33,14 +33,12 @@
<< ggl::area(poly)
<< " square units" << std::endl;
- /*
- Extension, other coordinate system:
- ggl::polygon<ggl::point_ll<float, ggl::cs::geographic<ggl::degree> > > poly_ll;
- ggl::read_wkt("POLYGON((4 51,4 52,5 52,5 51,4 51))", poly_ll);
- std::cout << "Polygon area is "
- << ggl::area(poly_ll)/(1000*1000)
- << " square kilometers " << std::endl;
- */
+ // Other coordinate system, spherical or geographic (extension)
+ ggl::polygon<ggl::point<float, 2, ggl::cs::spherical<ggl::degree> > > sph_poly;
+ ggl::read_wkt("POLYGON((0 0,0 45,45 0,0 0))", sph_poly);
+ std::cout << "Area is "
+ << ggl::area(sph_poly)
+ << " on unit sphere " << std::endl;
}
void example_as_wkt_point()
@@ -70,10 +68,10 @@
{
ggl::polygon<ggl::point_xy<double> > poly;
ggl::read_wkt("POLYGON((0 0,0 7,4 2,2 0,0 0))", poly);
- // Center of polygon might have different type then points of polygon
+ // Center of polygon might have different type than points of polygon
ggl::point_xy<float> center;
ggl::centroid(poly, center);
- std::cout << "Centroid: " << center.x() << "," << center.y() << std::endl;
+ std::cout << "Centroid: " << ggl::dsv(center) << std::endl;
}
@@ -155,22 +153,19 @@
*/
}
-void example_intersection_linestring1()
+void example_clip_linestring1()
{
typedef ggl::point_xy<double> P;
ggl::linestring<P> line;
ggl::read_wkt("linestring(1.1 1.1, 2.5 2.1, 3.1 3.1, 4.9 1.1, 3.1 1.9)", line);
ggl::box<P> cb(P(1.5, 1.5), P(4.5, 2.5));
std::cout << "Clipped linestring(s) " << std::endl;
- /*
- TODO: does not work because streamwkt is now extension and not included
- so make other construct
- ggl::intersection<ggl::linestring<P> > (cb, line,
- std::ostream_iterator<ggl::linestring<P> >(std::cout, "\n"));
- */
+
+ std::vector<ggl::linestring<P> > intersection;
+ ggl::intersection<ggl::linestring<P> >(cb, line, std::back_inserter(intersection));
}
-void example_intersection_linestring2()
+void example_clip_linestring2()
{
typedef ggl::point_xy<double> P;
std::vector<P> vector_in;
@@ -232,7 +227,7 @@
ggl::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 ggl::strategy::distance::xy_point_segment<P, ggl::segment<const P> > DS;
+ typedef ggl::strategy::distance::xy_point_segment<P, P> DS;
typedef ggl::strategy::simplify::douglas_peucker<P, DS> simplification;
ggl::simplify_inserter(line, std::ostream_iterator<P>(std::cout, "\n"), 0.5, simplification());
}
@@ -424,69 +419,6 @@
*/
}
-namespace example_loop1
-{
- // Class functor
- template <typename P>
- struct perimeter
- {
- struct summation
- {
- double sum;
- summation() : sum(0) {}
- };
-
- bool operator()(const ggl::segment<const P>& segment, summation& s) const
- {
- std::cout << "from " << segment.first << " to " << segment.second << std::endl;
- s.sum += ggl::distance(segment.first, segment.second);
- return true;
- }
- };
-
- void example()
- {
- typedef ggl::point_xy<double> P;
- ggl::polygon<P> poly;
- ggl::read_wkt("POLYGON((0 0,0 7,4 2,2 0,0 0))", poly);
- perimeter<P>::summation peri;
- ggl::loop(poly.outer(), perimeter<P>(), peri);
- std::cout << "Perimeter: " << peri.sum << std::endl;
- }
-} //:\\ --
-
-
-namespace example_loop2
-{
- struct summation
- {
- double sum;
- summation() : sum(0) {}
- };
-
- // Function functor
- template <typename P>
- bool perimeter(const ggl::segment<const P>& segment, summation& s)
- {
- std::cout << "from " << segment.first << " to " << segment.second << std::endl;
- s.sum += ggl::distance(segment.first, segment.second);
- return true;
- }
-
- void example()
- {
- /*
- Extension, other coordinate system:
- typedef ggl::point_ll<double, ggl::cs::geographic<ggl::degree> > P;
- ggl::polygon<P> poly;
- ggl::read_wkt("POLYGON((-178.786 70.7853,177.476 71.2333,179.744 71.5733,-178.786 70.7853))", poly);
- summation peri;
- ggl::loop(poly.outer(), perimeter<P>, peri);
- std::cout << "Perimeter: " << peri.sum/1000.0 << " km" << std::endl;
- */
- }
-} //:\\ --
-
struct example_point_1
@@ -580,10 +512,10 @@
template <> struct dimension<example_point_2> : boost::mpl::int_<2> {};
template <std::size_t Dimension> struct access<example_point_2, Dimension>
{
- static inline float get(example_point_2 const& p)
+ static inline float get(example_point_2 const& p)
{ return p.get<Dimension>(); }
- static inline void set(example_point_2& p, float const& value)
+ static inline void set(example_point_2& p, float const& value)
{ p.get<Dimension>() = value; }
};
@@ -630,8 +562,8 @@
example_as_wkt_point();
- example_intersection_linestring1();
- example_intersection_linestring2();
+ example_clip_linestring1();
+ example_clip_linestring2();
example_intersection_polygon1();
example_simplify_linestring1();
@@ -652,8 +584,6 @@
example_point_ll_construct();
example_dms();
- example_loop1::example();
- example_loop2::example();
example_own_point1::example();
example_own_point2::example();
Modified: sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/sourcecode/doxygen_examples.sln
==============================================================================
--- sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/sourcecode/doxygen_examples.sln (original)
+++ sandbox/ggl/formal_review_request/libs/ggl/doc/doxygen_input/sourcecode/doxygen_examples.sln 2009-11-02 10:54:35 EST (Mon, 02 Nov 2009)
@@ -4,6 +4,10 @@
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "doxygen_2", "doxygen_2.vcproj", "{6CF6A521-57E0-4DA4-9D17-ED5D29E4208C}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "doxygen_3", "doxygen_3.vcproj", "{45D4139F-BC5B-4D48-BAB8-9901C53ECCC9}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "doxygen_4", "doxygen_4.vcproj", "{CBEDAEC7-EC87-4F91-9C45-F9505A052A44}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@@ -18,6 +22,14 @@
{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
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
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