예제 #1
0
 public static Geometry constructRectyPolygonGeometry(
     Point2D.Double aLeftUpperCorner, Point2D.Double aBottomRightCorner) {
   GeometryFactory gFactory = new GeometryFactory();
   CoordinateSequenceFactory csFactory = gFactory.getCoordinateSequenceFactory();
   Coordinate[] coordinates = new Coordinate[5];
   coordinates[0] = new Coordinate(aLeftUpperCorner.x, aLeftUpperCorner.y);
   coordinates[1] = new Coordinate(aBottomRightCorner.x, aLeftUpperCorner.y);
   coordinates[2] = new Coordinate(aBottomRightCorner.x, aBottomRightCorner.y);
   coordinates[3] = new Coordinate(aLeftUpperCorner.x, aBottomRightCorner.y);
   coordinates[4] = new Coordinate(aLeftUpperCorner.x, aLeftUpperCorner.y);
   CoordinateSequence cSeq = csFactory.create(coordinates);
   return gFactory.createPolygon(new LinearRing(cSeq, gFactory), null);
 }
예제 #2
0
 public static Geometry createPointGeometry(Point2D.Double aPoint) {
   GeometryFactory gFactory = new GeometryFactory();
   Coordinate coordinate = new Coordinate(aPoint.x, aPoint.y);
   return gFactory.createPoint(coordinate);
 }