GEOS  3.4.2
BufferParameters.h
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/BufferParameters.java r378 (JTS-1.12)
00016  *
00017  **********************************************************************/
00018 
00019 #ifndef GEOS_OP_BUFFER_BUFFERPARAMETERS_H
00020 #define GEOS_OP_BUFFER_BUFFERPARAMETERS_H
00021 
00022 #include <geos/export.h>
00023 
00024 //#include <vector>
00025 
00026 //#include <geos/algorithm/LineIntersector.h> // for composition
00027 //#include <geos/geom/Coordinate.h> // for composition
00028 //#include <geos/geom/LineSegment.h> // for composition
00029 
00030 #ifdef _MSC_VER
00031 #pragma warning(push)
00032 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
00033 #endif
00034 
00035 // Forward declarations
00036 namespace geos {
00037         namespace geom {
00038                 class CoordinateSequence;
00039                 class PrecisionModel;
00040         }
00041         namespace operation {
00042                 namespace buffer {
00043                         class OffsetCurveVertexList;
00044                 }
00045         }
00046 }
00047 
00048 namespace geos {
00049 namespace operation { // geos.operation
00050 namespace buffer { // geos.operation.buffer
00051 
00057 class GEOS_DLL BufferParameters
00058 {
00059 
00060 public:
00061 
00063         enum EndCapStyle {
00064 
00066                 CAP_ROUND=1,
00067 
00069                 CAP_FLAT=2,
00070 
00072                 CAP_SQUARE=3
00073         };
00074 
00076         enum JoinStyle {
00077 
00079                 JOIN_ROUND=1,
00080 
00082                 JOIN_MITRE=2,
00083 
00085                 JOIN_BEVEL=3
00086         };
00087 
00091         //
00096         static const int DEFAULT_QUADRANT_SEGMENTS = 8;
00097 
00099         //
00102         static const double DEFAULT_MITRE_LIMIT; // 5.0 (in .cpp file)
00103 
00105         BufferParameters();
00106 
00108         //
00111         BufferParameters(int quadrantSegments);
00112 
00116         //
00120         BufferParameters(int quadrantSegments, EndCapStyle endCapStyle);
00121 
00125         //
00131         BufferParameters(int quadrantSegments, EndCapStyle endCapStyle,
00132                          JoinStyle joinStyle, double mitreLimit);
00133 
00135         //
00138         int getQuadrantSegments() const { return quadrantSegments; }
00139 
00143         // 
00169         void setQuadrantSegments(int quadSegs);
00170 
00174         //
00179         static double bufferDistanceError(int quadSegs);
00180 
00182         //
00185         EndCapStyle getEndCapStyle() const { return endCapStyle; }
00186 
00188         //
00196         void setEndCapStyle(EndCapStyle style)
00197         {
00198                 endCapStyle = style;
00199         }
00200 
00202         //
00205         JoinStyle getJoinStyle() const { return joinStyle; }
00206 
00210         //
00213         //
00216         void setJoinStyle(JoinStyle style)
00217         {
00218                 joinStyle = style;
00219         }
00220 
00222         //
00225         double getMitreLimit() const { return mitreLimit; }
00226  
00228         //
00240         void setMitreLimit(double limit)
00241         {
00242                 mitreLimit = limit;
00243         }
00244 
00262         void setSingleSided(bool isSingleSided)
00263         {
00264           _isSingleSided = isSingleSided;
00265         }
00266 
00272         bool isSingleSided() const {
00273           return _isSingleSided;
00274         }
00275 
00276 
00277 private:
00278 
00280         int quadrantSegments;
00281 
00283         EndCapStyle endCapStyle;
00284 
00286         JoinStyle joinStyle;
00287 
00289         double mitreLimit;
00290 
00291         bool _isSingleSided;
00292 };
00293 
00294 } // namespace geos::operation::buffer
00295 } // namespace geos::operation
00296 } // namespace geos
00297 
00298 #ifdef _MSC_VER
00299 #pragma warning(pop)
00300 #endif
00301 
00302 #endif // ndef GEOS_OP_BUFFER_BUFFERPARAMETERS_H
00303