/** * Default constructor. */ public GroupDetail() { groupGeometry = new GfxGeometry(GROUP_GEOM_ID); groupGeometry.setStyle(new ShapeStyle("#EEEE00", 0.5f, "#EEEE00", 0.8f, 2)); driver.initialize(this); }
private void updateGeometriesOnMap() { // make list of geometries from search items List<Geometry> searchGeoms = new ArrayList<Geometry>(); for (ListGridRecord record : searchItems.getRecords()) { SearchListRecord slr = (SearchListRecord) record; if (slr.getCritter() instanceof GeometryCriterion) { Geometry geometry = GeometryConverter.toGwt(((GeometryCriterion) slr.getCritter()).getGeometry()); searchGeoms.add(geometry); } } // (re)draw the geometries for (int i = 0; i < searchGeoms.size(); i++) { GfxGeometry worldPaintable = null; if (i < geometries.size()) { worldPaintable = geometries.get(i); mapWidget.unregisterWorldPaintable(worldPaintable); } else { worldPaintable = new GfxGeometry(GEOMETRY_IDENTIFIER + "_" + (i + 1)); worldPaintable.setStyle(selectionStyle); geometries.add(worldPaintable); } worldPaintable.setGeometry(searchGeoms.get(i)); mapWidget.registerWorldPaintable(worldPaintable); } // unregister superfluous geometries for (int i = searchGeoms.size(); i < geometries.size(); i++) { mapWidget.unregisterWorldPaintable(geometries.get(i)); } }
private void updateGeometryOnMap() { if (worldPaintable == null) { worldPaintable = new GfxGeometry(GeometricSearchCreator.IDENTIFIER + "_SELECTION_GEOMETRY"); worldPaintable.setStyle(selectionStyle); } else { mapWidget.unregisterWorldPaintable(worldPaintable); } if (searchGeometry != null) { worldPaintable.setGeometry(searchGeometry); mapWidget.registerWorldPaintable(worldPaintable); } } }
protected void updateTempLineAfterClick() { if (tempLine == null) { tempLine = new GfxGeometry("LineStringDrawController.updateLine"); tempLine.setStyle(drawStyle); } Coordinate[] srCoords = new Coordinate[geometry.getCoordinates().length]; Coordinate[] worldCoords = geometry.getCoordinates(); for (int i = 0; i < srCoords.length; i++) { srCoords[i] = getTransformer().worldToPan(worldCoords[i]); } currentLineStringCoordinates = srCoords; }
private void createTempPoint() { tempPoint = new GfxGeometry("PointDrawController.updatePoint"); tempPoint.setStyle(drawStyle); tempPoint.setSymbolInfo(symbolStyle); Coordinate coords = getTransformer().worldToPan(geometry.getCoordinate()); Point point = (Point) geometry.getGeometryFactory().createPoint(coords); tempPoint.setGeometry(point); mapWidget.render(tempPoint, RenderGroup.VECTOR, RenderStatus.ALL); }
@Override protected void updateTempLineAfterClick() { if (tempPolygon == null) { tempPolygon = new GfxGeometry("LineStringEditController.updatePolygon"); tempLine = new GfxGeometry("LineStringEditController.updateLine"); } if (geometry.isValid()) { tempPolygon.setStyle(drawStyleGood); tempLine.setStyle(drawStyleGood); } else { tempPolygon.setStyle(drawStyleBad); tempLine.setStyle(drawStyleBad); } Coordinate[] worldCoords = geometry.getCoordinates() != null ? geometry.getCoordinates() : new Coordinate[0]; int length = worldCoords != null ? worldCoords.length : 0; // remove the connection line between last and first point if (length > 2 && worldCoords[0].equals(worldCoords[length - 1])) { length--; } Coordinate[] srCoords = new Coordinate[length]; for (int i = 0; i < srCoords.length; i++) { srCoords[i] = getTransformer().worldToPan(worldCoords[i]); } GeometryFactory geometryFactory = geometry.getGeometryFactory(); LinearRing linearRing = geometryFactory.createLinearRing(srCoords); Polygon polygon = geometryFactory.createPolygon(linearRing, null); tempPolygon.setGeometry(polygon); mapWidget.render(tempPolygon, RenderGroup.VECTOR, RenderStatus.UPDATE); }
circle.setStyle(createStyle("#00FF00")); map.registerWorldPaintable(circle); GfxGeometry triangle = new GfxGeometry("triangle"); Geometry geom; geom = WktService