Example usage for com.google.gwt.maps.client.overlay Polygon Polygon

List of usage examples for com.google.gwt.maps.client.overlay Polygon Polygon

Introduction

In this page you can find the example usage for com.google.gwt.maps.client.overlay Polygon Polygon.

Prototype

public Polygon(LatLng[] points, String strokeColor, int strokeWeight, double strokeOpacity, String fillColor,
        double fillOpacity, PolygonOptions options) 

Source Link

Document

Create a polygon from an array of points, specifying optional parameters.

Usage

From source file:com.claudiushauptmann.gwt.maps.gxt.samples.client.OverlayEditor.java

License:Apache License

public void onModuleLoad() {
    // Map//from  w  ww  .j a  v a2s.  c om
    mapWidget = new MapWidget();
    mapWidget.setCenter(LatLng.newInstance(48.136559, 11.576318), 13);
    mapWidget.setWidth("100%");
    mapWidget.setHeight("100%");
    mapWidget.addControl(new LargeMapControl());
    mapWidget.setContinuousZoom(true);
    mapWidget.setScrollWheelZoomEnabled(true);
    RootPanel.get().add(mapWidget);

    // MapController
    mapGxtController = new MapGXTController(mapWidget);
    mapMenuProvider = new MapMenuProvider();
    mapGxtController.setMenuProvider(mapMenuProvider);

    // Marker
    MarkerOptions mo = MarkerOptions.newInstance();
    mo.setClickable(true);
    mo.setDraggable(true);
    Marker marker = new Marker(mapWidget.getCenter(), mo);
    mapWidget.addOverlay(marker);
    new MyMarkerEditController(mapGxtController, marker, "Marienplatz",
            "Marienplatz is a central square in the" + " city center of Munich, Germany since 1158.<br/>"
                    + " In the Middle Ages markets and tournaments were held in this"
                    + " city square. The Glockenspiel in the new city hall was inspired"
                    + " by these tournaments, and draws millions of tourists a year.");

    // Polyline
    LatLng[] llline = new LatLng[3];
    llline[0] = LatLng.newInstance(48.131955, 11.527061);
    llline[1] = LatLng.newInstance(48.11809, 11.579247);
    llline[2] = LatLng.newInstance(48.127143, 11.638298);
    PolylineOptions plo = PolylineOptions.newInstance(true, false);
    Polyline line = new Polyline(llline, "#FF0000", 2, 1.0, plo);
    mapWidget.addOverlay(line);
    new MyPolylineEditController(mapGxtController, line, "Polyline", "This is a polyline.");

    // Polygon
    LatLng[] llpolygon = new LatLng[4];
    llpolygon[0] = LatLng.newInstance(48.119809, 11.539936);
    llpolygon[1] = LatLng.newInstance(48.158185, 11.541138);
    llpolygon[2] = LatLng.newInstance(48.155894, 11.569118);
    llpolygon[3] = llpolygon[0];
    PolygonOptions pgo = PolygonOptions.newInstance(true);
    Polygon polygon = new Polygon(llpolygon, "#0000FF", 2, 1.0, "#0000FF", 0.3, pgo);
    mapWidget.addOverlay(polygon);
    new MyPolygonEditController(mapGxtController, polygon, "Polygon", "This is a polygon.");
}