GEOS  3.3.9
MCIndexNoder.h
00001 /**********************************************************************
00002  * $Id: MCIndexNoder.h 3255 2011-03-01 17:56:10Z 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/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 #ifdef _MSC_VER
00036 #pragma warning(push)
00037 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
00038 #endif
00039 
00040 // Forward declarations
00041 namespace geos {
00042         namespace geom {
00043                 class LineSegment;
00044         }
00045         namespace noding {
00046                 class SegmentString;
00047                 class SegmentIntersector;
00048         }
00049 }
00050 
00051 namespace geos {
00052 namespace noding { // geos.noding
00053 
00064 class GEOS_DLL MCIndexNoder : public SinglePassNoder {
00065 
00066 private:
00067         std::vector<index::chain::MonotoneChain*> monoChains;
00068         index::strtree::STRtree index;
00069         int idCounter;
00070         std::vector<SegmentString*>* nodedSegStrings;
00071         // statistics
00072         int nOverlaps;
00073 
00074         void intersectChains();
00075 
00076         void add(SegmentString* segStr);
00077 
00078 public:
00079 
00080         MCIndexNoder(SegmentIntersector *nSegInt=NULL)
00081                 :
00082                 SinglePassNoder(nSegInt),
00083                 idCounter(0),
00084                 nodedSegStrings(NULL),
00085                 nOverlaps(0)
00086         {}
00087 
00088         ~MCIndexNoder();
00089 
00091         std::vector<index::chain::MonotoneChain*>& getMonotoneChains() { return monoChains; }
00092 
00093         index::SpatialIndex& getIndex();
00094 
00095         std::vector<SegmentString*>* getNodedSubstrings() const;
00096 
00097         void computeNodes(std::vector<SegmentString*>* inputSegmentStrings);
00098 
00099         class SegmentOverlapAction : public index::chain::MonotoneChainOverlapAction {
00100         public:
00101                 SegmentOverlapAction(SegmentIntersector& newSi)
00102                         :
00103                         index::chain::MonotoneChainOverlapAction(),
00104                         si(newSi)
00105                 {}
00106 
00107                 void overlap(index::chain::MonotoneChain& mc1, std::size_t start1,
00108             index::chain::MonotoneChain& mc2, std::size_t start2);
00109     private:
00110         SegmentIntersector& si;
00111 
00112         // Declare type as noncopyable
00113         SegmentOverlapAction(const SegmentOverlapAction& other);
00114         SegmentOverlapAction& operator=(const SegmentOverlapAction& rhs);
00115         };
00116         
00117 };
00118 
00119 } // namespace geos.noding
00120 } // namespace geos
00121 
00122 #ifdef _MSC_VER
00123 #pragma warning(pop)
00124 #endif
00125 
00126 #ifdef GEOS_INLINE
00127 # include <geos/noding/MCIndexNoder.inl>
00128 #endif
00129 
00130 #endif // GEOS_NODING_MCINDEXNODER_H
00131 
00132 /**********************************************************************
00133  * $Log$
00134  * Revision 1.4  2006/03/24 09:52:41  strk
00135  * USE_INLINE => GEOS_INLINE
00136  *
00137  * Revision 1.3  2006/03/22 18:12:31  strk
00138  * indexChain.h header split.
00139  *
00140  * Revision 1.2  2006/03/14 12:55:56  strk
00141  * Headers split: geomgraphindex.h, nodingSnapround.h
00142  *
00143  * Revision 1.1  2006/03/09 16:46:49  strk
00144  * geos::geom namespace definition, first pass at headers split
00145  *
00146  **********************************************************************/
00147