GEOS
3.6.2
|
00001 /********************************************************************** 00002 * 00003 * GEOS - Geometry Engine Open Source 00004 * http://geos.osgeo.org 00005 * 00006 * Copyright (C) 2009-2011 Sandro Santilli <strk@keybit.net> 00007 * Copyright (C) 2006-2007 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 * Last port: operation/buffer/OffsetCurveBuilder.java r378 (JTS-1.12) 00017 * 00018 **********************************************************************/ 00019 00020 #ifndef GEOS_OP_BUFFER_OFFSETCURVEBUILDER_H 00021 #define GEOS_OP_BUFFER_OFFSETCURVEBUILDER_H 00022 00023 #include <geos/export.h> 00024 00025 #include <geos/operation/buffer/BufferParameters.h> // for composition 00026 #include <geos/operation/buffer/OffsetSegmentGenerator.h> 00027 00028 #include <vector> 00029 #include <memory> // for auto_ptr 00030 00031 #ifdef _MSC_VER 00032 #pragma warning(push) 00033 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class 00034 #endif 00035 00036 // Forward declarations 00037 namespace geos { 00038 namespace geom { 00039 class CoordinateSequence; 00040 class PrecisionModel; 00041 } 00042 } 00043 00044 namespace geos { 00045 namespace operation { // geos.operation 00046 namespace buffer { // geos.operation.buffer 00047 00062 class GEOS_DLL OffsetCurveBuilder { 00063 public: 00064 00065 /* 00066 * @param nBufParams buffer parameters, this object will 00067 * keep a reference to the passed parameters 00068 * so caller must make sure the object is 00069 * kept alive for the whole lifetime of 00070 * the buffer builder. 00071 */ 00072 OffsetCurveBuilder(const geom::PrecisionModel *newPrecisionModel, 00073 const BufferParameters& nBufParams) 00074 : 00075 distance(0.0), 00076 precisionModel(newPrecisionModel), 00077 bufParams(nBufParams) 00078 {} 00079 00085 const BufferParameters& getBufferParameters() const 00086 { 00087 return bufParams; 00088 } 00089 00099 void getLineCurve(const geom::CoordinateSequence* inputPts, 00100 double distance, 00101 std::vector<geom::CoordinateSequence*>& lineList); 00102 00119 void getSingleSidedLineCurve(const geom::CoordinateSequence* inputPts, 00120 double distance, std::vector<geom::CoordinateSequence*>& lineList, 00121 bool leftSide, bool rightSide ) ; 00122 00130 void getRingCurve(const geom::CoordinateSequence *inputPts, int side, 00131 double distance, 00132 std::vector<geom::CoordinateSequence*>& lineList); 00133 00134 00135 private: 00136 00137 double distance; 00138 00139 const geom::PrecisionModel* precisionModel; 00140 00141 const BufferParameters& bufParams; 00142 00150 static const double SIMPLIFY_FACTOR; // 100.0; 00151 00159 double simplifyTolerance(double bufDistance); 00160 00161 void computeLineBufferCurve(const geom::CoordinateSequence& inputPts, 00162 OffsetSegmentGenerator& segGen); 00163 00164 void computeSingleSidedBufferCurve(const geom::CoordinateSequence& inputPts, 00165 bool isRightSide, 00166 OffsetSegmentGenerator& segGen); 00167 00168 void computeRingBufferCurve(const geom::CoordinateSequence& inputPts, 00169 int side, OffsetSegmentGenerator& segGen); 00170 00171 std::auto_ptr<OffsetSegmentGenerator> getSegGen(double dist); 00172 00173 void computePointCurve(const geom::Coordinate& pt, 00174 OffsetSegmentGenerator& segGen); 00175 00176 00177 // Declare type as noncopyable 00178 OffsetCurveBuilder(const OffsetCurveBuilder& other); 00179 OffsetCurveBuilder& operator=(const OffsetCurveBuilder& rhs); 00180 }; 00181 00182 } // namespace geos::operation::buffer 00183 } // namespace geos::operation 00184 } // namespace geos 00185 00186 #ifdef _MSC_VER 00187 #pragma warning(pop) 00188 #endif 00189 00190 #endif // ndef GEOS_OP_BUFFER_OFFSETCURVEBUILDER_H 00191