Boost.Geometry    Boost C++ Libraries

access: get/set coordinate values, make objects, clear geometries, append point(s)


Functions

template<typename Geometry , typename RoP >
void boost::geometry::append (Geometry &geometry, RoP const &range_or_point, int ring_index=-1, int multi_index=0)
 Appends one or more points to a linestring, ring, polygon, multi.
template<typename Geometry , typename Range >
void boost::geometry::assign (Geometry &geometry, Range const &range)
 assign a range of points to a linestring, ring or polygon
template<typename Geometry , typename Type >
void boost::geometry::assign (Geometry &geometry, Type const &c1, Type const &c2, Type const &c3, Type const &c4)
 assign center + radius to a sphere [for extension]
template<typename Geometry , typename Type >
void boost::geometry::assign (Geometry &geometry, Type const &c1, Type const &c2, Type const &c3)
 assign three values to a 3D point [or the center + radius to a circle]
template<typename Geometry , typename Type >
void boost::geometry::assign (Geometry &geometry, Type const &c1, Type const &c2)
 assign two values to a 2D point
template<typename Box , typename Point >
void boost::geometry::assign_box_corners (Box const &box, Point &lower_left, Point &lower_right, Point &upper_left, Point &upper_right)
 Assign the 4 points of a 2D box.
template<typename Geometry >
void boost::geometry::assign_inverse (Geometry &geometry)
 assign to a box inverse infinite
template<std::size_t Index, typename Point , typename Geometry >
void boost::geometry::assign_point_from_index (Geometry const &geometry, Point &point)
 Assign a point with a point of a box or segment.
template<std::size_t Index, typename Geometry , typename Point >
void boost::geometry::assign_point_to_index (Point const &point, Geometry &geometry)
 Assign a box or segment with the value of a point.
template<typename Geometry >
void boost::geometry::assign_zero (Geometry &geometry)
 assign zero values to a box, point
template<typename Geometry >
void boost::geometry::clear (Geometry &geometry)
 Clears a linestring, linear ring or polygon (exterior+interiors) or multi*.
template<typename Polygon >
const ring_type< Polygon >::type & boost::geometry::exterior_ring (Polygon const &polygon)
 Function to get the exterior ring of a polygon (const version).
template<typename Polygon >
ring_type< Polygon >::type & boost::geometry::exterior_ring (Polygon &polygon)
 Function to get the exterior_ring ring of a polygon.
template<std::size_t Dimension, typename Geometry >
coordinate_type< Geometry >::type boost::geometry::get (Geometry const &geometry)
 
  • get coordinate value of a Point ( / Sphere)

template<std::size_t Dimension, typename Geometry >
coordinate_type< Geometry >::type boost::geometry::get_as_radian (const Geometry &geometry)
 get coordinate value of a point, result is in Radian
template<typename Polygon >
const interior_type< Polygon >
::type & 
boost::geometry::interior_rings (Polygon const &polygon)
 Function to get the interior rings of a polygon (const version).
template<typename Polygon >
interior_type< Polygon >::type & boost::geometry::interior_rings (Polygon &polygon)
 Function to get the interior rings of a polygon (non const version).
template<typename Geometry , typename T >
Geometry boost::geometry::make (T const &c1, T const &c2, T const &c3)
 Make a geometry.
template<typename Geometry , typename T >
Geometry boost::geometry::make (T const &c1, T const &c2)
 Make a geometry.
template<typename Geometry >
Geometry boost::geometry::make_inverse ()
 Create a box with inverse infinite coordinates.
template<typename Geometry >
Geometry boost::geometry::make_zero ()
 Create a geometry with "zero" coordinates.
template<typename Geometry >
std::size_t boost::geometry::num_interior_rings (Geometry const &geometry)
 Function to get the number of interior rings of a polygon.
template<typename Geometry >
std::size_t boost::geometry::num_points (Geometry const &geometry)
 get number of points
template<std::size_t Dimension, typename Geometry >
void boost::geometry::set (Geometry &geometry, typename coordinate_type< Geometry >::type const &value)
 
  • set coordinate value of a Point ( / Sphere)

template<std::size_t Dimension, typename Geometry >
void boost::geometry::set_from_radian (Geometry &geometry, const typename coordinate_type< Geometry >::type &radians)
 set coordinate value (in radian) to a point

Detailed Description

There are many ways to edit geometries. It is possible to:

The library provides the following functions to edit geometries:

For getting coordinates it is similar:


Function Documentation

template<std::size_t Dimension, typename Geometry >
coordinate_type< Geometry >::type boost::geometry::get ( Geometry const &  geometry  ) 

  • get coordinate value of a Point ( / Sphere)

  • get coordinate value of a Box / Segment

Returns:
coordinate value
Template Parameters:
Index index
  • for Point: don't specify
  • for Box: min_corner or max_corner
  • for Segment: 0 / 1
Dimension dimension
Geometry geometry
Parameters:
geometry geometry to get coordinate value from
Examples:
07_graph_route_example.cpp.

Definition at line 263 of file access.hpp.

template<std::size_t Dimension, typename Geometry >
void boost::geometry::set ( Geometry &  geometry,
typename coordinate_type< Geometry >::type const &  value 
)

  • set coordinate value of a Point ( / Sphere)

  • set coordinate value of a Box / Segment

Template Parameters:
Index index
  • for Point: don't specify
  • for Box: min_corner or max_corner
  • for Segment: 0 / 1
Dimension dimension
Geometry geometry
Parameters:
geometry geometry to assign coordinate to
value coordinate value to assign

Definition at line 299 of file access.hpp.

template<typename Polygon >
ring_type<Polygon>::type& boost::geometry::exterior_ring ( Polygon &  polygon  ) 

Function to get the exterior_ring ring of a polygon.

Note:
OGC compliance: instead of ExteriorRing
Template Parameters:
P polygon type
Parameters:
polygon the polygon to get the exterior ring from
Returns:
a reference to the exterior ring
Examples:
03_polygon_example.cpp, and c06_custom_polygon_example.cpp.

Definition at line 93 of file exterior_ring.hpp.

template<typename Polygon >
const ring_type<Polygon>::type& boost::geometry::exterior_ring ( Polygon const &  polygon  ) 

Function to get the exterior ring of a polygon (const version).

Note:
OGC compliance: instead of ExteriorRing
Template Parameters:
Polygon polygon type
Parameters:
polygon the polygon to get the exterior ring from
Returns:
a const reference to the exterior ring

Definition at line 113 of file exterior_ring.hpp.

template<typename Polygon >
interior_type<Polygon>::type& boost::geometry::interior_rings ( Polygon &  polygon  ) 

Function to get the interior rings of a polygon (non const version).

Note:
OGC compliance: instead of InteriorRingN
Template Parameters:
P polygon type
Parameters:
polygon the polygon to get the interior rings from
Returns:
a reference to the interior rings
Examples:
c06_custom_polygon_example.cpp.

Definition at line 177 of file interior_rings.hpp.

template<typename Polygon >
const interior_type<Polygon>::type& boost::geometry::interior_rings ( Polygon const &  polygon  ) 

Function to get the interior rings of a polygon (const version).

Note:
OGC compliance: instead of InteriorRingN
Template Parameters:
P polygon type
Parameters:
polygon the polygon to get the interior rings from
Returns:
a const reference to the interior rings

Definition at line 197 of file interior_rings.hpp.

template<typename Geometry >
std::size_t boost::geometry::num_interior_rings ( Geometry const &  geometry  ) 

Function to get the number of interior rings of a polygon.

Note:
Defined by OGC as "numInteriorRing". To be consistent with "numPoints" letter "s" is appended

Can be used for any geometry, returning 0 for geometries not having interior rings

Template Parameters:
Geometry geometry type
Parameters:
geometry the polygon or other geometry
Returns:
the number of interior rings of the geometry

Definition at line 222 of file interior_rings.hpp.

template<std::size_t Dimension, typename Geometry >
coordinate_type<Geometry>::type boost::geometry::get_as_radian ( const Geometry &  geometry  ) 

get coordinate value of a point, result is in Radian

Result is in Radian, even if source coordinate system is in Degrees

Returns:
coordinate value
Template Parameters:
Dimension dimension
Geometry geometry
Parameters:
geometry geometry to get coordinate value from
Note:
Only applicable to coordinate systems templatized by units, e.g. spherical or geographic coordinate systems

Definition at line 112 of file radian_access.hpp.

template<std::size_t Dimension, typename Geometry >
void boost::geometry::set_from_radian ( Geometry &  geometry,
const typename coordinate_type< Geometry >::type &  radians 
)

set coordinate value (in radian) to a point

Coordinate value will be set correctly, if coordinate system of point is in Degree, Radian value will be converted to Degree

Template Parameters:
Dimension dimension
Geometry geometry
Parameters:
geometry geometry to assign coordinate to
radians coordinate value to assign
Note:
Only applicable to coordinate systems templatized by units, e.g. spherical or geographic coordinate systems

Definition at line 132 of file radian_access.hpp.

template<typename Geometry , typename RoP >
void boost::geometry::append ( Geometry &  geometry,
RoP const &  range_or_point,
int  ring_index = -1,
int  multi_index = 0 
)

Appends one or more points to a linestring, ring, polygon, multi.

Parameters:
geometry a geometry
range_or_point the point or range to add
ring_index the index of the ring in case of a polygon: exterior ring (-1, the default) or interior ring index
multi_index reserved for multi polygons
Examples:
02_linestring_example.cpp, and 03_polygon_example.cpp.

Definition at line 170 of file append.hpp.

template<typename Geometry , typename Type >
void boost::geometry::assign ( Geometry &  geometry,
Type const &  c1,
Type const &  c2 
)

template<typename Geometry , typename Type >
void boost::geometry::assign ( Geometry &  geometry,
Type const &  c1,
Type const &  c2,
Type const &  c3 
)

assign three values to a 3D point [or the center + radius to a circle]

Definition at line 371 of file assign.hpp.

template<typename Geometry , typename Type >
void boost::geometry::assign ( Geometry &  geometry,
Type const &  c1,
Type const &  c2,
Type const &  c3,
Type const &  c4 
)

assign center + radius to a sphere [for extension]

Definition at line 389 of file assign.hpp.

template<typename Geometry , typename Range >
void boost::geometry::assign ( Geometry &  geometry,
Range const &  range 
)

assign a range of points to a linestring, ring or polygon

Note:
The point-type of the range might be different from the point-type of the geometry

Definition at line 409 of file assign.hpp.

template<typename Geometry >
void boost::geometry::assign_inverse ( Geometry &  geometry  ) 

assign to a box inverse infinite

The assign_inverse function initialize a 2D or 3D box with large coordinates, the min corner is very large, the max corner is very small. This is a convenient starting point to collect the minimum bounding box of a geometry.

Examples:
07_graph_route_example.cpp.

Definition at line 426 of file assign.hpp.

template<typename Geometry >
void boost::geometry::assign_zero ( Geometry &  geometry  ) 

assign zero values to a box, point

The assign_zero function initializes a 2D or 3D point or box with coordinates of zero

Template Parameters:
Geometry the geometry type
Examples:
07_graph_route_example.cpp.

Definition at line 444 of file assign.hpp.

template<typename Box , typename Point >
void boost::geometry::assign_box_corners ( Box const &  box,
Point &  lower_left,
Point &  lower_right,
Point &  upper_left,
Point &  upper_right 
)

Assign the 4 points of a 2D box.

Note:
The order is crucial. Most logical is LOWER, UPPER and sub-order LEFT, RIGHT so this is how it is implemented.

Definition at line 463 of file assign.hpp.

template<std::size_t Index, typename Geometry , typename Point >
void boost::geometry::assign_point_to_index ( Point const &  point,
Geometry &  geometry 
)

Assign a box or segment with the value of a point.

Template Parameters:
Index indicates which box-corner, min_corner (0) or max_corner (1) or which point of segment (0/1)

Definition at line 489 of file assign.hpp.

template<std::size_t Index, typename Point , typename Geometry >
void boost::geometry::assign_point_from_index ( Geometry const &  geometry,
Point &  point 
)

Assign a point with a point of a box or segment.

Template Parameters:
Index indicates which box-corner, min_corner (0) or max_corner (1) or which point of segment (0/1)

Definition at line 508 of file assign.hpp.

template<typename Geometry >
void boost::geometry::clear ( Geometry &  geometry  ) 

Clears a linestring, linear ring or polygon (exterior+interiors) or multi*.

Generic function to clear a geometry

Note:
points and boxes cannot be cleared, instead they can be set to zero by "assign_zero"

Definition at line 124 of file clear.hpp.

template<typename Geometry , typename T >
Geometry boost::geometry::make ( T const &  c1,
T const &  c2 
)

Make a geometry.

the Generic Geometry Library uses concepts for all its geometries. Therefore it does not rely on constructors. The "make" functions are object generators creating geometries. There are overloads with two, three, four or six values, which are implemented depending on the geometry specified.

Note:
It does not work with array-point types, like int[2]
Template Parameters:
G the geometry type
T the coordinate type
Returns:
the geometry

Definition at line 31 of file make.hpp.

template<typename Geometry , typename T >
Geometry boost::geometry::make ( T const &  c1,
T const &  c2,
T const &  c3 
)

Make a geometry.

Returns:
a 3D point

Definition at line 51 of file make.hpp.

template<typename Geometry >
Geometry boost::geometry::make_inverse (  ) 

Create a box with inverse infinite coordinates.

The make_inverse function initialize a 2D or 3D box with large coordinates, the min corner is very large, the max corner is very small

Template Parameters:
Geometry the geometry type
Returns:
the box

Definition at line 102 of file make.hpp.

template<typename Geometry >
Geometry boost::geometry::make_zero (  ) 

Create a geometry with "zero" coordinates.

The make_zero function initializes a 2D or 3D point or box with coordinates of zero

Template Parameters:
Geometry the geometry type
Returns:
the geometry

Definition at line 123 of file make.hpp.

template<typename Geometry >
std::size_t boost::geometry::num_points ( Geometry const &  geometry  ) 

get number of points

Template Parameters:
Geometry geometry type
Parameters:
geometry the geometry to get number of points from
Returns:
number of points
Note:
For linestrings/rings also boost::size or .size() could be used, however, for polygons this is less obvious. So this function is provided. Besides that it is described by OGC (numPoints)
Examples:
02_linestring_example.cpp.

Definition at line 129 of file num_points.hpp.


December 1, 2009

Copyright © 1995-2009 Barend Gehrels, Geodan, Amsterdam
Copyright © 2008-2009 Bruno Lalande, Paris
Copyright © 2009 Mateusz Loskot, Cadcorp, London
Documentation is generated by Doxygen