Polygon.h
/**********************************************************************
*
* GEOS - Geometry Engine Open Source
* http://geos.osgeo.org
*
* Copyright (C) 2011 Sandro Santilli <strk@kbt.io>
* Copyright (C) 2005 2006 Refractions Research Inc.
* Copyright (C) 2001-2002 Vivid Solutions Inc.
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU Lesser General Public Licence as published
* by the Free Software Foundation.
* See the COPYING file for more information.
*
**********************************************************************
*
* Last port: geom/Polygon.java r320 (JTS-1.12)
*
**********************************************************************/
#pragma once
#include <geos/export.h>
#include <string>
#include <vector>
#include <geos/geom/Geometry.h> // for inheritance
#include <geos/geom/Envelope.h> // for proper use of unique_ptr<>
#include <geos/geom/LinearRing.h>
#include <geos/geom/Dimension.h> // for Dimension::DimensionType
#include <geos/geom/SurfaceImpl.h>
#include <memory> // for unique_ptr
// Forward declarations
namespace geos {
namespace geom { // geos::geom
class Coordinate;
class CoordinateSequenceFilter;
class LineString;
}
}
namespace geos {
namespace geom { // geos::geom
class GEOS_DLL Polygon: public SurfaceImpl<LinearRing> {
public:
friend class GeometryFactory;
typedef std::vector<const Polygon*> ConstVect;
~Polygon() override = default;
std::unique_ptr<CoordinateSequence>
getCoordinates() const override;
std::unique_ptr<Polygon> clone() const
{
return std::unique_ptr<Polygon>(cloneImpl());
}
std::unique_ptr<Geometry> getBoundary() const override;
std::string getGeometryType() const override;
GeometryTypeId getGeometryTypeId() const override;
void normalize() override;
std::unique_ptr<Polygon> reverse() const { return std::unique_ptr<Polygon>(reverseImpl()); }
double getArea() const override;
bool isRectangle() const override;
void orientRings(bool exteriorCW);
protected:
using SurfaceImpl::SurfaceImpl;
Polygon* cloneImpl() const override { return new Polygon(*this); }
Polygon* reverseImpl() const override;
int
getSortIndex() const override
{
return SORTINDEX_POLYGON;
};
private:
void normalize(LinearRing* ring, bool clockwise);
};
} // namespace geos::geom
} // namespace geos
geos::geom::CoordinateSequenceFilter
Interface for classes which provide operations that can be applied to the coordinates in a Coordinate...
Definition CoordinateSequenceFilter.h:56
geos::geom::Coordinate
Coordinate is the lightweight class used to store coordinates.
Definition Coordinate.h:217
geos::geom::LineString
Definition LineString.h:66
geos::geom::LinearRing
Models an OGC SFS LinearRing. A LinearRing is a LineString which is both closed and simple.
Definition LinearRing.h:54
geos::geom::Polygon
Represents a linear polygon, which may include holes.
Definition Polygon.h:61
geos::geom::Polygon::normalize
void normalize() override
geos::geom::Polygon::getGeometryType
std::string getGeometryType() const override
Return a string representation of this Geometry type.
geos::geom::Polygon::ConstVect
std::vector< const Polygon * > ConstVect
A vector of const Polygon pointers.
Definition Polygon.h:68
geos::geom::Polygon::getArea
double getArea() const override
Returns the area of this Geometry.
geos::geom::Polygon::getCoordinates
std::unique_ptr< CoordinateSequence > getCoordinates() const override
Returns this Geometry vertices. Caller takes ownership of the returned object.
geos::geom::Polygon::getBoundary
std::unique_ptr< Geometry > getBoundary() const override
Computes the boundary of this geometry.
geos::geom::Polygon::clone
std::unique_ptr< Polygon > clone() const
Definition Polygon.h:81
geos::geom::Polygon::isRectangle
bool isRectangle() const override
Polygon overrides to check for actual rectangle.
geos::geom::Polygon::orientRings
void orientRings(bool exteriorCW)
Apply a ring ordering convention to this polygon, with interior rings having an opposite orientation ...
geos::geom::Polygon::reverseImpl
Polygon * reverseImpl() const override
Make a geometry with coordinates in reverse order.
geos::geom::Polygon::cloneImpl
Polygon * cloneImpl() const override
Make a deep-copy of this Geometry.
Definition Polygon.h:119
geos::geom::Polygon::getGeometryTypeId
GeometryTypeId getGeometryTypeId() const override
Return an integer representation of this Geometry type.
geos::geom
Definition Angle.h:26
geos::geom::GeometryTypeId
GeometryTypeId
Geometry types.
Definition Geometry.h:73
geos
Basic namespace for all GEOS functionalities.
Definition geos.h:38