Recent changes in qbk-generation

[SVN r64692]
This commit is contained in:
Barend Gehrels
2010-08-09 10:33:57 +00:00
parent 4800ea7918
commit 801f2e0eed
9 changed files with 207 additions and 113 deletions

View File

@@ -213,16 +213,21 @@ void example_intersection_polygon1()
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 @@ void example_simplify_linestring2()
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());
//]
}

View File

@@ -24,7 +24,7 @@ MULTILINE_CPP_IS_BRIEF = NO
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 @@ 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

View File

@@ -8,15 +8,17 @@
# Experimental!
project geometry/doc ;
import boostbook ;
import quickbook ;
xml geometry
: geometry.qbk
: <dependency>Jamfile.v2
boostbook geometry
: geometry.qbk
: <dependency>Jamfile.v2
: <xsl:param>boost.root=br_stub
<xsl:param>callout.graphics.path=br_stub/doc/html/images/callouts/
;
boostbook standalone
: geometry
: <xsl:param>callout.graphics.path=../callouts/
;

View File

@@ -1,33 +1,4 @@
[section:area0 area]
Calculate area of a geometry using a specified strategy.
[heading Synopsis]
``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 ]]
[[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 <boost/geometry/algorithms/area.hpp>`
[endsect]
[section:area1 area]
[section:area_1 area (1)]
Calculate area of a geometry.
@@ -39,7 +10,7 @@ area_result<Geometry>::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 <boost/geometry/geometry.hpp>`
Or
`#include <boost/geometry/algorithms/area.hpp>`
[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<typename Geometry, typename Strategy>
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 <boost/geometry/geometry.hpp>`
Or
`#include <boost/geometry/algorithms/area.hpp>`
[endsect]

View File

@@ -1,33 +1,4 @@
[section:distance0 distance]
Calculate distance between two geometries.
[heading Synopsis]
``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] [] [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 <boost/geometry/algorithms/distance.hpp>`
[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<Strategy>::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 <boost/geometry/geometry.hpp>`
Or
`#include <boost/geometry/algorithms/distance.hpp>`
[endsect]
[section:distance_2 distance (2)]
Calculate distance between two geometries.
[heading Synopsis]
``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 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 <boost/geometry/geometry.hpp>`
Or
`#include <boost/geometry/algorithms/distance.hpp>`
[endsect]

View File

@@ -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]
[include simplify.qbk]
[endsect]

View File

@@ -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
bjam --toolset=msvc --without-python

View File

@@ -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 @@ struct function
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 @@ static void parse_parameter(rapidxml::xml_node<>* node, par& p)
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 @@ 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 <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 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);

View File

@@ -272,12 +272,18 @@ struct simplify_inserter<ring_tag, Ring, Strategy>
/*!
\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 @@ 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 <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 @@ 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 <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 @@ 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<typename Geometry, typename OutputIterator, typename Distance>
inline void simplify_inserter(Geometry const& geometry, OutputIterator out,
Distance const& max_distance)