GEOS  3.13.1
IMPredicate.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/geom/Dimension.h>
20 #include <geos/geom/IntersectionMatrix.h>
21 #include <geos/operation/relateng/BasicPredicate.h>
22 #include <geos/export.h>
23 
24 #include <memory>
25 #include <vector>
26 
27 // Forward declarations
28 namespace geos {
29 namespace geom {
30  class Envelope;
31 }
32 }
33 
34 
39 
40 
41 namespace geos { // geos.
42 namespace operation { // geos.operation.
43 namespace relateng { // geos.operation.relateng
44 
45 
46 class GEOS_DLL IMPredicate : public BasicPredicate {
47 
48 private:
49 
50 
51 
52 protected:
53 
54  static constexpr int DIM_UNKNOWN = Dimension::DONTCARE;
55 
56  int dimA;
57  int dimB;
58  IntersectionMatrix intMatrix;
59 
66  virtual bool valueIM() = 0;
67 
78  virtual bool isDetermined() const = 0;
79 
87  bool intersectsExteriorOf(bool isA) const;
88 
89  bool isIntersects(Location locA, Location locB) const;
90 
91 
92 public:
93 
94  IMPredicate()
95  {
96  // intMatrix = new IntersectionMatrix();
97  //-- E/E is always dim = 2
99  }
100 
101  static bool isDimsCompatibleWithCovers(int dim0, int dim1);
102 
103  void init(int dA, int dB) override;
104 
105  void updateDimension(Location locA, Location locB, int dimension) override;
106 
107  bool isDimChanged(Location locA, Location locB, int dimension) const;
108 
109  using TopologyPredicate::isKnown;
110  bool isKnown(Location locA, Location locB) const;
111 
112  bool isDimension(Location locA, Location locB, int dimension) const;
113 
114  int getDimension(Location locA, Location locB) const;
115 
119  void finish() override;
120 
121  std::string toString() const;
122 
123  friend std::ostream& operator<<(std::ostream& os, const IMPredicate& imp);
124 
125 
126 };
127 
128 } // namespace geos.operation.relateng
129 } // namespace geos.operation
130 } // namespace geos
131 
Definition: Dimension.h:27
@ A
Dimension value of a surface (2).
Definition: Dimension.h:46
@ DONTCARE
Dimension value for any dimension (= {FALSE, TRUE}).
Definition: Dimension.h:31
An Envelope defines a rectangulare region of the 2D coordinate plane.
Definition: Envelope.h:59
Implementation of Dimensionally Extended Nine-Intersection Model (DE-9IM) matrix.
Definition: IntersectionMatrix.h:51
void set(Location row, Location column, int dimensionValue)
Changes the value of one of this IntersectionMatrixs elements.
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