MySQL 8.0.40
Source Code Documentation
gis::Polygon Class Referenceabstract

A polygon consisting of an outer ring and zero or more interior rings defining holes in the polygon. More...

#include <geometries.h>

Inheritance diagram for gis::Polygon:
[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...
 
Polygonclone () const override=0
 
virtual void push_back (const Linearring &lr)=0
 Adds a linear ring to the polygon. More...
 
virtual void push_back (Linearring &&lr)=0
 
virtual bool empty () const =0
 Checks if the polygon is empty. More...
 
virtual std::size_t size () const =0
 Returns the size of the polygon. More...
 
virtual Linearringexterior_ring ()=0
 Returns the exterior ring of the polygon. More...
 
virtual Linearringinterior_ring (std::size_t n)=0
 Returns an interior ring of the polygon. More...
 
- 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 Polygoncreate_polygon (Coordinate_system coordinate_system)
 Creates a subclass of Polygon from a Coordinate_system. More...
 

Detailed Description

A polygon consisting of an outer ring and zero or more interior rings defining holes in the polygon.

Polygon is an instantiable type in SQL.

The interior rings must be inside the exterior ring (not enforced by the implementation).

Member Function Documentation

◆ accept()

bool gis::Polygon::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::Surface.

Implemented in gis::Cartesian_polygon, and gis::Geographic_polygon.

◆ clone()

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

◆ create_polygon()

Polygon * gis::Polygon::create_polygon ( Coordinate_system  coordinate_system)
static

Creates a subclass of Polygon from a Coordinate_system.

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

◆ empty()

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

Checks if the polygon is empty.

The polygon is considered empty if it has no rings.

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

Implemented in gis::Cartesian_polygon, and gis::Geographic_polygon.

◆ exterior_ring()

virtual Linearring & gis::Polygon::exterior_ring ( )
pure virtual

Returns the exterior ring of the polygon.

Note
If the polygon currently has no exterior ring, an empty one is added.
Returns
The exterior ring.

Implemented in gis::Cartesian_polygon, and gis::Geographic_polygon.

◆ interior_ring()

virtual Linearring & gis::Polygon::interior_ring ( std::size_t  n)
pure virtual

Returns an interior ring of the polygon.

Parameters
nRing number, zero indexed.
Returns
The interior ring.

Implemented in gis::Cartesian_polygon, and gis::Geographic_polygon.

◆ is_empty()

bool gis::Polygon::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.

◆ push_back() [1/2]

virtual void gis::Polygon::push_back ( const Linearring lr)
pure virtual

Adds a linear ring to the polygon.

The first ring will become the exterior ring. All following rings will be interior rings (holes).

Parameters
lrThe linear ring to add.

Implemented in gis::Cartesian_polygon, and gis::Geographic_polygon.

◆ push_back() [2/2]

virtual void gis::Polygon::push_back ( Linearring &&  lr)
pure virtual

◆ size()

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

Returns the size of the polygon.

Returns
Number of rings in the polygon (exterior + interior).

Implemented in gis::Cartesian_polygon, and gis::Geographic_polygon.

◆ type()

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

Gets the geometry type of the object.

Returns
The type of this object

Implements gis::Surface.


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