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