GEOS 3.14.0dev
TopologyPredicate.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (c) 2024 Martin Davis
7 * Copyright (C) 2024 Paul Ramsey <pramsey@cleverelephant.ca>
8 *
9 * This is free software; you can redistribute and/or modify it under
10 * the terms of the GNU Lesser General Public Licence as published
11 * by the Free Software Foundation.
12 * See the COPYING file for more information.
13 *
14 **********************************************************************/
15
16#pragma once
17
18#include <geos/geom/Location.h>
19#include <geos/export.h>
20
21#include <ostream> // for operator<<
22#include <string>
23
24// Forward declarations
25namespace geos {
26namespace geom {
27 class Envelope;
28}
29}
30
31namespace geos { // geos.
32namespace operation { // geos.operation
33namespace relateng { // geos.operation.relateng
34
35
36class GEOS_DLL TopologyPredicate {
37 using Envelope = geos::geom::Envelope;
39
40public:
41
42 /* Virtual destructor to ensure proper cleanup of derived classes */
43 virtual ~TopologyPredicate() {};
44
50 virtual std::string name() const = 0;
51
56 virtual void finish() = 0;
57
63 virtual bool isKnown() const = 0;
64
71 virtual bool value() const = 0;
72
89 virtual bool requireSelfNoding() const {
90 return true;
91 };
92
105 virtual bool requireInteraction() const {
106 return true;
107 };
108
122 virtual bool requireCovers(bool isSourceA) {
123 (void)isSourceA;
124 return false;
125 }
126
139 virtual bool requireExteriorCheck(bool isSourceA) const {
140 (void)isSourceA;
141 return true;
142 }
143
154 virtual void init(int dimA, int dimB) {
155 (void)dimA;
156 (void)dimB;
157 };
158
167 virtual void init(const Envelope& envA, const Envelope& envB)
168 {
169 //-- default if envelopes provide no information
170 (void)envA;
171 (void)envB;
172 };
173
190 virtual void updateDimension(Location locA, Location locB, int dimension) = 0;
191
192
193 friend std::ostream&
194 operator<<(std::ostream& os, const TopologyPredicate& ns)
195 {
196 os << ns.name();
197 return os;
198 }
199
200};
201
202} // namespace geos.operation.relateng
203} // namespace geos.operation
204} // namespace geos
205
An Envelope defines a rectangulare region of the 2D coordinate plane.
Definition Envelope.h:59
Location
Constants representing the location of a point relative to a geometry.
Definition Location.h:32
Basic namespace for all GEOS functionalities.
Definition geos.h:39