GEOS: BufferOp.h Source File

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

# BufferOp.h

    00001 /**********************************************************************
    00002  * $Id: BufferOp.h 2605 2009-06-26 21:59:14Z strk $
    00003  *
    00004  * GEOS - Geometry Engine Open Source
    00005  * http://geos.refractions.net
    00006  *
    00007  * Copyright (C) 2009  Sandro Santilli <strk@keybit.net>
    00008  * Copyright (C) 2005-2007 Refractions Research Inc.
    00009  * Copyright (C) 2001-2002 Vivid Solutions Inc.
    00010  *
    00011  * This is free software; you can redistribute and/or modify it under
    00012  * the terms of the GNU Lesser General Public Licence as published
    00013  * by the Free Software Foundation.
    00014  * See the COPYING file for more information.
    00015  *
    00016  **********************************************************************
    00017  *
    00018  * Last port: operation/buffer/BufferOp.java rev. 1.43 (JTS-1.10)
    00019  *
    00020  **********************************************************************/
    00021
    00022 #ifndef GEOS_OP_BUFFER_BUFFEROP_H
    00023 #define GEOS_OP_BUFFER_BUFFEROP_H
    00024
    00025 #include <geos/export.h>//#include <geos/operation/buffer/OffsetCurveBuilder.h> // for enum values
    00026 #include <geos/operation/buffer/BufferParameters.h> // for enum values
    00027
    00028 #include <geos/util/TopologyException.h> // for composition
    00029
    00030 // Forward declarations
    00031 namespace geos {
    00032         namespace geom {
    00033                 class PrecisionModel;
    00034                 class Geometry;
    00035         }
    00036 }
    00037
    00038 namespace geos {
    00039 namespace operation { // geos.operation
    00040 namespace buffer { // geos.operation.buffer
    00041
    00072 class GEOS_DLL BufferOp {
    00073
    00074
    00075 private:
    00076
    00083         static const int MAX_PRECISION_DIGITS = 12;
    00084
    00101         static double precisionScaleFactor(const geom::Geometry *g,
    00102                         double distance, int maxPrecisionDigits);
    00103
    00104         const geom::Geometry *argGeom;
    00105
    00106         util::TopologyException saveException;
    00107
    00108         double distance;
    00109
    00110         //int quadrantSegments;
    00111         //int endCapStyle;
    00112         BufferParameters bufParams;
    00113
    00114         geom::Geometry* resultGeometry;
    00115
    00116         void computeGeometry();
    00117
    00118         void bufferOriginalPrecision();
    00119
    00120         void bufferReducedPrecision(int precisionDigits);
    00121
    00122         void bufferReducedPrecision();
    00123
    00124         void bufferFixedPrecision(const geom::PrecisionModel& fixedPM);
    00125
    00126 public:
    00127
    00128         enum {
    00131                 CAP_ROUND = BufferParameters::CAP_ROUND,
    00132
    00135                 CAP_BUTT = BufferParameters::CAP_FLAT,
    00136
    00139                 CAP_SQUARE = BufferParameters::CAP_SQUARE
    00140         };
    00141
    00153         static geom::Geometry* bufferOp(const geom::Geometry *g,
    00154                 double distance,
    00155                 int quadrantSegments=
    00156                         BufferParameters::DEFAULT_QUADRANT_SEGMENTS,
    00157                 int endCapStyle=BufferParameters::CAP_ROUND);
    00158
    00164         BufferOp(const geom::Geometry *g)
    00165                 :
    00166                 argGeom(g),
    00167                 bufParams(),
    00168                 resultGeometry(NULL)
    00169         {
    00170         }
    00171
    00180         BufferOp(const geom::Geometry* g, const BufferParameters& params)
    00181                 :
    00182                 argGeom(g),
    00183                 bufParams(params),
    00184                 resultGeometry(NULL)
    00185         {
    00186         }
    00187
    00188
    00196         inline void setEndCapStyle(int nEndCapStyle);
    00197
    00205         inline void setQuadrantSegments(int nQuadrantSegments);
    00206
    00215         geom::Geometry* getResultGeometry(double nDistance);
    00216
    00217 };
    00218
    00219 // BufferOp inlines
    00220 void
    00221 BufferOp::setQuadrantSegments(int q)
    00222 {
    00223         bufParams.setQuadrantSegments(q);
    00224 }
    00225
    00226 void
    00227 BufferOp::setEndCapStyle(int s)
    00228 {
    00229         bufParams.setEndCapStyle((BufferParameters::EndCapStyle)s);
    00230 }
    00231
    00232
    00233 } // namespace geos::operation::buffer
    00234 } // namespace geos::operation
    00235 } // namespace geos
    00236
    00237 #endif // ndef GEOS_OP_BUFFER_BUFFEROP_H
    00238
    00239 /**********************************************************************
    00240  * $Log$
    00241  * Revision 1.1  2006/03/14 00:19:40  strk
    00242  * opBuffer.h split, streamlined headers in some (not all) files in operation/buffer/
    00243  *
    00244  **********************************************************************/
    00245