# MonotoneChainEdge.h

    00001 /**********************************************************************
    00002  * $Id: MonotoneChainEdge.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_GEOMGRAPH_INDEX_MONOTONECHAINEDGE_H
    00018 #define GEOS_GEOMGRAPH_INDEX_MONOTONECHAINEDGE_H
    00019
    00020 #include <geos/geom/Envelope.h> // for composition
    00021
    00022 // Forward declarations
    00023 namespace geos {
    00024         namespace geom {
    00025                 class CoordinateSequence;
    00026         }
    00027         namespace geomgraph {
    00028                 class Edge;
    00029                 namespace index {
    00030                         class SegmentIntersector;
    00031                 }
    00032         }
    00033 }
    00034
    00035 namespace geos {
    00036 namespace geomgraph { // geos::geomgraph
    00037 namespace index { // geos::geomgraph::index
    00038
    00039 class MonotoneChainEdge {
    00040 public:
    00041         //MonotoneChainEdge();
    00042         ~MonotoneChainEdge();
    00043         MonotoneChainEdge(Edge *newE);
    00044         const geom::CoordinateSequence* getCoordinates();
    00045         std::vector<int>& getStartIndexes();
    00046         double getMinX(int chainIndex);
    00047         double getMaxX(int chainIndex);
    00048
    00049         void computeIntersects(const MonotoneChainEdge &mce,
    00050                 SegmentIntersector &si);
    00051
    00052         void computeIntersectsForChain(int chainIndex0,
    00053                 const MonotoneChainEdge &mce, int chainIndex1,
    00054                 SegmentIntersector &si);
    00055
    00056 protected:
    00057         Edge *e;
    00058         const geom::CoordinateSequence* pts; // cache a reference to the coord array, for efficiency
    00059         // the lists of start/end indexes of the monotone chains.
    00060         // Includes the end point of the edge as a sentinel
    00061         std::vector<int> startIndex;
    00062         // these envelopes are created once and reused
    00063         geom::Envelope env1;
    00064         geom::Envelope env2;
    00065 private:
    00066         void computeIntersectsForChain(int start0, int end0,
    00067                 const MonotoneChainEdge &mce,
    00068                 int start1, int end1,
    00069                 SegmentIntersector &ei);
    00070 };
    00071
    00072
    00073
    00074 } // namespace geos.geomgraph.index
    00075 } // namespace geos.geomgraph
    00076 } // namespace geos
    00077
    00078 #endif
    00079
    00080 /**********************************************************************
    00081  * $Log$
    00082  * Revision 1.1  2006/03/14 12:55:55  strk
    00083  * Headers split: geomgraphindex.h, nodingSnapround.h
    00084  *
    00085  **********************************************************************/
    00086