RelateSegmentString.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/noding/BasicSegmentString.h>
#include <geos/export.h>
#include <string>
#include <sstream>
// Forward declarations
namespace geos {
namespace geom {
class CoordinateXY;
class CoordinateSequence;
class Geometry;
}
namespace operation {
namespace relateng {
class RelateGeometry;
class NodeSection;
}
}
}
namespace geos { // geos.
namespace operation { // geos.operation
namespace relateng { // geos.operation.relateng
class GEOS_DLL RelateSegmentString : public geos::noding::BasicSegmentString {
using BasicSegmentString = geos::noding::BasicSegmentString;
using Geometry = geos::geom::Geometry;
using CoordinateXY = geos::geom::CoordinateXY;
using CoordinateSequence = geos::geom::CoordinateSequence;
private:
// Members
bool m_isA;
int m_dimension;
int m_id;
int m_ringId;
const RelateGeometry* m_inputGeom;
const Geometry* m_parentPolygonal = nullptr;
// Constructor
RelateSegmentString(
const CoordinateSequence* pts,
bool isA,
int dimension,
int id,
int ringId,
const Geometry* poly,
const RelateGeometry* inputGeom)
: BasicSegmentString(const_cast<CoordinateSequence*>(pts), nullptr)
, m_isA(isA)
, m_dimension(dimension)
, m_id(id)
, m_ringId(ringId)
, m_inputGeom(inputGeom)
, m_parentPolygonal(poly)
{}
// Methods
static const RelateSegmentString* createSegmentString(
const CoordinateSequence* pts,
bool isA, int dim, int elementId, int ringId,
const Geometry* poly, const RelateGeometry* parent);
const CoordinateXY* prevVertex(
std::size_t segIndex,
const CoordinateXY* pt) const;
const CoordinateXY* nextVertex(
std::size_t segIndex,
const CoordinateXY* pt) const;
public:
static const RelateSegmentString* createLine(
const CoordinateSequence* pts,
bool isA, int elementId,
const RelateGeometry* parent);
static const RelateSegmentString* createRing(
const CoordinateSequence* pts,
bool isA, int elementId, int ringId,
const Geometry* poly, const RelateGeometry* parent);
inline bool isA() const {
return m_isA;
}
inline const RelateGeometry* getGeometry() const {
return m_inputGeom;
}
inline const Geometry* getPolygonal() const {
return m_parentPolygonal;
}
NodeSection* createNodeSection(std::size_t segIndex, const CoordinateXY intPt) const;
bool isContainingSegment(std::size_t segIndex, const CoordinateXY* pt) const;
};
} // 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::operation::relateng::NodeSection
Definition NodeSection.h:50
geos::geom
Definition Angle.h:26
geos::operation
Provides classes for implementing operations on geometries.
Definition CleanCoverage.h:34
geos
Basic namespace for all GEOS functionalities.
Definition geos.h:38