# SingleInteriorIntersectionFinder.h

    00001 /**********************************************************************
    00002  * $Id: SinglePassNoder.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) 2006      Refractions Research 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_NODING_SINGLEINTERIORINTERSECTIONFINDER_H
    00017 #define GEOS_NODING_SINGLEINTERIORINTERSECTIONFINDER_H
    00018
    00019 #include <geos/noding/SegmentIntersector.h> // for inheritance
    00020 #include <geos/geom/Coordinate.h> // for composition
    00021
    00022 #include <vector>
    00023
    00024 // Forward declarations
    00025 namespace geos {
    00026         namespace algorithm {
    00027                 class LineIntersector;
    00028         }
    00029         namespace noding {
    00030                 class SegmentString;
    00031         }
    00032 }
    00033
    00034 namespace geos {
    00035 namespace noding { // geos.noding
    00036
    00044 class SingleInteriorIntersectionFinder: public SegmentIntersector
    00045 {
    00046
    00047 private:
    00048         algorithm::LineIntersector& li;
    00049         geom::Coordinate interiorIntersection;
    00050         std::vector<geom::Coordinate> intSegments;
    00051
    00052 public:
    00053
    00060         SingleInteriorIntersectionFinder(algorithm::LineIntersector& newLi)
    00061                 :
    00062                 li(newLi),
    00063                 interiorIntersection(geom::Coordinate::getNull())
    00064         {
    00065         }
    00066
    00072         bool hasIntersection() const
    00073         {
    00074                 return interiorIntersection != geom::Coordinate::getNull();
    00075         }
    00076
    00083         const geom::Coordinate& getInteriorIntersection() const
    00084         {
    00085                 return interiorIntersection;
    00086         }
    00087
    00093         const std::vector<geom::Coordinate>& getIntersectionSegments() const
    00094         {
    00095                 return intSegments;
    00096         }
    00097
    00107         void processIntersections(
    00108                 SegmentString* e0,  int segIndex0,
    00109                 SegmentString* e1,  int segIndex1);
    00110
    00111         bool isDone() const
    00112         {
    00113                 // TODO: add Coordinate::isNull()
    00114                 return interiorIntersection != geom::Coordinate::getNull();
    00115         }
    00116 };
    00117
    00118 } // namespace geos.noding
    00119 } // namespace geos
    00120
    00121 #endif // GEOS_NODING_SINGLEINTERIORINTERSECTIONFINDER_H
    00122
    00123 /**********************************************************************
    00124  * $Log$
    00125  **********************************************************************/