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

- File List

# EdgeIntersection.h

    00001 /**********************************************************************
    00002  * $Id: EdgeIntersection.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) 2009      Sandro Santilli <strk@keybit.net>
    00008  * Copyright (C) 2005-2006 Refractions Research Inc.
    00009  * Copyright (C) 2001-2002 Vivid Solutions Inc.
    00010  *
    00011  * This is free software; you can redistribute and/or modify it under
    00012  * the terms of the GNU Lesser General Public Licence as published
    00013  * by the Free Software Foundation.
    00014  * See the COPYING file for more information.
    00015  *
    00016  **********************************************************************
    00017  *
    00018  * Last port: geomgraph/EdgeIntersection.java rev. 1.5 (JTS-1.10)
    00019  *
    00020  **********************************************************************/
    00021
    00022
    00023 #ifndef GEOS_GEOMGRAPH_EDGEINTERSECTION_H
    00024 #define GEOS_GEOMGRAPH_EDGEINTERSECTION_H
    00025
    00026 #include <geos/export.h>
    00027 #include <string>
    00028
    00029 #include <geos/geom/Coordinate.h> // for CoordinateLessThen
    00030
    00031 #include <geos/inline.h>
    00032
    00033
    00034 namespace geos {
    00035 namespace geomgraph { // geos.geomgraph
    00036
    00046 class GEOS_DLL EdgeIntersection {
    00047 public:
    00048
    00049         // the point of intersection
    00050         geom::Coordinate coord;
    00051
    00052         // the index of the containing line segment in the parent edge
    00053         int segmentIndex;
    00054
    00055         // the edge distance of this point along the containing line segment
    00056         double dist;
    00057
    00058         EdgeIntersection(const geom::Coordinate& newCoord,
    00059                          int newSegmentIndex, double newDist);
    00060
    00061         virtual ~EdgeIntersection();
    00062
    00070         int compare(int newSegmentIndex, double newDist) const;
    00071
    00072         bool isEndPoint(int maxSegmentIndex);
    00073
    00074         std::string print() const;
    00075
    00076         int compareTo(const EdgeIntersection *) const;
    00077
    00078         const geom::Coordinate& getCoordinate() const {
    00079                 return coord;
    00080         }
    00081
    00082         int getSegmentIndex() const { return segmentIndex; }
    00083
    00084         double getDistance() { return dist; }
    00085
    00086 };
    00087
    00088 struct GEOS_DLL  EdgeIntersectionLessThen {
    00089         bool operator()(const EdgeIntersection *ei1,
    00090                 const EdgeIntersection *ei2) const
    00091         {
    00092                 if ( ei1->segmentIndex<ei2->segmentIndex ||
    00093                         ( ei1->segmentIndex==ei2->segmentIndex &&
    00094                         ei1->dist<ei2->dist ) ) return true;
    00095                 return false;
    00096         }
    00097 };
    00098
    00099
    00100 } // namespace geos.geomgraph
    00101 } // namespace geos
    00102
    00103 //#ifdef GEOS_INLINE
    00104 //# include "geos/geomgraph/EdgeIntersection.inl"
    00105 //#endif
    00106
    00107 #endif // ifndef GEOS_GEOMGRAPH_EDGEINTERSECTION_H
    00108
    00109