GEOS: EdgeEnd.h Source File

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

# EdgeEnd.h

    00001 /**********************************************************************
    00002  * $Id: EdgeEnd.h 2557 2009-06-08 09:30:55Z strk $
    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.6 (JTS-1.10)
    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/inline.h>
    00028
    00029 #include <string>
    00030
    00031 // Forward declarations
    00032 namespace geos {
    00033         namespace algorithm {
    00034                 class BoundaryNodeRule;
    00035         }
    00036         namespace geomgraph {
    00037                 class Label;
    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                         Label* newLabel=NULL);
    00076
    00077         Edge* getEdge() { return edge; }
    00078         //virtual Edge* getEdge() { return edge; }
    00079
    00080         virtual Label* getLabel();
    00081
    00082         virtual geom::Coordinate& getCoordinate();
    00083
    00084         virtual geom::Coordinate& getDirectedCoordinate();
    00085
    00086         virtual int getQuadrant();
    00087
    00088         virtual double getDx();
    00089
    00090         virtual double getDy();
    00091
    00092         virtual void setNode(Node* newNode);
    00093
    00094         virtual Node* getNode();
    00095
    00096         virtual int compareTo(const EdgeEnd *e) const;
    00097
    00114         virtual int compareDirection(const EdgeEnd *e) const;
    00115
    00116         virtual void computeLabel(const algorithm::BoundaryNodeRule& bnr);
    00117
    00118         virtual std::string print();
    00119
    00120 protected:
    00121
    00122         Edge* edge;// the parent edge of this edge end
    00123
    00124         Label* label;
    00125
    00126         EdgeEnd(Edge* newEdge);
    00127
    00128         virtual void init(const geom::Coordinate& newP0,
    00129                         const geom::Coordinate& newP1);
    00130
    00131 private:
    00132
    00134         Node* node;
    00135
    00137         geom::Coordinate p0, p1;
    00138
    00140         double dx, dy;
    00141
    00142         int quadrant;
    00143 };
    00144
    00145 std::ostream& operator<< (std::ostream&, const EdgeEnd&);
    00146
    00147 struct GEOS_DLL  EdgeEndLT {
    00148         bool operator()(const EdgeEnd *s1, const EdgeEnd *s2) const {
    00149                 return s1->compareTo(s2)<0;
    00150         }
    00151 };
    00152
    00153 } // namespace geos.geomgraph
    00154 } // namespace geos
    00155
    00156 //#ifdef GEOS_INLINE
    00157 //# include "geos/geomgraph/EdgeEnd.inl"
    00158 //#endif
    00159
    00160 #endif // ifndef GEOS_GEOMGRAPH_EDGEEND_H
    00161
    00162 /**********************************************************************
    00163  * $Log$
    00164  * Revision 1.6  2006/06/14 14:32:20  strk
    00165  * EdgeEnd::getEdge() made non-virtual and inlined.
    00166  *
    00167  * Revision 1.5  2006/04/06 09:39:56  strk
    00168  * Added operator<<
    00169  *
    00170  * Revision 1.4  2006/04/03 17:05:22  strk
    00171  * Assertion checking, port info, cleanups
    00172  *
    00173  * Revision 1.3  2006/03/24 09:52:41  strk
    00174  * USE_INLINE => GEOS_INLINE
    00175  *
    00176  * Revision 1.2  2006/03/15 15:27:24  strk
    00177  * cleanups
    00178  *
    00179  * Revision 1.1  2006/03/09 16:46:49  strk
    00180  * geos::geom namespace definition, first pass at headers split
    00181  *
    00182  **********************************************************************/
    00183