# MCIndexNoder.h

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