GEOS 3.14.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
25namespace geos {
26namespace geom {
27class Envelope;
28class Coordinate;
29class CoordinateSequence;
30}
31}
32
33namespace geos { // geos.
34namespace operation { // geos.operation
35namespace overlayng { // geos.operation.overlayng
36
54class GEOS_DLL LineLimiter {
58
59private:
60
61 // Members
62 const Envelope* limitEnv;
63 std::unique_ptr<geom::CoordinateSequence> ptList;
64 const Coordinate* lastOutside;
65 std::vector<std::unique_ptr<CoordinateSequence>> sections;
66
67 // Methods
68 void addPoint(const Coordinate* p);
69 void addOutside(const Coordinate* p);
70 bool isLastSegmentIntersecting(const Coordinate* p);
71 bool isSectionOpen();
72 void startSection();
73 void finishSection();
74
75
76public:
77
78 LineLimiter(const Envelope* env)
79 : limitEnv(env)
80 , ptList(nullptr)
81 , lastOutside(nullptr)
82 {};
83
84 std::vector<std::unique_ptr<CoordinateSequence>>& limit(const CoordinateSequence *pts);
85
86};
87
88
89} // namespace geos.operation.overlayng
90} // namespace geos.operation
91} // namespace geos
92
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:217
An Envelope defines a rectangulare region of the 2D coordinate plane.
Definition Envelope.h:59
Definition LineLimiter.h:54
Basic namespace for all GEOS functionalities.
Definition geos.h:39