Example usage for com.google.gwt.maps.client.overlay Polyline addPolylineCancelLineHandler

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

Introduction

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

Prototype

public void addPolylineCancelLineHandler(final PolylineCancelLineHandler handler) 

Source Link

Document

This event is fired when the polyline is being edited and the edit is canceled.

Usage

From source file:com.google.gwt.maps.sample.hellomaps.client.DrawingOverlayDemo.java

License:Apache License

private void createPolyline() {
    PolyStyleOptions style = PolyStyleOptions.newInstance(color, weight, opacity);

    final Polyline poly = new Polyline(new LatLng[0]);
    lastPolyline = poly;/*from ww  w .j ava  2  s. c  om*/
    map.addOverlay(poly);
    poly.setDrawingEnabled();
    poly.setStrokeStyle(style);
    message2.setText("");
    poly.addPolylineLineUpdatedHandler(new PolylineLineUpdatedHandler() {

        public void onUpdate(PolylineLineUpdatedEvent event) {
            message2.setText(message2.getText() + " : Line Updated");
        }
    });

    poly.addPolylineCancelLineHandler(new PolylineCancelLineHandler() {

        public void onCancel(PolylineCancelLineEvent event) {
            message2.setText(message2.getText() + " : Line Canceled");
        }
    });

    poly.addPolylineEndLineHandler(new PolylineEndLineHandler() {

        public void onEnd(PolylineEndLineEvent event) {
            message2.setText(message2.getText() + " : Line End at " + event.getLatLng() + ".  Bounds="
                    + poly.getBounds().getNorthEast() + "," + poly.getBounds().getSouthWest() + " length="
                    + poly.getLength() + "m");
        }
    });
}