GEOS
3.3.7
|
00001 /********************************************************************** 00002 * $Id: CoordinateArraySequence.h 3255 2011-03-01 17:56:10Z mloskot $ 00003 * 00004 * GEOS - Geometry Engine Open Source 00005 * http://geos.refractions.net 00006 * 00007 * Copyright (C) 2006 Refractions Research 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_GEOM_COORDINATEARRAYSEQUENCE_H 00017 #define GEOS_GEOM_COORDINATEARRAYSEQUENCE_H 00018 00019 #include <geos/export.h> 00020 #include <vector> 00021 00022 #include <geos/geom/CoordinateSequence.h> 00023 00024 #include <geos/inline.h> 00025 00026 // Forward declarations 00027 namespace geos { 00028 namespace geom { 00029 class Coordinate; 00030 } 00031 } 00032 00033 00034 namespace geos { 00035 namespace geom { // geos.geom 00036 00038 class GEOS_DLL CoordinateArraySequence : public CoordinateSequence { 00039 public: 00040 00041 CoordinateArraySequence(const CoordinateArraySequence &cl); 00042 00043 CoordinateSequence *clone() const; 00044 00045 //const Coordinate& getCoordinate(int pos) const; 00046 const Coordinate& getAt(std::size_t pos) const; 00047 00049 virtual void getAt(std::size_t i, Coordinate& c) const; 00050 00051 //int size() const; 00052 size_t getSize() const; 00053 00054 // @deprecated 00055 const std::vector<Coordinate>* toVector() const; 00056 00057 // See dox in CoordinateSequence.h 00058 void toVector(std::vector<Coordinate>&) const; 00059 00061 CoordinateArraySequence(); 00062 00064 CoordinateArraySequence(std::vector<Coordinate> *coords, 00065 std::size_t dimension = 0); 00066 00068 CoordinateArraySequence(std::size_t n, std::size_t dimension = 0); 00069 00070 ~CoordinateArraySequence(); 00071 00072 bool isEmpty() const { return empty(); } 00073 00074 bool empty() const { return vect->empty(); } 00075 00077 void clear() { vect->clear(); } 00078 00079 void add(const Coordinate& c); 00080 00081 virtual void add(const Coordinate& c, bool allowRepeated); 00082 00094 virtual void add(std::size_t i, const Coordinate& coord, bool allowRepeated); 00095 00096 void setAt(const Coordinate& c, std::size_t pos); 00097 00098 void deleteAt(std::size_t pos); 00099 00100 std::string toString() const; 00101 00102 void setPoints(const std::vector<Coordinate> &v); 00103 00104 double getOrdinate(std::size_t index, 00105 size_t ordinateIndex) const; 00106 00107 void setOrdinate(std::size_t index, std::size_t ordinateIndex, 00108 double value); 00109 00110 void expandEnvelope(Envelope &env) const; 00111 00112 std::size_t getDimension() const; 00113 00114 void apply_rw(const CoordinateFilter *filter); 00115 00116 void apply_ro(CoordinateFilter *filter) const; 00117 00118 virtual CoordinateSequence& removeRepeatedPoints(); 00119 00120 private: 00121 std::vector<Coordinate> *vect; 00122 mutable std::size_t dimension; 00123 }; 00124 00126 typedef CoordinateArraySequence DefaultCoordinateSequence; 00127 00128 } // namespace geos.geom 00129 } // namespace geos 00130 00131 //#ifdef GEOS_INLINE 00132 //# include "geos/geom/CoordinateArraySequence.inl" 00133 //#endif 00134 00135 #endif // ndef GEOS_GEOM_COORDINATEARRAYSEQUENCE_H 00136 00137 /********************************************************************** 00138 * $Log$ 00139 * Revision 1.4 2006/06/12 10:10:39 strk 00140 * Fixed getGeometryN() to take size_t rather then int, changed unsigned int parameters to size_t. 00141 * 00142 * Revision 1.3 2006/05/03 08:58:34 strk 00143 * added new non-static CoordinateSequence::removeRepeatedPoints() mutator. 00144 * 00145 * Revision 1.2 2006/03/24 09:52:41 strk 00146 * USE_INLINE => GEOS_INLINE 00147 * 00148 * Revision 1.1 2006/03/09 16:46:49 strk 00149 * geos::geom namespace definition, first pass at headers split 00150 * 00151 **********************************************************************/