# SegmentIntersector.h

    00001 /**********************************************************************
    00002  * $Id: SegmentIntersector.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 #ifndef GEOS_GEOMGRAPH_INDEX_SEGMENTINTERSECTOR_H
    00018 #define GEOS_GEOMGRAPH_INDEX_SEGMENTINTERSECTOR_H
    00019
    00020 #include <vector>
    00021
    00022 #include <geos/geom/Coordinate.h> // for composition
    00023
    00024 // Forward declarations
    00025 namespace geos {
    00026         namespace algorithm {
    00027                 class LineIntersector;
    00028         }
    00029         namespace geomgraph {
    00030                 class Node;
    00031                 class Edge;
    00032         }
    00033 }
    00034
    00035 namespace geos {
    00036 namespace geomgraph { // geos::geomgraph
    00037 namespace index { // geos::geomgraph::index
    00038
    00039
    00040 class SegmentIntersector{
    00041
    00042 private:
    00043
    00048         bool hasIntersectionVar;
    00049
    00050         bool hasProper;
    00051
    00052         bool hasProperInterior;
    00053
    00054         // the proper intersection point found
    00055         geom::Coordinate properIntersectionPoint;
    00056
    00057         algorithm::LineIntersector *li;
    00058
    00059         bool includeProper;
    00060
    00061         bool recordIsolated;
    00062
    00063         //bool isSelfIntersection;
    00064
    00065         //bool intersectionFound;
    00066
    00067         int numIntersections;
    00068
    00070         std::vector<std::vector<Node*>*> bdyNodes;
    00071
    00072         bool isTrivialIntersection(Edge *e0,int segIndex0,Edge *e1, int segIndex1);
    00073
    00074         bool isBoundaryPoint(algorithm::LineIntersector *li,
    00075                         std::vector<std::vector<Node*>*>& tstBdyNodes);
    00076
    00077         bool isBoundaryPoint(algorithm::LineIntersector *li,
    00078                         std::vector<Node*> *tstBdyNodes);
    00079
    00080 public:
    00081
    00082         static bool isAdjacentSegments(int i1,int i2);
    00083
    00084         // testing only
    00085         int numTests;
    00086
    00087         //SegmentIntersector();
    00088
    00089         virtual ~SegmentIntersector() {}
    00090
    00091         SegmentIntersector(algorithm::LineIntersector *newLi,
    00092                         bool newIncludeProper, bool newRecordIsolated)
    00093                 :
    00094                 hasIntersectionVar(false),
    00095                 hasProper(false),
    00096                 hasProperInterior(false),
    00097                 li(newLi),
    00098                 includeProper(newIncludeProper),
    00099                 recordIsolated(newRecordIsolated),
    00100                 numIntersections(0),
    00101                 bdyNodes(2),
    00102                 numTests(0)
    00103         {}
    00104
    00108         void setBoundaryNodes(std::vector<Node*> *bdyNodes0,
    00109                         std::vector<Node*> *bdyNodes1);
    00110
    00111         geom::Coordinate& getProperIntersectionPoint();
    00112
    00113         bool hasIntersection();
    00114
    00115         bool hasProperIntersection();
    00116
    00117         bool hasProperInteriorIntersection();
    00118
    00119         void addIntersections(Edge *e0, int segIndex0, Edge *e1, int segIndex1);
    00120
    00121 };
    00122
    00123
    00124 } // namespace geos.geomgraph.index
    00125 } // namespace geos.geomgraph
    00126 } // namespace geos
    00127
    00128 #endif
    00129
    00130 /**********************************************************************
    00131  * $Log$
    00132  * Revision 1.1  2006/03/14 12:55:55  strk
    00133  * Headers split: geomgraphindex.h, nodingSnapround.h
    00134  *
    00135  **********************************************************************/
    00136