GEOS  3.13.1
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
25 namespace geos {
26 namespace geom {
27  class Envelope;
28 }
29 }
30 
31 
34 
35 
36 namespace geos { // geos.
37 namespace operation { // geos.operation
38 namespace relateng { // geos.operation.relateng
39 
40 
41 class GEOS_DLL TopologyPredicate {
42 
43 public:
44 
45  /* Virtual destructor to ensure proper cleanup of derived classes */
46  virtual ~TopologyPredicate() {};
47 
53  virtual std::string name() const = 0;
54 
59  virtual void finish() = 0;
60 
66  virtual bool isKnown() const = 0;
67 
74  virtual bool value() const = 0;
75 
92  virtual bool requireSelfNoding() const {
93  return true;
94  };
95 
108  virtual bool requireInteraction() const {
109  return true;
110  };
111 
125  virtual bool requireCovers(bool isSourceA) {
126  (void)isSourceA;
127  return false;
128  }
129 
142  virtual bool requireExteriorCheck(bool isSourceA) const {
143  (void)isSourceA;
144  return true;
145  }
146 
157  virtual void init(int dimA, int dimB) {
158  (void)dimA;
159  (void)dimB;
160  };
161 
170  virtual void init(const Envelope& envA, const Envelope& envB)
171  {
172  //-- default if envelopes provide no information
173  (void)envA;
174  (void)envB;
175  };
176 
193  virtual void updateDimension(Location locA, Location locB, int dimension) = 0;
194 
195 
196  friend std::ostream&
197  operator<<(std::ostream& os, const TopologyPredicate& ns)
198  {
199  os << ns.name();
200  return os;
201  }
202 
203 };
204 
205 } // namespace geos.operation.relateng
206 } // namespace geos.operation
207 } // namespace geos
208 
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: Angle.h:25