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

# IntersectionAdder.h

    00001 /**********************************************************************
    00002  * $Id: IntersectionAdder.h 2207 2008-10-22 18:51:09Z pramsey $
    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_INTERSECTIONADDER_H
    00017 #define GEOS_NODING_INTERSECTIONADDER_H
    00018
    00019 #include <vector>
    00020 #include <iostream>
    00021 #include <cstdlib> // for abs()
    00022
    00023 #include <geos/inline.h>
    00024
    00025 #include <geos/geom/Coordinate.h>
    00026 #include <geos/noding/SegmentIntersector.h> // for inheritance
    00027
    00028 // Forward declarations
    00029 namespace geos {
    00030         namespace geom {
    00031                 class Coordinate;
    00032         }
    00033         namespace noding {
    00034                 class SegmentString;
    00035         }
    00036         namespace algorithm {
    00037                 class LineIntersector;
    00038         }
    00039 }
    00040
    00041 namespace geos {
    00042 namespace noding { // geos.noding
    00043
    00055 class IntersectionAdder: public SegmentIntersector {
    00056
    00057 private:
    00058
    00063         bool hasIntersectionVar;
    00064         bool hasProper;
    00065         bool hasProperInterior;
    00066         bool hasInterior;
    00067
    00068         // the proper intersection point found
    00069         const geom::Coordinate* properIntersectionPoint;
    00070
    00071         algorithm::LineIntersector& li;
    00072         bool isSelfIntersection;
    00073         //bool intersectionFound;
    00074
    00081         bool isTrivialIntersection(const SegmentString* e0, int segIndex0,
    00082                         const SegmentString* e1, int segIndex1);
    00083
    00084
    00085
    00086 public:
    00087
    00088         int numIntersections;
    00089         int numInteriorIntersections;
    00090         int numProperIntersections;
    00091
    00092         // testing only
    00093         int numTests;
    00094
    00095         IntersectionAdder(algorithm::LineIntersector& newLi)
    00096                 :
    00097                 hasIntersectionVar(false),
    00098                 hasProper(false),
    00099                 hasProperInterior(false),
    00100                 hasInterior(false),
    00101                 properIntersectionPoint(NULL),
    00102                 li(newLi),
    00103                 numIntersections(0),
    00104                 numInteriorIntersections(0),
    00105                 numProperIntersections(0),
    00106                 numTests(0)
    00107         {}
    00108
    00109         algorithm::LineIntersector& getLineIntersector() { return li; }
    00110
    00115         const geom::Coordinate* getProperIntersectionPoint()  {
    00116                 return properIntersectionPoint;
    00117         }
    00118
    00119         bool hasIntersection() { return hasIntersectionVar; }
    00120
    00129         bool hasProperIntersection() { return hasProper; }
    00130
    00136         bool hasProperInteriorIntersection() { return hasProperInterior; }
    00137
    00142         bool hasInteriorIntersection() { return hasInterior; }
    00143
    00144
    00154         void processIntersections(
    00155                 SegmentString* e0,  int segIndex0,
    00156                 SegmentString* e1,  int segIndex1);
    00157
    00158
    00159         static bool isAdjacentSegments(int i1, int i2) {
    00160                 return abs(i1 - i2) == 1;
    00161         }
    00162
    00163 };
    00164
    00165
    00166 } // namespace geos.noding
    00167 } // namespace geos
    00168
    00169 //#ifdef GEOS_INLINE
    00170 //# include "geos/noding/IntersectionAdder.inl"
    00171 //#endif
    00172
    00173 #endif // GEOS_NODING_INTERSECTIONADDER_H
    00174
    00175 /**********************************************************************
    00176  * $Log$
    00177  * Revision 1.2  2006/03/24 09:52:41  strk
    00178  * USE_INLINE => GEOS_INLINE
    00179  *
    00180  * Revision 1.1  2006/03/09 16:46:49  strk
    00181  * geos::geom namespace definition, first pass at headers split
    00182  *
    00183  **********************************************************************/
    00184