GEOS  3.13.0dev
LineLimiter.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2020 Paul Ramsey <pramsey@cleverelephant.ca>
7  *
8  * This is free software; you can redistribute and/or modify it under
9  * the terms of the GNU Lesser General Public Licence as published
10  * by the Free Software Foundation.
11  * See the COPYING file for more information.
12  *
13  **********************************************************************/
14 
15 #pragma once
16 
17 #include <geos/geom/CoordinateSequence.h>
18 
19 #include <geos/export.h>
20 #include <array>
21 #include <memory>
22 #include <vector>
23 
24 // Forward declarations
25 namespace geos {
26 namespace geom {
27 class Envelope;
28 class Coordinate;
29 class CoordinateSequence;
30 }
31 }
32 
33 using namespace geos::geom;
34 
35 namespace geos { // geos.
36 namespace operation { // geos.operation
37 namespace overlayng { // geos.operation.overlayng
38 
56 class GEOS_DLL LineLimiter {
57 
58 private:
59 
60  // Members
61  const Envelope* limitEnv;
62  std::unique_ptr<geom::CoordinateSequence> ptList;
63  const Coordinate* lastOutside;
64  std::vector<std::unique_ptr<CoordinateSequence>> sections;
65 
66  // Methods
67  void addPoint(const Coordinate* p);
68  void addOutside(const Coordinate* p);
69  bool isLastSegmentIntersecting(const Coordinate* p);
70  bool isSectionOpen();
71  void startSection();
72  void finishSection();
73 
74 
75 public:
76 
77  LineLimiter(const Envelope* env)
78  : limitEnv(env)
79  , ptList(nullptr)
80  , lastOutside(nullptr)
81  {};
82 
83  std::vector<std::unique_ptr<CoordinateSequence>>& limit(const CoordinateSequence *pts);
84 
85 };
86 
87 
88 } // namespace geos.operation.overlayng
89 } // namespace geos.operation
90 } // namespace geos
91 
The internal representation of a list of coordinates inside a Geometry.
Definition: CoordinateSequence.h:56
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:216
An Envelope defines a rectangulare region of the 2D coordinate plane.
Definition: Envelope.h:58
Definition: LineLimiter.h:56
Definition: Angle.h:26
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25