MySQL 8.4.0
Source Code Documentation
gis::Linestring Class Referenceabstract

A string of connected line segments. More...

#include <geometries.h>

Inheritance diagram for gis::Linestring:
[legend]

Public Member Functions

Geometry_type type () const override
 Gets the geometry type of the object. More...
 
bool accept (Geometry_visitor *v) override=0
 Applies a hierarchical visitor to this geometry. More...
 
bool is_empty () const override
 Check if this is an empty geometry. More...
 
Linestringclone () const override=0
 
virtual void push_back (const Point &pt)=0
 Adds a point to the end of the linestring. More...
 
virtual void push_back (Point &&pt)=0
 
virtual void pop_front ()=0
 Removes a point from the front of the linestring. More...
 
virtual bool empty () const =0
 Checks if the linestring is empty. More...
 
virtual std::size_t size () const =0
 Returns the size of (number of points in) the linestring. More...
 
virtual void clear () noexcept=0
 Removes all points from the linestring. More...
 
virtual Pointback ()=0
 Returns the last point of the linestring. More...
 
virtual const Pointback () const =0
 
virtual Pointfront ()=0
 Returns the first point of the linestring. More...
 
virtual const Pointfront () const =0
 
virtual Pointoperator[] (std::size_t i)=0
 
virtual const Pointoperator[] (std::size_t i) const =0
 
- Public Member Functions inherited from gis::Geometry
 Geometry ()=default
 
virtual ~Geometry ()=default
 
 Geometry (const Geometry &)=default
 
Geometryoperator= (const Geometry &)=default
 
virtual Coordinate_system coordinate_system () const =0
 Gets the coordinate system. More...
 

Static Public Member Functions

static Linestringcreate_linestring (Coordinate_system coordinate_system)
 Creates a subclass of Linestring from a Coordinate_system. More...
 

Detailed Description

A string of connected line segments.

Linestring is an instantiable type in SQL.

According to the SFA-CA, linestrings have a linear interpolation between points. In MySQL, a linestring represents the geodesic. On a plane, this is linear interpolation, but on an ellipsoid, it's the shortest path along the ellipsoid surface.

Member Function Documentation

◆ accept()

bool gis::Linestring::accept ( Geometry_visitor v)
overridepure virtual

Applies a hierarchical visitor to this geometry.

See also
gis::Geometry_visitor
Parameters
vA hierarchical visitor.
Return values
trueThe execution was aborted by the visitor.
falseThe execution completed.

Implements gis::Curve.

Implemented in gis::Cartesian_linestring, gis::Geographic_linestring, gis::Cartesian_linearring, gis::Geographic_linearring, and gis::Linearring.

◆ back() [1/2]

virtual const Point & gis::Linestring::back ( ) const
pure virtual

◆ back() [2/2]

virtual Point & gis::Linestring::back ( )
pure virtual

Returns the last point of the linestring.

Returns
Last point of linestring

Implemented in gis::Cartesian_linestring, gis::Geographic_linestring, gis::Cartesian_linearring, and gis::Geographic_linearring.

◆ clear()

virtual void gis::Linestring::clear ( )
pure virtualnoexcept

Removes all points from the linestring.

Implemented in gis::Cartesian_linestring, gis::Geographic_linestring, gis::Cartesian_linearring, and gis::Geographic_linearring.

◆ clone()

Linestring * gis::Linestring::clone ( ) const
overridepure virtual

◆ create_linestring()

Linestring * gis::Linestring::create_linestring ( Coordinate_system  coordinate_system)
static

Creates a subclass of Linestring from a Coordinate_system.

Parameters
[in]coordinate_systemCoordinate system to create a Linestring for.
Returns
A pointer to a Linestring that caller must free when it is done with it.

◆ empty()

virtual bool gis::Linestring::empty ( ) const
pure virtual

Checks if the linestring is empty.

Here, the definition of empty is that the linestring does not contain any points. An invalid linestring with only one coordinate is not empty.

Return values
trueThe linestring is empty.
falseThe linestring is not empty.

Implemented in gis::Cartesian_linestring, gis::Geographic_linestring, gis::Cartesian_linearring, and gis::Geographic_linearring.

◆ front() [1/2]

virtual const Point & gis::Linestring::front ( ) const
pure virtual

◆ front() [2/2]

virtual Point & gis::Linestring::front ( )
pure virtual

Returns the first point of the linestring.

Returns
First point of linestring

Implemented in gis::Cartesian_linestring, gis::Geographic_linestring, gis::Cartesian_linearring, and gis::Geographic_linearring.

◆ is_empty()

bool gis::Linestring::is_empty ( ) const
inlineoverridevirtual

Check if this is an empty geometry.

The definition of empty geometries is the one in SFA-CA (OGC 06-103r4, Sect. 6.1.2.2), i.e., an empty point set.

Note
This is different from the function "empty", which returns true if a geometry contains no subgeometries. E.g., a geometry collection may contain another geometry collection which is empty. In this case, the "empty" function would return false on the outermost geometry collection, while "is_empty" would return true.
Return values
trueThe geometry represents the empty point set.
falseThe geometry represent a non-empty point set.

Implements gis::Geometry.

Reimplemented in gis::Cartesian_linearring, and gis::Geographic_linearring.

◆ operator[]() [1/2]

virtual const Point & gis::Linestring::operator[] ( std::size_t  i) const
pure virtual

◆ operator[]() [2/2]

virtual Point & gis::Linestring::operator[] ( std::size_t  i)
pure virtual

◆ pop_front()

virtual void gis::Linestring::pop_front ( )
pure virtual

Removes a point from the front of the linestring.

Implemented in gis::Cartesian_linestring, gis::Geographic_linestring, gis::Cartesian_linearring, and gis::Geographic_linearring.

◆ push_back() [1/2]

virtual void gis::Linestring::push_back ( const Point pt)
pure virtual

Adds a point to the end of the linestring.

Parameters
ptThe point to add.

Implemented in gis::Cartesian_linearring, gis::Geographic_linearring, gis::Cartesian_linestring, and gis::Geographic_linestring.

◆ push_back() [2/2]

virtual void gis::Linestring::push_back ( Point &&  pt)
pure virtual

◆ size()

virtual std::size_t gis::Linestring::size ( ) const
pure virtual

Returns the size of (number of points in) the linestring.

Returns
Number of points in the linestring.

Implemented in gis::Cartesian_linestring, gis::Geographic_linestring, gis::Cartesian_linearring, and gis::Geographic_linearring.

◆ type()

Geometry_type gis::Linestring::type ( ) const
inlineoverridevirtual

Gets the geometry type of the object.

Returns
The type of this object

Implements gis::Curve.

Reimplemented in gis::Cartesian_linearring, and gis::Geographic_linearring.


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