Search in sources :

Example 1 with Marker

use of com.google.gwt.maps.client.overlay.Marker in project opennms by OpenNMS.

the class GoogleMapsPanel method createMarker.

private Marker createMarker(final GWTMarkerState marker) {
    final Icon icon = Icon.newInstance();
    icon.setIconSize(Size.newInstance(32, 32));
    icon.setIconAnchor(Point.newInstance(16, 32));
    String markerImageURL = marker.getImageURL();
    icon.setImageURL(markerImageURL);
    final MarkerOptions markerOptions = MarkerOptions.newInstance();
    markerOptions.setAutoPan(true);
    markerOptions.setClickable(true);
    markerOptions.setTitle(marker.getName());
    markerOptions.setIcon(icon);
    Marker m = new Marker(toLatLng(marker.getLatLng()), markerOptions);
    m.setVisible(marker.isVisible());
    m.addMarkerClickHandler(new DefaultMarkerClickHandler(marker));
    return m;
}
Also used : MarkerOptions(com.google.gwt.maps.client.overlay.MarkerOptions) Icon(com.google.gwt.maps.client.overlay.Icon) Marker(com.google.gwt.maps.client.overlay.Marker)

Example 2 with Marker

use of com.google.gwt.maps.client.overlay.Marker in project opennms by OpenNMS.

the class GoogleMapsPanel method showLocationDetails.

/** {@inheritDoc} */
@Override
public void showLocationDetails(final String name, final String htmlTitle, final String htmlContent) {
    final Marker m = m_markers.get(name);
    getMapWidget().savePosition();
    getMapWidget().setCenter(m.getLatLng());
    if (m != null) {
        final VerticalPanel panel = new VerticalPanel();
        panel.add(new Label(htmlTitle));
        panel.add(new HTML(htmlContent));
        getMapWidget().getInfoWindow().open(m.getLatLng(), new InfoWindowContent(panel.toString()));
        getMapWidget().getInfoWindow().addInfoWindowCloseClickHandler(new InfoWindowCloseClickHandler() {

            @Override
            public void onCloseClick(InfoWindowCloseClickEvent event) {
                getMapWidget().returnToSavedPosition();
            }
        });
    }
}
Also used : VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) InfoWindowCloseClickHandler(com.google.gwt.maps.client.event.InfoWindowCloseClickHandler) Label(com.google.gwt.user.client.ui.Label) HTML(com.google.gwt.user.client.ui.HTML) Marker(com.google.gwt.maps.client.overlay.Marker) InfoWindowContent(com.google.gwt.maps.client.InfoWindowContent)

Example 3 with Marker

use of com.google.gwt.maps.client.overlay.Marker in project opennms by OpenNMS.

the class GoogleMapsPanel method placeMarker.

/** {@inheritDoc} */
@Override
public void placeMarker(final GWTMarkerState marker) {
    m_markerStates.put(marker.getName(), marker);
    Marker m = m_markers.get(marker.getName());
    if (m == null) {
        m = createMarker(marker);
        m_markers.put(marker.getName(), m);
        addOverlay(m);
    }
    updateMarkerFromState(m, marker);
}
Also used : Marker(com.google.gwt.maps.client.overlay.Marker)

Aggregations

Marker (com.google.gwt.maps.client.overlay.Marker)3 InfoWindowContent (com.google.gwt.maps.client.InfoWindowContent)1 InfoWindowCloseClickHandler (com.google.gwt.maps.client.event.InfoWindowCloseClickHandler)1 Icon (com.google.gwt.maps.client.overlay.Icon)1 MarkerOptions (com.google.gwt.maps.client.overlay.MarkerOptions)1 HTML (com.google.gwt.user.client.ui.HTML)1 Label (com.google.gwt.user.client.ui.Label)1 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)1