AdjacentEdgeLocator.h
/**********************************************************************
*
* GEOS - Geometry Engine Open Source
* http://geos.osgeo.org
*
* Copyright (c) 2024 Martin Davis
* Copyright (C) 2024 Paul Ramsey <pramsey@cleverelephant.ca>
*
* 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.
*
**********************************************************************/
#pragma once
#include <geos/geom/CoordinateSequence.h>
#include <geos/geom/Location.h>
#include <geos/export.h>
// Forward declarations
namespace geos {
namespace operation {
namespace relateng {
class NodeSections;
class NodeSection;
}
}
namespace geom {
class CoordinateXY;
class Geometry;
class LinearRing;
class Polygon;
}
}
namespace geos { // geos.
namespace operation { // geos.operation
namespace relateng { // geos.operation.relateng
class GEOS_DLL AdjacentEdgeLocator {
using CoordinateXY = geos::geom::CoordinateXY;
using CoordinateSequence = geos::geom::CoordinateSequence;
using Geometry = geos::geom::Geometry;
using LinearRing = geos::geom::LinearRing;
using Polygon = geos::geom::Polygon;
using Location = geos::geom::Location;
public:
AdjacentEdgeLocator(const Geometry* geom)
{
init(geom);
}
Location locate(const CoordinateXY* p);
AdjacentEdgeLocator(const AdjacentEdgeLocator&) = delete;
AdjacentEdgeLocator& operator=(const AdjacentEdgeLocator&) = delete;
private:
// Members
std::vector<const CoordinateSequence*> ringList;
/*
* When we have to reorient rings, we end up allocating new
* rings, since we cannot reorient the rings of the input
* geometry, so this is where we store those "local" rings.
*/
std::vector<std::unique_ptr<CoordinateSequence>> localRingList;
// Methods
void addSections(
const CoordinateXY* p,
const CoordinateSequence* ring,
NodeSections& sections);
NodeSection* createSection(
const CoordinateXY* p,
const CoordinateXY* prev,
const CoordinateXY* next);
void init(const Geometry* geom);
void addRings(const Geometry* geom);
void addRing(const LinearRing* ring, bool requireCW);
};
} // namespace geos.operation.relateng
} // namespace geos.operation
} // namespace geos
geos::geom::CoordinateSequence
The internal representation of a list of coordinates inside a Geometry.
Definition CoordinateSequence.h:56
geos::geom::Geometry
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition Geometry.h:196
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::operation::relateng::AdjacentEdgeLocator::AdjacentEdgeLocator
AdjacentEdgeLocator(const AdjacentEdgeLocator &)=delete
geos::operation::relateng::NodeSection
Definition NodeSection.h:50
geos::geom
Definition Angle.h:26
geos::geom::Location
Location
Constants representing the location of a point relative to a geometry.
Definition Location.h:32
geos::operation
Provides classes for implementing operations on geometries.
Definition CleanCoverage.h:34
geos
Basic namespace for all GEOS functionalities.
Definition geos.h:38