GEOS  3.3.7
BufferParameters.h
00001 /**********************************************************************
00002  * $Id: BufferParameters.h 3300 2011-04-27 09:42:13Z strk $
00003  *
00004  * GEOS - Geometry Engine Open Source
00005  * http://geos.refractions.net
00006  *
00007  * Copyright (C) 2009  Sandro Santilli <strk@keybit.net>
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/BufferParameters.java r378 (JTS-1.12)
00017  *
00018  **********************************************************************/
00019 
00020 #ifndef GEOS_OP_BUFFER_BUFFERPARAMETERS_H
00021 #define GEOS_OP_BUFFER_BUFFERPARAMETERS_H
00022 
00023 #include <geos/export.h>
00024 
00025 //#include <vector>
00026 
00027 //#include <geos/algorithm/LineIntersector.h> // for composition
00028 //#include <geos/geom/Coordinate.h> // for composition
00029 //#include <geos/geom/LineSegment.h> // for composition
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         namespace operation {
00043                 namespace buffer {
00044                         class OffsetCurveVertexList;
00045                 }
00046         }
00047 }
00048 
00049 namespace geos {
00050 namespace operation { // geos.operation
00051 namespace buffer { // geos.operation.buffer
00052 
00058 class GEOS_DLL BufferParameters
00059 {
00060 
00061 public:
00062 
00064         enum EndCapStyle {
00065 
00067                 CAP_ROUND=1,
00068 
00070                 CAP_FLAT=2,
00071 
00073                 CAP_SQUARE=3
00074         };
00075 
00077         enum JoinStyle {
00078 
00080                 JOIN_ROUND=1,
00081 
00083                 JOIN_MITRE=2,
00084 
00086                 JOIN_BEVEL=3
00087         };
00088 
00092         //
00097         static const int DEFAULT_QUADRANT_SEGMENTS = 8;
00098 
00100         //
00103         static const double DEFAULT_MITRE_LIMIT; // 5.0 (in .cpp file)
00104 
00106         BufferParameters();
00107 
00109         //
00112         BufferParameters(int quadrantSegments);
00113 
00117         //
00121         BufferParameters(int quadrantSegments, EndCapStyle endCapStyle);
00122 
00126         //
00132         BufferParameters(int quadrantSegments, EndCapStyle endCapStyle,
00133                          JoinStyle joinStyle, double mitreLimit);
00134 
00136         //
00139         int getQuadrantSegments() const { return quadrantSegments; }
00140 
00144         // 
00170         void setQuadrantSegments(int quadSegs);
00171 
00175         //
00180         static double bufferDistanceError(int quadSegs);
00181 
00183         //
00186         EndCapStyle getEndCapStyle() const { return endCapStyle; }
00187 
00189         //
00197         void setEndCapStyle(EndCapStyle style)
00198         {
00199                 endCapStyle = style;
00200         }
00201 
00203         //
00206         JoinStyle getJoinStyle() const { return joinStyle; }
00207 
00211         //
00214         //
00217         void setJoinStyle(JoinStyle style)
00218         {
00219                 joinStyle = style;
00220         }
00221 
00223         //
00226         double getMitreLimit() const { return mitreLimit; }
00227  
00229         //
00241         void setMitreLimit(double limit)
00242         {
00243                 mitreLimit = limit;
00244         }
00245 
00263         void setSingleSided(bool isSingleSided)
00264         {
00265           _isSingleSided = isSingleSided;
00266         }
00267 
00273         bool isSingleSided() const {
00274           return _isSingleSided;
00275         }
00276 
00277 
00278 private:
00279 
00281         int quadrantSegments;
00282 
00284         EndCapStyle endCapStyle;
00285 
00287         JoinStyle joinStyle;
00288 
00290         double mitreLimit;
00291 
00292         bool _isSingleSided;
00293 };
00294 
00295 } // namespace geos::operation::buffer
00296 } // namespace geos::operation
00297 } // namespace geos
00298 
00299 #ifdef _MSC_VER
00300 #pragma warning(pop)
00301 #endif
00302 
00303 #endif // ndef GEOS_OP_BUFFER_BUFFERPARAMETERS_H
00304