GEOS 3.11.1
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/CoordinateArraySequence.h>
18
19#include <geos/export.h>
20#include <array>
21#include <memory>
22#include <vector>
23
24// Forward declarations
25namespace geos {
26namespace geom {
27class Envelope;
28class Coordinate;
30}
31}
32
33using namespace geos::geom;
34
35namespace geos { // geos.
36namespace operation { // geos.operation
37namespace overlayng { // geos.operation.overlayng
38
56class GEOS_DLL LineLimiter {
57
58private:
59
60 // Members
61 const Envelope* limitEnv;
62 std::unique_ptr<std::vector<Coordinate>> ptList;
63 const Coordinate* lastOutside;
64 std::vector<std::unique_ptr<CoordinateArraySequence>> 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
75public:
76
77 LineLimiter(const Envelope* env)
78 : limitEnv(env)
79 , ptList(nullptr)
80 , lastOutside(nullptr)
81 {};
82
83 std::vector<std::unique_ptr<CoordinateArraySequence>>& 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:44
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:58
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: geos.h:39