MCIndexSnapRounder.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: noding/snapround/MCIndexSnapRounder.java r486 (JTS-1.12+)
*
**********************************************************************/
#pragma once
#include <geos/export.h>
#include <geos/noding/Noder.h> // for inheritance
#include <geos/noding/NodedSegmentString.h> // for inlines
#include <geos/noding/snapround/MCIndexPointSnapper.h> // for inlines
#include <geos/algorithm/LineIntersector.h> // for composition
#include <geos/geom/Coordinate.h> // for use in vector
#include <geos/geom/PrecisionModel.h> // for inlines
#include <vector>
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
#endif
// Forward declarations
namespace geos {
namespace algorithm {
class LineIntersector;
}
namespace noding {
class SegmentString;
class MCIndexNoder;
}
}
namespace geos {
namespace noding { // geos::noding
namespace snapround { // geos::noding::snapround
class GEOS_DLL MCIndexSnapRounder: public Noder { // implements Noder
public:
MCIndexSnapRounder(const geom::PrecisionModel& nPm)
:
pm(nPm),
scaleFactor(nPm.getScale()),
pointSnapper(nullptr)
{
li.setPrecisionModel(&pm);
}
std::vector<SegmentString*>*
getNodedSubstrings() const override
{
return NodedSegmentString::getNodedSubstrings(*nodedSegStrings);
}
void computeNodes(std::vector<SegmentString*>* segStrings) override;
void computeVertexSnaps(std::vector<SegmentString*>& edges);
private:
const geom::PrecisionModel& pm;
algorithm::LineIntersector li;
double scaleFactor;
std::vector<SegmentString*>* nodedSegStrings;
std::unique_ptr<MCIndexPointSnapper> pointSnapper;
void snapRound(MCIndexNoder& noder, std::vector<SegmentString*>* segStrings);
void findInteriorIntersections(MCIndexNoder& noder,
std::vector<SegmentString*>* segStrings,
std::vector<geom::Coordinate>& intersections);
void computeIntersectionSnaps(std::vector<geom::Coordinate>& snapPts);
void computeVertexSnaps(NodedSegmentString* e);
void checkCorrectness(std::vector<SegmentString*>& inputSegmentStrings);
// Declare type as noncopyable
MCIndexSnapRounder(const MCIndexSnapRounder& other) = delete;
MCIndexSnapRounder& operator=(const MCIndexSnapRounder& rhs) = delete;
};
} // namespace geos::noding::snapround
} // namespace geos::noding
} // namespace geos
#ifdef _MSC_VER
#pragma warning(pop)
#endif
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::PrecisionModel
Specifies the precision model of the Coordinate in a Geometry.
Definition PrecisionModel.h:87
geos::geom::PrecisionModel::getScale
double getScale() const
Returns the multiplying factor used to obtain a precise coordinate.
Definition PrecisionModel.h:228
geos::noding::MCIndexNoder
Nodes a set of SegmentString using a index based on MonotoneChain and a SpatialIndex.
Definition MCIndexNoder.h:65
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::MCIndexSnapRounder::getNodedSubstrings
std::vector< SegmentString * > * getNodedSubstrings() const override
Returns a collection of fully noded SegmentStrings. The SegmentStrings have the same context as their...
Definition MCIndexSnapRounder.h:87
geos::noding::snapround::MCIndexSnapRounder::computeVertexSnaps
void computeVertexSnaps(std::vector< SegmentString * > &edges)
geos::noding::snapround::MCIndexSnapRounder::computeNodes
void computeNodes(std::vector< SegmentString * > *segStrings) override
Computes the noding for a collection of SegmentStrings.
geos::algorithm
Contains classes and interfaces implementing fundamental computational geometry algorithms.
Definition Angle.h:32
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