BasicPreparedGeometry.h
/**********************************************************************
*
* GEOS - Geometry Engine Open Source
* http://geos.osgeo.org
*
* Copyright (C) 2006 Refractions Research 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/prep/BasicPreparedGeometry.java rev. 1.5 (JTS-1.10)
*
**********************************************************************/
#pragma once
#include <geos/geom/prep/PreparedGeometry.h> // for inheritance
#include <geos/geom/Coordinate.h>
#include <geos/operation/relateng/RelateNG.h>
#include <vector>
#include <string>
namespace geos {
namespace geom {
class Geometry;
class Coordinate;
}
}
namespace geos {
namespace geom { // geos::geom
namespace prep { // geos::geom::prep
// * \class BasicPreparedGeometry
class BasicPreparedGeometry: public PreparedGeometry {
using RelateNG = geos::operation::relateng::RelateNG;
private:
const geom::Geometry* baseGeom;
std::vector<const CoordinateXY*> representativePts;
mutable std::unique_ptr<RelateNG> relate_ng;
RelateNG& getRelateNG() const
{
if (relate_ng == nullptr)
relate_ng = RelateNG::prepare(baseGeom);
return *relate_ng;
}
protected:
void setGeometry(const geom::Geometry* geom);
bool envelopesIntersect(const geom::Geometry* g) const;
bool envelopeCovers(const geom::Geometry* g) const;
public:
BasicPreparedGeometry(const Geometry* geom);
~BasicPreparedGeometry() override = default;
const geom::Geometry&
getGeometry() const override
{
return *baseGeom;
}
const std::vector<const CoordinateXY*>*
getRepresentativePoints() const
{
return &representativePts;
}
bool isAnyTargetComponentInTest(const geom::Geometry* testGeom) const;
bool within(const geom::Geometry* g) const override;
bool contains(const geom::Geometry* g) const override;
bool containsProperly(const geom::Geometry* g) const override;
bool coveredBy(const geom::Geometry* g) const override;
bool covers(const geom::Geometry* g) const override;
bool crosses(const geom::Geometry* g) const override;
bool disjoint(const geom::Geometry* g) const override;
bool intersects(const geom::Geometry* g) const override;
bool overlaps(const geom::Geometry* g) const override;
bool touches(const geom::Geometry* g) const override;
std::unique_ptr<IntersectionMatrix> relate(const geom::Geometry* g) const override;
bool relate(const geom::Geometry* g, const std::string& pat) const override;
std::unique_ptr<geom::CoordinateSequence> nearestPoints(const geom::Geometry* g) const override;
double distance(const geom::Geometry* g) const override;
bool isWithinDistance(const geom::Geometry* geom, double dist) const override;
std::string toString();
};
} // namespace geos::geom::prep
} // namespace geos::geom
} // namespace geos
geos::geom::Coordinate
Coordinate is the lightweight class used to store coordinates.
Definition Coordinate.h:217
geos::geom::Geometry
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition Geometry.h:196
geos::geom::prep::BasicPreparedGeometry::covers
bool covers(const geom::Geometry *g) const override
geos::geom::prep::BasicPreparedGeometry::envelopeCovers
bool envelopeCovers(const geom::Geometry *g) const
geos::geom::prep::BasicPreparedGeometry::relate
bool relate(const geom::Geometry *g, const std::string &pat) const override
geos::geom::prep::BasicPreparedGeometry::coveredBy
bool coveredBy(const geom::Geometry *g) const override
geos::geom::prep::BasicPreparedGeometry::relate
std::unique_ptr< IntersectionMatrix > relate(const geom::Geometry *g) const override
geos::geom::prep::BasicPreparedGeometry::isWithinDistance
bool isWithinDistance(const geom::Geometry *geom, double dist) const override
geos::geom::prep::BasicPreparedGeometry::intersects
bool intersects(const geom::Geometry *g) const override
geos::geom::prep::BasicPreparedGeometry::contains
bool contains(const geom::Geometry *g) const override
geos::geom::prep::BasicPreparedGeometry::getGeometry
const geom::Geometry & getGeometry() const override
Gets the original Geometry which has been prepared.
Definition BasicPreparedGeometry.h:103
geos::geom::prep::BasicPreparedGeometry::distance
double distance(const geom::Geometry *g) const override
geos::geom::prep::BasicPreparedGeometry::isAnyTargetComponentInTest
bool isAnyTargetComponentInTest(const geom::Geometry *testGeom) const
geos::geom::prep::BasicPreparedGeometry::envelopesIntersect
bool envelopesIntersect(const geom::Geometry *g) const
geos::geom::prep::BasicPreparedGeometry::touches
bool touches(const geom::Geometry *g) const override
geos::geom::prep::BasicPreparedGeometry::crosses
bool crosses(const geom::Geometry *g) const override
geos::geom::prep::BasicPreparedGeometry::overlaps
bool overlaps(const geom::Geometry *g) const override
geos::geom::prep::BasicPreparedGeometry::setGeometry
void setGeometry(const geom::Geometry *geom)
geos::geom::prep::BasicPreparedGeometry::within
bool within(const geom::Geometry *g) const override
geos::geom::prep::BasicPreparedGeometry::disjoint
bool disjoint(const geom::Geometry *g) const override
geos::geom::prep::BasicPreparedGeometry::getRepresentativePoints
const std::vector< const CoordinateXY * > * getRepresentativePoints() const
Definition BasicPreparedGeometry.h:116
geos::geom::prep::BasicPreparedGeometry::nearestPoints
std::unique_ptr< geom::CoordinateSequence > nearestPoints(const geom::Geometry *g) const override
geos::geom::prep::BasicPreparedGeometry::containsProperly
bool containsProperly(const geom::Geometry *g) const override
geos::geom::prep::PreparedGeometry
An interface for classes which prepare Geometrys in order to optimize the performance of repeated cal...
Definition PreparedGeometry.h:58
geos::operation::relateng::RelateNG
Definition RelateNG.h:86
geos::operation::relateng::RelateNG::prepare
static std::unique_ptr< RelateNG > prepare(const Geometry *a)
geos::geom::prep
Contains classes and interfaces implementing algorithms that optimize the performance of repeated cal...
Definition AbstractPreparedPolygonContains.h:30
geos::geom
Definition Angle.h:26
geos
Basic namespace for all GEOS functionalities.
Definition geos.h:38