GEOS  3.13.1
IMPatternMatcher.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/IMPredicate.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 IMPatternMatcher : public IMPredicate {
47 
48 
49 private:
50 
51  std::string imPattern;
52  IntersectionMatrix patternMatrix;
53 
54  static bool requireInteraction(const IntersectionMatrix& im);
55 
56  static bool isInteraction(int imDim);
57 
58 
59 public:
60 
61  IMPatternMatcher(std::string p_imPattern)
62  : imPattern(p_imPattern)
63  , patternMatrix(p_imPattern)
64  {};
65 
66  std::string name() const override;
67 
68  using IMPredicate::init;
69  void init(const Envelope& envA, const Envelope& envB) override;
70 
71  bool requireInteraction() const override;
72 
73  bool isDetermined() const override;
74 
75  bool valueIM() override;
76 
77  std::string toString() const;
78 
79  friend std::ostream& operator<<(std::ostream& os, const IMPatternMatcher& imp);
80 
81 };
82 
83 
84 } // namespace geos.operation.relateng
85 } // namespace geos.operation
86 } // namespace geos
87 
Definition: Dimension.h:27
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
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