EdgeEnd.h

00001 /**********************************************************************
00002  * $Id: EdgeEnd.h 1820 2006-09-06 16:54:23Z mloskot $
00003  *
00004  * GEOS - Geometry Engine Open Source
00005  * http://geos.refractions.net
00006  *
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 rev. 1.5 (JTS-1.7)
00018  *
00019  **********************************************************************/
00020 
00021 
00022 #ifndef GEOS_GEOMGRAPH_EDGEEND_H
00023 #define GEOS_GEOMGRAPH_EDGEEND_H
00024 
00025 #include <geos/geom/Coordinate.h>  // for p0,p1
00026 #include <geos/inline.h>
00027 
00028 #include <string>
00029 
00030 // Forward declarations
00031 namespace geos {
00032         namespace geomgraph {
00033                 class Label;
00034                 class Edge;
00035                 class Node;
00036         }
00037 }
00038 
00039 namespace geos {
00040 namespace geomgraph { // geos.geomgraph
00041 
00052 class EdgeEnd {
00053 
00054 public:
00055 
00056         friend std::ostream& operator<< (std::ostream&, const EdgeEnd&);
00057 
00058         EdgeEnd();
00059 
00060         virtual ~EdgeEnd();
00061 
00069         EdgeEnd(Edge* newEdge, const geom::Coordinate& newP0,
00070                         const geom::Coordinate& newP1,
00071                         Label* newLabel=NULL);
00072 
00073         Edge* getEdge() { return edge; }
00074         //virtual Edge* getEdge() { return edge; }
00075 
00076         virtual Label* getLabel();
00077 
00078         virtual geom::Coordinate& getCoordinate();
00079 
00080         virtual geom::Coordinate& getDirectedCoordinate();
00081 
00082         virtual int getQuadrant();
00083 
00084         virtual double getDx();
00085 
00086         virtual double getDy();
00087 
00088         virtual void setNode(Node* newNode);
00089 
00090         virtual Node* getNode();
00091 
00092         virtual int compareTo(const EdgeEnd *e) const;
00093 
00110         virtual int compareDirection(const EdgeEnd *e) const;
00111 
00112         virtual void computeLabel();
00113 
00114         virtual std::string print();
00115 
00116 protected:
00117 
00118         Edge* edge;// the parent edge of this edge end
00119 
00120         Label* label;
00121 
00122         EdgeEnd(Edge* newEdge);
00123 
00124         virtual void init(const geom::Coordinate& newP0,
00125                         const geom::Coordinate& newP1);
00126 
00127 private:
00128 
00130         Node* node;         
00131 
00133         geom::Coordinate p0, p1; 
00134 
00136         double dx, dy;     
00137 
00138         int quadrant;
00139 };
00140 
00141 std::ostream& operator<< (std::ostream&, const EdgeEnd&);
00142 
00143 struct EdgeEndLT {
00144         bool operator()(const EdgeEnd *s1, const EdgeEnd *s2) const {
00145                 return s1->compareTo(s2)<0;
00146         }
00147 };
00148 
00149 } // namespace geos.geomgraph
00150 } // namespace geos
00151 
00152 //#ifdef GEOS_INLINE
00153 //# include "geos/geomgraph/EdgeEnd.inl"
00154 //#endif
00155 
00156 #endif // ifndef GEOS_GEOMGRAPH_EDGEEND_H
00157 
00158 /**********************************************************************
00159  * $Log$
00160  * Revision 1.6  2006/06/14 14:32:20  strk
00161  * EdgeEnd::getEdge() made non-virtual and inlined.
00162  *
00163  * Revision 1.5  2006/04/06 09:39:56  strk
00164  * Added operator<<
00165  *
00166  * Revision 1.4  2006/04/03 17:05:22  strk
00167  * Assertion checking, port info, cleanups
00168  *
00169  * Revision 1.3  2006/03/24 09:52:41  strk
00170  * USE_INLINE => GEOS_INLINE
00171  *
00172  * Revision 1.2  2006/03/15 15:27:24  strk
00173  * cleanups
00174  *
00175  * Revision 1.1  2006/03/09 16:46:49  strk
00176  * geos::geom namespace definition, first pass at headers split
00177  *
00178  **********************************************************************/
00179 

Generated on Fri Mar 27 04:52:40 2009 for GEOS by  doxygen 1.5.4