List of usage examples for com.google.gwt.maps.client.overlays InfoWindowOptions setPosition
public final native void setPosition(LatLng position) ;
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);/* www. j a v a 2 s. c o m*/ options.setPosition(mapWidget.getCenter()); InfoWindow iw = InfoWindow.newInstance(options); iw.open(mapWidget); }
From source file:gov.nist.spectrumbrowser.client.SensorGroupMarker.java
License:Open Source License
public InfoWindow getInfoWindow(String message) { if (infoWindow == null) { LatLng northeast = SpectrumBrowserShowDatasets.getMap().getBounds().getNorthEast(); LatLng southwest = SpectrumBrowserShowDatasets.getMap().getBounds().getSouthWest(); double delta = northeast.getLatitude() - southwest.getLatitude(); int height = SpectrumBrowser.MAP_HEIGHT; // should be the height of the icon. int desiredPixelOffset = 15; double latitudeOffset = delta / height * desiredPixelOffset; InfoWindowOptions iwo = InfoWindowOptions.newInstance(); iwo.setPosition(LatLng.newInstance(lat + latitudeOffset, lon)); iwo.setDisableAutoPan(true);/*from w ww.j a v a 2 s.co m*/ iwo.setContent(message); infoWindow = InfoWindow.newInstance(iwo); } return infoWindow; }
From source file:gov.nist.spectrumbrowser.client.SensorInfoDisplay.java
License:Open Source License
public InfoWindow getInfoWindow() { LatLng northeast = SpectrumBrowserShowDatasets.getMap().getBounds().getNorthEast(); LatLng southwest = SpectrumBrowserShowDatasets.getMap().getBounds().getSouthWest(); double delta = northeast.getLatitude() - southwest.getLatitude(); int height = SpectrumBrowser.MAP_HEIGHT; // should be the height of the icon. int desiredPixelOffset = 15; double latitudeOffset = delta / height * desiredPixelOffset; InfoWindowOptions iwo = InfoWindowOptions.newInstance(); iwo.setPosition(LatLng.newInstance(getLatLng().getLatitude() + latitudeOffset, getLatLng().getLongitude())); iwo.setDisableAutoPan(true);//from w w w . j av a2s .c om iwo.setContent(sensorInfo.getSensorDescription()); return InfoWindow.newInstance(iwo); }
From source file:net.cbtltd.client.field.MapField.java
/** * Instantiates a new map field.//from w w w. ja v a 2 s .com * * @param form is the form or other HasComponents element that contains the field. * @param permission that controls the visibility of the field. * @param tab index of the field. */ public MapField(HasComponents form, short[] permission, int tab) { initialize(panel, form, permission, CSS.cbtMapField()); super.setDefaultValue(LatLng.newInstance(0.0, 0.0)); addressLabel.addStyleName(CSS.cbtMapFieldLabel()); addressBox.addStyleName(CSS.cbtLocationFieldField()); addressBox.addBlurHandler(new BlurHandler() { @Override public void onBlur(BlurEvent event) { setName(addressBox.getText()); } }); addressBox.addKeyDownHandler(new KeyDownHandler() { @Override public void onKeyDown(KeyDownEvent event) { if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) { setName(addressBox.getText()); } } }); latitudeLabel.addStyleName(CSS.cbtMapFieldLabel()); latitudeBox.addStyleName(CSS.cbtMapFieldLatLng()); latitudeBox.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent event) { Double latitude = LF.parse(latitudeBox.getText()); if (latitude < -90.0 || latitude > 90.0) { addMessage(Level.ERROR, CONSTANTS.errPositionLatitude(), latitudeBox); } else { setValue(LatLng.newInstance(latitude, marker.getPosition().getLongitude())); } } }); longitudeLabel.addStyleName(CSS.cbtMapFieldLabel()); longitudeBox.addStyleName(CSS.cbtMapFieldLatLng()); longitudeBox.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent event) { Double longitude = LF.parse(longitudeBox.getText()); if (longitude < -180.0 || longitude > 180.0) { addMessage(Level.ERROR, CONSTANTS.errPositionLongitude(), longitudeBox); } else { setValue(LatLng.newInstance(marker.getPosition().getLatitude(), longitude)); } } }); position.addStyleName(CSS.cbtMapFieldTitle()); position.add(addressLabel); position.add(addressBox); position.add(latitudeLabel); position.add(latitudeBox); position.add(longitudeLabel); position.add(longitudeBox); position.add(lock); panel.add(position); MapOptions mapOptions = MapOptions.newInstance(); mapOptions.setDraggableCursor("crosshair"); mapOptions.setDraggingCursor("text"); mapOptions.setCenter(LatLng.newInstance(0.0, 0.0)); mapOptions.setDraggable(true); mapOptions.setDisableDoubleClickZoom(true); // mapOptions.setHeading(heading); mapOptions.setKeyboardShortcuts(false); mapOptions.setMapMaker(true); mapOptions.setMapTypeControl(true); mapOptions.setMapTypeId(mapTypeId); mapOptions.setNoClear(false); mapOptions.setOverviewMapControl(false); // mapOptions.setMapTypeControlOptions(MapTypeControlOptions.) mapOptions.setPanControl(true); // mapOptions.setPanControlOptions(panControlOptions); mapOptions.setRotateControl(false); // mapOptions.setRotateControlOptions(rotateControlOptions) mapOptions.setScaleControl(true); // mapOptions.setScaleControlOptions(scaleControlOptions) mapOptions.setScrollWheel(scrollWheel); // StreetViewPanoramaImpl streetView = StreetViewPanoramaImpl.newInstance(field.getElement(), options); // mapOptions.setStreetView(streetView); mapOptions.setStreetViewControl(streetView); // mapOptions.setStreetViewControlOptions(streetViewControlOptions) // mapOptions.setStyles(styles) mapOptions.setZoom(15); mapOptions.setZoomControl(true); map = MapWidget.newInstance(MapImpl.newInstance(field.getElement(), mapOptions)); map.addClickHandler(new ClickMapHandler() { public void onEvent(ClickMapEvent event) { if (isEnabled()) { setValue(event.getMouseEvent().getLatLng()); fireChange(MapField.this); } } }); panel.add(field); emptyValue.addStyleName(CSS.cbtMapFieldEmpty()); emptyValue.setVisible(false); panel.add(emptyValue); InfoWindowOptions infowindowOpts = InfoWindowOptions.newInstance(); infowindowOpts.setMaxWidth(100); infowindowOpts.setPosition(defaultValue); infoWindow = InfoWindow.newInstance(infowindowOpts); }
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 ww w . j ava 2s . co m*/ 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(); }/*from w w w . j a v a2s . 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); }