GEOS  3.6.2
SimpleMCSweepLineIntersector.h
00001 /**********************************************************************
00002  *
00003  * GEOS - Geometry Engine Open Source
00004  * http://geos.osgeo.org
00005  *
00006  * Copyright (C) 2005-2006 Refractions Research Inc.
00007  * Copyright (C) 2001-2002 Vivid Solutions 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_GEOMGRAPH_INDEX_SIMPLEMCSWEEPLINEINTERSECTOR_H
00017 #define GEOS_GEOMGRAPH_INDEX_SIMPLEMCSWEEPLINEINTERSECTOR_H
00018 
00019 #include <geos/export.h>
00020 #include <vector>
00021 
00022 #include <geos/geomgraph/index/EdgeSetIntersector.h> // for inheritance
00023 #include <geos/geomgraph/index/SegmentIntersector.h>
00024 
00025 #ifdef _MSC_VER
00026 #pragma warning(push)
00027 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
00028 #endif
00029 
00030 // Forward declarations
00031 namespace geos {
00032         namespace geomgraph {
00033                 class Edge;
00034                 namespace index {
00035                         // class SegmentIntersector;
00036                         class SweepLineEvent;
00037                 }
00038         }
00039 }
00040 
00041 namespace geos {
00042 namespace geomgraph { // geos::geomgraph
00043 namespace index { // geos::geomgraph::index
00044 
00054 class GEOS_DLL SimpleMCSweepLineIntersector: public EdgeSetIntersector {
00055 
00056 public:
00057 
00058         SimpleMCSweepLineIntersector();
00059 
00060         virtual ~SimpleMCSweepLineIntersector();
00061 
00062         void computeIntersections(std::vector<Edge*> *edges,
00063                         SegmentIntersector *si, bool testAllSegments);
00064 
00065         void computeIntersections(std::vector<Edge*> *edges0,
00066                         std::vector<Edge*> *edges1,
00067                         SegmentIntersector *si);
00068 
00069 protected:
00070 
00071         std::vector<SweepLineEvent*> events;
00072 
00073         // statistics information
00074         int nOverlaps;
00075 
00076 private:
00077         void add(std::vector<Edge*> *edges);
00078 
00079         void add(std::vector<Edge*> *edges,void* edgeSet);
00080 
00081         void add(Edge *edge,void* edgeSet);
00082 
00083         void prepareEvents();
00084 
00085         void computeIntersections(SegmentIntersector *si);
00086 
00087         void processOverlaps(int start, int end,
00088                         SweepLineEvent *ev0,
00089                         SegmentIntersector *si);
00090 };
00091 
00092 } // namespace geos.geomgraph.index
00093 } // namespace geos.geomgraph
00094 } // namespace geos
00095 
00096 #ifdef _MSC_VER
00097 #pragma warning(pop)
00098 #endif
00099 
00100 #endif // GEOS_GEOMGRAPH_INDEX_SIMPLEMCSWEEPLINEINTERSECTOR_H
00101