GEOS  3.13.0dev
MCIndexPointSnapper.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/MCIndexPointSnapper.java r486 (JTS-1.12+)
16  *
17  **********************************************************************/
18 
19 #pragma once
20 
21 #include <cstddef>
22 #include <geos/export.h>
23 
24 // Forward declarations
25 namespace geos {
26 namespace geom {
27 class Envelope;
28 }
29 namespace index {
30 class SpatialIndex;
31 }
32 namespace noding {
33 class SegmentString;
34 namespace snapround {
35 class HotPixel;
36 }
37 }
38 }
39 
40 namespace geos {
41 namespace noding { // geos::noding
42 namespace snapround { // geos::noding::snapround
43 
49 class GEOS_DLL MCIndexPointSnapper {
50 
51 public:
52 
53 
55  :
56  index(nIndex)
57  {}
58 
71  bool snap(HotPixel& hotPixel, SegmentString* parentEdge,
72  std::size_t vertexIndex);
73 
74  bool
75  snap(HotPixel& hotPixel)
76  {
77  return snap(hotPixel, nullptr, 0);
78  }
79 
80  geom::Envelope getSafeEnvelope(const HotPixel& hp) const;
81 
82 
83 private:
84 
85  static constexpr double SAFE_ENV_EXPANSION_FACTOR = 0.75;
86 
87  index::SpatialIndex& index;
88 
89  // Declare type as noncopyable
90  MCIndexPointSnapper(const MCIndexPointSnapper& other) = delete;
91  MCIndexPointSnapper& operator=(const MCIndexPointSnapper& rhs) = delete;
92 };
93 
94 
95 } // namespace geos::noding::snapround
96 } // namespace geos::noding
97 } // namespace geos
98 
An Envelope defines a rectangulare region of the 2D coordinate plane.
Definition: Envelope.h:58
Abstract class defines basic insertion and query operations supported by classes implementing spatial...
Definition: SpatialIndex.h:46
An interface for classes which represent a sequence of contiguous line segments.
Definition: SegmentString.h:47
Implements a "hot pixel" as used in the Snap Rounding algorithm.
Definition: HotPixel.h:60
"Snaps" all SegmentStrings in a SpatialIndex containing MonotoneChains to a given HotPixel.
Definition: MCIndexPointSnapper.h:49
bool snap(HotPixel &hotPixel, SegmentString *parentEdge, std::size_t vertexIndex)
Snaps (nodes) all interacting segments to this hot pixel.
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25