List of usage examples for com.google.gwt.maps.client.overlay Marker Marker
Marker
From source file:com.google.mobile.trippy.web.client.view.MapView.java
License:Apache License
/** * Create a new marker on the map.//from ww w . j av a2 s.c o m * The marker is by default clickable and non-draggable */ @Override public final HasMarker newMarker(HasLatLng position) { HasMarker marker = new Marker(); marker.setPosition(position); marker.setMap(getMap()); marker.setDraggable(false); marker.setClickable(true); marker.setIcon(new MarkerImage.Builder(TrippyBundle.INSTANCE.mapMarkerNormal().getURL()).build()); if (markers == null) { markers = new ArrayList<HasMarker>(); } markers.add(marker); return marker; }
From source file:es.uem.geoparser.client.view.MapViewImpl.java
License:Apache License
@Override public HasMarker createMarkerAt(HasLatLng position) { final Marker marker = new Marker(); marker.setMap(getMap());/*from w w w .java2 s . c o m*/ marker.setPosition(position); return marker; }
From source file:org.opendatakit.aggregate.client.popups.VisualizationPopup.java
License:Apache License
private MapWidget createMap() { int latIndex = findGpsIndex(geoPoints.getElementKey(), GeoPointConsts.GEOPOINT_LATITUDE_ORDINAL_NUMBER); int lonIndex = findGpsIndex(geoPoints.getElementKey(), GeoPointConsts.GEOPOINT_LONGITUDE_ORDINAL_NUMBER); // check to see if we have lat & long, if not display erro if (latIndex < 0 || lonIndex < 0) { String error = "ERROR:"; if (latIndex < 0) { error = error + " The Latitude Coordinate is NOT included in the Filter."; }/* www.j a va 2 s.co m*/ if (lonIndex < 0) { error = error + " The Longitude Coordinate is NOT included in the Filter."; } Window.alert(error); return null; } // create a center point, stop at the first gps point found LatLng center = new LatLng(0.0, 0.0); for (SubmissionUI sub : submissions) { LatLng gpsPoint = getLatLonFromSubmission(latIndex, lonIndex, sub); if (gpsPoint != null) { center = gpsPoint; break; } } // create mapping area final MapOptions options = new MapOptions(); options.setCenter(center); MapTypeId id = new MapTypeId(); options.setMapTypeId(id.getRoadmap()); options.setZoom(6); options.setMapTypeControl(true); options.setNavigationControl(true); options.setScaleControl(true); final MapWidget mapWidget = new MapWidget(options); mapWidget.setSize("100%", "100%"); final HasMap map = mapWidget.getMap(); // create the markers for (SubmissionUI sub : submissions) { LatLng gpsPoint = getLatLonFromSubmission(latIndex, lonIndex, sub); if (gpsPoint != null) { final Marker marker = new Marker(); marker.setPosition(gpsPoint); marker.setMap(map); // marker needs to be added to the map before calling // InfoWindow.open(marker, ...) final SubmissionUI tmpSub = sub; Event.addListener(marker, "mouseover", new MouseEventCallback() { @Override public void callback(HasMouseEvent event) { if (infoWindow != null) { infoWindow.close(); } infoWindow = new InfoWindow(); InfoContentSubmission w = createInfoWindowWidget(tmpSub); HTMLPanel container = new HTMLPanel("<div></div>"); container.add(w); infoWindow.setContent(container.getElement().getInnerHTML()); infoWindow.open(map, marker); } }); Event.addListener(marker, "mouseout", new MouseEventCallback() { @Override public void callback(HasMouseEvent event) { if (!mapMarkerClicked) { if (infoWindow != null) { infoWindow.close(); infoWindow = null; } } mapMarkerClicked = false; } }); Event.addListener(marker, "click", new MouseEventCallback() { @Override public void callback(HasMouseEvent event) { mapMarkerClicked = true; } }); } } return mapWidget; }