SegmentIntersector.h

00001 /**********************************************************************
00002  *
00003  * GEOS - Geometry Engine Open Source
00004  * http://geos.osgeo.org
00005  *
00006  * Copyright (C) 2005-2006 Refractions Research Inc.
00007  * Copyright (C) 2001-2002 Vivid Solutions Inc.
00008  *
00009  * This is free software; you can redistribute and/or modify it under
00010  * the terms of the GNU Lesser General Public Licence as published
00011  * by the Free Software Foundation. 
00012  * See the COPYING file for more information.
00013  *
00014  **********************************************************************/
00015 
00016 #ifndef GEOS_GEOMGRAPH_INDEX_SEGMENTINTERSECTOR_H
00017 #define GEOS_GEOMGRAPH_INDEX_SEGMENTINTERSECTOR_H
00018 
00019 #include <geos/export.h>
00020 #include <vector>
00021 
00022 #include <geos/geom/Coordinate.h> // for composition
00023 
00024 #ifdef _MSC_VER
00025 #pragma warning(push)
00026 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
00027 #endif
00028 
00029 // Forward declarations
00030 namespace geos {
00031         namespace algorithm {
00032                 class LineIntersector;
00033         }
00034         namespace geomgraph {
00035                 class Node;
00036                 class Edge;
00037         }
00038 }
00039 
00040 namespace geos {
00041 namespace geomgraph { // geos::geomgraph
00042 namespace index { // geos::geomgraph::index
00043 
00044 
00045 class GEOS_DLL SegmentIntersector{
00046 
00047 private:
00048 
00053         bool hasIntersectionVar;
00054 
00055         bool hasProper;
00056 
00057         bool hasProperInterior;
00058 
00059         // the proper intersection point found
00060         geom::Coordinate properIntersectionPoint;
00061 
00062         algorithm::LineIntersector *li;
00063 
00064         bool includeProper;
00065 
00066         bool recordIsolated;
00067 
00068         //bool isSelfIntersection;
00069 
00070         //bool intersectionFound;
00071 
00072         int numIntersections;
00073 
00075         std::vector<std::vector<Node*>*> bdyNodes;
00076 
00077         bool isTrivialIntersection(Edge *e0,int segIndex0,Edge *e1, int segIndex1);
00078 
00079         bool isBoundaryPoint(algorithm::LineIntersector *li,
00080                         std::vector<std::vector<Node*>*>& tstBdyNodes);
00081 
00082         bool isBoundaryPoint(algorithm::LineIntersector *li,
00083                         std::vector<Node*> *tstBdyNodes);
00084 
00085 public:
00086 
00087         static bool isAdjacentSegments(int i1,int i2);
00088 
00089         // testing only
00090         int numTests;
00091 
00092         //SegmentIntersector();
00093 
00094         virtual ~SegmentIntersector() {}
00095 
00096         SegmentIntersector(algorithm::LineIntersector *newLi,
00097                         bool newIncludeProper, bool newRecordIsolated)
00098                 :
00099                 hasIntersectionVar(false),
00100                 hasProper(false),
00101                 hasProperInterior(false),
00102                 li(newLi),
00103                 includeProper(newIncludeProper),
00104                 recordIsolated(newRecordIsolated),
00105                 numIntersections(0),
00106                 bdyNodes(2),
00107                 numTests(0)
00108         {}
00109 
00113         void setBoundaryNodes(std::vector<Node*> *bdyNodes0,
00114                         std::vector<Node*> *bdyNodes1);
00115 
00116         geom::Coordinate& getProperIntersectionPoint();
00117 
00118         bool hasIntersection();
00119 
00120         bool hasProperIntersection();
00121 
00122         bool hasProperInteriorIntersection();
00123 
00124         void addIntersections(Edge *e0, int segIndex0, Edge *e1, int segIndex1);
00125 
00126 };
00127 
00128 } // namespace geos.geomgraph.index
00129 } // namespace geos.geomgraph
00130 } // namespace geos
00131 
00132 #ifdef _MSC_VER
00133 #pragma warning(pop)
00134 #endif
00135 
00136 #endif
00137 

Generated on 10 Sep 2013 for GEOS by  doxygen 1.4.7