IAOIService aOIService = PlatformGIS.getAOIService();
Geometry multiGeometry = aOIService.getGeometry();
if (multiGeometry != null) {
Geometry innerPolygons = null;
Polygon polygon = null;
// draw the rectangle around the active region green:143
//float[] rgba = style.backgroundColor.getColorComponents(null);
//g.setColor(new Color(rgba[0], rgba[1], rgba[2], style.bAlpha));
graphic.setColor(new Color((float)0.5, (float)0.5, (float)0.5, (float)0.5));
int screenWidth = screen.width;
int screenHeight = screen.height;
GeneralPath path = new GeneralPath(GeneralPath.WIND_EVEN_ODD);
path.moveTo(0, 0);
path.lineTo(screenWidth, 0);
path.lineTo(screenWidth, screenHeight);
path.lineTo(0, screenHeight);
path.closePath();
// if multi geometry - loop through each geometry
for (int g=0; g<multiGeometry.getNumGeometries(); g++) {
Geometry geometry = multiGeometry.getGeometryN(g);
if (geometry.getGeometryType().equals("Polygon")){
polygon = (Polygon) geometry;
// get the exterior rings
LineString exterior = polygon.getExteriorRing();
// collects the internal holes if there are any
for (int i=0; i<polygon.getNumInteriorRing(); i++) {
if (innerPolygons == null) {
innerPolygons = polygon.getInteriorRingN(i);
}
else {
innerPolygons = innerPolygons.union(polygon.getInteriorRingN(i));
}
}
Coordinate[] coordinates = exterior.getCoordinates();