Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r64692 - in sandbox/geometry: boost/geometry/algorithms libs/geometry/doc/doxygen_input/sourcecode libs/geometry/doc/qbk other/programs/doxygen_xml2qbk
From: barend.gehrels_at_[hidden]
Date: 2010-08-09 06:34:02


Author: barendgehrels
Date: 2010-08-09 06:33:57 EDT (Mon, 09 Aug 2010)
New Revision: 64692
URL: http://svn.boost.org/trac/boost/changeset/64692

Log:
Recent changes in qbk-generation
Text files modified:
   sandbox/geometry/boost/geometry/algorithms/simplify.hpp | 20 ++++++++
   sandbox/geometry/libs/geometry/doc/doxygen_input/sourcecode/doxygen_1.cpp | 8 +++
   sandbox/geometry/libs/geometry/doc/qbk/Doxyfile | 7 +-
   sandbox/geometry/libs/geometry/doc/qbk/Jamfile.v2 | 16 +++---
   sandbox/geometry/libs/geometry/doc/qbk/area.qbk | 47 ++++++++++++-------
   sandbox/geometry/libs/geometry/doc/qbk/distance.qbk | 48 +++++++++++++-------
   sandbox/geometry/libs/geometry/doc/qbk/geometry.qbk | 12 ++++
   sandbox/geometry/libs/geometry/doc/qbk/make_qbk.bat | 7 ++
   sandbox/geometry/other/programs/doxygen_xml2qbk/doxygen_xml2qbk.cpp | 91 ++++++++++++++++++++++++++-------------
   9 files changed, 175 insertions(+), 81 deletions(-)

Modified: sandbox/geometry/boost/geometry/algorithms/simplify.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/algorithms/simplify.hpp (original)
+++ sandbox/geometry/boost/geometry/algorithms/simplify.hpp 2010-08-09 06:33:57 EDT (Mon, 09 Aug 2010)
@@ -272,12 +272,18 @@
 /*!
     \brief Simplify a geometry using a specified strategy
     \ingroup simplify
+ \tparam Geometry A type fulfilling any Geometry concept
+ \tparam Distance A numerical distance measure
+ \tparam Strategy A type fulfilling a SimplifyStrategy concept
+ \param strategy A strategy to calculate simplification
     \param geometry input geometry, to be simplified
     \param out output geometry, simplified version of the input geometry
     \param max_distance distance (in units of input coordinates) of a vertex
         to other segments to be removed
     \param strategy simplify strategy to be used for simplification, might
         include point-distance strategy
+
+ \image html svg_simplify_country.png
  */
 template<typename Geometry, typename Distance, typename Strategy>
 inline void simplify(Geometry const& geometry, Geometry& out,
@@ -303,6 +309,8 @@
 /*!
     \brief Simplify a geometry
     \ingroup simplify
+ \tparam Geometry A type fulfilling any Geometry concept
+ \tparam Distance A numerical distance measure
     \note This version of simplify simplifies a geometry using the default
         strategy (Douglas Peucker),
     \param geometry input geometry, to be simplified
@@ -315,6 +323,9 @@
     \skip example_simplify_linestring1
     \line {
     \until }
+
+ \xmlonly <qbk.example>simplify</qbk.example> \endxmlonly
+ \image html svg_simplify_country.png
  */
 template<typename Geometry, typename Distance>
 inline void simplify(Geometry const& geometry, Geometry& out,
@@ -341,6 +352,7 @@
     \brief Simplify a geometry, using an output iterator
         and a specified strategy
     \ingroup simplify
+ \tparam Geometry geometry_concept
     \param geometry input geometry, to be simplified
     \param out output iterator, outputs all simplified points
     \param max_distance distance (in units of input coordinates) of a vertex
@@ -353,6 +365,9 @@
     \skip example_simplify_linestring2
     \line {
     \until }
+
+ \xmlonly <qbk.example>simplify_inserter</qbk.example> \endxmlonly
+ \image html svg_simplify_country.png
  */
 template<typename Geometry, typename OutputIterator, typename Distance, typename Strategy>
 inline void simplify_inserter(Geometry const& geometry, OutputIterator out,
@@ -372,11 +387,14 @@
 /*!
     \brief Simplify a geometry, using an output iterator
     \ingroup simplify
+ \tparam Geometry geometry_concept
     \param geometry input geometry, to be simplified
     \param out output iterator, outputs all simplified points
     \param max_distance distance (in units of input coordinates) of a vertex
         to other segments to be removed
- */
+
+ \image html svg_simplify_country.png
+*/
 template<typename Geometry, typename OutputIterator, typename Distance>
 inline void simplify_inserter(Geometry const& geometry, OutputIterator out,
                               Distance const& max_distance)

Modified: sandbox/geometry/libs/geometry/doc/doxygen_input/sourcecode/doxygen_1.cpp
==============================================================================
--- sandbox/geometry/libs/geometry/doc/doxygen_input/sourcecode/doxygen_1.cpp (original)
+++ sandbox/geometry/libs/geometry/doc/doxygen_input/sourcecode/doxygen_1.cpp 2010-08-09 06:33:57 EDT (Mon, 09 Aug 2010)
@@ -213,16 +213,21 @@
 
 void example_simplify_linestring1()
 {
+ //[simplify
+ //` Simplify a linestring
     boost::geometry::linestring<boost::geometry::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);
+ 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::point_xy<double> P;
     typedef boost::geometry::linestring<P> L;
     L line;
@@ -232,6 +237,7 @@
     typedef boost::geometry::strategy::distance::projected_point<P, P> DS;
     typedef boost::geometry::strategy::simplify::douglas_peucker<P, DS> simplification;
     boost::geometry::simplify_inserter(line, std::ostream_iterator<P>(std::cout, "\n"), 0.5, simplification());
+ //]
 }
 
 

Modified: sandbox/geometry/libs/geometry/doc/qbk/Doxyfile
==============================================================================
--- sandbox/geometry/libs/geometry/doc/qbk/Doxyfile (original)
+++ sandbox/geometry/libs/geometry/doc/qbk/Doxyfile 2010-08-09 06:33:57 EDT (Mon, 09 Aug 2010)
@@ -24,7 +24,7 @@
 INHERIT_DOCS = YES
 SEPARATE_MEMBER_PAGES = NO
 TAB_SIZE = 8
-ALIASES =
+ALIASES = qbk{2}="\xmlonly <qbk.\1>\2</qbk.\1> \endxmlonly"
 OPTIMIZE_OUTPUT_FOR_C = NO
 OPTIMIZE_OUTPUT_JAVA = NO
 OPTIMIZE_FOR_FORTRAN = NO
@@ -80,10 +80,11 @@
 # configuration options related to the input files
 #---------------------------------------------------------------------------
 INPUT = ../../../../boost/geometry/geometries \
+ ../../../../boost/geometry/core \
                         ../../../../boost/geometry/algorithms \
                         ../../../../boost/geometry/strategies/cartesian
 INPUT_ENCODING = UTF-8
-FILE_PATTERNS = point.hpp area.hpp distance.hpp distance_pythagoras.hpp
+FILE_PATTERNS = point.hpp area.hpp distance.hpp distance_pythagoras.hpp simplify1.hpp access.hpp
 RECURSIVE = NO
 EXCLUDE =
 EXCLUDE_SYMLINKS = NO
@@ -92,7 +93,7 @@
 EXAMPLE_PATH = ../doxygen_input/sourcecode
 EXAMPLE_PATTERNS =
 EXAMPLE_RECURSIVE = NO
-IMAGE_PATH =
+IMAGE_PATH = ../doxygen_input/images
 INPUT_FILTER =
 FILTER_PATTERNS =
 FILTER_SOURCE_FILES = NO

Modified: sandbox/geometry/libs/geometry/doc/qbk/Jamfile.v2
==============================================================================
--- sandbox/geometry/libs/geometry/doc/qbk/Jamfile.v2 (original)
+++ sandbox/geometry/libs/geometry/doc/qbk/Jamfile.v2 2010-08-09 06:33:57 EDT (Mon, 09 Aug 2010)
@@ -8,15 +8,17 @@
 
 # Experimental!
 
+project geometry/doc ;
+
+import boostbook ;
 import quickbook ;
 
-xml geometry
- : geometry.qbk
- : <dependency>Jamfile.v2
- ;
 
-boostbook standalone
- : geometry
- : <xsl:param>callout.graphics.path=../callouts/
+boostbook geometry
+ : geometry.qbk
+ : <dependency>Jamfile.v2
+ : <xsl:param>boost.root=br_stub
+ <xsl:param>callout.graphics.path=br_stub/doc/html/images/callouts/
         ;
 
+

Modified: sandbox/geometry/libs/geometry/doc/qbk/area.qbk
==============================================================================
--- sandbox/geometry/libs/geometry/doc/qbk/area.qbk (original)
+++ sandbox/geometry/libs/geometry/doc/qbk/area.qbk 2010-08-09 06:33:57 EDT (Mon, 09 Aug 2010)
@@ -1,60 +1,71 @@
-[section:area0 area]
+[section:area_1 area (1)]
 
-Calculate area of a geometry using a specified strategy.
+Calculate area of a geometry.
 
 [heading Synopsis]
-``template<typename Geometry, typename Strategy>
-Strategy::return_type area (Geometry const &geometry, Strategy const &strategy)``
+``template<typename Geometry>
+area_result<Geometry>::type area (Geometry const &geometry)``
 
 [heading Parameters]
 
 [table
 [[Type] [Concept] [Name] [Description] ]
-[[Geometry] [A type fulfilling any Geometry concept ] [geometry] [A model of Geometry ]]
-[[Strategy] [A type fulfilling a AreaStrategy concept ] [strategy] [A strategy to calculate area. Especially for spherical and geographical area calculations there are various approaches. ]]
+[[Geometry const &] [A type fulfilling any Geometry concept ] [geometry] [A model of Geometry ]]
 ]
 
 
 [heading Returns]
-The calculated area
+The calculated area
 
 [heading Description]
-This version of area calculation takes a strategy
+The function area returns the area of a polygon, ring, box using the default area-calculation strategy. Strategies are provided for cartesian and spherical coordinate systems The geometries should correct, polygons should be closed and according to the specified orientation (clockwise/counter clockwise)
 
 [heading Header]
+Either
+
+`#include <boost/geometry/geometry.hpp>`
+
+Or
+
 `#include <boost/geometry/algorithms/area.hpp>`
 
 
+
 [endsect]
 
-[section:area1 area]
+[section:area_2 area (2)]
 
-Calculate area of a geometry.
+Calculate area of a geometry using a specified strategy.
 
 [heading Synopsis]
-``template<typename Geometry>
-area_result<Geometry>::type area (Geometry const &geometry)``
+``template<typename Geometry, typename Strategy>
+Strategy::return_type area (Geometry const &geometry, Strategy const &strategy)``
 
 [heading Parameters]
 
 [table
 [[Type] [Concept] [Name] [Description] ]
-[[Geometry] [A type fulfilling any Geometry concept ] [geometry] [A model of Geometry ]]
+[[Geometry const &] [A type fulfilling any Geometry concept ] [geometry] [A model of Geometry ]]
+[[Strategy const &] [A type fulfilling a AreaStrategy concept ] [strategy] [A strategy to calculate area. Especially for spherical and geographical area calculations there are various approaches. ]]
 ]
 
 
 [heading Returns]
-The calculated area
+The calculated area
 
 [heading Description]
-The function area returns the area of a polygon, ring, box using the default area-calculation strategy. Strategies are provided for cartesian and spherical coordinate systems The geometries should correct, polygons should be closed and according to the specified orientation (clockwise/counter clockwise)
+This version of area calculation takes a strategy
 
 [heading Header]
+Either
+
+`#include <boost/geometry/geometry.hpp>`
+
+Or
+
 `#include <boost/geometry/algorithms/area.hpp>`
 
-[heading Example]
-[area_polygon]
-[area_polygon_spherical]
+
 
 [endsect]
 

Modified: sandbox/geometry/libs/geometry/doc/qbk/distance.qbk
==============================================================================
--- sandbox/geometry/libs/geometry/doc/qbk/distance.qbk (original)
+++ sandbox/geometry/libs/geometry/doc/qbk/distance.qbk 2010-08-09 06:33:57 EDT (Mon, 09 Aug 2010)
@@ -1,59 +1,73 @@
-[section:distance0 distance]
+[section:distance_3 distance (3)]
 
-Calculate distance between two geometries.
+Calculate distance between two geometries with a specified strategy.
 
 [heading Synopsis]
-``template<typename Geometry1, typename Geometry2>
-distance_result<Geometry1, Geometry2>::type distance (Geometry1 const &geometry1, Geometry2 const &geometry2)``
+``template<typename Geometry1, typename Geometry2, typename Strategy>
+strategy::distance::services::return_type<Strategy>::type distance (Geometry1 const &geometry1, Geometry2 const &geometry2, Strategy const &strategy)``
 
 [heading Parameters]
 
 [table
 [[Type] [Concept] [Name] [Description] ]
-[[Geometry1] [] [geometry1] [first geometry ]]
-[[Geometry2] [] [geometry2] [second geometry ]]
+[[Geometry1 const &] [first geometry type ] [geometry1] [first geometry ]]
+[[Geometry2 const &] [second geometry type ] [geometry2] [second geometry ]]
+[[Strategy const &] [] [strategy] [strategy to calculate distance between two points ]]
 ]
 
 
 [heading Returns]
-the distance (either a double or a distance result, convertable to double)
+the distance
 
 [heading Description]
-The default strategy is used, belonging to the corresponding coordinate system of the geometries
+
 
 [heading Header]
+Either
+
+`#include <boost/geometry/geometry.hpp>`
+
+Or
+
 `#include <boost/geometry/algorithms/distance.hpp>`
 
 
+
 [endsect]
 
-[section:distance1 distance]
+[section:distance_2 distance (2)]
 
-Calculate distance between two geometries with a specified strategy.
+Calculate distance between two geometries.
 
 [heading Synopsis]
-``template<typename Geometry1, typename Geometry2, typename Strategy>
-strategy::distance::services::return_type<Strategy>::type distance (Geometry1 const &geometry1, Geometry2 const &geometry2, Strategy const &strategy)``
+``template<typename Geometry1, typename Geometry2>
+distance_result<Geometry1, Geometry2>::type distance (Geometry1 const &geometry1, Geometry2 const &geometry2)``
 
 [heading Parameters]
 
 [table
 [[Type] [Concept] [Name] [Description] ]
-[[Geometry1] [first geometry type ] [geometry1] [first geometry ]]
-[[Geometry2] [second geometry type ] [geometry2] [second geometry ]]
-[[Strategy] [] [strategy] [strategy to calculate distance between two points ]]
+[[Geometry1 const &] [] [geometry1] [first geometry ]]
+[[Geometry2 const &] [] [geometry2] [second geometry ]]
 ]
 
 
 [heading Returns]
-the distance
+the distance (either a double or a distance result, convertable to double)
 
 [heading Description]
-
+The default strategy is used, belonging to the corresponding coordinate system of the geometries
 
 [heading Header]
+Either
+
+`#include <boost/geometry/geometry.hpp>`
+
+Or
+
 `#include <boost/geometry/algorithms/distance.hpp>`
 
 
+
 [endsect]
 

Modified: sandbox/geometry/libs/geometry/doc/qbk/geometry.qbk
==============================================================================
--- sandbox/geometry/libs/geometry/doc/qbk/geometry.qbk (original)
+++ sandbox/geometry/libs/geometry/doc/qbk/geometry.qbk 2010-08-09 06:33:57 EDT (Mon, 09 Aug 2010)
@@ -25,18 +25,26 @@
 EXPERIMENTAL!
 
 [import ../../../../boost/geometry/geometries/point.hpp]
-[import ../../../../boost/geometry/algorithms/area.hpp]
 [import ../doxygen_input/sourcecode/doxygen_1.cpp]
 
 [section Introduction]
 This is the documentation of Boost Geometry.
 [endsect]
 
+[/xinclude ref.xml]
+
+
 [section Sample]
 [point]
 [endsect]
 
+[def __geometry_concept__ Any geometry fulfilling the any Geometry concept]
+
+
 [section Reference]
 [include area.qbk]
+[include access.qbk]
 [include distance.qbk]
-[endsect]
\ No newline at end of file
+[include simplify.qbk]
+[endsect]
+

Modified: sandbox/geometry/libs/geometry/doc/qbk/make_qbk.bat
==============================================================================
--- sandbox/geometry/libs/geometry/doc/qbk/make_qbk.bat (original)
+++ sandbox/geometry/libs/geometry/doc/qbk/make_qbk.bat 2010-08-09 06:33:57 EDT (Mon, 09 Aug 2010)
@@ -16,9 +16,11 @@
 
 doxygen
 
-set xml2qbk=..\..\..\..\other\programs\doxygen_xml2qbk\Debug\doxygen_xml2qbk.exe
+set xml2qbk=..\..\..\..\other\programs\doxygen_xml2qbk\Release\doxygen_xml2qbk.exe
 %xml2qbk% doxygen_output\xml\group__area.xml > area.qbk
+%xml2qbk% doxygen_output\xml\group__access.xml > access.qbk
 %xml2qbk% doxygen_output\xml\group__distance.xml > distance.qbk
+%xml2qbk% doxygen_output\xml\group__simplify.xml > simplify.qbk
 
 set xslt=c:\software\xsltproc\xml\bin\xsltproc.exe
 
@@ -27,4 +29,5 @@
 :: %xslt% reference.xsl doxygen_output\xml\area_8hpp.xml > area2.qbk
 
 
-bjam --toolset=msvc
\ No newline at end of file
+bjam --toolset=msvc --without-python
+

Modified: sandbox/geometry/other/programs/doxygen_xml2qbk/doxygen_xml2qbk.cpp
==============================================================================
--- sandbox/geometry/other/programs/doxygen_xml2qbk/doxygen_xml2qbk.cpp (original)
+++ sandbox/geometry/other/programs/doxygen_xml2qbk/doxygen_xml2qbk.cpp 2010-08-09 06:33:57 EDT (Mon, 09 Aug 2010)
@@ -14,7 +14,7 @@
 // - basically generic, but implemented with Boost.Geometry in mind
 // - makes use of some specific XML elements, which can be created by Doxygen
 // using /xmlonly
-// currently this is the element <qbk.example> which will make a reference
+// currently this is the element <qbk.snippet> which will make a reference
 // to an example.
 // - earlier generations of QBK was done by XSLT, I'm not so into the XSLT and
 // think this is more flexible. The XSLT only did point-structure, not yet
@@ -24,6 +24,7 @@
 
 #define _CRT_SECURE_NO_WARNINGS
 #define _SCL_SECURE_NO_WARNINGS
+#define _SCL_INSECURE_DEPRECATE
 
 #include <iostream>
 #include <fstream>
@@ -121,7 +122,8 @@
     std::string model_of;
     std::string location;
     std::string paragraphs;
- std::vector<std::string> example;
+ std::vector<std::string> snippets;
+ std::vector<std::string> images;
 
     std::map<std::string, par> parameters;
     std::vector<std::string> tparams;
@@ -136,17 +138,12 @@
         if (name == "type")
         {
             p.fulltype = node->value();
- std::vector<std::string> splitted;
- boost::split(splitted, p.fulltype, boost::is_any_of(" *&"));
- for(std::vector<std::string>::const_iterator it = splitted.begin();
- it != splitted.end(); ++it)
- {
- if (! it->empty()
- && *it != "const")
- {
- p.type = *it;
- }
- }
+ p.type = p.fulltype;
+ boost::replace_all(p.type, " const", "");
+ boost::trim(p.type);
+ boost::replace_all(p.type, "&", "");
+ boost::replace_all(p.type, "*", "");
+ boost::trim(p.type);
         }
         else if (name == "declname") p.name = node->value();
         else if (name == "parametername") p.name = node->value();
@@ -184,10 +181,16 @@
         }
                 else if (name == "param")
         {
- // Element of 'templateparamlist.param'
- std::string type;
- get_contents(node->first_node(), type);
- f.tparams.push_back(type);
+ // Element of 'templateparamlist.param (.type,.declname,.defname)'
+ par p;
+ parse_parameter(node->first_node(), p);
+ std::string tparam = p.type;
+ if (! p.name.empty())
+ {
+ tparam += " ";
+ tparam += p.name;
+ }
+ f.tparams.push_back(tparam);
         }
 
         parse_parameter_list(node->first_node(), f);
@@ -240,9 +243,17 @@
                 get_contents(node->first_node(), f.paragraphs);
             }
         }
- else if (full == ".detaileddescription.para.qbk.example")
+ else if (full == ".detaileddescription.para.qbk.snippet")
+ {
+ f.snippets.push_back(node->value());
+ }
+ else if (full == ".detaileddescription.para.image")
         {
- f.example.push_back(node->value());
+ std::string image = get_attribute(node, "name");
+ if (! image.empty())
+ {
+ f.images.push_back(image);
+ }
         }
         else if (full == ".templateparamlist")
         {
@@ -287,7 +298,8 @@
 void quickbook_output(function const& f, std::ostream& out, int index)
 {
     // Write the parsed function
- out << "[section:" << f.name << index << " " << f.name << "]" << std::endl;
+ int arity = f.parameters.size();
+ out << "[section:" << f.name << "_" << arity << " " << f.name << " (" << arity << ")" "]" << std::endl;
     out << std::endl;
 
     out << f.brief_description << std::endl;
@@ -321,15 +333,18 @@
         it != f.parameters.end(); ++it)
     {
         par const& p = it->second;
- out << "[[" << p.type << "] [" << p.concept << "] [" << p.name << "] [" << p.description << "]]" << std::endl;
+ out << "[[" << p.fulltype << "] [" << p.concept << "] [" << p.name << "] [" << p.description << "]]" << std::endl;
     }
     out << "]" << std::endl;
     out << std::endl;
     out << std::endl;
 
- out << "[heading Returns]" << std::endl;
- out << f.return_type << std::endl;
- out << std::endl;
+ if (! f.return_type.empty())
+ {
+ out << "[heading Returns]" << std::endl;
+ out << f.return_type << std::endl;
+ out << std::endl;
+ }
 
     out << "[heading Description]" << std::endl;
     out << f.detailed_description << std::endl;
@@ -343,19 +358,35 @@
     }
 
     out << "[heading Header]" << std::endl;
+ if (true)
+ {
+ // TODO: get the alternative headerfiles from somewhere
+ out << "Either" << std::endl << std::endl;
+ out << "`#include <boost/geometry/geometry.hpp>`" << std::endl << std::endl;
+ out << "Or" << std::endl << std::endl;
+ }
     out << "`#include <" << f.location << ">`" << std::endl;
     out << std::endl;
 
- if (! f.example.empty())
+ if (! f.snippets.empty())
+ {
+ out << "[heading Snippets]" << std::endl;
+ BOOST_FOREACH(std::string const& snippet, f.snippets)
+ {
+ out << "[" << snippet << "]" << std::endl;
+ }
+ }
+ out << std::endl;
+
+ if (! f.images.empty())
     {
- out << "[heading Example]" << std::endl;
- BOOST_FOREACH(std::string const& example, f.example)
+ out << "[heading Image(s)]" << std::endl;
+ BOOST_FOREACH(std::string const& image, f.images)
         {
- out << "[" << example << "]" << std::endl;
+ out << "[$" << image << "]" << std::endl;
         }
     }
     out << std::endl;
- // todo, include an appropriate QBK
 
     out << "[endsect]" << std::endl;
     out << std::endl;
@@ -401,7 +432,7 @@
     std::string filename =
         argc > 1
             ? argv[1]
- : "../../../libs/geometry/doc/qbk/doxygen_output/xml/group__area.xml";
+ : "../../../libs/geometry/doc/qbk/doxygen_output/xml/group__simplify.xml";
 
     std::string xml = file_to_string(filename);
 


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