GEOS
3.6.2
|
00001 /********************************************************************** 00002 * 00003 * GEOS - Geometry Engine Open Source 00004 * http://geos.osgeo.org 00005 * 00006 * Copyright (C) 2009 Sandro Santilli <strk@keybit.net> 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: operation/buffer/BufferInputLineSimplifier.java r320 (JTS-1.12) 00016 * 00017 **********************************************************************/ 00018 00019 #ifndef GEOS_OP_BUFFER_BUFFERINPUTLINESIMPLIFIER_H 00020 #define GEOS_OP_BUFFER_BUFFERINPUTLINESIMPLIFIER_H 00021 00022 #include <geos/geom/CoordinateSequence.h> // complete type required 00023 #include <geos/algorithm/CGAlgorithms.h> // for enum 00024 00025 #include <memory> 00026 #include <vector> // for composition 00027 00028 00029 // Forward declarations 00030 namespace geos { 00031 namespace geom { 00032 class CoordinateSequence; 00033 //class PrecisionModel; 00034 } 00035 } 00036 00037 namespace geos { 00038 namespace operation { // geos.operation 00039 namespace buffer { // geos.operation.buffer 00040 00073 class BufferInputLineSimplifier 00074 { 00075 00076 public: 00077 00090 static std::auto_ptr<geom::CoordinateSequence> simplify( 00091 const geom::CoordinateSequence& inputLine, double distanceTol); 00092 00093 BufferInputLineSimplifier(const geom::CoordinateSequence& input); 00094 00105 std::auto_ptr<geom::CoordinateSequence> simplify(double distanceTol); 00106 00107 private: 00108 00115 bool deleteShallowConcavities(); 00116 00125 unsigned int findNextNonDeletedIndex(unsigned int index) const; 00126 00127 std::auto_ptr<geom::CoordinateSequence> collapseLine() const; 00128 00129 bool isDeletable(int i0, int i1, int i2, double distanceTol) const; 00130 00131 bool isShallowConcavity(const geom::Coordinate& p0, 00132 const geom::Coordinate& p1, 00133 const geom::Coordinate& p2, 00134 double distanceTol) const; 00135 00149 bool isShallowSampled(const geom::Coordinate& p0, 00150 const geom::Coordinate& p2, 00151 int i0, int i2, double distanceTol) const; 00152 00153 bool isShallow(const geom::Coordinate& p0, 00154 const geom::Coordinate& p1, 00155 const geom::Coordinate& p2, 00156 double distanceTol) const; 00157 00158 bool isConcave(const geom::Coordinate& p0, 00159 const geom::Coordinate& p1, 00160 const geom::Coordinate& p2) const; 00161 00162 static const int NUM_PTS_TO_CHECK = 10; 00163 00164 static const int INIT = 0; 00165 static const int DELETE = 1; 00166 static const int KEEP = 1; 00167 00168 const geom::CoordinateSequence& inputLine; 00169 double distanceTol; 00170 std::vector<int> isDeleted; 00171 00172 int angleOrientation; 00173 00174 // Declare type as noncopyable 00175 BufferInputLineSimplifier(const BufferInputLineSimplifier& other); 00176 BufferInputLineSimplifier& operator=(const BufferInputLineSimplifier& rhs); 00177 }; 00178 00179 00180 } // namespace geos.operation.buffer 00181 } // namespace geos.operation 00182 } // namespace geos 00183 00184 00185 #endif // ndef GEOS_OP_BUFFER_BUFFERINPUTLINESIMPLIFIER_H 00186