GEOS 3.9.1
OverlayLabel.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2020 Paul Ramsey <pramsey@cleverelephant.ca>
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#pragma once
16
17#include <geos/geom/Location.h>
18#include <geos/geom/Position.h>
19#include <geos/export.h>
20
21
22namespace geos { // geos.
23namespace operation { // geos.operation
24namespace overlayng { // geos.operation.overlayng
25
26
29
30
90class GEOS_DLL OverlayLabel {
91
92private:
93
94 // Members
95 int aDim = DIM_NOT_PART;
96 bool aIsHole = false;
97 Location aLocLeft = LOC_UNKNOWN;
98 Location aLocRight = LOC_UNKNOWN;
99 Location aLocLine = LOC_UNKNOWN;
100 int bDim = DIM_NOT_PART;
101 bool bIsHole = false;
102 Location bLocLeft = LOC_UNKNOWN;
103 Location bLocRight = LOC_UNKNOWN;
104 Location bLocLine = LOC_UNKNOWN;
105
106
107 std::string dimensionSymbol(int dim) const;
108 void locationString(int index, bool isForward, std::ostream& os) const;
109
110
111public:
112
113 static constexpr Location LOC_UNKNOWN = Location::NONE;
114
115 enum {
116 DIM_UNKNOWN = -1,
117 DIM_NOT_PART = -1,
118 DIM_LINE = 1,
119 DIM_BOUNDARY = 2,
120 DIM_COLLAPSE = 3
121 };
122
124 : aDim(DIM_NOT_PART)
125 , aIsHole(false)
126 , aLocLeft(LOC_UNKNOWN)
127 , aLocRight(LOC_UNKNOWN)
128 , aLocLine(LOC_UNKNOWN)
129 , bDim(DIM_NOT_PART)
130 , bIsHole(false)
131 , bLocLeft(LOC_UNKNOWN)
132 , bLocRight(LOC_UNKNOWN)
133 , bLocLine(LOC_UNKNOWN) {};
134
135 OverlayLabel(int p_index)
136 : OverlayLabel()
137 {
138 initLine(p_index);
139 };
140
141 OverlayLabel(int p_index, Location p_locLeft, Location p_locRight, bool p_isHole)
142 : OverlayLabel()
143 {
144 initBoundary(p_index, p_locLeft, p_locRight, p_isHole);
145 };
146
147 int dimension(int index) const { return index == 0 ? aDim : bDim; };
148 void initBoundary(int index, Location locLeft, Location locRight, bool p_isHole);
149 void initCollapse(int index, bool p_isHole);
150 void initLine(int index);
151 void initNotPart(int index);
152
162 void setLocationLine(int index, Location loc);
163 void setLocationAll(int index, Location loc);
164 void setLocationCollapse(int index);
165
166 /*
167 * Tests whether at least one of the sources is a Line.
168 *
169 * @return true if at least one source is a line
170 */
171 bool isLine() const;
172 bool isLine(int index) const;
173 bool isLinear(int index) const;
174 bool isKnown(int index) const;
175 bool isNotPart(int index) const;
176 bool isBoundaryEither() const;
177 bool isBoundaryBoth() const;
178
186 bool isBoundaryCollapse() const;
187
192 bool isBoundaryTouch() const;
193 bool isBoundary(int index) const;
194 bool isLineLocationUnknown(int index) const;
195
201
207 bool isLineInArea(int index) const;
208 bool isHole(int index) const;
209 bool isCollapse(int index) const;
210 Location getLineLocation(int index) const;
211
216 bool isInteriorCollapse() const;
217
223
230 bool isLineInterior(int index) const;
231
243 Location getLocationBoundaryOrLine(int index, int position, bool isForward) const;
244
251 Location getLocation(int index) const;
252 Location getLocation(int index, int position, bool isForward) const;
253 bool hasSides(int index) const;
254
255 OverlayLabel copy() const;
256
257
258 friend std::ostream& operator<<(std::ostream& os, const OverlayLabel& ol);
259 void toString(bool isForward, std::ostream& os) const;
260
261
262};
263
264
265} // namespace geos.operation.overlayng
266} // namespace geos.operation
267} // namespace geos
268
A Position indicates the position of a Location relative to a graph component (Node,...
Definition: Position.h:39
Definition: OverlayLabel.h:90
Location getLocation(int index) const
void setLocationLine(int index, Location loc)
Location getLocationBoundaryOrLine(int index, int position, bool isForward) const
Location
Constants representing the location of a point relative to a geometry.
Definition: Location.h:34
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:26