MonotoneChain.h

00001 /**********************************************************************
00002  *
00003  * GEOS - Geometry Engine Open Source
00004  * http://geos.osgeo.org
00005  *
00006  * Copyright (C) 2001-2002 Vivid Solutions Inc.
00007  *
00008  * This is free software; you can redistribute and/or modify it under
00009  * the terms of the GNU Lesser General Public Licence as published
00010  * by the Free Software Foundation. 
00011  * See the COPYING file for more information.
00012  *
00013  **********************************************************************
00014  *
00015  * Last port: index/chain/MonotoneChain.java rev. 1.15 (JTS-1.10)
00016  *
00017  **********************************************************************/
00018 
00019 #ifndef GEOS_IDX_CHAIN_MONOTONECHAIN_H
00020 #define GEOS_IDX_CHAIN_MONOTONECHAIN_H
00021 
00022 #include <geos/export.h>
00023 #include <geos/geom/Envelope.h> // for inline
00024 
00025 #include <memory> // for auto_ptr
00026 
00027 // Forward declarations
00028 namespace geos {
00029         namespace geom {
00030                 class Envelope;
00031                 class LineSegment;
00032                 class CoordinateSequence;
00033         }
00034         namespace index { 
00035                 namespace chain { 
00036                         class MonotoneChainSelectAction;
00037                         class MonotoneChainOverlapAction;
00038                 }
00039         }
00040 }
00041 
00042 namespace geos {
00043 namespace index { // geos::index
00044 namespace chain { // geos::index::chain
00045 
00085 class GEOS_DLL MonotoneChain
00086 {
00087 public:
00088 
00099         MonotoneChain(const geom::CoordinateSequence& pts,
00100                   std::size_t start, std::size_t end, void* context);
00101 
00102         ~MonotoneChain();
00103 
00105         const geom::Envelope& getEnvelope() const;
00106 
00107         size_t getStartIndex() const { return start; }
00108 
00109         size_t getEndIndex() const { return end; }
00110 
00115         void getLineSegment(std::size_t index, geom::LineSegment& ls) const;
00116 
00122         std::auto_ptr<geom::CoordinateSequence> getCoordinates() const;
00123 
00128         void select(const geom::Envelope& searchEnv,
00129                         MonotoneChainSelectAction& mcs);
00130 
00131         void computeOverlaps(MonotoneChain *mc,
00132                         MonotoneChainOverlapAction *mco);
00133 
00134         void setId(int nId) { id=nId; }
00135 
00136         inline int getId() const { return id; }
00137 
00138         void* getContext() { return context; }
00139 
00140 private:
00141 
00142         void computeSelect(const geom::Envelope& searchEnv,
00143                         size_t start0,
00144                         size_t end0,
00145                         MonotoneChainSelectAction& mcs);
00146 
00147         void computeOverlaps(std::size_t start0, std::size_t end0, MonotoneChain& mc,
00148                              std::size_t start1, std::size_t end1,
00149                              MonotoneChainOverlapAction& mco);
00150 
00152         const geom::CoordinateSequence& pts;
00153 
00155         mutable geom::Envelope* env;
00156 
00158         void* context;
00159 
00161         size_t start;
00162 
00164         size_t end;
00165 
00167         int id;
00168 
00169     // Declare type as noncopyable
00170     MonotoneChain(const MonotoneChain& other);
00171     MonotoneChain& operator=(const MonotoneChain& rhs);
00172 };
00173 
00174 } // namespace geos::index::chain
00175 } // namespace geos::index
00176 } // namespace geos
00177 
00178 #endif // GEOS_IDX_CHAIN_MONOTONECHAIN_H
00179 

Generated on 15 May 2014 for GEOS by  doxygen 1.4.7