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

- File List

# SweeplineNestedRingTester.h

    00001 /**********************************************************************
    00002  * $Id: SweeplineNestedRingTester.h 3255 2011-03-01 17:56:10Z mloskot $
    00003  *
    00004  * GEOS - Geometry Engine Open Source
    00005  * http://geos.refractions.net
    00006  *
    00007  * Copyright (C) 2005-2006 Refractions Research Inc.
    00008  * Copyright (C) 2001-2002 Vivid Solutions Inc.
    00009  *
    00010  * This is free software; you can redistribute and/or modify it under
    00011  * the terms of the GNU Lesser General Public Licence as published
    00012  * by the Free Software Foundation.
    00013  * See the COPYING file for more information.
    00014  *
    00015  **********************************************************************
    00016  *
    00017  * Last port: operation/valid/SweeplineNestedRingTester.java rev. 1.12 (JTS-1.10)
    00018  *
    00019  **********************************************************************/
    00020
    00021 #ifndef GEOS_OP_SWEEPLINENESTEDRINGTESTER_H
    00022 #define GEOS_OP_SWEEPLINENESTEDRINGTESTER_H
    00023
    00024 #include <geos/export.h>
    00025 #include <geos/geom/Envelope.h> // for inline
    00026 //#include <geos/indexSweepline.h> // for inline and inheritance
    00027 #include <geos/index/sweepline/SweepLineOverlapAction.h> // for inheritance
    00028 #include <geos/index/sweepline/SweepLineIndex.h> // for inlines
    00029
    00030 #include <vector>
    00031
    00032 #ifdef _MSC_VER
    00033 #pragma warning(push)
    00034 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
    00035 #endif
    00036
    00037 // Forward declarations
    00038 namespace geos {
    00039         namespace geom {
    00040                 class LinearRing;
    00041                 class Envelope;
    00042                 class Coordinate;
    00043         }
    00044         namespace index {
    00045                 namespace sweepline {
    00046                         class SweepLineIndex;
    00047                 }
    00048         }
    00049         namespace geomgraph {
    00050                 class GeometryGraph;
    00051         }
    00052 }
    00053
    00054 namespace geos {
    00055 namespace operation { // geos::operation
    00056 namespace valid { // geos::operation::valid
    00057
    00063 class GEOS_DLL SweeplineNestedRingTester {
    00064
    00065 private:
    00066         geomgraph::GeometryGraph *graph;  // used to find non-node vertices
    00067         std::vector<geom::LinearRing*> rings;
    00068         index::sweepline::SweepLineIndex *sweepLine;
    00069         geom::Coordinate *nestedPt;
    00070         void buildIndex();
    00071
    00072 public:
    00073
    00074         SweeplineNestedRingTester(geomgraph::GeometryGraph *newGraph)
    00075                 :
    00076                 graph(newGraph),
    00077                 rings(),
    00078                 sweepLine(new index::sweepline::SweepLineIndex()),
    00079                 nestedPt(NULL)
    00080         {}
    00081
    00082         ~SweeplineNestedRingTester()
    00083         {
    00084                 delete sweepLine;
    00085         }
    00086
    00087         /*
    00088          * Be aware that the returned Coordinate (if != NULL)
    00089          * will point to storage owned by one of the LinearRing
    00090          * previously added. If you destroy them, this
    00091          * will point to an invalid memory address.
    00092          */
    00093         geom::Coordinate *getNestedPoint() { return nestedPt; }
    00094
    00095         void add(geom::LinearRing* ring) {
    00096                 rings.push_back(ring);
    00097         }
    00098
    00099         bool isNonNested();
    00100         bool isInside(geom::LinearRing *innerRing, geom::LinearRing *searchRing);
    00101         class OverlapAction: public index::sweepline::SweepLineOverlapAction {
    00102         public:
    00103                 bool isNonNested;
    00104                 OverlapAction(SweeplineNestedRingTester *p);
    00105                 void overlap(index::sweepline::SweepLineInterval *s0,
    00106                                 index::sweepline::SweepLineInterval *s1);
    00107         private:
    00108                 SweeplineNestedRingTester *parent;
    00109         };
    00110 };
    00111
    00112 } // namespace geos::operation::valid
    00113 } // namespace geos::operation
    00114 } // namespace geos
    00115
    00116 #ifdef _MSC_VER
    00117 #pragma warning(pop)
    00118 #endif
    00119
    00120 #endif // GEOS_OP_SWEEPLINENESTEDRINGTESTER_H
    00121
    00122 /**********************************************************************
    00123  * $Log$
    00124  * Revision 1.2  2006/06/01 10:28:47  strk
    00125  * Reduced number of installed headers for the geos::index namespace
    00126  *
    00127  * Revision 1.1  2006/03/20 16:57:44  strk
    00128  * spatialindex.h and opValid.h headers split
    00129  *
    00130  **********************************************************************/
    00131