use of de.micromata.opengis.kml.v_2_2_0.PolyStyle in project java-mapollage by trixon.
the class Operation method addPolygon.
private void addPolygon(String name, ArrayList<Coordinate> coordinates, Folder polygonFolder) {
List<Point2D.Double> inputs = new ArrayList<>();
coordinates.forEach((coordinate) -> {
inputs.add(new Point2D.Double(coordinate.getLongitude(), coordinate.getLatitude()));
});
try {
List<Point2D.Double> convexHull = GrahamScan.getConvexHullDouble(inputs);
Placemark placemark = polygonFolder.createAndAddPlacemark().withName(name);
Style style = placemark.createAndAddStyle();
LineStyle lineStyle = style.createAndSetLineStyle().withColor("00000000").withWidth(0.0);
PolyStyle polyStyle = style.createAndSetPolyStyle().withColor("ccffffff").withColorMode(ColorMode.RANDOM);
Polygon polygon = placemark.createAndSetPolygon();
Boundary boundary = polygon.createAndSetOuterBoundaryIs();
LinearRing linearRing = boundary.createAndSetLinearRing();
convexHull.forEach((node) -> {
linearRing.addToCoordinates(node.x, node.y);
});
} catch (IllegalArgumentException e) {
System.err.println(e);
}
}
Aggregations