GEOS 3.10.1
SegmentNode.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2006 Refractions Research Inc.
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 * Last port: noding/SegmentNode.java 4667170ea (JTS-1.17)
16 *
17 **********************************************************************/
18
19#ifndef GEOS_NODING_SEGMENTNODE_H
20#define GEOS_NODING_SEGMENTNODE_H
21
22#include <geos/export.h>
23
24#include <vector>
25#include <iostream>
26
27#include <geos/inline.h>
28
29#include <geos/geom/Coordinate.h>
30
31// Forward declarations
32namespace geos {
33namespace noding {
34class NodedSegmentString;
35}
36}
37
38namespace geos {
39namespace noding { // geos.noding
40
47class GEOS_DLL SegmentNode {
48private:
49 // const NodedSegmentString* segString;
50
51 int segmentOctant;
52
53 bool isInteriorVar;
54
55public:
56 friend std::ostream& operator<< (std::ostream& os, const SegmentNode& n);
57
60
62 std::size_t segmentIndex;
63
77 const geom::Coordinate& nCoord,
78 std::size_t nSegmentIndex, int nSegmentOctant);
79
80 ~SegmentNode() {}
81
87 bool
88 isInterior() const
89 {
90 return isInteriorVar;
91 }
92
93 bool isEndPoint(unsigned int maxSegmentIndex) const;
94
102 int compareTo(const SegmentNode& other) const;
103
104 //string print() const;
105};
106
107std::ostream& operator<< (std::ostream& os, const SegmentNode& n);
108
109struct GEOS_DLL SegmentNodeLT {
110 bool
111 operator()(SegmentNode* s1, SegmentNode* s2) const
112 {
113 return s1->compareTo(*s2) < 0;
114 }
115
116 bool
117 operator()(const SegmentNode& s1, const SegmentNode& s2) const
118 {
119 return s1.compareTo(s2) < 0;
120 }
121};
122
123
124} // namespace geos.noding
125} // namespace geos
126
127#ifdef GEOS_INLINE
128# include "geos/noding/SegmentNode.inl"
129#endif
130
131#endif // GEOS_NODING_SEGMENTNODE_H
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
Represents a list of contiguous line segments, and supports noding the segments.
Definition: NodedSegmentString.h:58
Represents an intersection point between two NodedSegmentString.
Definition: SegmentNode.h:47
int compareTo(const SegmentNode &other) const
std::size_t segmentIndex
the index of the containing line segment in the parent edge
Definition: SegmentNode.h:62
geom::Coordinate coord
the point of intersection (own copy)
Definition: SegmentNode.h:59
bool isInterior() const
Return true if this Node is internal (not on the boundary) of the corresponding segment....
Definition: SegmentNode.h:88
SegmentNode(const NodedSegmentString &ss, const geom::Coordinate &nCoord, std::size_t nSegmentIndex, int nSegmentOctant)
Basic namespace for all GEOS functionalities.
Definition: geos.h:40