Example usage for com.google.gwt.maps.client.overlays InfoWindow open

List of usage examples for com.google.gwt.maps.client.overlays InfoWindow open

Introduction

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

Prototype

private final native void open(StreetViewPanoramaImpl impl) ;

Source Link

Usage

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

License:Apache License

protected void drawInfoWindow(LatLng position, double elevation) {

    NumberFormat format = NumberFormat.getFormat("###");
    String elevationStr = format.format(elevation);
    String latlngStr = "[ " + format.format(position.getLatitude()) + ", "
            + format.format(position.getLongitude()) + " ]";
    String message = "Elevation " + elevationStr + "m @ " + latlngStr;

    HTML html = new HTML(message);
    InfoWindowOptions options = InfoWindowOptions.newInstance();
    options.setContent(html);//from   www  .  ja  v  a 2 s  .  co m
    InfoWindow iw = InfoWindow.newInstance(options);
    iw.setPosition(position);
    iw.open(mapWidget);
}

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

License:Apache License

private void drawInfoWindowOnMapCenter() {
    HTML html = new HTML("Center: " + mapWidget.getCenter().getToString());

    InfoWindowOptions options = InfoWindowOptions.newInstance();
    options.setContent(html);/*from w ww.  ja v a  2s.co m*/
    options.setPosition(mapWidget.getCenter());

    InfoWindow iw = InfoWindow.newInstance(options);
    iw.open(mapWidget);
}

From source file:org.rebioma.client.MapView.java

License:Apache License

protected void mapGeocoderResult(JsArray<com.google.gwt.maps.client.services.GeocoderResult> results) {
    String address = geocoder.getAddress();
    StringBuilder sb = new StringBuilder();
    LatLng point = null;//from   w  w w.ja  v  a 2  s  .com
    for (int i = 0; i < results.length(); i++) {
        com.google.gwt.maps.client.services.GeocoderResult geoResult = results.get(i);
        point = geoResult.getGeometry().getLocation();
        MapGeocoderResult result = new MapGeocoderResult(point, address);
        sb.append(result);
        InfoWindowOptions contentOptions = InfoWindowOptions.newInstance();
        contentOptions.setContent(result);
        contentOptions.setPosition(point);
        final InfoWindow content = InfoWindow.newInstance(contentOptions);
        if (geocoderMarkers != null) {
            for (Marker marker : geocoderMarkers) {
                marker.setMap((MapWidget) null);
            }
        }
        Marker geocoderMarker = GeocoderControl.createMarker(point, address);
        geocoderMarker.setMap(map);
        geocoderMarker.addClickHandler(new ClickMapHandler() {
            @Override
            public void onEvent(ClickMapEvent event) {
                closeInfoWindows();
                content.open(map);
                infoWindows.add(content);
            }
        });
        geocoderMarkers.add(geocoderMarker);
    }
    if (results.length() == 1 && point != null) {
        map.setCenter(point);
    }
}

From source file:org.rebioma.client.MapView.java

License:Apache License

private void showWindowInfo(OccurrenceMarkerManager occurrenceMarkerManager) {
    if (summaryContent == null) {
        summaryContent = new OccurrenceSummaryContent();
    }//  ww  w  .  j  a va  2  s  . c  o m
    closeInfoWindows();
    summaryContent.loadOccurrenceInfo(occurrenceMarkerManager.getOccurrence());
    //parent.getAbsoluteLeft();
    InfoWindowOptions infoWindowOptions = InfoWindowOptions.newInstance();
    infoWindowOptions.setPosition(occurrenceMarkerManager.getMarker().getPosition());
    try {
        infoWindowOptions.setContent(summaryContent);
    } catch (JavaScriptException e) {
        //on reessaie
        //TODO determiner pourquoi pour un nombre paire(2ime, 4ime, ...) d'execution, il y a une JavaScriptException
        infoWindowOptions.setContent(summaryContent);
    }

    InfoWindow infoWindow = InfoWindow.newInstance(infoWindowOptions);
    infoWindow.open(map);
    infoWindows.add(infoWindow);
}