List of usage examples for com.google.gwt.maps.client.drawinglib DrawingControlOptions setPosition
public final void setPosition(ControlPosition position)
From source file:com.google.gwt.maps.testing.client.maps.DrawingMapWidget.java
License:Apache License
private void drawDrawing() { DrawingControlOptions drawingControlOptions = DrawingControlOptions.newInstance(); drawingControlOptions.setPosition(ControlPosition.TOP_CENTER); drawingControlOptions.setDrawingModes(OverlayType.values()); CircleOptions circleOptions = CircleOptions.newInstance(); // circleOptions.setFillColor("FF6633"); DrawingManagerOptions options = DrawingManagerOptions.newInstance(); options.setMap(mapWidget);//from w w w.j a v a 2s.c o m options.setDrawingMode(OverlayType.CIRCLE); options.setCircleOptions(circleOptions); options.setDrawingControlOptions(drawingControlOptions); DrawingManager o = DrawingManager.newInstance(options); o.addCircleCompleteHandler(new CircleCompleteMapHandler() { @Override public void onEvent(CircleCompleteMapEvent event) { Circle circle = event.getCircle(); GWT.log("circle completed radius=" + circle.getRadius()); } }); o.addMarkerCompleteHandler(new MarkerCompleteMapHandler() { @Override public void onEvent(MarkerCompleteMapEvent event) { Marker marker = event.getMarker(); GWT.log("marker completed position=" + marker.getPosition()); } }); o.addOverlayCompleteHandler(new OverlayCompleteMapHandler() { @Override public void onEvent(OverlayCompleteMapEvent event) { OverlayType ot = event.getOverlayType(); GWT.log("marker completed OverlayType=" + ot.toString()); if (ot == OverlayType.CIRCLE) { Circle circle = event.getCircle(); GWT.log("radius=" + circle.getRadius()); GWT.log("center=" + circle.getBounds().getCenter()); } if (ot == OverlayType.MARKER) { Marker marker = event.getMarker(); GWT.log("position=" + marker.getPosition()); GWT.log("center=" + marker.getPosition()); } if (ot == OverlayType.POLYGON) { Polygon polygon = event.getPolygon(); GWT.log("paths=" + polygon.getPaths().toString()); // print path points MVCArray<LatLng> points = polygon.getPath(); for (int g = 0; g < points.getLength(); g++) { LatLng p = points.get(g); GWT.log("[" + p.getLatitude() + "," + p.getLongitude() + "]"); } GWT.log("center=" + polygon.getPath()); } if (ot == OverlayType.POLYLINE) { Polyline polyline = event.getPolyline(); GWT.log("paths=" + polyline.getPath().toString()); GWT.log("center=" + polyline.getPath()); } if (ot == OverlayType.RECTANGLE) { Rectangle rectangle = event.getRectangle(); GWT.log("bounds=" + rectangle.getBounds()); GWT.log("center=" + rectangle.getBounds().getCenter()); } GWT.log("marker completed OverlayType=" + ot.toString()); } }); o.addPolygonCompleteHandler(new PolygonCompleteMapHandler() { @Override public void onEvent(PolygonCompleteMapEvent event) { Polygon polygon = event.getPolygon(); GWT.log("Polygon completed paths=" + polygon.getPath().toString()); } }); o.addPolylineCompleteHandler(new PolylineCompleteMapHandler() { @Override public void onEvent(PolylineCompleteMapEvent event) { Polyline polyline = event.getPolyline(); GWT.log("Polyline completed paths=" + polyline.getPath().toString()); } }); o.addRectangleCompleteHandler(new RectangleCompleteMapHandler() { @Override public void onEvent(RectangleCompleteMapEvent event) { Rectangle rectangle = event.getRectangle(); GWT.log("Rectangle completed bounds=" + rectangle.getBounds().getToString()); } }); }