GEOS 3.6.2
MCIndexSnapRounder.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2006 Refractions Research Inc.
7 *
8 * This is free software; you can redistribute and/or modify it under
9 * the terms of the GNU Lesser General Public Licence as published
10 * by the Free Software Foundation.
11 * See the COPYING file for more information.
12 *
13 **********************************************************************
14 *
15 * Last port: noding/snapround/MCIndexSnapRounder.java r486 (JTS-1.12+)
16 *
17 **********************************************************************/
18
19#ifndef GEOS_NODING_SNAPROUND_MCINDEXSNAPROUNDER_H
20#define GEOS_NODING_SNAPROUND_MCINDEXSNAPROUNDER_H
21
22#include <geos/export.h>
23
24#include <geos/noding/Noder.h> // for inheritance
25#include <geos/noding/NodedSegmentString.h> // for inlines
26#include <geos/noding/snapround/MCIndexPointSnapper.h> // for inines
27#include <geos/algorithm/LineIntersector.h> // for composition
28#include <geos/geom/Coordinate.h> // for use in vector
29#include <geos/geom/PrecisionModel.h> // for inlines
30
31#include <vector>
32
33#ifdef _MSC_VER
34#pragma warning(push)
35#pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
36#endif
37
38// Forward declarations
39namespace geos {
40 namespace algorithm {
41 class LineIntersector;
42 }
43 namespace noding {
44 class SegmentString;
45 class MCIndexNoder;
46 }
47}
48
49namespace geos {
50namespace noding { // geos::noding
51namespace snapround { // geos::noding::snapround
52
53
74class GEOS_DLL MCIndexSnapRounder: public Noder { // implments Noder
75
76public:
77
78 MCIndexSnapRounder(const geom::PrecisionModel& nPm)
79 :
80 pm(nPm),
81 scaleFactor(nPm.getScale()),
82 pointSnapper(0)
83 {
84 li.setPrecisionModel(&pm);
85 }
86
87 std::vector<SegmentString*>* getNodedSubstrings() const {
88 return NodedSegmentString::getNodedSubstrings(*nodedSegStrings);
89 }
90
91 void computeNodes(std::vector<SegmentString*>* segStrings);
92
101 void computeVertexSnaps(std::vector<SegmentString*>& edges);
102
103private:
104
106 const geom::PrecisionModel& pm;
107
109
110 double scaleFactor;
111
112 std::vector<SegmentString*>* nodedSegStrings;
113
114 std::auto_ptr<MCIndexPointSnapper> pointSnapper;
115
116 void snapRound(MCIndexNoder& noder, std::vector<SegmentString*>* segStrings);
117
118
126 void findInteriorIntersections(MCIndexNoder& noder,
127 std::vector<SegmentString*>* segStrings,
128 std::vector<geom::Coordinate>& intersections);
129
134 void computeIntersectionSnaps(std::vector<geom::Coordinate>& snapPts);
135
141
142 void checkCorrectness(std::vector<SegmentString*>& inputSegmentStrings);
143
144 // Declare type as noncopyable
145 MCIndexSnapRounder(const MCIndexSnapRounder& other);
146 MCIndexSnapRounder& operator=(const MCIndexSnapRounder& rhs);
147};
148
149} // namespace geos::noding::snapround
150} // namespace geos::noding
151} // namespace geos
152
153#ifdef _MSC_VER
154#pragma warning(pop)
155#endif
156
157#endif // GEOS_NODING_SNAPROUND_MCINDEXSNAPROUNDER_H
A LineIntersector is an algorithm that can both test whether two line segments intersect and compute ...
Definition LineIntersector.h:49
Specifies the precision model of the Coordinate in a Geometry.
Definition PrecisionModel.h:87
double getScale() const
Returns the multiplying factor used to obtain a precise coordinate.
Nodes a set of SegmentString using a index based on index::chain::MonotoneChain and a index::SpatialI...
Definition MCIndexNoder.h:63
Represents a list of contiguous line segments, and supports noding the segments.
Definition NodedSegmentString.h:58
An interface for classes which represent a sequence of contiguous line segments.
Definition SegmentString.h:46
void computeVertexSnaps(std::vector< SegmentString * > &edges)
void computeNodes(std::vector< SegmentString * > *segStrings)
Computes the noding for a collection of SegmentStrings.
std::vector< SegmentString * > * getNodedSubstrings() const
Returns a Collection of fully noded SegmentStrings. The SegmentStrings have the same context as their...
Definition MCIndexSnapRounder.h:87
Contains classes and interfaces implementing fundamental computational geometry algorithms.
Definition Angle.h:33
Contains classes to implement the Snap Rounding algorithm for noding linestrings.
Definition HotPixel.h:49
Classes to compute nodings for arrangements of line segments and line segment sequences.
Definition PreparedLineString.h:27
Basic namespace for all GEOS functionalities.
Definition IndexedNestedRingTester.h:25