Coordinate coord = new Coordinate(0, 0); Point point = new GeometryFactory().createPoint(coord); Coordinate[] coords = new Coordinate[] { new Coordinate(0, 0), new Coordinate(1, 1), new Coordinate(2, 2) }; LineString line = new GeometryFactory().createLineString(coords); Coordinate[] coords = new Coordinate[] { new Coordinate(0, 0), new Coordinate(0, 1), new Coordinate(1, 1), new Coordinate(1, 0), new Coordinate(0, 0) }; LinearRing ring = new GeometryFactory().createLinearRing(coords); Polygon polygon = new GeometryFactory().createPolygon(ring, null); Geometry intersection = geometry1.intersection(geometry2); Geometry union = geometry1.union(geometry2); boolean intersects = geometry1.intersects(geometry2); boolean contains = geometry1.contains(geometry2); import org.locationtech.jtstest.testbuilder.JTSTestBuilderFrame; public class MyTestBuilder { public static void main(String[] args) { JTSTestBuilderFrame frame = new JTSTestBuilderFrame(); frame.setVisible(true); } } import org.locationtech.jtstest.awt.ControlPanel; import org.locationtech.jtstest.awt.RepaintingMapPane; public class MySwingApp { public static void main(String[] args) { RepaintingMapPane mapPane = new RepaintingMapPane(); ControlPanel controlPanel = new ControlPanel(); controlPanel.setMapPane(mapPane); JFrame frame = new JFrame(); frame.getContentPane().add(controlPanel); frame.pack(); frame.setVisible(true); } }


上一篇:
下一篇:
切换中文