GEOS
3.4.2
|
00001 /********************************************************************** 00002 * 00003 * GEOS - Geometry Engine Open Source 00004 * http://geos.osgeo.org 00005 * 00006 * Copyright (C) 2011 Sandro Santilli <strk@keybit.net> 00007 * Copyright (C) 2005-2006 Refractions Research Inc. 00008 * Copyright (C) 2001-2002 Vivid Solutions Inc. 00009 * 00010 * This is free software; you can redistribute and/or modify it under 00011 * the terms of the GNU Lesser General Public Licence as published 00012 * by the Free Software Foundation. 00013 * See the COPYING file for more information. 00014 * 00015 ********************************************************************** 00016 * 00017 * Last port: geomgraph/EdgeEnd.java r428 (JTS-1.12+) 00018 * 00019 **********************************************************************/ 00020 00021 00022 #ifndef GEOS_GEOMGRAPH_EDGEEND_H 00023 #define GEOS_GEOMGRAPH_EDGEEND_H 00024 00025 #include <geos/export.h> 00026 #include <geos/geom/Coordinate.h> // for p0,p1 00027 #include <geos/geomgraph/Label.h> // for composition 00028 #include <geos/inline.h> 00029 00030 #include <string> 00031 00032 // Forward declarations 00033 namespace geos { 00034 namespace algorithm { 00035 class BoundaryNodeRule; 00036 } 00037 namespace geomgraph { 00038 class Edge; 00039 class Node; 00040 } 00041 } 00042 00043 namespace geos { 00044 namespace geomgraph { // geos.geomgraph 00045 00056 class GEOS_DLL EdgeEnd { 00057 00058 public: 00059 00060 friend std::ostream& operator<< (std::ostream&, const EdgeEnd&); 00061 00062 EdgeEnd(); 00063 00064 virtual ~EdgeEnd() {} 00065 00073 EdgeEnd(Edge* newEdge, const geom::Coordinate& newP0, 00074 const geom::Coordinate& newP1, 00075 const Label& newLabel); 00076 00083 EdgeEnd(Edge* newEdge, const geom::Coordinate& newP0, 00084 const geom::Coordinate& newP1); 00085 00086 Edge* getEdge() { return edge; } 00087 //virtual Edge* getEdge() { return edge; } 00088 00089 Label& getLabel() { return label; } 00090 00091 const Label& getLabel() const { return label; } 00092 00093 virtual geom::Coordinate& getCoordinate(); 00094 00095 virtual geom::Coordinate& getDirectedCoordinate(); 00096 00097 virtual int getQuadrant(); 00098 00099 virtual double getDx(); 00100 00101 virtual double getDy(); 00102 00103 virtual void setNode(Node* newNode); 00104 00105 virtual Node* getNode(); 00106 00107 virtual int compareTo(const EdgeEnd *e) const; 00108 00125 virtual int compareDirection(const EdgeEnd *e) const; 00126 00127 virtual void computeLabel(const algorithm::BoundaryNodeRule& bnr); 00128 00129 virtual std::string print(); 00130 00131 protected: 00132 00133 Edge* edge;// the parent edge of this edge end 00134 00135 Label label; 00136 00137 EdgeEnd(Edge* newEdge); 00138 00139 virtual void init(const geom::Coordinate& newP0, 00140 const geom::Coordinate& newP1); 00141 00142 private: 00143 00145 Node* node; 00146 00148 geom::Coordinate p0, p1; 00149 00151 double dx, dy; 00152 00153 int quadrant; 00154 }; 00155 00156 std::ostream& operator<< (std::ostream&, const EdgeEnd&); 00157 00158 struct GEOS_DLL EdgeEndLT { 00159 bool operator()(const EdgeEnd *s1, const EdgeEnd *s2) const { 00160 return s1->compareTo(s2)<0; 00161 } 00162 }; 00163 00164 } // namespace geos.geomgraph 00165 } // namespace geos 00166 00167 //#ifdef GEOS_INLINE 00168 //# include "geos/geomgraph/EdgeEnd.inl" 00169 //#endif 00170 00171 #endif // ifndef GEOS_GEOMGRAPH_EDGEEND_H