Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

MCIndexNoder.h

00001 /**********************************************************************
00002  * $Id: MCIndexNoder.h 2556 2009-06-06 22:22:28Z strk $
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/MCIndexNoder.java rev. 1.6 (JTS-1.9)
00017  *
00018  **********************************************************************/
00019 
00020 #ifndef GEOS_NODING_MCINDEXNODER_H
00021 #define GEOS_NODING_MCINDEXNODER_H
00022 
00023 #include <geos/export.h>
00024 
00025 #include <geos/inline.h>
00026 
00027 #include <geos/index/chain/MonotoneChainOverlapAction.h> // for inheritance
00028 #include <geos/noding/SinglePassNoder.h> // for inheritance
00029 #include <geos/index/strtree/STRtree.h> // for composition
00030 #include <geos/util.h>
00031 
00032 #include <vector>
00033 #include <iostream>
00034 
00035 // Forward declarations
00036 namespace geos {
00037         namespace geom {
00038                 class LineSegment;
00039         }
00040         namespace noding {
00041                 class SegmentString;
00042                 class SegmentIntersector;
00043         }
00044 }
00045 
00046 namespace geos {
00047 namespace noding { // geos.noding
00048 
00059 class GEOS_DLL MCIndexNoder : public SinglePassNoder {
00060 
00061 private:
00062         std::vector<index::chain::MonotoneChain*> monoChains;
00063         index::strtree::STRtree index;
00064         int idCounter;
00065         std::vector<SegmentString*>* nodedSegStrings;
00066         // statistics
00067         int nOverlaps;
00068 
00069         void intersectChains();
00070 
00071         void add(SegmentString* segStr);
00072 
00073 public:
00074 
00075         MCIndexNoder(SegmentIntersector *nSegInt=NULL)
00076                 :
00077                 SinglePassNoder(nSegInt),
00078                 idCounter(0),
00079                 nodedSegStrings(NULL),
00080                 nOverlaps(0)
00081         {}
00082 
00083         ~MCIndexNoder();
00084 
00086         std::vector<index::chain::MonotoneChain*>& getMonotoneChains() { return monoChains; }
00087 
00088         index::SpatialIndex& getIndex();
00089 
00090         std::vector<SegmentString*>* getNodedSubstrings() const;
00091 
00092         void computeNodes(std::vector<SegmentString*>* inputSegmentStrings);
00093 
00094         class SegmentOverlapAction : public index::chain::MonotoneChainOverlapAction {
00095         private:
00096                 SegmentIntersector& si;
00097         public:
00098                 SegmentOverlapAction(SegmentIntersector& newSi)
00099                         :
00100                         index::chain::MonotoneChainOverlapAction(),
00101                         si(newSi)
00102                 {}
00103 
00104                 void overlap(index::chain::MonotoneChain& mc1, size_t start1,
00105                              index::chain::MonotoneChain& mc2, size_t start2);
00106 
00107         };
00108         
00109 };
00110 
00111 } // namespace geos.noding
00112 } // namespace geos
00113 
00114 #ifdef GEOS_INLINE
00115 # include <geos/noding/MCIndexNoder.inl>
00116 #endif
00117 
00118 #endif // GEOS_NODING_MCINDEXNODER_H
00119 
00120 /**********************************************************************
00121  * $Log$
00122  * Revision 1.4  2006/03/24 09:52:41  strk
00123  * USE_INLINE => GEOS_INLINE
00124  *
00125  * Revision 1.3  2006/03/22 18:12:31  strk
00126  * indexChain.h header split.
00127  *
00128  * Revision 1.2  2006/03/14 12:55:56  strk
00129  * Headers split: geomgraphindex.h, nodingSnapround.h
00130  *
00131  * Revision 1.1  2006/03/09 16:46:49  strk
00132  * geos::geom namespace definition, first pass at headers split
00133  *
00134  **********************************************************************/
00135 

Generated on Thu Jun 11 06:17:01 2009 for GEOS by  doxygen 1.4.4