GEOS  3.13.0dev
EdgeEnd.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2011 Sandro Santilli <strk@kbt.io>
7  * Copyright (C) 2005-2006 Refractions Research Inc.
8  * Copyright (C) 2001-2002 Vivid Solutions Inc.
9  *
10  * This is free software; you can redistribute and/or modify it under
11  * the terms of the GNU Lesser General Public Licence as published
12  * by the Free Software Foundation.
13  * See the COPYING file for more information.
14  *
15  **********************************************************************
16  *
17  * Last port: geomgraph/EdgeEnd.java r428 (JTS-1.12+)
18  *
19  **********************************************************************/
20 
21 
22 #pragma once
23 
24 #include <geos/export.h>
25 #include <geos/geom/Coordinate.h> // for p0,p1
26 #include <geos/geomgraph/Label.h> // for composition
27 
28 #include <string>
29 
30 // Forward declarations
31 namespace geos {
32 namespace algorithm {
33 class BoundaryNodeRule;
34 }
35 namespace geomgraph {
36 class Edge;
37 class Node;
38 }
39 }
40 
41 namespace geos {
42 namespace geomgraph { // geos.geomgraph
43 
54 class GEOS_DLL EdgeEnd {
55 
56 public:
57 
58  friend std::ostream& operator<< (std::ostream&, const EdgeEnd&);
59 
60  EdgeEnd();
61 
62  virtual
63  ~EdgeEnd() {}
64 
72  EdgeEnd(Edge* newEdge, const geom::Coordinate& newP0,
73  const geom::Coordinate& newP1,
74  const Label& newLabel);
75 
82  EdgeEnd(Edge* newEdge, const geom::Coordinate& newP0,
83  const geom::Coordinate& newP1);
84 
85  Edge*
86  getEdge()
87  {
88  return edge;
89  }
90  //virtual Edge* getEdge() { return edge; }
91 
92  Label&
93  getLabel()
94  {
95  return label;
96  }
97 
98  const Label&
99  getLabel() const
100  {
101  return label;
102  }
103 
104  virtual geom::Coordinate& getCoordinate() {
105  return p0;
106  }
107 
108  const geom::Coordinate&
109  getCoordinate() const
110  {
111  return p0;
112  }
113 
114  virtual geom::Coordinate& getDirectedCoordinate();
115 
116  virtual int getQuadrant();
117 
118  virtual double getDx();
119 
120  virtual double getDy();
121 
122  virtual void setNode(Node* newNode);
123 
124  virtual Node* getNode();
125 
126  virtual int compareTo(const EdgeEnd* e) const;
127 
144  virtual int compareDirection(const EdgeEnd* e) const;
145 
146  virtual void computeLabel(const algorithm::BoundaryNodeRule& bnr);
147 
148  virtual std::string print() const;
149 
150 protected:
151 
152  Edge* edge;// the parent edge of this edge end
153 
154  Label label;
155 
156  EdgeEnd(Edge* newEdge);
157 
158  virtual void init(const geom::Coordinate& newP0,
159  const geom::Coordinate& newP1);
160 
161 private:
162 
164  Node* node;
165 
167  geom::Coordinate p0, p1;
168 
170  double dx, dy;
171 
172  int quadrant;
173 };
174 
175 std::ostream& operator<< (std::ostream&, const EdgeEnd&);
176 
177 struct GEOS_DLL EdgeEndLT {
178  bool
179  operator()(const EdgeEnd* s1, const EdgeEnd* s2) const
180  {
181  return s1->compareTo(s2) < 0;
182  }
183 };
184 
185 } // namespace geos.geomgraph
186 } // namespace geos
187 
An interface for rules which determine whether node points which are in boundaries of lineal geometry...
Definition: BoundaryNodeRule.h:50
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:216
Models the end of an edge incident on a node.
Definition: EdgeEnd.h:54
EdgeEnd(Edge *newEdge, const geom::Coordinate &newP0, const geom::Coordinate &newP1, const Label &newLabel)
virtual int compareDirection(const EdgeEnd *e) const
EdgeEnd(Edge *newEdge, const geom::Coordinate &newP0, const geom::Coordinate &newP1)
Definition: geomgraph/Edge.h:63
A Label indicates the topological relationship of a component of a topology graph to a given Geometry...
Definition: Label.h:57
The node component of a geometry graph.
Definition: geomgraph/Node.h:59
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25