This file is indexed.

/usr/include/geos/operation/buffer/OffsetCurveBuilder.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
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
/**********************************************************************
 * $Id: OffsetCurveBuilder.h 2779 2009-12-03 19:45:53Z mloskot $
 *
 * GEOS - Geometry Engine Open Source
 * http://geos.refractions.net
 *
 * Copyright (C) 2009  Sandro Santilli <strk@keybit.net>
 * Copyright (C) 2006-2007 Refractions Research 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/OffsetCurveBuilder.java rev. 1.30 (JTS-1.10)
 *
 **********************************************************************/

#ifndef GEOS_OP_BUFFER_OFFSETCURVEBUILDER_H
#define GEOS_OP_BUFFER_OFFSETCURVEBUILDER_H

#include <geos/export.h>

#include <vector>

#include <geos/algorithm/LineIntersector.h> // for composition
#include <geos/geom/Coordinate.h> // for composition
#include <geos/geom/LineSegment.h> // for composition
#include <geos/operation/buffer/BufferParameters.h> // for composition

// Forward declarations
namespace geos {
	namespace geom {
		class CoordinateSequence;
		class PrecisionModel;
	}
	namespace operation {
		namespace buffer {
			class OffsetCurveVertexList;
		}
	}
}

namespace geos {
namespace operation { // geos.operation
namespace buffer { // geos.operation.buffer

/**
 * \class OffsetCurveBuilder opBuffer.h geos/opBuffer.h
 *
 * \brief
 * Computes the raw offset curve for a
 * single Geometry component (ring, line or point).
 *
 * A raw offset curve line is not noded -
 * it may contain self-intersections (and usually will).
 * The final buffer polygon is computed by forming a topological graph
 * of all the noded raw curves and tracing outside contours.
 * The points in the raw curve are rounded to the required precision model.
 *
 * Last port: operation/buffer/OffsetCurveBuilder.java rev. 1.9
 *
 */
class GEOS_DLL OffsetCurveBuilder {
public:

	/*
	 * @param nBufParams buffer parameters, this object will
	 *                   keep a reference to the passed parameters
	 *                   so caller must make sure the object is
	 *                   kept alive for the whole lifetime of
	 *                   the buffer builder.
	 */
	OffsetCurveBuilder(const geom::PrecisionModel *newPrecisionModel,
			const BufferParameters& bufParams);

	~OffsetCurveBuilder();

	/**
	 * This method handles single points as well as lines.
	 * Lines are assumed to <b>not</b> be closed (the function will not
	 * fail for closed lines, but will generate superfluous line caps).
	 *
	 * @param lineList the std::vector to which the newly created
	 *                 CoordinateSequences will be pushed_back.
	 *                 Caller is responsible to delete these new elements.
	 */
	void getLineCurve(const geom::CoordinateSequence* inputPts,
	                  double distance,
	                  std::vector<geom::CoordinateSequence*>& lineList);

	/**
	 * This method handles single points as well as lines.
	 *
	 * Lines are assumed to <b>not</b> be closed (the function will not
	 * fail for closed lines, but will generate superfluous line caps).
	 *
	 * @param lineList the std::vector to which newly created
	 *                 CoordinateSequences will be pushed_back.
	 *                 Caller will be responsible to delete them.
	 * @param leftSide indicates that the left side buffer will be
	 *                 obtained/skipped
	 * @param rightSide indicates that the right side buffer will
	 *                  be obtained/skipped
	 *
	 * NOTE: this is a GEOS extension
	 */
	void getSingleSidedLineCurve(const geom::CoordinateSequence* inputPts, 
	     double distance, std::vector<geom::CoordinateSequence*>& lineList,
	     bool leftSide, bool rightSide ) ;

	/**
	 * This method handles the degenerate cases of single points and lines,
	 * as well as rings.
	 *
	 * @param lineList the std::vector to which CoordinateSequences will
	 *                 be pushed_back
	 */
	void getRingCurve(const geom::CoordinateSequence *inputPts, int side,
	                  double distance,
	                  std::vector<geom::CoordinateSequence*>& lineList);


private:

	/// The mitre will be beveled if it exceeds the mitre ratio limit.
	//
	/// @param offset0 the first offset segment
	/// @param offset1 the second offset segment
	/// @param distance the offset distance
	///
	void addMitreJoin(const geom::Coordinate& p,
	                  const geom::LineSegment& offset0,
	                  const geom::LineSegment& offset1,
	                  double distance);

	/// Adds a limited mitre join connecting the two reflex offset segments.
	//
	/// A limited mitre is a mitre which is beveled at the distance
	/// determined by the mitre ratio limit.
	///
	/// @param offset0 the first offset segment
	/// @param offset1 the second offset segment
	/// @param distance the offset distance
	/// @param mitreLimit the mitre limit ratio
	///
	void addLimitedMitreJoin(
	                  const geom::LineSegment& offset0,
	                  const geom::LineSegment& offset1,
	                  double distance, double mitreLimit);

	/// \brief
	/// Adds a bevel join connecting the two offset segments
	/// around a reflex corner.
	// 
	/// @param offset0 the first offset segment
	/// @param offset1 the second offset segment
	///
	void addBevelJoin(const geom::LineSegment& offset0,
	                  const geom::LineSegment& offset1);

   
	/**
	 * Factor which controls how close curve vertices can be to be snapped
	 */
	static const double CURVE_VERTEX_SNAP_DISTANCE_FACTOR; //  1.0E-6;

	static const double PI; //  3.14159265358979

	static const double MAX_CLOSING_SEG_LEN; // 3.0

	/**
	 * Factor which controls how close offset segments can be to
	 * skip adding a filler or mitre.
	 */
	static const double OFFSET_SEGMENT_SEPARATION_FACTOR; // 1.0E-3;

	/**
	 * Factor which controls how close curve vertices on inside turns
	 * can be to be snapped
	 */
	static const double INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR; // 1.0E-3;

	/** \brief
	 * Factor which determines how short closing segs can be
	 * for round buffers
	 */
	static const int MAX_CLOSING_SEG_FRACTION = 80;

	algorithm::LineIntersector li;

	/** \brief
	 * The angle quantum with which to approximate a fillet curve
	 * (based on the input # of quadrant segments)
	 */
	double filletAngleQuantum;

	/** \brief
	 * the max error of approximation (distance) between a quad segment and
	 * the true fillet curve
	 */
	double maxCurveSegmentError;

	/// Owned by this object, destroyed by dtor 
	//
	/// This actually gets created multiple times
	/// and each of the old versions is pushed
	/// to the ptLists std::vector to ensure all
	/// created CoordinateSequences are properly 
	/// destroyed.
	///
	OffsetCurveVertexList* vertexList;

	double distance;

	const geom::PrecisionModel* precisionModel;

	const BufferParameters& bufParams; 

	/// The Closing Segment Factor controls how long "closing
	/// segments" are.  Closing segments are added at the middle of
	/// inside corners to ensure a smoother boundary for the buffer
	/// offset curve.  In some cases (particularly for round joins
	/// with default-or-better quantization) the closing segments
	/// can be made quite short.  This substantially improves
	/// performance (due to fewer intersections being created).
	/// 
	/// A closingSegFactor of 0 results in lines to the corner vertex.
	/// A closingSegFactor of 1 results in lines halfway
	/// to the corner vertex.
	/// A closingSegFactor of 80 results in lines 1/81 of the way
	/// to the corner vertex (this option is reasonable for the very
	/// common default situation of round joins and quadrantSegs >= 8).
	///
	/// The default is 1.
	///
	int closingSegFactor; // 1;

	geom::Coordinate s0, s1, s2;

	geom::LineSegment seg0;

	geom::LineSegment seg1;

	geom::LineSegment offset0;

	geom::LineSegment offset1;

	int side;

	// Not in JTS, used for single-sided buffers
	int endCapIndex;

	void init(double newDistance);

	/**
	 * Use a value which results in a potential distance error which is
	 * significantly less than the error due to
	 * the quadrant segment discretization.
	 * For QS = 8 a value of 100 is reasonable.
	 * This should produce a maximum of 1% distance error.
	 */
	static const double SIMPLIFY_FACTOR; // 100.0;

	/** \brief
	 * Computes the distance tolerance to use during input
	 * line simplification.
	 *
	 * @param distance the buffer distance
	 * @return the simplification tolerance
	 */
	double simplifyTolerance(double bufDistance);

	void computeLineBufferCurve(const geom::CoordinateSequence& inputPts);

	void computeRingBufferCurve(const geom::CoordinateSequence& inputPts,
	                            int side);

	void initSideSegments(const geom::Coordinate &nS1,
	                      const geom::Coordinate &nS2, int nSide);

	void addNextSegment(const geom::Coordinate &p, bool addStartPoint);

	void addCollinear(bool addStartPoint);

	/// Adds the offset points for an outside (convex) turn
	//
	/// @param orientation 
	/// @param addStartPoint  
	///
	void addOutsideTurn(int orientation, bool addStartPoint);

	/// Adds the offset points for an inside (concave) turn
	//
	/// @param orientation 
	/// @param addStartPoint  
	///
	void addInsideTurn(int orientation, bool addStartPoint);

	/// Add last offset point
	void addLastSegment();

	/** \brief
	 * Compute an offset segment for an input segment on a given
	 * side and at a given distance.
	 *
	 * The offset points are computed in full double precision,
	 * for accuracy.
	 *
	 * @param seg the segment to offset
	 * @param side the side of the segment the offset lies on
	 * @param distance the offset distance
	 * @param offset the points computed for the offset segment
	 */
	void computeOffsetSegment(const geom::LineSegment& seg,
	                          int side, double distance,
	                          geom::LineSegment& offset);

	/// \brief
	/// Add an end cap around point p1, terminating a line segment
	/// coming from p0
	void addLineEndCap(const geom::Coordinate &p0,
	                   const geom::Coordinate &p1);

	/**
	 * Adds points for a circular fillet around a reflex corner.
	 * 
	 * Adds the start and end points
	 *
	 * @param p base point of curve
	 * @param p0 start point of fillet curve
	 * @param p1 endpoint of fillet curve
	 * @param direction the orientation of the fillet
	 * @param radius the radius of the fillet
	 */
	void addFillet(const geom::Coordinate &p, const geom::Coordinate &p0,
	               const geom::Coordinate &p1,
	               int direction, double radius);

	/** 
	 * Adds points for a circular fillet arc between two specified angles.
	 *
	 * The start and end point for the fillet are not added -
	 * the caller must add them if required.
	 *
	 * @param direction is -1 for a CW angle, 1 for a CCW angle
	 * @param radius the radius of the fillet
	 */
	void addFillet(const geom::Coordinate &p, double startAngle,
	               double endAngle, int direction, double radius);

	/// Adds a CW circle around a point
	void addCircle(const geom::Coordinate &p, double distance);

	/// Adds a CW square around a point
	void addSquare(const geom::Coordinate &p, double distance);

    std::vector<OffsetCurveVertexList*> vertexLists;

    // Declare type as noncopyable
    OffsetCurveBuilder(const OffsetCurveBuilder& other);
    OffsetCurveBuilder& operator=(const OffsetCurveBuilder& rhs);
};

} // namespace geos::operation::buffer
} // namespace geos::operation
} // namespace geos

#endif // ndef GEOS_OP_BUFFER_OFFSETCURVEBUILDER_H

/**********************************************************************
 * $Log$
 * Revision 1.2  2006/03/27 17:04:17  strk
 * Cleanups and explicit initializations
 *
 * Revision 1.1  2006/03/14 00:19:40  strk
 * opBuffer.h split, streamlined headers in some (not all) files in operation/buffer/
 *
 **********************************************************************/