예제 #1
0
Coordinate LengthIndexedLine::extractPoint(double index, double offsetDistance) const
{
	LinearLocation loc = LengthLocationMap::getLocation(linearGeom, index);
	Coordinate ret;
	loc.getSegment(linearGeom)->pointAlongOffset(loc.getSegmentFraction(), offsetDistance, ret);
	return ret;
}
예제 #2
0
double LengthLocationMap::getLength(const LinearLocation& loc) const
{
	double totalLength = 0.0;

	LinearIterator it(linearGeom);
	while (it.hasNext())
	{
		if (! it.isEndOfLine())
		{
			Coordinate p0 = it.getSegmentStart();
			Coordinate p1 = it.getSegmentEnd();
			double segLen = p1.distance(p0);
			// length falls in this segment
			if (loc.getComponentIndex() == it.getComponentIndex()
					&& loc.getSegmentIndex() == it.getVertexIndex())
			{
				return totalLength + segLen * loc.getSegmentFraction();
			}
			totalLength += segLen;
		}
		it.next();
	}
	return totalLength;
}
예제 #3
0
unsigned int LinearIterator::segmentEndVertexIndex(const LinearLocation& loc)
{
	if (loc.getSegmentFraction() > 0.0)
		return loc.getSegmentIndex() + 1;
	return loc.getSegmentIndex();
}