GEOS 3.13.1
LinkedLine.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2021 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/Coordinate.h>
18
19#include <geos/export.h>
20
21#include <vector>
22#include <memory>
23
24
25namespace geos {
26namespace geom {
27class Coordinate;
29}
30}
31
34
35
36namespace geos {
37namespace simplify { // geos::simplify
38
39class LinkedLine
40{
41
42public:
43
44 LinkedLine(const CoordinateSequence& pts);
45
46 bool isRing() const;
47 bool isCorner(std::size_t i) const;
48
49 std::size_t size() const;
50 std::size_t next(std::size_t i) const;
51 std::size_t prev(std::size_t i) const;
52
53 const Coordinate& getCoordinate(std::size_t index) const;
54 const Coordinate& prevCoordinate(std::size_t index) const;
55 const Coordinate& nextCoordinate(std::size_t index) const;
56
57 bool hasCoordinate(std::size_t index) const;
58
59 void remove(std::size_t index);
60
61 std::unique_ptr<CoordinateSequence> getCoordinates() const;
62
63
64private:
65
66 // Members
67 const CoordinateSequence& m_coord;
68 bool m_isRing;
69 std::size_t m_size;
70 std::vector<std::size_t> m_next;
71 std::vector<std::size_t> m_prev;
72
73 void createNextLinks(std::size_t size);
74
75 void createPrevLinks(std::size_t size);
76
77
78}; // LinkedLine
79
80GEOS_DLL std::ostream& operator<< (std::ostream& os, const LinkedLine& ll);
81
82
83} // geos::simplify
84} // geos
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
Basic namespace for all GEOS functionalities.
Definition geos.h:39