Example usage for com.google.gwt.maps.client.overlays MarkerOptions setClickable

List of usage examples for com.google.gwt.maps.client.overlays MarkerOptions setClickable

Introduction

In this page you can find the example usage for com.google.gwt.maps.client.overlays MarkerOptions setClickable.

Prototype

public final native void setClickable(boolean clickable) ;

Source Link

Document

sets If true, the marker receives mouse and touch events.

Usage

From source file:com.google.gwt.maps.testing.client.maps.StreetViewSideBySideMapWidget.java

License:Apache License

private void processPanoSearch(LatLng latlng, final StreetViewPanoramaData data, StreetViewStatus status) {
    if (status != StreetViewStatus.OK) {
        // TODO error
        return;//  ww  w .j  a v  a2  s  . c  o  m
    }

    if (data == null) {
        // TODO error
        return;
    }

    // setup marker for location clicked
    MarkerOptions options = MarkerOptions.newInstance();
    options.setClickable(true);
    options.setPosition(latlng);
    options.setMap(mapWidget);
    options.setTitle(data.getLocation().getDescription());

    Marker marker = Marker.newInstance(options);

    // move back on click
    marker.addClickHandler(new ClickMapHandler() {
        public void onEvent(ClickMapEvent event) {
            moveStreetView(data);
        }
    });

    // move
    moveStreetView(data);
}

From source file:gov.nist.spectrumbrowser.client.SensorGroupMarker.java

License:Open Source License

private SensorGroupMarker(double lat, double lon) {
    this.lat = lat;
    this.lon = lon;
    this.position = LatLng.newInstance(lat, lon);

    String iconPath = SpectrumBrowser.getIconsPath() + "mm_20_red.png";
    logger.finer("lon = " + lon + " lat = " + lat + " iconPath = " + iconPath);
    MarkerImage notSelectedIcon = MarkerImage.newInstance(iconPath);

    notSelectedIcon.setSize(Size.newInstance(12, 20));
    notSelectedIcon.setAnchor(Point.newInstance(6, 20));
    MarkerOptions notSelectedMarkerOptions = MarkerOptions.newInstance();
    notSelectedMarkerOptions.setIcon(notSelectedIcon);
    notSelectedMarkerOptions.setClickable(true);
    notSelectedMarker = Marker.newInstance(notSelectedMarkerOptions);

    // Attach marker to the map.

    notSelectedMarker.addMouseOverHandler(new NotSelectedMarkerMouseOverMapHandler());
    notSelectedMarker.addMouseOutMoveHandler(new NotSelectedMarkerMouseOutMapHandler());
    notSelectedMarker.addMouseDownHandler(new NotSelectedMarkerMouseDownMapHandler());
    notSelectedMarker.setPosition(position);
    notSelectedMarker.setVisible(true);//from  www  . j a  va 2 s. c  o m
    notSelectedMarker.setZindex(1);

    // Create icons for the selected marker.
    iconPath = SpectrumBrowser.getIconsPath() + "mm_20_yellow.png";
    MarkerImage selectedIcon = MarkerImage.newInstance(iconPath);
    selectedIcon.setSize(Size.newInstance(12, 20));
    selectedIcon.setAnchor(Point.newInstance(6, 20));
    // create marker options for the selected maker.
    MarkerOptions selectedMarkerOptions = MarkerOptions.newInstance();
    selectedMarkerOptions.setIcon(iconPath);
    selectedMarkerOptions.setClickable(true);

    // Create and attach the selected marker.
    selectedMarker = Marker.newInstance(selectedMarkerOptions);
    selectedMarker.setPosition(position);
    selectedMarker.setVisible(true);
    selectedMarker.setZindex(0);

}

From source file:net.cbtltd.client.field.MapField.java

/**
 * Adds a marker.//from   ww  w  .j  a  va 2s .c o  m
 *
 * @param value the position of the marker
 * @param text the text when clicked
 * @return the marker
 */
public Marker addMarker(LatLng value, String text) {
    if (value == null) {
        return null;
    }
    MarkerOptions markerOptions = MarkerOptions.newInstance();
    markerOptions.setClickable(true);
    markerOptions.setDraggable(isEnabled());
    markerOptions.setTitle(text);
    markerOptions.setPosition(value);
    markerOptions.setMap(map);
    markerOptions.setVisible(visible);
    marker = Marker.newInstance(markerOptions);
    markers.add(marker);

    marker.addClickHandler(new ClickMapHandler() {
        public void onEvent(ClickMapEvent event) {
            setValue(event.getMouseEvent().getLatLng());
        }
    });

    marker.addDragEndHandler(new DragEndMapHandler() {
        public void onEvent(DragEndMapEvent event) {
            setValue(marker.getPosition());
            fireChange(MapField.this);
        }
    });

    marker.addMouseOverHandler(new MouseOverMapHandler() {
        public void onEvent(MouseOverMapEvent event) {
            if (markerFunction != null) {
                markerFunction.onFocus(event);
            }
        }
    });

    marker.addMouseOutMoveHandler(new MouseOutMapHandler() {
        public void onEvent(MouseOutMapEvent event) {
            if (markerFunction != null) {
                markerFunction.onBlur(event);
            }
        }
    });
    return marker;
}

From source file:org.rebioma.client.maps.GeocoderControl.java

License:Apache License

private static MarkerOptions getOptions(LatLng point, String address) {
    MarkerImage icon = MarkerImage.newInstance("http://www.google.com/mapfiles/arrow.png");
    //      icon.setSize(Size.newInstance(39, 34));
    //      icon.setAnchor(Point.newInstance(9, 34));
    //      icon.setOrigin(Point.newInstance(9, 2));
    MarkerImage shadow = MarkerImage.newInstance("http://www.google.com/mapfiles/arrowshadow.png");
    //      shadow.setSize(Size.newInstance(39, 34));
    MarkerOptions options = MarkerOptions.newInstance();
    options.setClickable(true);
    options.setDraggable(false);/*from ww w  .  ja  v  a2  s.  c o  m*/
    options.setIcon(icon);
    options.setShadow(shadow);
    options.setTitle(address);
    return options;
}