本文整理汇总了Java中com.vividsolutions.jts.geom.LineString.distance方法的典型用法代码示例。如果您正苦于以下问题:Java LineString.distance方法的具体用法?Java LineString.distance怎么用?Java LineString.distance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vividsolutions.jts.geom.LineString
的用法示例。
在下文中一共展示了LineString.distance方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: bufferError
import com.vividsolutions.jts.geom.LineString; //导入方法依赖的package包/类
/**
* Measure the maximum error in the buffer computation. This error is measured
* by computing the distance between all point in the buffer
* {@link LineString} and the input {@link LineString} used to compute the
* buffer.
* @param bufferRing one of the buffer rings
* @param line input {@link LineString} used to compute the buffer
* @param distance distance used to compute the buffer
* @return maximum error in the buffer computation
*/
public static double bufferError(LineString bufferRing, LineString line,
double distance) {
double maxError = 0;
for (Coordinate c : bufferRing.getCoordinates()) {
double d = line.distance(line.getFactory().createPoint(c));
maxError = Math.max(maxError, Math.abs(d - distance));
}
return maxError;
}