...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Checks if a geometry is simple.
template<typename Geometry, typename Strategy> bool is_simple(Geometry const & geometry, Strategy const & strategy)
Type |
Concept |
Name |
Description |
---|---|---|---|
Geometry const & |
Any type fulfilling a Geometry Concept |
geometry |
A model of the specified concept |
Strategy const & |
Any type fulfilling a Is_simple Strategy Concept |
strategy |
The strategy which will be used for is_simple calculations |
Returns true if the geometry is simple
Either
#include <boost/geometry.hpp>
Or
#include <boost/geometry/algorithms/is_simple.hpp>
The function is_simple implements function IsSimple from the OGC Simple Feature Specification.
Geometry |
Status |
---|---|
Point |
|
Segment |
|
Box |
|
Linestring |
|
Ring |
|
Polygon |
|
MultiPoint |
|
MultiLinestring |
|
MultiPolygon |
|
Variant |
|
Constant-time for points, segments and boxes
Linear for rings, polygons and multi-polygons
Linearithmic for multi-points, linestrings and multi-linestrings
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> 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; return 0; }
Output:
is simple? no