GEOS 3.15.0dev
Traversal.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2018-2025 ISciences, LLC
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 <vector>
18
19#include <geos/geom/Coordinate.h>
20#include <geos/operation/grid/Side.h>
21
22namespace geos::operation::grid {
23
30{
31 public:
32 Traversal()
33 : m_entry{ Side::NONE }
34 , m_exit{ Side::NONE }
35 {
36 }
37
38 bool isClosedRing() const;
39
40 bool isEmpty() const;
41
42 bool isEntered() const;
43
44 bool isExited() const;
45
46 bool isTraversed() const;
47
48 bool hasMultipleUniqueCoordinates() const;
49
51 void enter(const geom::CoordinateXY& c, Side s);
52
54 void exit(const geom::CoordinateXY& c, Side s);
55
56 Side getEntrySide() const { return m_entry; }
57
58 Side getExitSide() const { return m_exit; }
59
60 const geom::CoordinateXY& getLastCoordinate() const;
61
62 const geom::CoordinateXY& getExitCoordinate() const;
63
64 void add(const geom::CoordinateXY& c);
65
66 void forceExit(Side s) { m_exit = s; }
67
68 const std::vector<geom::CoordinateXY>& getCoordinates() const { return m_coords; }
69
70 private:
71 std::vector<geom::CoordinateXY> m_coords;
72 Side m_entry;
73 Side m_exit;
74};
75
76}
The Traversal class records the coordinates of a line that are within a grid cell,...
Definition Traversal.h:30
void exit(const geom::CoordinateXY &c, Side s)
Complete a Traversal on the specified Side
void enter(const geom::CoordinateXY &c, Side s)
Begin a Traversal on the specified Side