From 801f2e0eed20a4fec6b61027033351595fc68614 Mon Sep 17 00:00:00 2001 From: Barend Gehrels Date: Mon, 9 Aug 2010 10:33:57 +0000 Subject: [PATCH] Recent changes in qbk-generation [SVN r64692] --- doc/doxygen_input/sourcecode/doxygen_1.cpp | 8 +- doc/qbk/Doxyfile | 7 +- doc/qbk/Jamfile.v2 | 16 ++-- doc/qbk/area.qbk | 79 +++++++++------- doc/qbk/distance.qbk | 80 +++++++++------- doc/qbk/geometry.qbk | 12 ++- doc/qbk/make_qbk.bat | 7 +- .../tools/doxygen_xml2qbk/doxygen_xml2qbk.cpp | 91 +++++++++++++------ .../boost/geometry/algorithms/simplify.hpp | 20 +++- 9 files changed, 207 insertions(+), 113 deletions(-) diff --git a/doc/doxygen_input/sourcecode/doxygen_1.cpp b/doc/doxygen_input/sourcecode/doxygen_1.cpp index 8a83401b2..3ded1a838 100644 --- a/doc/doxygen_input/sourcecode/doxygen_1.cpp +++ b/doc/doxygen_input/sourcecode/doxygen_1.cpp @@ -213,16 +213,21 @@ void example_intersection_polygon1() void example_simplify_linestring1() { + //[simplify + //` Simplify a linestring boost::geometry::linestring > 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 P; typedef boost::geometry::linestring

L; L line; @@ -232,6 +237,7 @@ void example_simplify_linestring2() typedef boost::geometry::strategy::distance::projected_point DS; typedef boost::geometry::strategy::simplify::douglas_peucker simplification; boost::geometry::simplify_inserter(line, std::ostream_iterator

(std::cout, "\n"), 0.5, simplification()); + //] } diff --git a/doc/qbk/Doxyfile b/doc/qbk/Doxyfile index 51aa7f913..d0a84a787 100644 --- a/doc/qbk/Doxyfile +++ b/doc/qbk/Doxyfile @@ -24,7 +24,7 @@ MULTILINE_CPP_IS_BRIEF = NO INHERIT_DOCS = YES SEPARATE_MEMBER_PAGES = NO TAB_SIZE = 8 -ALIASES = +ALIASES = qbk{2}="\xmlonly \2 \endxmlonly" OPTIMIZE_OUTPUT_FOR_C = NO OPTIMIZE_OUTPUT_JAVA = NO OPTIMIZE_FOR_FORTRAN = NO @@ -80,10 +80,11 @@ WARN_LOGFILE = # 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 @@ EXCLUDE_SYMBOLS = 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 diff --git a/doc/qbk/Jamfile.v2 b/doc/qbk/Jamfile.v2 index b27078771..05590713c 100644 --- a/doc/qbk/Jamfile.v2 +++ b/doc/qbk/Jamfile.v2 @@ -8,15 +8,17 @@ # Experimental! +project geometry/doc ; + +import boostbook ; import quickbook ; -xml geometry - : geometry.qbk - : Jamfile.v2 + +boostbook geometry + : geometry.qbk + : Jamfile.v2 + : boost.root=br_stub + callout.graphics.path=br_stub/doc/html/images/callouts/ ; -boostbook standalone - : geometry - : callout.graphics.path=../callouts/ - ; diff --git a/doc/qbk/area.qbk b/doc/qbk/area.qbk index da73321df..026fd9268 100644 --- a/doc/qbk/area.qbk +++ b/doc/qbk/area.qbk @@ -1,33 +1,4 @@ -[section:area0 area] - -Calculate area of a geometry using a specified strategy. - -[heading Synopsis] -``template -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 ]] -[[Strategy] [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 - -[heading Description] -This version of area calculation takes a strategy - -[heading Header] -`#include ` - - -[endsect] - -[section:area1 area] +[section:area_1 area (1)] Calculate area of a geometry. @@ -39,7 +10,7 @@ area_result::type area (Geometry const &geometry)`` [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 ]] ] @@ -50,11 +21,51 @@ The calculated area 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 ` + +Or + `#include ` -[heading Example] -[area_polygon] -[area_polygon_spherical] + + +[endsect] + +[section:area_2 area (2)] + +Calculate area of a geometry using a specified strategy. + +[heading Synopsis] +``template +Strategy::return_type area (Geometry const &geometry, Strategy const &strategy)`` + +[heading Parameters] + +[table +[[Type] [Concept] [Name] [Description] ] +[[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 + +[heading Description] +This version of area calculation takes a strategy + +[heading Header] +Either + +`#include ` + +Or + +`#include ` + + [endsect] diff --git a/doc/qbk/distance.qbk b/doc/qbk/distance.qbk index d42c01acc..5b8cbf294 100644 --- a/doc/qbk/distance.qbk +++ b/doc/qbk/distance.qbk @@ -1,33 +1,4 @@ -[section:distance0 distance] - -Calculate distance between two geometries. - -[heading Synopsis] -``template -distance_result::type distance (Geometry1 const &geometry1, Geometry2 const &geometry2)`` - -[heading Parameters] - -[table -[[Type] [Concept] [Name] [Description] ] -[[Geometry1] [] [geometry1] [first geometry ]] -[[Geometry2] [] [geometry2] [second geometry ]] -] - - -[heading Returns] -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] -`#include ` - - -[endsect] - -[section:distance1 distance] +[section:distance_3 distance (3)] Calculate distance between two geometries with a specified strategy. @@ -39,9 +10,9 @@ strategy::distance::services::return_type::type distance (Geometry1 co [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 &] [first geometry type ] [geometry1] [first geometry ]] +[[Geometry2 const &] [second geometry type ] [geometry2] [second geometry ]] +[[Strategy const &] [] [strategy] [strategy to calculate distance between two points ]] ] @@ -52,8 +23,51 @@ the distance [heading Header] +Either + +`#include ` + +Or + `#include ` + +[endsect] + +[section:distance_2 distance (2)] + +Calculate distance between two geometries. + +[heading Synopsis] +``template +distance_result::type distance (Geometry1 const &geometry1, Geometry2 const &geometry2)`` + +[heading Parameters] + +[table +[[Type] [Concept] [Name] [Description] ] +[[Geometry1 const &] [] [geometry1] [first geometry ]] +[[Geometry2 const &] [] [geometry2] [second geometry ]] +] + + +[heading Returns] +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 ` + +Or + +`#include ` + + + [endsect] diff --git a/doc/qbk/geometry.qbk b/doc/qbk/geometry.qbk index 7190abb75..47b0edd66 100644 --- a/doc/qbk/geometry.qbk +++ b/doc/qbk/geometry.qbk @@ -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] + diff --git a/doc/qbk/make_qbk.bat b/doc/qbk/make_qbk.bat index 20eba9a52..3847c1b42 100644 --- a/doc/qbk/make_qbk.bat +++ b/doc/qbk/make_qbk.bat @@ -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 @@ set xslt=c:\software\xsltproc\xml\bin\xsltproc.exe :: %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 + diff --git a/doc/src/docutils/tools/doxygen_xml2qbk/doxygen_xml2qbk.cpp b/doc/src/docutils/tools/doxygen_xml2qbk/doxygen_xml2qbk.cpp index e1add35db..fa99cf518 100644 --- a/doc/src/docutils/tools/doxygen_xml2qbk/doxygen_xml2qbk.cpp +++ b/doc/src/docutils/tools/doxygen_xml2qbk/doxygen_xml2qbk.cpp @@ -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 which will make a reference +// currently this is the element 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 #include @@ -121,7 +122,8 @@ struct function std::string model_of; std::string location; std::string paragraphs; - std::vector example; + std::vector snippets; + std::vector images; std::map parameters; std::vector tparams; @@ -136,17 +138,12 @@ static void parse_parameter(rapidxml::xml_node<>* node, par& p) if (name == "type") { p.fulltype = node->value(); - std::vector splitted; - boost::split(splitted, p.fulltype, boost::is_any_of(" *&")); - for(std::vector::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 @@ static void parse_parameter_list(rapidxml::xml_node<>* node, function& f) } 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 @@ static void parse_member(rapidxml::xml_node<>* node, std::string const& parent, get_contents(node->first_node(), f.paragraphs); } } - else if (full == ".detaileddescription.para.qbk.example") + else if (full == ".detaileddescription.para.qbk.snippet") { - f.example.push_back(node->value()); + f.snippets.push_back(node->value()); + } + else if (full == ".detaileddescription.para.image") + { + std::string image = get_attribute(node, "name"); + if (! image.empty()) + { + f.images.push_back(image); + } } else if (full == ".templateparamlist") { @@ -287,7 +298,8 @@ static void parse_member(rapidxml::xml_node<>* node, std::string const& parent, 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 @@ void quickbook_output(function const& f, std::ostream& out, int index) 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 @@ void quickbook_output(function const& f, std::ostream& out, int index) } out << "[heading Header]" << std::endl; + if (true) + { + // TODO: get the alternative headerfiles from somewhere + out << "Either" << std::endl << std::endl; + out << "`#include `" << 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 Example]" << std::endl; - BOOST_FOREACH(std::string const& example, f.example) + out << "[heading Snippets]" << std::endl; + BOOST_FOREACH(std::string const& snippet, f.snippets) { - out << "[" << example << "]" << std::endl; + out << "[" << snippet << "]" << std::endl; + } + } + out << std::endl; + + if (! f.images.empty()) + { + out << "[heading Image(s)]" << std::endl; + BOOST_FOREACH(std::string const& image, f.images) + { + out << "[$" << image << "]" << std::endl; } } out << std::endl; - // todo, include an appropriate QBK out << "[endsect]" << std::endl; out << std::endl; @@ -401,7 +432,7 @@ int main(int argc, char** argv) 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); diff --git a/include/boost/geometry/algorithms/simplify.hpp b/include/boost/geometry/algorithms/simplify.hpp index 350c85052..9c81d2e24 100644 --- a/include/boost/geometry/algorithms/simplify.hpp +++ b/include/boost/geometry/algorithms/simplify.hpp @@ -272,12 +272,18 @@ struct simplify_inserter /*! \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 inline void simplify(Geometry const& geometry, Geometry& out, @@ -303,6 +309,8 @@ inline void simplify(Geometry const& geometry, Geometry& out, /*! \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 @@ inline void simplify(Geometry const& geometry, Geometry& out, \skip example_simplify_linestring1 \line { \until } + + \xmlonly simplify \endxmlonly + \image html svg_simplify_country.png */ template inline void simplify(Geometry const& geometry, Geometry& out, @@ -341,6 +352,7 @@ inline void simplify(Geometry const& geometry, Geometry& out, \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 @@ inline void simplify(Geometry const& geometry, Geometry& out, \skip example_simplify_linestring2 \line { \until } + + \xmlonly simplify_inserter \endxmlonly + \image html svg_simplify_country.png */ template inline void simplify_inserter(Geometry const& geometry, OutputIterator out, @@ -372,11 +387,14 @@ inline void simplify_inserter(Geometry const& geometry, OutputIterator out, /*! \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 inline void simplify_inserter(Geometry const& geometry, OutputIterator out, Distance const& max_distance)