GEOS
3.6.2
|
00001 /********************************************************************** 00002 * 00003 * GEOS - Geometry Engine Open Source 00004 * http://geos.osgeo.org 00005 * 00006 * Copyright (C) 2006 Refractions Research 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 #ifndef GEOS_GEOM_COORDINATEARRAYSEQUENCE_H 00016 #define GEOS_GEOM_COORDINATEARRAYSEQUENCE_H 00017 00018 #include <geos/export.h> 00019 #include <vector> 00020 00021 #include <geos/geom/CoordinateSequence.h> 00022 00023 #include <geos/inline.h> 00024 00025 // Forward declarations 00026 namespace geos { 00027 namespace geom { 00028 class Coordinate; 00029 } 00030 } 00031 00032 00033 namespace geos { 00034 namespace geom { // geos.geom 00035 00037 class GEOS_DLL CoordinateArraySequence : public CoordinateSequence { 00038 public: 00039 00040 CoordinateArraySequence(const CoordinateArraySequence &cl); 00041 00042 CoordinateArraySequence(const CoordinateSequence &cl); 00043 00044 CoordinateSequence *clone() const; 00045 00046 //const Coordinate& getCoordinate(int pos) const; 00047 const Coordinate& getAt(std::size_t pos) const; 00048 00050 virtual void getAt(std::size_t i, Coordinate& c) const; 00051 00052 //int size() const; 00053 size_t getSize() const; 00054 00055 // @deprecated 00056 const std::vector<Coordinate>* toVector() const; 00057 00058 // See dox in CoordinateSequence.h 00059 void toVector(std::vector<Coordinate>&) const; 00060 00062 CoordinateArraySequence(); 00063 00065 CoordinateArraySequence(std::vector<Coordinate> *coords, 00066 std::size_t dimension = 0); 00067 00069 CoordinateArraySequence(std::size_t n, std::size_t dimension = 0); 00070 00071 ~CoordinateArraySequence(); 00072 00073 bool isEmpty() const { return empty(); } 00074 00075 bool empty() const { return vect->empty(); } 00076 00078 void clear() { vect->clear(); } 00079 00080 void add(const Coordinate& c); 00081 00082 virtual void add(const Coordinate& c, bool allowRepeated); 00083 00095 virtual void add(std::size_t i, const Coordinate& coord, bool allowRepeated); 00096 00097 void setAt(const Coordinate& c, std::size_t pos); 00098 00099 void deleteAt(std::size_t pos); 00100 00101 std::string toString() const; 00102 00103 void setPoints(const std::vector<Coordinate> &v); 00104 00105 double getOrdinate(std::size_t index, 00106 size_t ordinateIndex) const; 00107 00108 void setOrdinate(std::size_t index, std::size_t ordinateIndex, 00109 double value); 00110 00111 void expandEnvelope(Envelope &env) const; 00112 00113 std::size_t getDimension() const; 00114 00115 void apply_rw(const CoordinateFilter *filter); 00116 00117 void apply_ro(CoordinateFilter *filter) const; 00118 00119 virtual CoordinateSequence& removeRepeatedPoints(); 00120 00121 private: 00122 std::vector<Coordinate> *vect; 00123 mutable std::size_t dimension; 00124 }; 00125 00127 typedef CoordinateArraySequence DefaultCoordinateSequence; 00128 00129 } // namespace geos.geom 00130 } // namespace geos 00131 00132 #endif // ndef GEOS_GEOM_COORDINATEARRAYSEQUENCE_H