/usr/include/geos/algorithm/LengthIndexedLine.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 | /**********************************************************************
* $Id: LengthIndexedLine.h 2809 2009-12-06 01:05:24Z mloskot $
*
* GEOS - Geometry Engine Open Source
* http://geos.refractions.net
*
* Copyright (C) 2005-2006 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: linearref/LengthIndexedLine.java rev. 1.10
*
**********************************************************************/
#ifndef GEOS_LINEARREF_LENGTHINDEXEDLINE_H
#define GEOS_LINEARREF_LENGTHINDEXEDLINE_H
#include <geos/geom/Coordinate.h>
#include <geos/geom/Geometry.h>
#include <geos/linearref/LinearLocation.h>
namespace geos
{
namespace linearref // geos::linearref
{
/** \brief
* Supports linear referencing along a linear {@link Geometry}
* using the length along the line as the index.
* Negative length values are taken as measured in the reverse direction
* from the end of the geometry.
* Out-of-range index values are handled by clamping
* them to the valid range of values.
* Non-simple lines (i.e. which loop back to cross or touch
* themselves) are supported.
*/
class LengthIndexedLine
{
private:
const geom::Geometry *linearGeom;
LinearLocation locationOf(double index) const;
public:
/** \brief
* Constructs an object which allows a linear {@link Geometry}
* to be linearly referenced using length as an index.
*
* @param linearGeom the linear geometry to reference along
*/
LengthIndexedLine(const geom::Geometry *linearGeom);
/** \brief
* Computes the {@link Coordinate} for the point
* on the line at the given index.
* If the index is out of range the first or last point on the
* line will be returned.
* The Z-ordinate of the computed point will be interpolated from
* the Z-ordinates of the line segment containing it, if they exist.
*
* @param index the index of the desired point
* @return the Coordinate at the given index
*/
geom::Coordinate extractPoint(double index) const;
/**
* Computes the {@link Coordinate} for the point
* on the line at the given index, offset by the given distance.
* If the index is out of range the first or last point on the
* line will be returned.
* The computed point is offset to the left of the line if the offset distance is
* positive, to the right if negative.
*
* The Z-ordinate of the computed point will be interpolated from
* the Z-ordinates of the line segment containing it, if they exist.
*
* @param index the index of the desired point
* @param offsetDistance the distance the point is offset from the segment
* (positive is to the left, negative is to the right)
* @return the Coordinate at the given index
*/
geom::Coordinate extractPoint(double index, double offsetDistance) const;
/**
* Computes the {@link LineString} for the interval
* on the line between the given indices.
* If the endIndex lies before the startIndex,
* the computed geometry is reversed.
*
* @param startIndex the index of the start of the interval
* @param endIndex the index of the end of the interval
* @return the linear interval between the indices
*/
geom::Geometry *extractLine(double startIndex, double endIndex) const;
/**
* Computes the minimum index for a point on the line.
* If the line is not simple (i.e. loops back on itself)
* a single point may have more than one possible index.
* In this case, the smallest index is returned.
*
* The supplied point does not <i>necessarily</i> have to lie precisely
* on the line, but if it is far from the line the accuracy and
* performance of this function is not guaranteed.
* Use {@link #project} to compute a guaranteed result for points
* which may be far from the line.
*
* @param pt a point on the line
* @return the minimum index of the point
*
* @see project
*/
double indexOf(const geom::Coordinate& pt) const;
/**
* Finds the index for a point on the line
* which is greater than the given index.
* If no such index exists, returns <tt>minIndex</tt>.
* This method can be used to determine all indexes for
* a point which occurs more than once on a non-simple line.
* It can also be used to disambiguate cases where the given point lies
* slightly off the line and is equidistant from two different
* points on the line.
*
* The supplied point does not <i>necessarily</i> have to lie precisely
* on the line, but if it is far from the line the accuracy and
* performance of this function is not guaranteed.
* Use {@link #project} to compute a guaranteed result for points
* which may be far from the line.
*
* @param pt a point on the line
* @param minIndex the value the returned index must be greater than
* @return the index of the point greater than the given minimum index
*
* @see project
*/
double indexOfAfter(const geom::Coordinate& pt, double minIndex) const;
/**
* Computes the indices for a subline of the line.
* (The subline must <b>conform</b> to the line; that is,
* all vertices in the subline (except possibly the first and last)
* must be vertices of the line and occcur in the same order).
*
* @param subLine a subLine of the line
* @return a pair of indices for the start and end of the subline.
*/
double* indicesOf(const geom::Geometry *subLine) const;
/**
* Computes the index for the closest point on the line to the given point.
* If more than one point has the closest distance the first one along the line
* is returned.
* (The point does not necessarily have to lie precisely on the line.)
*
* @param pt a point on the line
* @return the index of the point
*/
double project(const geom::Coordinate& pt) const;
/**
* Returns the index of the start of the line
* @return the start index
*/
double getStartIndex() const;
/**
* Returns the index of the end of the line
* @return the end index
*/
double getEndIndex() const;
/**
* Tests whether an index is in the valid index range for the line.
*
* @param length the index to test
* @return <code>true</code> if the index is in the valid range
*/
bool isValidIndex(double index) const;
/**
* Computes a valid index for this line
* by clamping the given index to the valid range of index values
*
* @return a valid index value
*/
double clampIndex(double index) const;
};
}
}
#endif
|