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

- File List

# MonotoneChain.h

    00001 /**********************************************************************
    00002  * $Id: MonotoneChain.h 2774 2009-12-03 19:36:56Z 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  * Last port: index/chain/MonotoneChain.java rev. 1.15 (JTS-1.10)
    00017  *
    00018  **********************************************************************/
    00019
    00020 #ifndef GEOS_IDX_CHAIN_MONOTONECHAIN_H
    00021 #define GEOS_IDX_CHAIN_MONOTONECHAIN_H
    00022
    00023 #include <geos/export.h>
    00024 #include <geos/geom/Envelope.h> // for inline
    00025
    00026 #include <memory> // for auto_ptr
    00027
    00028 // Forward declarations
    00029 namespace geos {
    00030         namespace geom {
    00031                 class Envelope;
    00032                 class LineSegment;
    00033                 class CoordinateSequence;
    00034         }
    00035         namespace index {
    00036                 namespace chain {
    00037                         class MonotoneChainSelectAction;
    00038                         class MonotoneChainOverlapAction;
    00039                 }
    00040         }
    00041 }
    00042
    00043 namespace geos {
    00044 namespace index { // geos::index
    00045 namespace chain { // geos::index::chain
    00046
    00086 class GEOS_DLL MonotoneChain
    00087 {
    00088 public:
    00089
    00100         MonotoneChain(const geom::CoordinateSequence& pts,
    00101                   size_t start, size_t end, void* context);
    00102
    00103         ~MonotoneChain();
    00104
    00106         const geom::Envelope& getEnvelope() const;
    00107
    00108         size_t getStartIndex() const { return start; }
    00109
    00110         size_t getEndIndex() const { return end; }
    00111
    00116         void getLineSegment(size_t index, geom::LineSegment& ls) const;
    00117
    00123         std::auto_ptr<geom::CoordinateSequence> getCoordinates() const;
    00124
    00129         void select(const geom::Envelope& searchEnv,
    00130                         MonotoneChainSelectAction& mcs);
    00131
    00132         void computeOverlaps(MonotoneChain *mc,
    00133                         MonotoneChainOverlapAction *mco);
    00134
    00135         void setId(int nId) { id=nId; }
    00136
    00137         inline int getId() const { return id; }
    00138
    00139         void* getContext() { return context; }
    00140
    00141 private:
    00142
    00143         void computeSelect(const geom::Envelope& searchEnv,
    00144                         size_t start0,
    00145                         size_t end0,
    00146                         MonotoneChainSelectAction& mcs);
    00147
    00148         void computeOverlaps(size_t start0, size_t end0, MonotoneChain& mc,
    00149                              size_t start1, size_t end1,
    00150                              MonotoneChainOverlapAction& mco);
    00151
    00153         const geom::CoordinateSequence& pts;
    00154
    00156         mutable geom::Envelope* env;
    00157
    00159         void* context;
    00160
    00162         size_t start;
    00163
    00165         size_t end;
    00166
    00168         int id;
    00169
    00170     // Declare type as noncopyable
    00171     MonotoneChain(const MonotoneChain& other);
    00172     MonotoneChain& operator=(const MonotoneChain& rhs);
    00173 };
    00174
    00175 } // namespace geos::index::chain
    00176 } // namespace geos::index
    00177 } // namespace geos
    00178
    00179 #endif // GEOS_IDX_CHAIN_MONOTONECHAIN_H
    00180
    00181 /**********************************************************************
    00182  * $Log$
    00183  * Revision 1.1  2006/03/22 18:12:31  strk
    00184  * indexChain.h header split.
    00185  *
    00186  **********************************************************************/
    00187