Shapes
GIS made easy, a lightweight header-only planar geometry library for Modern C++
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Friends | List of all members
simo::shapes::basic_point< T, typename > Class Template Reference
Inheritance diagram for simo::shapes::basic_point< T, typename >:
simo::shapes::basic_geometry< basic_point< T > >

Public Types

using value_type = T
 
using reference = T &
 
using const_reference = const T &
 
using iterator = T *
 
using const_iterator = const T *
 
using difference_type = std::ptrdiff_t
 
using size_type = size_t
 
using reverse_iterator = std::reverse_iterator< iterator >
 
using const_reverse_iterator = std::reverse_iterator< const_iterator >
 
using point_type = basic_point
 
using coord_type = T
 
using coord_iterator = typename std::vector< coord_type >::iterator
 
using coord_const_iterator = typename std::vector< coord_type >::const_iterator
 

Public Member Functions

 basic_point ()
 Creates a empty point.
 
 basic_point (T x, T y)
 Creates a point from the given coordinates. More...
 
 basic_point (coord_iterator begin, coord_iterator end)
 
 basic_point (coord_const_iterator begin, coord_const_iterator end)
 
size_type size () const noexcept
 
reference operator[] (size_t pos)
 
std::string polyline (std::int32_t precision=5) const
 
size_type max_size () const
 
bool empty ()
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
reverse_iterator rbegin ()
 
reverse_iterator rend ()
 
const_reverse_iterator rbegin () const
 
const_reverse_iterator rend () const
 
- Public Member Functions inherited from simo::shapes::basic_geometry< basic_point< T > >
geometry_type geom_type () const noexcept
 Returns the geometry type. More...
 
std::string tagged_text () const noexcept
 Returns the geometry type as a string. More...
 
dimension_type dim () const noexcept
 Returns the dimension type for the geometry. More...
 
size_t ndim () const noexcept
 Returns the number of dimensions of the geometry. More...
 
void throw_for_invalid () const
 Raise an error if the geometry is invalid. More...
 
bool is_closed () const noexcept
 Whether the geometry is closed. More...
 
bool is_valid () const noexcept
 Whether the geometry is valid. More...
 
bounds_t bounds () const
 Returns the bounding box of the geometry. More...
 
bool has_z () const noexcept
 Whether the geometry has the z-coordinate. More...
 
bool has_m () const noexcept
 Whether the geometry has the m-coordinate (measurement coordinate) More...
 
std::string json (std::int32_t precision=-1) const
 Dumps the geojson representation of the geometry. More...
 
std::string wkt (std::int32_t precision=-1) const
 Dumps the wkt representation of the geometry. More...
 

Static Public Member Functions

static basic_point< T > from_polyline (const std::string &polyline, std::int32_t precision=5)
 
- Static Public Member Functions inherited from simo::shapes::basic_geometry< basic_point< T > >
static basic_point< T > from_json (const std::string &json)
 Creates a geometry from a geojson string. More...
 
static basic_point< T > from_wkt (const std::string &wkt)
 Creates a Geometry from a wkt string. More...
 

Public Attributes

union {
   struct {
      T   x
 
      T   y
 
   } 
 
   struct {
      T   lng
 
      T   lat
 
   } 
 
   T   coords [N]
 
}; 
 

Static Public Attributes

static const size_type N = 2
 

Friends

class basic_geometry< basic_point< T > >
 for allow basic_geometry to access basic_point private members
 
bool operator== (const basic_point< T > &lhs, const basic_point< T > &rhs)
 
bool operator!= (const basic_point< T > &lhs, const basic_point< T > &rhs)
 

Detailed Description

template<class T, typename = typename std::enable_if<std::is_arithmetic<T>::value, T>::type>
class simo::shapes::basic_point< T, typename >

Definition at line 42 of file point.hpp.

Constructor & Destructor Documentation

template<class T, typename = typename std::enable_if<std::is_arithmetic<T>::value, T>::type>
simo::shapes::basic_point< T, typename >::basic_point ( x,
y 
)
inline

Creates a point from the given coordinates.

Parameters
xthe x-coordinate
ythe y-coordinate

Definition at line 90 of file point.hpp.

template<class T, typename = typename std::enable_if<std::is_arithmetic<T>::value, T>::type>
simo::shapes::basic_point< T, typename >::basic_point ( coord_iterator  begin,
coord_iterator  end 
)
inlineexplicit
Todo:
(pavel) deal with repetition

Definition at line 93 of file point.hpp.

template<class T, typename = typename std::enable_if<std::is_arithmetic<T>::value, T>::type>
simo::shapes::basic_point< T, typename >::basic_point ( coord_const_iterator  begin,
coord_const_iterator  end 
)
inlineexplicit
Todo:
(pavel) deal with repetition

Definition at line 104 of file point.hpp.


The documentation for this class was generated from the following file: