1#ifndef SQL_GIS_GEOMETRIES_H_INCLUDED
2#define SQL_GIS_GEOMETRIES_H_INCLUDED
91class Geometry_visitor;
157 return (std::isnan(
m_x) || std::isnan(
m_y));
170 template <std::
size_t K>
193 template <std::
size_t K>
236 return (lhs.
x() < rhs.
x()) || (lhs.
x() == rhs.
x() && lhs.
y() < rhs.
y());
293 virtual std::size_t
size()
const = 0;
310 virtual const
Point &operator[](
std::
size_t i) const = 0;
385 virtual std::size_t
size()
const = 0;
444 virtual std::size_t
size()
const = 0;
An abstract 2d curve.
Definition: geometries.h:242
bool accept(Geometry_visitor *v) override=0
Applies a hierarchical visitor to this geometry.
Geometry_type type() const override=0
Gets the geometry type of the object.
Abstract visitor class to be used on class Geometry and descendants.
Definition: geometry_visitor.h:46
Abstract superclass for all geometric objects.
Definition: geometries.h:100
virtual Coordinate_system coordinate_system() const =0
Gets the coordinate system.
virtual bool is_empty() const =0
Check if this is an empty geometry.
virtual bool accept(Geometry_visitor *v)=0
Applies a hierarchical visitor to this geometry.
Geometry & operator=(const Geometry &)=default
virtual ~Geometry()=default
virtual Geometry_type type() const =0
Gets the geometry type of the object.
virtual Geometry * clone() const =0
Geometry(const Geometry &)=default
A collection of geometries.
Definition: geometries.h:410
virtual void pop_front()=0
Removes a geometry from the front of the collection.
virtual void push_back(const Geometry &g)=0
Adds a geometry to the collection.
Geometry_type type() const override
Gets the geometry type of the object.
Definition: geometries.h:412
static Geometrycollection * CreateGeometrycollection(Coordinate_system coordinate_system)
Creates a subclass of Geometrycollection from a Coordinate_system.
bool accept(Geometry_visitor *v) override=0
Applies a hierarchical visitor to this geometry.
virtual bool empty() const =0
Checks if the collection is empty.
virtual void clear() noexcept=0
Removes all geometries from the geometrycollection.
virtual void resize(std::size_t count)=0
Resizes the geometrycollection to contain a given number of elements.
virtual std::size_t size() const =0
Returns the size of the geometrycollection.
virtual void push_back(Geometry &&g)=0
A ring-shaped linestring.
Definition: geometries.h:320
bool accept(Geometry_visitor *v) override=0
Applies a hierarchical visitor to this geometry.
A string of connected line segments.
Definition: geometries.h:256
virtual void push_back(const Point &pt)=0
Adds a point to the end of the linestring.
virtual void clear() noexcept=0
Removes all points from the linestring.
bool accept(Geometry_visitor *v) override=0
Applies a hierarchical visitor to this geometry.
bool is_empty() const override
Check if this is an empty geometry.
Definition: geometries.h:260
virtual Point & back()=0
Returns the last point of the linestring.
virtual Point & front()=0
Returns the first point of the linestring.
virtual void push_back(Point &&pt)=0
virtual std::size_t size() const =0
Returns the size of (number of points in) the linestring.
virtual void pop_front()=0
Removes a point from the front of the linestring.
virtual bool empty() const =0
Checks if the linestring is empty.
static Linestring * create_linestring(Coordinate_system coordinate_system)
Creates a subclass of Linestring from a Coordinate_system.
Definition: geometries.cc:74
Linestring * clone() const override=0
Geometry_type type() const override
Gets the geometry type of the object.
Definition: geometries.h:258
An abstract collection of curves.
Definition: geometries.h:514
Geometry_type type() const override=0
Gets the geometry type of the object.
bool accept(Geometry_visitor *v) override=0
Applies a hierarchical visitor to this geometry.
A collection of linestrings.
Definition: geometries.h:523
const Linestring & front() const override=0
Linestring & front() override=0
Returns the first linestring of the Multilinestring.
bool accept(Geometry_visitor *v) override=0
Applies a hierarchical visitor to this geometry.
Geometry_type type() const override
Gets the geometry type of the object.
Definition: geometries.h:525
Multilinestring * clone() const override=0
Clone pattern to easily duplicate a Multilinestring.
A collection of points.
Definition: geometries.h:484
Geometry_type type() const override
Gets the geometry type of the object.
Definition: geometries.h:486
const Point & front() const override=0
bool accept(Geometry_visitor *v) override=0
Applies a hierarchical visitor to this geometry.
Multipoint * clone() const override=0
Clone pattern to easily duplicate a Multipoint.
Point & front() override=0
Returns the first point of the Multipoint.
A collection of polygons.
Definition: geometries.h:564
Geometry_type type() const override
Gets the geometry type of the object.
Definition: geometries.h:566
const Polygon & front() const override=0
Polygon & front() override=0
Returns the first polygon of the Multipolygon.
Multipolygon * clone() const override=0
Clone pattern to easily duplicate a Multipolygon.
bool accept(Geometry_visitor *v) override=0
Applies a hierarchical visitor to this geometry.
An abstract collection of surfaces.
Definition: geometries.h:555
bool accept(Geometry_visitor *v) override=0
Applies a hierarchical visitor to this geometry.
Geometry_type type() const override=0
Gets the geometry type of the object.
A 2d point.
Definition: geometries.h:150
void set(double d)
Sets a coordinate.
bool is_empty() const override
Check if this is an empty geometry.
Definition: geometries.h:156
double get() const
Gets a coordinate value.
double x() const
Gets the first coordinate value.
Definition: geometries.cc:46
Point(double x, double y)
Definition: geometries.h:153
bool accept(Geometry_visitor *v) override
Applies a hierarchical visitor to this geometry.
Definition: geometries.cc:34
Geometry_type type() const override
Gets the geometry type of the object.
Definition: geometries.h:154
double m_x
First coordinate (X or longitude).
Definition: geometries.h:215
double m_y
Second coordinate (Y or latitude).
Definition: geometries.h:221
Point()
Definition: geometries.h:152
Point * clone() const override=0
double y() const
Gets the second coordinate value.
Definition: geometries.cc:48
A polygon consisting of an outer ring and zero or more interior rings defining holes in the polygon.
Definition: geometries.h:349
Polygon * clone() const override=0
bool is_empty() const override
Check if this is an empty geometry.
Definition: geometries.h:353
virtual bool empty() const =0
Checks if the polygon is empty.
virtual void push_back(Linearring &&lr)=0
virtual std::size_t size() const =0
Returns the size of the polygon.
virtual Linearring & interior_ring(std::size_t n)=0
Returns an interior ring of the polygon.
Geometry_type type() const override
Gets the geometry type of the object.
Definition: geometries.h:351
bool accept(Geometry_visitor *v) override=0
Applies a hierarchical visitor to this geometry.
virtual void push_back(const Linearring &lr)=0
Adds a linear ring to the polygon.
virtual Linearring & exterior_ring()=0
Returns the exterior ring of the polygon.
An abstract 2d surface.
Definition: geometries.h:335
bool accept(Geometry_visitor *v) override=0
Applies a hierarchical visitor to this geometry.
Geometry_type type() const override=0
Gets the geometry type of the object.
static int count
Definition: myisam_ftdump.cc:43
Coordinate_system
Types of coordinate systems.
Definition: geometries.h:69
@ kCartesian
A Cartesian plane with the same unit in both directions.
@ kGeographic
An ellipsoidal system with longitude and latitude coordinates, both in the same unit.
const char * type_to_name(Geometry_type type)
Get the type name string corresponding to a geometry type.
Definition: geometries.cc:688
Geometry_type
Types of geometry objects.
Definition: geometries.h:53
bool operator<(const Point &lhs, const Point &rhs)
Compares two points.
Definition: geometries.h:235
Ring_direction
Direction of a ring.
Definition: geometries.h:78
Definition: gcs_xcom_synode.h:64
static Geometry * create_multipoint(char *buffer)
Definition: spatial.cc:217
static Geometry * create_multipolygon(char *buffer)
Definition: spatial.cc:221
static Geometry * create_geometrycollection(char *buffer)
Definition: spatial.cc:229
static Geometry * create_multilinestring(char *buffer)
Definition: spatial.cc:225
static Geometry * create_polygon(char *buffer)
Definition: spatial.cc:213
int n
Definition: xcom_base.cc:509