GEOS  3.13.1
BasicPredicate.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/operation/relateng/TopologyPredicate.h>
20 #include <geos/export.h>
21 
22 #include <memory>
23 #include <vector>
24 
25 // Forward declarations
26 namespace geos {
27 namespace geom {
28  class Envelope;
29 }
30 }
31 
32 
35 
36 
37 namespace geos { // geos.
38 namespace operation { // geos.operation.
39 namespace relateng { // geos.operation.relateng
40 
41 
42 class GEOS_DLL BasicPredicate : public TopologyPredicate {
43 
44 private:
45 
46  static constexpr int UNKNOWN = -1;
47  static constexpr int FALSE = 0;
48  static constexpr int TRUE = 1;
49 
50  int m_value = UNKNOWN;
51 
52  static bool isKnown(int val);
53 
54  static bool toBoolean(int val);
55 
56  static int toValue(bool val);
57 
58 
59 protected:
60 
67  void setValue(bool val);
68 
69  void setValue(int val);
70 
71  void setValueIf(bool val, bool cond);
72 
73  void require(bool cond);
74 
75  using TopologyPredicate::requireCovers;
76  void requireCovers(const Envelope& a, const Envelope& b);
77 
78 
79 public:
80 
89  static bool isIntersection(Location locA, Location locB);
90 
91  std::string name() const override = 0;
92 
93  void finish() override = 0;
94 
95  bool isKnown() const override;
96 
97  bool value() const override;
98 
99 
100 };
101 
102 } // namespace geos.operation.relateng
103 } // namespace geos.operation
104 } // namespace geos
105 
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