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

- File List

# SweeplineNestedRingTester.h

    00001 /**********************************************************************
    00002  * $Id: SweeplineNestedRingTester.h 2572 2009-06-08 22:10:55Z strk $
    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 <vector>
    00026
    00027 #include <geos/geom/Envelope.h> // for inline
    00028 //#include <geos/indexSweepline.h> // for inline and inheritance
    00029 #include <geos/index/sweepline/SweepLineOverlapAction.h> // for inheritance
    00030 #include <geos/index/sweepline/SweepLineIndex.h> // for inlines
    00031
    00032 // Forward declarations
    00033 namespace geos {
    00034         namespace geom {
    00035                 class LinearRing;
    00036                 class Envelope;
    00037                 class Coordinate;
    00038         }
    00039         namespace index {
    00040                 namespace sweepline {
    00041                         class SweepLineIndex;
    00042                 }
    00043         }
    00044         namespace geomgraph {
    00045                 class GeometryGraph;
    00046         }
    00047 }
    00048
    00049 namespace geos {
    00050 namespace operation { // geos::operation
    00051 namespace valid { // geos::operation::valid
    00052
    00058 class GEOS_DLL SweeplineNestedRingTester {
    00059
    00060 private:
    00061         geomgraph::GeometryGraph *graph;  // used to find non-node vertices
    00062         std::vector<geom::LinearRing*> rings;
    00063         index::sweepline::SweepLineIndex *sweepLine;
    00064         geom::Coordinate *nestedPt;
    00065         void buildIndex();
    00066
    00067 public:
    00068
    00069         SweeplineNestedRingTester(geomgraph::GeometryGraph *newGraph)
    00070                 :
    00071                 graph(newGraph),
    00072                 rings(),
    00073                 sweepLine(new index::sweepline::SweepLineIndex()),
    00074                 nestedPt(NULL)
    00075         {}
    00076
    00077         ~SweeplineNestedRingTester()
    00078         {
    00079                 delete sweepLine;
    00080         }
    00081
    00082         /*
    00083          * Be aware that the returned Coordinate (if != NULL)
    00084          * will point to storage owned by one of the LinearRing
    00085          * previously added. If you destroy them, this
    00086          * will point to an invalid memory address.
    00087          */
    00088         geom::Coordinate *getNestedPoint() { return nestedPt; }
    00089
    00090         void add(geom::LinearRing* ring) {
    00091                 rings.push_back(ring);
    00092         }
    00093
    00094         bool isNonNested();
    00095         bool isInside(geom::LinearRing *innerRing, geom::LinearRing *searchRing);
    00096         class OverlapAction: public index::sweepline::SweepLineOverlapAction {
    00097         public:
    00098                 bool isNonNested;
    00099                 OverlapAction(SweeplineNestedRingTester *p);
    00100                 void overlap(index::sweepline::SweepLineInterval *s0,
    00101                                 index::sweepline::SweepLineInterval *s1);
    00102         private:
    00103                 SweeplineNestedRingTester *parent;
    00104         };
    00105 };
    00106
    00107
    00108 } // namespace geos::operation::valid
    00109 } // namespace geos::operation
    00110 } // namespace geos
    00111
    00112 #endif // GEOS_OP_SWEEPLINENESTEDRINGTESTER_H
    00113
    00114 /**********************************************************************
    00115  * $Log$
    00116  * Revision 1.2  2006/06/01 10:28:47  strk
    00117  * Reduced number of installed headers for the geos::index namespace
    00118  *
    00119  * Revision 1.1  2006/03/20 16:57:44  strk
    00120  * spatialindex.h and opValid.h headers split
    00121  *
    00122  **********************************************************************/
    00123