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

MCIndexSegmentSetMutualIntersector.h

00001 /**********************************************************************
00002  * $Id: MCIndexSegmentSetMutualIntersector.h 2479 2009-05-06 17:42:58Z 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 
00017 #ifndef GEOS_NODING_MCINDEXSEGMENTSETMUTUALINTERSECTOR_H
00018 #define GEOS_NODING_MCINDEXSEGMENTSETMUTUALINTERSECTOR_H
00019 
00020 #include <geos/noding/SegmentSetMutualIntersector.h> // inherited
00021 #include <geos/index/chain/MonotoneChainOverlapAction.h> // inherited
00022 
00023 namespace geos {
00024         namespace index {
00025                 class SpatialIndex;
00026 
00027                 namespace chain {
00028                         class MonotoneChain;
00029                 }
00030                 namespace strtree {
00031                         //class STRtree;
00032                 }
00033         }
00034         namespace noding {
00035                 class SegmentString;
00036                 class SegmentIntersector;
00037         }
00038 }
00039 
00040 //using namespace geos::index::strtree;
00041 
00042 namespace geos {
00043 namespace noding { // geos::noding
00044 
00051 class MCIndexSegmentSetMutualIntersector : public SegmentSetMutualIntersector 
00052 {
00053 public:
00054 
00055         MCIndexSegmentSetMutualIntersector();
00056 
00057         ~MCIndexSegmentSetMutualIntersector();
00058 
00059         std::vector<index::chain::MonotoneChain *>* getMonotoneChains() 
00060         { 
00061                 return monoChains; 
00062         }
00063 
00064         index::SpatialIndex* getIndex() 
00065         { 
00066                 return index; 
00067         }
00068 
00069         void setBaseSegments(SegmentString::ConstVect* segStrings);
00070   
00071         void process(SegmentString::ConstVect* segStrings);
00072 
00073         class SegmentOverlapAction : public index::chain::MonotoneChainOverlapAction
00074         {
00075         private:
00076                 SegmentIntersector & si;
00077 
00078         public:
00079 
00080                 SegmentOverlapAction(SegmentIntersector & si)
00081                         :
00082                         index::chain::MonotoneChainOverlapAction(),
00083                         si(si)
00084                 {}
00085 
00086                 void overlap(index::chain::MonotoneChain& mc1, size_t start1,
00087                              index::chain::MonotoneChain& mc2, size_t start2);
00088         };
00089 
00090 private:
00091 
00092         std::vector<index::chain::MonotoneChain *> * monoChains;
00093 
00094         /*
00095          * The {@link SpatialIndex} used should be something that supports
00096          * envelope (range) queries efficiently (such as a {@link Quadtree}
00097          * or {@link STRtree}.
00098          */
00099         index::SpatialIndex * index;
00100         int indexCounter;
00101         int processCounter;
00102         // statistics
00103         int nOverlaps;
00104         
00105         // memory management helper
00106       typedef std::vector<std::vector<index::chain::MonotoneChain*>*> chainstore_mm_type;
00107       chainstore_mm_type chainStore;
00108       
00109         void addToIndex( SegmentString * segStr);
00110 
00111         void intersectChains();
00112 
00113         void addToMonoChains( SegmentString * segStr);
00114 
00115 };
00116 
00117 } // namespace geos::noding
00118 } // namespace geos
00119 
00120 #endif // GEOS_NODING_MCINDEXSEGMENTSETMUTUALINTERSECTOR_H
00121 /**********************************************************************
00122  * $Log$
00123  **********************************************************************/
00124 

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