com.vividsolutions.jts.geom.Point.distance()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(3.0k)|赞(0)|评价(0)|浏览(127)

本文整理了Java中com.vividsolutions.jts.geom.Point.distance()方法的一些代码示例,展示了Point.distance()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Point.distance()方法的具体详情如下:
包路径:com.vividsolutions.jts.geom.Point
类名称:Point
方法名:distance

Point.distance介绍

暂无

代码示例

代码示例来源:origin: org.geotools/gt-render

public double distance(Geometry g) {
  return point.distance(g);
}

代码示例来源:origin: org.geotools/gt2-render

/**
 * Remove holes from a polygon
 *
 * @param polygon
 */
private Polygon simplifyPoly(Polygon polygon) {
  if(polygon.getNumInteriorRing() == 0)
    return polygon;
  
  LineString outer = polygon.getExteriorRing();
  if (outer.getStartPoint().distance(outer.getEndPoint()) != 0) {
    List clist = new ArrayList(Arrays.asList(outer.getCoordinates()));
    clist.add(outer.getStartPoint().getCoordinate());
    outer = outer.getFactory().createLinearRing(
        (Coordinate[]) clist.toArray(new Coordinate[clist.size()]));
  }
  LinearRing r = (LinearRing) outer;
  return outer.getFactory().createPolygon(r, null);
}

代码示例来源:origin: mapplus/spatial_statistics_for_geotools_udig

private Point getCentralPoint(MultiPoint multiPoint) {
  int numPoints = multiPoint.getNumPoints();
  if (numPoints == 1) {
    return (Point) multiPoint.getGeometryN(0);
  }
  double minDistance = Double.MAX_VALUE;
  Point centralPoint = null;
  for (int i = 0; i < numPoints; i++) {
    Point ce = (Point) multiPoint.getGeometryN(i);
    double curDistance = 0d;
    for (int j = 0; j < numPoints; j++) {
      Point de = (Point) multiPoint.getGeometryN(j);
      if (i != j) {
        curDistance += ce.distance(de);
      }
    }
    if (minDistance > curDistance) {
      minDistance = curDistance;
      centralPoint = ce;
    }
  }
  return centralPoint;
}

代码示例来源:origin: io.github.agentsoz/bdi-matsim

final double heightAtFromNode = Math.pow(bufferWidth-fromPoint.distance(fire),2.) ;
final double heightAtToNode = Math.pow( bufferWidth - point.distance(fire),2.) ;
if ( heightAtToNode>heightAtFromNode) {
  penaltyFactorsOfLinks.put( link.getId(), heightAtToNode-heightAtFromNode ) ;
final double heightAtToNode = Math.pow( bufferWidth - point.distance(fire),2.) ;
penaltyFactorsOfLinks.put(link.getId(), heightAtToNode ) ;

代码示例来源:origin: mapplus/spatial_statistics_for_geotools_udig

final Point[] minPoint = { null, null };
for (Point source : intersections) {
  double startDist = source.distance(input.getStartPoint());
  if (startDist < minDist[0]) {
    minDist[0] = startDist;
  double endDist = source.distance(input.getEndPoint());
  if (endDist < minDist[1]) {
    minDist[1] = endDist;

代码示例来源:origin: mapplus/spatial_statistics_for_geotools_udig

final Point[] minPoint = { null, null };
for (Point source : intersections) {
  double startDist = source.distance(part.getStartPoint());
  double endDist = source.distance(part.getEndPoint());
  if (startDist < endDist) {
    if (startDist < minDist[0]) {

代码示例来源:origin: io.github.agentsoz/bdi-matsim

final double distanceFromNode = point.distance(fire) ;
final double distanceToNode = point2.distance(fire) ;
if ( distanceToNode > distanceFromNode ) {
  penaltyFactorsOfLinks.put(link.getId(), buffer2bufferGettingAway);
final double distanceToNode = point.distance(fire) ;
final double distanceFromNode = point2.distance(fire) ;
if ( distanceToNode > distanceFromNode ) {
  penaltyFactorsOfLinks.put(link.getId(), buffer2bufferGettingAway);

相关文章