/usr/include/geos/operation/buffer/BufferOp.h is in libgeos-dev 3.2.2-3ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 | /**********************************************************************
* $Id: BufferOp.h 2605 2009-06-26 21:59:14Z strk $
*
* GEOS - Geometry Engine Open Source
* http://geos.refractions.net
*
* Copyright (C) 2009 Sandro Santilli <strk@keybit.net>
* Copyright (C) 2005-2007 Refractions Research Inc.
* Copyright (C) 2001-2002 Vivid Solutions Inc.
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU Lesser General Public Licence as published
* by the Free Software Foundation.
* See the COPYING file for more information.
*
**********************************************************************
*
* Last port: operation/buffer/BufferOp.java rev. 1.43 (JTS-1.10)
*
**********************************************************************/
#ifndef GEOS_OP_BUFFER_BUFFEROP_H
#define GEOS_OP_BUFFER_BUFFEROP_H
#include <geos/export.h>//#include <geos/operation/buffer/OffsetCurveBuilder.h> // for enum values
#include <geos/operation/buffer/BufferParameters.h> // for enum values
#include <geos/util/TopologyException.h> // for composition
// Forward declarations
namespace geos {
namespace geom {
class PrecisionModel;
class Geometry;
}
}
namespace geos {
namespace operation { // geos.operation
namespace buffer { // geos.operation.buffer
/**
* \class BufferOp opBuffer.h geos/opBuffer.h
*
* \brief
* Computes the buffer of a geometry, for both positive and negative
* buffer distances.
*
* In GIS, the buffer of a geometry is defined as
* the Minkowski sum or difference of the geometry
* with a circle with radius equal to the absolute value of the buffer
* distance.
* In the CAD/CAM world buffers are known as </i>offset curves</i>.
* In morphological analysis they are known as <i>erosion</i> and <i>dilation</i>.
*
* The buffer operation always returns a polygonal result.
* The negative or zero-distance buffer of lines and points is always an empty Polygon.
*
* Since true buffer curves may contain circular arcs,
* computed buffer polygons can only be approximations to the true geometry.
* The user can control the accuracy of the curve approximation by specifying
* the number of linear segments with which to approximate a curve.
*
* The end cap style of a linear buffer may be specified.
* The following end cap styles are supported:
* - CAP_ROUND - the usual round end caps
* - CAP_BUTT - end caps are truncated flat at the line ends
* - CAP_SQUARE - end caps are squared off at the buffer distance
* beyond the line ends
*
*/
class GEOS_DLL BufferOp {
private:
/**
* A number of digits of precision which leaves some computational "headroom"
* for floating point operations.
*
* This value should be less than the decimal precision of double-precision values (16).
*/
static const int MAX_PRECISION_DIGITS = 12;
/**
* Compute a reasonable scale factor to limit the precision of
* a given combination of Geometry and buffer distance.
* The scale factor is based on a heuristic.
*
* @param g the Geometry being buffered
*
* @param distance the buffer distance
*
* @param maxPrecisionDigits the mzx # of digits that should be
* allowed by the precision determined by the
* computed scale factor
*
* @return a scale factor that allows a reasonable amount of
* precision for the buffer computation
*/
static double precisionScaleFactor(const geom::Geometry *g,
double distance, int maxPrecisionDigits);
const geom::Geometry *argGeom;
util::TopologyException saveException;
double distance;
//int quadrantSegments;
//int endCapStyle;
BufferParameters bufParams;
geom::Geometry* resultGeometry;
void computeGeometry();
void bufferOriginalPrecision();
void bufferReducedPrecision(int precisionDigits);
void bufferReducedPrecision();
void bufferFixedPrecision(const geom::PrecisionModel& fixedPM);
public:
enum {
/// Specifies a round line buffer end cap style.
/// @deprecated use BufferParameters
CAP_ROUND = BufferParameters::CAP_ROUND,
/// Specifies a butt (or flat) line buffer end cap style.
/// @deprecated use BufferParameters
CAP_BUTT = BufferParameters::CAP_FLAT,
/// Specifies a square line buffer end cap style.
/// @deprecated use BufferParameters
CAP_SQUARE = BufferParameters::CAP_SQUARE
};
/**
* Computes the buffer for a geometry for a given buffer distance
* and accuracy of approximation.
*
* @param g the geometry to buffer
* @param distance the buffer distance
* @param quadrantSegments the number of segments used to
* approximate a quarter circle
* @return the buffer of the input geometry
*
*/
static geom::Geometry* bufferOp(const geom::Geometry *g,
double distance,
int quadrantSegments=
BufferParameters::DEFAULT_QUADRANT_SEGMENTS,
int endCapStyle=BufferParameters::CAP_ROUND);
/**
* Initializes a buffer computation for the given geometry
*
* @param g the geometry to buffer
*/
BufferOp(const geom::Geometry *g)
:
argGeom(g),
bufParams(),
resultGeometry(NULL)
{
}
/**
* Initializes a buffer computation for the given geometry
* with the given set of parameters
*
* @param g the geometry to buffer
* @param params the buffer parameters to use. This class will
* copy it to private memory.
*/
BufferOp(const geom::Geometry* g, const BufferParameters& params)
:
argGeom(g),
bufParams(params),
resultGeometry(NULL)
{
}
/**
* Specifies the end cap style of the generated buffer.
* The styles supported are CAP_ROUND, CAP_BUTT, and CAP_SQUARE.
* The default is CAP_ROUND.
*
* @param endCapStyle the end cap style to specify
*/
inline void setEndCapStyle(int nEndCapStyle);
/**
* Specifies the end cap style of the generated buffer.
* The styles supported are CAP_ROUND, CAP_BUTT, and CAP_SQUARE.
* The default is CAP_ROUND.
*
* @param endCapStyle the end cap style to specify
*/
inline void setQuadrantSegments(int nQuadrantSegments);
/**
* Returns the buffer computed for a geometry for a given buffer
* distance.
*
* @param g the geometry to buffer
* @param distance the buffer distance
* @return the buffer of the input geometry
*/
geom::Geometry* getResultGeometry(double nDistance);
};
// BufferOp inlines
void
BufferOp::setQuadrantSegments(int q)
{
bufParams.setQuadrantSegments(q);
}
void
BufferOp::setEndCapStyle(int s)
{
bufParams.setEndCapStyle((BufferParameters::EndCapStyle)s);
}
} // namespace geos::operation::buffer
} // namespace geos::operation
} // namespace geos
#endif // ndef GEOS_OP_BUFFER_BUFFEROP_H
/**********************************************************************
* $Log$
* Revision 1.1 2006/03/14 00:19:40 strk
* opBuffer.h split, streamlined headers in some (not all) files in operation/buffer/
*
**********************************************************************/
|