GEOS: MCIndexNoder.h Source File

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

- File List

# MCIndexNoder.h

    00001 /**********************************************************************
    00002  * $Id: MCIndexNoder.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/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         public:
    00096                 SegmentOverlapAction(SegmentIntersector& newSi)
    00097                         :
    00098                         index::chain::MonotoneChainOverlapAction(),
    00099                         si(newSi)
    00100                 {}
    00101
    00102                 void overlap(index::chain::MonotoneChain& mc1, size_t start1,
    00103             index::chain::MonotoneChain& mc2, size_t start2);
    00104     private:
    00105         SegmentIntersector& si;
    00106
    00107         // Declare type as noncopyable
    00108         SegmentOverlapAction(const SegmentOverlapAction& other);
    00109         SegmentOverlapAction& operator=(const SegmentOverlapAction& rhs);
    00110         };
    00111
    00112 };
    00113
    00114 } // namespace geos.noding
    00115 } // namespace geos
    00116
    00117 #ifdef GEOS_INLINE
    00118 # include <geos/noding/MCIndexNoder.inl>
    00119 #endif
    00120
    00121 #endif // GEOS_NODING_MCINDEXNODER_H
    00122
    00123 /**********************************************************************
    00124  * $Log$
    00125  * Revision 1.4  2006/03/24 09:52:41  strk
    00126  * USE_INLINE => GEOS_INLINE
    00127  *
    00128  * Revision 1.3  2006/03/22 18:12:31  strk
    00129  * indexChain.h header split.
    00130  *
    00131  * Revision 1.2  2006/03/14 12:55:56  strk
    00132  * Headers split: geomgraphindex.h, nodingSnapround.h
    00133  *
    00134  * Revision 1.1  2006/03/09 16:46:49  strk
    00135  * geos::geom namespace definition, first pass at headers split
    00136  *
    00137  **********************************************************************/
    00138