[doc][is_simple, is_valid] add doxygen and qbk support for documentation

of is_simple and is_valid; add qbk doc for is_simple and is_valid;
add example for is_simple and is_valid;
This commit is contained in:
Menelaos Karavelas 2014-06-27 02:35:33 +03:00
parent 7ec752d5ea
commit ff8d26e3e9
9 changed files with 209 additions and 4 deletions

View File

@ -181,6 +181,8 @@ INPUT = . .. ../../../../boost/geometry/core \
../../../../boost/geometry/algorithms/detail/disjoint \
../../../../boost/geometry/algorithms/detail/distance \
../../../../boost/geometry/algorithms/detail/equals \
../../../../boost/geometry/algorithms/detail/is_simple \
../../../../boost/geometry/algorithms/detail/is_valid \
../../../../boost/geometry/algorithms/detail/overlay \
../../../../boost/geometry/algorithms/detail/relate \
../../../../boost/geometry/algorithms/detail/sections \

View File

@ -44,6 +44,8 @@
[import src/examples/algorithms/intersection_segment.cpp]
[import src/examples/algorithms/intersection_poly_poly.cpp]
[import src/examples/algorithms/intersects_linestring.cpp]
[import src/examples/algorithms/is_simple.cpp]
[import src/examples/algorithms/is_valid.cpp]
[import src/examples/algorithms/num_geometries.cpp]
[import src/examples/algorithms/num_interior_rings.cpp]
[import src/examples/algorithms/num_points.cpp]

View File

@ -83,10 +83,11 @@ call_doxygen()
algorithms = ["append", "assign", "make", "clear"
, "area", "buffer", "centroid", "convert", "correct", "covered_by"
, "convex_hull", "crosses", "difference", "disjoint", "distance"
, "envelope", "equals", "expand", "for_each", "intersection", "intersects"
, "length", "num_geometries", "num_interior_rings", "num_points"
, "overlaps", "perimeter", "reverse", "simplify", "sym_difference"
, "touches", "transform", "union", "unique", "within"]
, "envelope", "equals", "expand", "for_each", "is_simple", "is_valid"
, "intersection", "intersects", "length", "num_geometries"
, "num_interior_rings", "num_points", "overlaps", "perimeter"
, "reverse", "simplify", "sym_difference", "touches", "transform"
, "union", "unique", "within"]
access_functions = ["get", "set", "exterior_ring", "interior_rings"
, "num_points", "num_interior_rings", "num_geometries"]

View File

@ -0,0 +1,28 @@
[/============================================================================
Boost.Geometry (aka GGL, Generic Geometry Library)
Copyright (c) 2014, Oracle and/or its affiliates.
Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
Licensed under the Boost Software License version 1.0.
http://www.boost.org/users/license.html
=============================================================================/]
[def __this_function__ is_simple]
[heading_conformance_ogc __this_function__..IsSimple]
[heading Complexity]
Constant-time for points, segments and boxes
Linear for rings, polygons and multi-polygons
Worst-case quadratic for linestrings and multi-linestrings
[heading Example]
[is_simple]
[is_simple_output]
[heading See also]
* [link geometry.reference.algorithms.is_valid is_valid]

View File

@ -0,0 +1,26 @@
[/============================================================================
Boost.Geometry (aka GGL, Generic Geometry Library)
Copyright (c) 2014, Oracle and/or its affiliates.
Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
Licensed under the Boost Software License version 1.0.
http://www.boost.org/users/license.html
=============================================================================/]
[def __this_function__ is_valid]
[heading_conformance_no_ogc __this_function__]
[heading Complexity]
Constant-time for points, segments and boxes
Currently, worst-case quadratic for all other geometries
[heading Example]
[is_valid]
[is_valid_output]
[heading See also]
* [link geometry.reference.algorithms.is_simple is_simple]

View File

@ -50,6 +50,10 @@ exe intersection_segment : intersection_segment.cpp ;
exe intersects_linestring : intersects_linestring.cpp ;
exe is_simple : is_simple.cpp ;
exe is_valid : is_valid.cpp ;
exe length : length.cpp ;
exe length_with_strategy : length_with_strategy.cpp ;

View File

@ -0,0 +1,44 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// Code to create SVG for examples
#ifndef CREATE_SVG_ONE_HPP
#define CREATE_SVG_ONE_HPP
#include <fstream>
#include <boost/algorithm/string.hpp>
#if defined(HAVE_SVG)
# include <boost/geometry/io/svg/svg_mapper.hpp>
#endif
template <typename Geometry>
void create_svg(std::string const& filename, Geometry const& g)
{
#if defined(HAVE_SVG)
std::cout << std::endl << "[$img/algorithms/" << boost::replace_all_copy(filename, ".svg", ".png") << "]" << std::endl << std::endl;
typedef typename boost::geometry::point_type<Geometry>::type point_type;
std::ofstream svg(filename.c_str());
boost::geometry::svg_mapper<point_type> mapper(svg, 400, 400);
mapper.add(g);
mapper.map(g, "fill-opacity:0.5;fill:rgb(153,204,0);stroke:rgb(153,204,0);stroke-width:2");
#else
boost::ignore_unused(filename, g);
#endif
}
// NOTE: convert manually from svg to png using Inkscape ctrl-shift-E
// and copy png to html/img/algorithms/
#endif // CREATE_SVG_ONE_HPP

View File

@ -0,0 +1,50 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// QuickBook Example
// Copyright (c) 2014, Oracle and/or its affiliates
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Licensed under the Boost Software License version 1.0.
// http://www.boost.org/users/license.html
//[is_simple
//` Checks whether a geometry is simple
#include <iostream>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/linestring.hpp>
#include <boost/geometry/geometries/multi_linestring.hpp>
#include <boost/geometry/io/wkt/wkt.hpp>
/*<-*/ #include "create_svg_one.hpp" /*->*/
int main()
{
typedef boost::geometry::model::d2::point_xy<double> point_type;
typedef boost::geometry::model::linestring<point_type> linestring_type;
typedef boost::geometry::model::multi_linestring<linestring_type> multi_linestring_type;
multi_linestring_type multi_linestring;
boost::geometry::read_wkt("MULTILINESTRING((0 0,0 10,10 10,10 0,0 0),(10 10,20 20))", multi_linestring);
std::cout << "is simple? "
<< (boost::geometry::is_simple(multi_linestring) ? "yes" : "no")
<< std::endl;
/*<-*/ create_svg("is_simple_example.svg", multi_linestring); /*->*/
return 0;
}
//]
//[is_simple_output
/*`
Output:
[pre
is simple? no
]
*/
//]

View File

@ -0,0 +1,48 @@
// Boost.Geometry (aka GGL, Generic Geometry Library)
// QuickBook Example
// Copyright (c) 2014, Oracle and/or its affiliates
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
// Licensed under the Boost Software License version 1.0.
// http://www.boost.org/users/license.html
//[is_valid
//` Checks whether a geometry is valid
#include <iostream>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/io/wkt/wkt.hpp>
/*<-*/ #include "create_svg_one.hpp" /*->*/
int main()
{
typedef boost::geometry::model::d2::point_xy<double> point_type;
typedef boost::geometry::model::polygon<point_type> polygon_type;
polygon_type poly;
boost::geometry::read_wkt(
"POLYGON((0 0,0 10,10 10,10 0,0 0),(0 0,9 1,9 2,0 0),(0 0,1 9,2 9,0 0),(2 9,9 2,9 9,2 9))"
, poly);
std::cout << "is valid? " << (boost::geometry::is_valid(poly) ? "yes" : "no") << std::endl;
/*<-*/ create_svg("is_valid_example.svg", poly); /*->*/
return 0;
}
//]
//[is_valid_output
/*`
Output:
[pre
is valid? no
]
*/
//]