SnapRoundingIntersectionAdder.h
/**********************************************************************
*
* GEOS - Geometry Engine Open Source
* http://geos.osgeo.org
*
* Copyright (C) 2020 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/export.h>
#include <vector>
#include <memory>
#include <geos/noding/Noder.h> // for inheritance
#include <geos/algorithm/LineIntersector.h> // for composition
#include <geos/geom/Coordinate.h> // for use in vector
#include <geos/geom/CoordinateSequence.h>
#include <geos/geom/PrecisionModel.h> // for inlines (should drop)
#include <geos/noding/SegmentIntersector.h>
// Forward declarations
namespace geos {
namespace geom {
class PrecisionModel;
}
namespace noding {
class SegmentString;
class NodedSegmentString;
namespace snapround {
class HotPixel;
}
}
}
namespace geos {
namespace noding { // geos::noding
namespace snapround { // geos::noding::snapround
class GEOS_DLL SnapRoundingIntersectionAdder: public SegmentIntersector { // implements SegmentIntersector
private:
algorithm::LineIntersector li;
geom::CoordinateSequence intersections;
// const geom::PrecisionModel* pm;
double nearnessTol;
void processNearVertex(const geom::CoordinateSequence& seq0,
std::size_t ptIndex,
const geom::CoordinateSequence& seq1,
std::size_t segIndex,
SegmentString* edge);
bool isNearSegmentInterior(const geom::CoordinateXY& p, const geom::CoordinateXY& p0, const geom::CoordinateXY& p1) const;
public:
SnapRoundingIntersectionAdder(double p_nearnessTol)
: SegmentIntersector()
, intersections(geom::CoordinateSequence::XYZM(0))
, nearnessTol(p_nearnessTol)
{}
geom::CoordinateSequence getIntersections() { return std::move(intersections); };
void processIntersections(SegmentString* e0, std::size_t segIndex0, SegmentString* e1, std::size_t segIndex1) override;
bool isDone() const override { return false; }
};
} // namespace geos::noding::snapround
} // namespace geos::noding
} // namespace geos
geos::algorithm::LineIntersector
A LineIntersector is an algorithm that can both test whether two line segments intersect and compute ...
Definition LineIntersector.h:53
geos::geom::CoordinateSequence
The internal representation of a list of coordinates inside a Geometry.
Definition CoordinateSequence.h:56
geos::geom::PrecisionModel
Specifies the precision model of the Coordinate in a Geometry.
Definition PrecisionModel.h:87
geos::noding::NodedSegmentString
Represents a list of contiguous line segments, and supports noding the segments.
Definition NodedSegmentString.h:58
geos::noding::SegmentString
An interface for classes which represent a sequence of contiguous line segments.
Definition SegmentString.h:47
geos::noding::snapround::HotPixel
Implements a "hot pixel" as used in the Snap Rounding algorithm.
Definition HotPixel.h:60
geos::noding::snapround::SnapRoundingIntersectionAdder::processIntersections
void processIntersections(SegmentString *e0, std::size_t segIndex0, SegmentString *e1, std::size_t segIndex1) override
geos::noding::snapround::SnapRoundingIntersectionAdder::isDone
bool isDone() const override
Definition SnapRoundingIntersectionAdder.h:118
geos::geom::CoordinateSequence::XYZM
static CoordinateSequence XYZM(std::size_t size)
Definition CoordinateSequence.h:146
geos::geom
Definition Angle.h:26
geos::noding::snapround
Contains classes to implement the Snap Rounding algorithm for noding linestrings.
Definition namespaces.h:175
geos::noding
Classes to compute nodings for arrangements of line segments and line segment sequences.
Definition CoverageCleaner.h:42
geos
Basic namespace for all GEOS functionalities.
Definition geos.h:38