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

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

Introduction

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

Prototype

public final native void setTitle(String title) ;

Source Link

Document

sets Rollover text

Usage

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

License:Apache License

private void drawBasicMarker() {
    LatLng center = LatLng.newInstance(47.8, -121.4);
    MarkerOptions options = MarkerOptions.newInstance();
    options.setPosition(center);/*from w ww. j  av  a2s  .co  m*/
    options.setTitle("Hello World");

    markerBasic = Marker.newInstance(options);
    markerBasic.setMap(mapWidget);

    markerBasic.addClickHandler(new ClickMapHandler() {
        @Override
        public void onEvent(ClickMapEvent event) {
            drawInfoWindow(markerBasic, event.getMouseEvent());
        }
    });
}

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

License:Apache License

private void drawMarkerWithBounceAnimation() {
    LatLng center = LatLng.newInstance(46.33, -113.81);
    MarkerOptions options = MarkerOptions.newInstance();
    options.setPosition(center);//from   w  w  w.  j  a v a  2s .co m
    options.setTitle("Hi I'm marker 2. Thanks for clicking on me.");
    options.setAnimation(Animation.BOUNCE);

    markerBouncing = Marker.newInstance(options);
    markerBouncing.setMap(mapWidget);
}

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

License:Apache License

private void drawMarkerWithDropAnimation() {
    LatLng center = LatLng.newInstance(42.33, -120.81);
    MarkerOptions options = MarkerOptions.newInstance();
    options.setPosition(center);//w  w  w  .  j a va 2s.  c  o  m
    options.setTitle("Thanks for clicking on me.");
    options.setAnimation(Animation.DROP);

    markerDrop = Marker.newInstance(options);
    markerDrop.setMap(mapWidget);
}

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

License:Apache License

private void drawMarker1() {
    LatLng center = LatLng.newInstance(47.8, -121.4);
    MarkerOptions options = MarkerOptions.newInstance();
    options.setPosition(center);/*from  ww  w.j  a  va  2 s.c  o  m*/
    options.setTitle("Hello World");

    final Marker marker = Marker.newInstance(options);
    marker.setMap(mapWidget);

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

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;/*from ww  w .ja  va 2s. co  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:com.google.sampling.experiential.client.ChartPanel.java

License:Open Source License

private Widget renderEventsOnMap() {
    markers.clear();//  ww w .  java2  s .  c o m
    createMap();
    final LatLngBounds bounds = LatLngBounds.newInstance(google, google);
    for (final EventDAO event : data) {
        String latLon = event.getWhatByKey(input.getName());
        if (latLon == null || latLon.length() == 0) {
            continue;
        }
        String[] splits = latLon.split(",");
        if (splits == null || splits.length != 2) {
            continue;
        }
        try {
            double latitude = Double.parseDouble(splits[0]);
            double longitude = Double.parseDouble(splits[1]);

            MarkerOptions markerOptions = MarkerOptions.newInstance();
            markerOptions.setMap(map);
            markerOptions.setTitle(event.getWhatString());
            LatLng newInstance = LatLng.newInstance(latitude, longitude);
            final Marker marker = Marker.newInstance(markerOptions);
            marker.setPosition(newInstance);
            bounds.union(LatLngBounds.newInstance(marker.getPosition(), marker.getPosition()));
            marker.addClickHandler(new ClickMapHandler() {
                @Override
                public void onEvent(ClickMapEvent mapEvent) {
                    openInfoWindowForMarker(event, marker);
                }
            });
            markers.put(event, marker);
        } catch (NumberFormatException nfe) {
        }
    }

    map.fitBounds(bounds);

    final LatLng oldCenter = map.getCenter();
    final int oldZoom = map.getZoom();
    map.addResizeHandler(new ResizeMapHandler() {

        @Override
        public void onEvent(ResizeMapEvent event) {
            map.setCenter(oldCenter);
            map.setZoom(oldZoom);
            map.fitBounds(bounds);
        }
    });
    Window.addResizeHandler(new ResizeHandler() {
        @Override
        public void onResize(ResizeEvent event) {
            MapHandlerRegistration.trigger(map, MapEventType.RESIZE);
            GWT.log("Window has been resized!");
        }
    });
    return map;
}

From source file:com.saveland.ancestry.client.InfoWindowMapWidget.java

License:Apache License

private void addPersonToMap(Person person) {
    final String key = person.key;
    LatLng center = LatLng.newInstance(person.lat, person.lon);
    MarkerOptions options = MarkerOptions.newInstance();
    options.setPosition(center);//from   ww  w . j a  va2  s  .  c  om
    options.setTitle(person.getDisplayName());

    final Marker marker = Marker.newInstance(options);
    marker.setMap(mapWidget);

    marker.addClickHandler(new ClickMapHandler() {
        public void onEvent(ClickMapEvent event) {
            drawInfoWindow(key, marker, event.getMouseEvent());
            // fill the form with the person data
            cData.setCurrentPerson(key);
        }
    });
}

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

/**
 * Adds a marker.//  w w w  . ja  v  a  2s  . co  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);//from w  w w  .  ja v  a  2 s.  com
    options.setDraggable(false);
    options.setIcon(icon);
    options.setShadow(shadow);
    options.setTitle(address);
    return options;
}