org.locationtech.jts.geom.Polygon.normalize()方法的使用及代码示例

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

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

Polygon.normalize介绍

暂无

代码示例

代码示例来源:origin: geotools/geotools

@Override
  public void filter(Geometry geom) {
    if (geom instanceof Polygon) {
      ((Polygon) geom).normalize();
    }
  }
});

代码示例来源:origin: geotools/geotools

public void normalize() {
  polygon.normalize();
}

代码示例来源:origin: geotools/geotools

((Polygon) g).normalize();
} else if (g instanceof GeometryCollection) {
  g.apply(

代码示例来源:origin: locationtech/jts

private LinearRing normalized(LinearRing ring, boolean clockwise) {
 LinearRing res = (LinearRing) ring.copy();
 normalize(res, clockwise);
 return res;
}

代码示例来源:origin: locationtech/jts

public void testNormalizeEmptyPolygon() throws Exception {
 Polygon actualValue = (Polygon) reader.read("POLYGON EMPTY");
 actualValue.normalize();
 Polygon expectedValue = (Polygon) reader.read("POLYGON EMPTY");
 assertEqualsExact(expectedValue, actualValue);
}

代码示例来源:origin: locationtech/jts

public void testNormalizePolygon1() throws Exception {
 Polygon actualValue = (Polygon) reader.read(
    "POLYGON ((120 320, 240 200, 120 80, 20 200, 120 320), (60 200, 80 220, 80 200, 60 200), (160 200, 180 200, 180 220, 160 200), (120 140, 140 140, 140 160, 120 140), (140 240, 140 220, 120 260, 140 240))");
 actualValue.normalize();
 Polygon expectedValue = (Polygon) reader.read(
    "POLYGON ((20 200, 120 320, 240 200, 120 80, 20 200), (60 200, 80 200, 80 220, 60 200), (120 140, 140 140, 140 160, 120 140), (120 260, 140 220, 140 240, 120 260), (160 200, 180 200, 180 220, 160 200))");
 assertEqualsExact(expectedValue, actualValue);
}

代码示例来源:origin: locationtech/jts

public void testAsGeometry() throws Exception {
  assertTrue(geometryFactory.createPoint((Coordinate) null).getEnvelope()
      .isEmpty());
  Geometry g = geometryFactory.createPoint(new Coordinate(5, 6))
      .getEnvelope();
  assertTrue(!g.isEmpty());
  assertTrue(g instanceof Point);
  Point p = (Point) g;
  assertEquals(5, p.getX(), 1E-1);
  assertEquals(6, p.getY(), 1E-1);
  LineString l = (LineString) reader.read("LINESTRING(10 10, 20 20, 30 40)");
  Geometry g2 = l.getEnvelope();
  assertTrue(!g2.isEmpty());
  assertTrue(g2 instanceof Polygon);
  Polygon poly = (Polygon) g2;
  poly.normalize();
  assertEquals(5, poly.getExteriorRing().getNumPoints());
  assertEquals(new Coordinate(10, 10), poly.getExteriorRing().getCoordinateN(
      0));
  assertEquals(new Coordinate(10, 40), poly.getExteriorRing().getCoordinateN(
      1));
  assertEquals(new Coordinate(30, 40), poly.getExteriorRing().getCoordinateN(
      2));
  assertEquals(new Coordinate(30, 10), poly.getExteriorRing().getCoordinateN(
      3));
  assertEquals(new Coordinate(10, 10), poly.getExteriorRing().getCoordinateN(
      4));
}

相关文章