GEOS
3.4.2
|
00001 /********************************************************************** 00002 * 00003 * GEOS - Geometry Engine Open Source 00004 * http://geos.osgeo.org 00005 * 00006 * Copyright (C) 2011 Sandro Santilli <strk@keybit.net> 00007 * Copyright (C) 2001-2002 Vivid Solutions Inc. 00008 * Copyright (C) 2005 2006 Refractions Research Inc. 00009 * 00010 * This is free software; you can redistribute and/or modify it under 00011 * the terms of the GNU Lesser General Public Licence as published 00012 * by the Free Software Foundation. 00013 * See the COPYING file for more information. 00014 * 00015 ********************************************************************** 00016 * 00017 * Last port: geom/LineString.java r320 (JTS-1.12) 00018 * 00019 **********************************************************************/ 00020 00021 #ifndef GEOS_GEOS_LINESTRING_H 00022 #define GEOS_GEOS_LINESTRING_H 00023 00024 #include <geos/export.h> 00025 #include <geos/platform.h> // do we need this ? 00026 #include <geos/geom/Geometry.h> // for inheritance 00027 #include <geos/geom/Lineal.h> // for inheritance 00028 #include <geos/geom/CoordinateSequence.h> // for proper use of auto_ptr<> 00029 #include <geos/geom/Envelope.h> // for proper use of auto_ptr<> 00030 #include <geos/geom/Dimension.h> // for Dimension::DimensionType 00031 00032 #include <string> 00033 #include <vector> 00034 #include <memory> // for auto_ptr 00035 00036 #include <geos/inline.h> 00037 00038 #ifdef _MSC_VER 00039 #pragma warning(push) 00040 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class 00041 #endif 00042 00043 namespace geos { 00044 namespace geom { 00045 class Coordinate; 00046 class CoordinateArraySequence; 00047 class CoordinateSequenceFilter; 00048 } 00049 } 00050 00051 namespace geos { 00052 namespace geom { // geos::geom 00053 00070 class GEOS_DLL LineString: public virtual Geometry, public Lineal { 00071 00072 public: 00073 00074 friend class GeometryFactory; 00075 00077 typedef std::vector<const LineString *> ConstVect; 00078 00079 virtual ~LineString(); 00080 00087 virtual Geometry *clone() const; 00088 00089 virtual CoordinateSequence* getCoordinates() const; 00090 00092 const CoordinateSequence* getCoordinatesRO() const; 00093 00094 virtual const Coordinate& getCoordinateN(int n) const; 00095 00097 virtual Dimension::DimensionType getDimension() const; 00098 00104 virtual int getBoundaryDimension() const; 00105 00107 virtual int getCoordinateDimension() const; 00108 00114 virtual Geometry* getBoundary() const; 00115 00116 virtual bool isEmpty() const; 00117 00118 virtual std::size_t getNumPoints() const; 00119 00120 virtual Point* getPointN(std::size_t n) const; 00121 00126 virtual Point* getStartPoint() const; 00127 00132 virtual Point* getEndPoint() const; 00133 00134 virtual bool isClosed() const; 00135 00136 virtual bool isRing() const; 00137 00138 virtual std::string getGeometryType() const; 00139 00140 virtual GeometryTypeId getGeometryTypeId() const; 00141 00142 virtual bool isCoordinate(Coordinate& pt) const; 00143 00144 virtual bool equalsExact(const Geometry *other, double tolerance=0) 00145 const; 00146 00147 virtual void apply_rw(const CoordinateFilter *filter); 00148 00149 virtual void apply_ro(CoordinateFilter *filter) const; 00150 00151 virtual void apply_rw(GeometryFilter *filter); 00152 00153 virtual void apply_ro(GeometryFilter *filter) const; 00154 00155 virtual void apply_rw(GeometryComponentFilter *filter); 00156 00157 virtual void apply_ro(GeometryComponentFilter *filter) const; 00158 00159 void apply_rw(CoordinateSequenceFilter& filter); 00160 00161 void apply_ro(CoordinateSequenceFilter& filter) const; 00162 00170 virtual void normalize(); 00171 00172 //was protected 00173 virtual int compareToSameClass(const Geometry *ls) const; 00174 00175 virtual const Coordinate* getCoordinate() const; 00176 00177 virtual double getLength() const; 00178 00185 Geometry* reverse() const; 00186 00187 protected: 00188 00189 LineString(const LineString &ls); 00190 00194 LineString(CoordinateSequence *pts, const GeometryFactory *newFactory); 00195 00197 LineString(CoordinateSequence::AutoPtr pts, 00198 const GeometryFactory *newFactory); 00199 00200 Envelope::AutoPtr computeEnvelopeInternal() const; 00201 00202 CoordinateSequence::AutoPtr points; 00203 00204 private: 00205 00206 void validateConstruction(); 00207 00208 }; 00209 00210 struct GEOS_DLL LineStringLT { 00211 bool operator()(const LineString *ls1, const LineString *ls2) const { 00212 return ls1->compareTo(ls2)<0; 00213 } 00214 }; 00215 00216 00217 inline Geometry* 00218 LineString::clone() const { 00219 return new LineString(*this); 00220 } 00221 00222 } // namespace geos::geom 00223 } // namespace geos 00224 00225 #ifdef _MSC_VER 00226 #pragma warning(pop) 00227 #endif 00228 00229 #endif // ndef GEOS_GEOS_LINESTRING_H