# MCPointInRing.h

    00001 /**********************************************************************
    00002  * $Id: MCPointInRing.h 1820 2006-09-06 16:54:23Z 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 #ifndef GEOS_ALGORITHM_MCPOINTINRING_H
    00018 #define GEOS_ALGORITHM_MCPOINTINRING_H
    00019
    00020 #include <geos/index/chain/MonotoneChainSelectAction.h> // for inheritance
    00021 #include <geos/algorithm/PointInRing.h> // for inheritance
    00022 #include <geos/geom/Coordinate.h> // for composition
    00023 #include <geos/index/bintree/Interval.h> // for composition
    00024
    00025 #include <vector>
    00026
    00027 // Forward declarations
    00028 namespace geos {
    00029         namespace geom {
    00030                 class Coordinate;
    00031                 class LineSegment;
    00032                 class LinearRing;
    00033                 class CoordinateSequence;
    00034                 class CoordinateSequence;
    00035         }
    00036         namespace index {
    00037                 namespace bintree {
    00038                         class Bintree;
    00039                         class Interval;
    00040                 }
    00041                 namespace chain {
    00042                         class MonotoneChain;
    00043                 }
    00044         }
    00045 }
    00046
    00047 namespace geos {
    00048 namespace algorithm { // geos::algorithm
    00049
    00050 class MCPointInRing: public PointInRing {
    00051 public:
    00052         MCPointInRing(const geom::LinearRing *newRing);
    00053         ~MCPointInRing();
    00054         bool isInside(const geom::Coordinate& pt);
    00055         void testLineSegment(geom::Coordinate& p, geom::LineSegment *seg);
    00056
    00057         class MCSelecter: public index::chain::MonotoneChainSelectAction {
    00058         using MonotoneChainSelectAction::select;
    00059         private:
    00060                 geom::Coordinate p;
    00061                 MCPointInRing *parent;
    00062         public:
    00063                 MCSelecter(const geom::Coordinate& newP, MCPointInRing *prt);
    00064                 void select(geom::LineSegment *ls);
    00065         };
    00066
    00067 private:
    00068         const geom::LinearRing *ring;
    00069         index::bintree::Interval interval;
    00070         geom::CoordinateSequence *pts;
    00071         index::bintree::Bintree *tree;
    00072         int crossings;  // number of segment/ray crossings
    00073         void buildIndex();
    00074         void testMonotoneChain(geom::Envelope *rayEnv,
    00075                         MCSelecter *mcSelecter,
    00076                         index::chain::MonotoneChain *mc);
    00077 };
    00078
    00079 } // namespace geos::algorithm
    00080 } // namespace geos
    00081
    00082 #endif // GEOS_ALGORITHM_MCPOINTINRING_H
    00083
    00084 /**********************************************************************
    00085  * $Log$
    00086  * Revision 1.4  2006/03/29 11:52:00  strk
    00087  * const correctness, useless heap allocations removal
    00088  *
    00089  * Revision 1.3  2006/03/22 18:12:31  strk
    00090  * indexChain.h header split.
    00091  *
    00092  * Revision 1.2  2006/03/22 16:01:33  strk
    00093  * indexBintree.h header split, classes renamed to match JTS
    00094  *
    00095  * Revision 1.1  2006/03/09 16:46:48  strk
    00096  * geos::geom namespace definition, first pass at headers split
    00097  *
    00098  **********************************************************************/
    00099