コード例 #1
0
 private static Shape fromJtsGeometry(com.spatial4j.core.shape.jts.JtsGeometry shape) {
   com.vividsolutions.jts.geom.Coordinate[] coordinates = shape.getGeom().getCoordinates();
   Point[] points = new Point[coordinates.length];
   for (int i = 0; i < coordinates.length; i++)
     points[i] = point(coordinates[i].getOrdinate(0), coordinates[i].getOrdinate(1));
   String shapeType = shape.getGeom().getGeometryType();
   if (shapeType.equals("LineString")) return lineString(points);
   if (shapeType.equals("Polygon")) return polygon(points);
   throw new IllegalArgumentException("Unsupported shape type: " + shapeType);
 }
コード例 #2
0
 public static void assertEquals(JtsGeometry g1, JtsGeometry g2) {
   assertEquals(g1.getGeom(), g2.getGeom());
 }