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

- File List

# MCIndexSegmentSetMutualIntersector.h

    00001 /**********************************************************************
    00002  * $Id: MCIndexSegmentSetMutualIntersector.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
    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         // Declare type as noncopyable
    00079         SegmentOverlapAction(const SegmentOverlapAction& other);
    00080         SegmentOverlapAction& operator=(const SegmentOverlapAction& rhs);
    00081
    00082     public:
    00083         SegmentOverlapAction(SegmentIntersector & si) :
    00084           index::chain::MonotoneChainOverlapAction(), si(si)
    00085           {}
    00086
    00087           void overlap(index::chain::MonotoneChain& mc1, size_t start1,
    00088               index::chain::MonotoneChain& mc2, size_t start2);
    00089     };
    00090
    00091 private:
    00092
    00093         typedef std::vector<index::chain::MonotoneChain *> MonoChains;
    00094         MonoChains monoChains;
    00095
    00096         /*
    00097          * The {@link SpatialIndex} used should be something that supports
    00098          * envelope (range) queries efficiently (such as a {@link Quadtree}
    00099          * or {@link STRtree}.
    00100          */
    00101         index::SpatialIndex * index;
    00102         int indexCounter;
    00103         int processCounter;
    00104         // statistics
    00105         int nOverlaps;
    00106
    00107         // memory management helper
    00108       typedef std::vector<std::vector<index::chain::MonotoneChain*>*> chainstore_mm_type;
    00109       chainstore_mm_type chainStore;
    00110
    00111         void addToIndex( SegmentString * segStr);
    00112
    00113         void intersectChains();
    00114
    00115         void addToMonoChains( SegmentString * segStr);
    00116
    00117 };
    00118
    00119 } // namespace geos::noding
    00120 } // namespace geos
    00121
    00122 #endif // GEOS_NODING_MCINDEXSEGMENTSETMUTUALINTERSECTOR_H
    00123 /**********************************************************************
    00124  * $Log$
    00125  **********************************************************************/
    00126