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

# MonotoneChain.h

    00001 /**********************************************************************
    00002  * $Id: MonotoneChain.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) 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_IDX_CHAIN_MONOTONECHAIN_H
    00017 #define GEOS_IDX_CHAIN_MONOTONECHAIN_H
    00018
    00019 #include <geos/geom/Envelope.h> // for inline
    00020
    00021 // Forward declarations
    00022 namespace geos {
    00023         namespace geom {
    00024                 class Envelope;
    00025                 class LineSegment;
    00026                 class CoordinateSequence;
    00027         }
    00028         namespace index {
    00029                 namespace chain {
    00030                         class MonotoneChainSelectAction;
    00031                         class MonotoneChainOverlapAction;
    00032                 }
    00033         }
    00034 }
    00035
    00036 namespace geos {
    00037 namespace index { // geos::index
    00038 namespace chain { // geos::index::chain
    00039
    00079 class MonotoneChain {
    00080
    00081 private:
    00082
    00083         void computeSelect(const geom::Envelope& searchEnv,
    00084                         unsigned int start0,
    00085                         unsigned int end0,
    00086                         MonotoneChainSelectAction& mcs);
    00087
    00088         void computeOverlaps(int start0, int end0, MonotoneChain* mc,
    00089                         int start1, int end1, MonotoneChainOverlapAction* mco);
    00090
    00091         const geom::CoordinateSequence* pts;
    00092
    00093         int start, end;
    00094
    00095         geom::Envelope* env;
    00096
    00098         void* context;
    00099
    00101         int id;
    00102
    00103 public:
    00104         MonotoneChain(const geom::CoordinateSequence *newPts,
    00105                         int nstart, int nend,
    00106                         void* nContext)
    00107                 :
    00108                 pts(newPts),
    00109                 start(nstart),
    00110                 end(nend),
    00111                 env(NULL),
    00112                 context(nContext)
    00113         {
    00114         }
    00115
    00116         ~MonotoneChain() {
    00117                 delete env;
    00118         }
    00119
    00120         geom::Envelope* getEnvelope();
    00121
    00122         int getStartIndex() { return start; }
    00123
    00124         int getEndIndex() { return end; }
    00125
    00126         void getLineSegment(unsigned int index, geom::LineSegment *ls);
    00127
    00132         geom::CoordinateSequence* getCoordinates();
    00133
    00138         void select(const geom::Envelope& searchEnv,
    00139                         MonotoneChainSelectAction& mcs);
    00140
    00141         void computeOverlaps(MonotoneChain *mc,
    00142                         MonotoneChainOverlapAction *mco);
    00143
    00144         void setId(int nId) { id=nId; }
    00145
    00146         inline int getId() { return id; }
    00147
    00148         void* getContext() { return context; }
    00149
    00150 };
    00151
    00152 } // namespace geos::index::chain
    00153 } // namespace geos::index
    00154 } // namespace geos
    00155
    00156 #endif // GEOS_IDX_CHAIN_MONOTONECHAIN_H
    00157
    00158 /**********************************************************************
    00159  * $Log$
    00160  * Revision 1.1  2006/03/22 18:12:31  strk
    00161  * indexChain.h header split.
    00162  *
    00163  **********************************************************************/
    00164