GEOS
3.2.3
|
00001 /********************************************************************** 00002 * $Id: IntersectionAdder.h 2778 2009-12-03 19:44:00Z 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 * Last port: noding/IntersectionAdder.java rev. 1.6 (JTS-1.9) 00017 * 00018 **********************************************************************/ 00019 00020 #ifndef GEOS_NODING_INTERSECTIONADDER_H 00021 #define GEOS_NODING_INTERSECTIONADDER_H 00022 00023 #include <geos/export.h> 00024 00025 #include <vector> 00026 #include <iostream> 00027 #include <cstdlib> // for abs() 00028 00029 #include <geos/inline.h> 00030 00031 #include <geos/geom/Coordinate.h> 00032 #include <geos/noding/SegmentIntersector.h> // for inheritance 00033 00034 // Forward declarations 00035 namespace geos { 00036 namespace geom { 00037 class Coordinate; 00038 } 00039 namespace noding { 00040 class SegmentString; 00041 } 00042 namespace algorithm { 00043 class LineIntersector; 00044 } 00045 } 00046 00047 namespace geos { 00048 namespace noding { // geos.noding 00049 00059 class GEOS_DLL IntersectionAdder: public SegmentIntersector { 00060 00061 private: 00062 00067 bool hasIntersectionVar; 00068 bool hasProper; 00069 bool hasProperInterior; 00070 bool hasInterior; 00071 00072 // the proper intersection point found 00073 const geom::Coordinate* properIntersectionPoint; 00074 00075 algorithm::LineIntersector& li; 00076 bool isSelfIntersection; 00077 //bool intersectionFound; 00078 00085 bool isTrivialIntersection(const SegmentString* e0, int segIndex0, 00086 const SegmentString* e1, int segIndex1); 00087 00088 // Declare type as noncopyable 00089 IntersectionAdder(const IntersectionAdder& other); 00090 IntersectionAdder& operator=(const IntersectionAdder& rhs); 00091 00092 public: 00093 00094 int numIntersections; 00095 int numInteriorIntersections; 00096 int numProperIntersections; 00097 00098 // testing only 00099 int numTests; 00100 00101 IntersectionAdder(algorithm::LineIntersector& newLi) 00102 : 00103 hasIntersectionVar(false), 00104 hasProper(false), 00105 hasProperInterior(false), 00106 hasInterior(false), 00107 properIntersectionPoint(NULL), 00108 li(newLi), 00109 numIntersections(0), 00110 numInteriorIntersections(0), 00111 numProperIntersections(0), 00112 numTests(0) 00113 {} 00114 00115 algorithm::LineIntersector& getLineIntersector() { return li; } 00116 00121 const geom::Coordinate* getProperIntersectionPoint() { 00122 return properIntersectionPoint; 00123 } 00124 00125 bool hasIntersection() { return hasIntersectionVar; } 00126 00135 bool hasProperIntersection() { return hasProper; } 00136 00142 bool hasProperInteriorIntersection() { return hasProperInterior; } 00143 00148 bool hasInteriorIntersection() { return hasInterior; } 00149 00150 00160 void processIntersections( 00161 SegmentString* e0, int segIndex0, 00162 SegmentString* e1, int segIndex1); 00163 00164 00165 static bool isAdjacentSegments(int i1, int i2) { 00166 return std::abs(i1 - i2) == 1; 00167 } 00168 00174 virtual bool isDone() const { 00175 return false; 00176 } 00177 }; 00178 00179 00180 } // namespace geos.noding 00181 } // namespace geos 00182 00183 //#ifdef GEOS_INLINE 00184 //# include "geos/noding/IntersectionAdder.inl" 00185 //#endif 00186 00187 #endif // GEOS_NODING_INTERSECTIONADDER_H 00188 00189 /********************************************************************** 00190 * $Log$ 00191 * Revision 1.2 2006/03/24 09:52:41 strk 00192 * USE_INLINE => GEOS_INLINE 00193 * 00194 * Revision 1.1 2006/03/09 16:46:49 strk 00195 * geos::geom namespace definition, first pass at headers split 00196 * 00197 **********************************************************************/ 00198