List of usage examples for com.google.gwt.maps.client.overlays MarkerOptions setPosition
public final native void setPosition(LatLng position) ;
From source file:com.arcbees.website.client.application.contact.ContactView.java
License:Apache License
private void onMapsLoaded() { // -- HOW TO STYLE A GOOGLE MAP // -> First, we create the style. To help : http://software.stadtwerk.org/google_maps_colorizr/ MapTypeStyle style1 = MapTypeStyle.newInstance(); style1.setElementType(MapTypeStyleElementType.GEOMETRY); style1.setFeatureType(MapTypeStyleFeatureType.ROAD); style1.setStylers(new MapTypeStyler[] { MapTypeStyler.newHueStyler("#FFF"), MapTypeStyler.newSaturationStyler(-100), MapTypeStyler.newLightnessStyler(100) }); MapTypeStyle style2 = MapTypeStyle.newInstance(); style2.setElementType(MapTypeStyleElementType.ALL); style2.setFeatureType(MapTypeStyleFeatureType.LANDSCAPE); style2.setStylers(new MapTypeStyler[] { MapTypeStyler.newHueStyler("#cccccc"), MapTypeStyler.newSaturationStyler(-100), MapTypeStyler.newLightnessStyler(-10) }); MapTypeStyle style3 = MapTypeStyle.newInstance(); style3.setElementType(MapTypeStyleElementType.ALL); style3.setFeatureType(MapTypeStyleFeatureType.POI); style3.setStylers(new MapTypeStyler[] { MapTypeStyler.newHueStyler("#f00"), MapTypeStyler.newSaturationStyler(-100), MapTypeStyler.newLightnessStyler(9), }); MapTypeStyle style4 = MapTypeStyle.newInstance(); style4.setElementType(MapTypeStyleElementType.ALL); style4.setFeatureType(MapTypeStyleFeatureType.WATER); style4.setStylers(new MapTypeStyler[] { MapTypeStyler.newHueStyler("#1c1c1c"), MapTypeStyler.newSaturationStyler(-100), MapTypeStyler.newLightnessStyler(86), }); MapTypeStyle[] array = { style1, style2, style3, style4 }; JsArray<MapTypeStyle> styles = ArrayHelper.toJsArray(array); // -> Then we tell the map to use our new style by default MapTypeControlOptions controlOptions = MapTypeControlOptions.newInstance(); controlOptions.setMapTypeIds(new String[] {}); controlOptions.setPosition(ControlPosition.TOP_RIGHT); // -> And tell the map what our custom style is StyledMapTypeOptions styledMapTypeOptions = StyledMapTypeOptions.newInstance(); styledMapTypeOptions.setName("Arcbees"); StyledMapType customMapType = StyledMapType.newInstance(styles, styledMapTypeOptions); // -> Then we define our Lat and Long LatLng arcbeesCoord = LatLng.newInstance(46.792097, -71.285362); // -> Then goes the map options MapOptions options = MapOptions.newInstance(); options.setCenter(arcbeesCoord);/*from w w w . j a v a 2s. c o m*/ options.setZoom(16); options.setScrollWheel(false); options.setMapTypeControlOptions(controlOptions); options.setMapTypeId(ARCBEES_MAPTYPE); options.setPanControl(false); options.setDraggable(Window.getClientWidth() > 649); ZoomControlOptions zoomControlOptions = ZoomControlOptions.newInstance(); zoomControlOptions.setPosition(ControlPosition.RIGHT_CENTER); options.setZoomControlOptions(zoomControlOptions); // -> We create the map with our options MapWidget mapWidget = new MapWidget(options); mapWidget.addStyleName(page.style().map()); mapWidget.setCustomMapType(ARCBEES_MAPTYPE, customMapType); // -> We define the marker MarkerOptions markerOptions = MarkerOptions.newInstance(); markerOptions.setIcon(pageContactResources.marker().getSafeUri().asString()); markerOptions.setMap(mapWidget); markerOptions.setPosition(arcbeesCoord); Marker.newInstance(markerOptions); // -> And finally, add it to its container container.add(mapWidget); }
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); options.setTitle("Hello World"); markerBasic = Marker.newInstance(options); markerBasic.setMap(mapWidget);/*from w w w. ja va 2 s. c om*/ 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); options.setTitle("Hi I'm marker 2. Thanks for clicking on me."); options.setAnimation(Animation.BOUNCE); markerBouncing = Marker.newInstance(options); markerBouncing.setMap(mapWidget);/*from w w w .j av a2 s.com*/ }
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); options.setTitle("Thanks for clicking on me."); options.setAnimation(Animation.DROP); markerDrop = Marker.newInstance(options); markerDrop.setMap(mapWidget);/*from w w w .j a va 2 s. c o m*/ }
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); options.setTitle("Hello World"); final Marker marker = Marker.newInstance(options); marker.setMap(mapWidget);// w w w .j a v a2 s . c o m 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;//ww w . j a v a2 s . c o 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.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); options.setTitle(person.getDisplayName()); final Marker marker = Marker.newInstance(options); marker.setMap(mapWidget);/*from w ww .j a v a2 s . co m*/ 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:gov.wa.wsdot.mobile.client.activities.ferries.vesselwatch.VesselWatchMapViewGwtImpl.java
License:Open Source License
@Override public void addMapMarker(Position position) { if (myLocationMarker != null) { myLocationMarker.setMap((MapWidget) null); }// w w w.jav a 2 s . c o m if (myLocationError != null) { myLocationError.setMap(null); } LatLng center = LatLng.newInstance(position.getCoordinates().getLatitude(), position.getCoordinates().getLongitude()); MarkerOptions options = MarkerOptions.newInstance(); options.setPosition(center); MarkerImage icon = MarkerImage.newInstance(AppBundle.INSTANCE.myLocationPNG().getSafeUri().asString()); icon.setAnchor(Point.newInstance(11, 11)); options.setOptimized(true); options.setIcon(icon); myLocationMarker = Marker.newInstance(options); myLocationMarker.setMap(mapWidget); // create a circle the size of the error CircleOptions circleOptions = CircleOptions.newInstance(); circleOptions.setFillOpacity(0.1); circleOptions.setFillColor("#1a75ff"); circleOptions.setStrokeOpacity(0.12); circleOptions.setStrokeWeight(1); circleOptions.setStrokeColor("#1a75ff"); myLocationError = Circle.newInstance(circleOptions); myLocationError.setCenter(center); myLocationError.setRadius(position.getCoordinates().getAccuracy()); myLocationError.setMap(mapWidget); }
From source file:gov.wa.wsdot.mobile.client.activities.ferries.vesselwatch.VesselWatchMapViewGwtImpl.java
License:Open Source License
@Override public void drawCameras(final List<CameraItem> cameras) { deleteCameras();//from ww w . j ava2 s .co m for (final CameraItem camera : cameras) { final LatLng loc = LatLng.newInstance(camera.getLatitude(), camera.getLongitude()); MarkerOptions options = MarkerOptions.newInstance(); options.setPosition(loc); MarkerImage icon; if (camera.getHasVideo() == 1) { icon = MarkerImage.newInstance(AppBundle.INSTANCE.cameraVideoPNG().getSafeUri().asString()); } else { icon = MarkerImage.newInstance(AppBundle.INSTANCE.cameraPNG().getSafeUri().asString()); } options.setIcon(icon); cameraMarker = Marker.newInstance(options); cameraMarker.addClickHandler(new ClickMapHandler() { @Override public void onEvent(ClickMapEvent event) { presenter.onCameraSelected(camera.getCameraId()); } }); cameraMarkers.add(cameraMarker); } if (Boolean.valueOf(localStorage.getItem("KEY_SHOW_CAMERAS"))) { showCameras(); } }
From source file:gov.wa.wsdot.mobile.client.activities.ferries.vesselwatch.VesselWatchMapViewGwtImpl.java
License:Open Source License
@Override public void drawFerries(List<VesselWatchItem> vessels) { deleteFerries();/* w w w . j a v a 2s .com*/ for (final VesselWatchItem vessel : vessels) { final LatLng loc = LatLng.newInstance(vessel.getLat(), vessel.getLon()); MarkerOptions options = MarkerOptions.newInstance(); options.setPosition(loc); MarkerImage icon = MarkerImage.newInstance(vessel.getIcon()); options.setIcon(icon); MarkerImage shadow = MarkerImage.newInstance(vessel.getIconShadow()); options.setShadow(shadow); vesselMarker = Marker.newInstance(options); vesselMarker.addClickHandler(new ClickMapHandler() { @Override public void onEvent(ClickMapEvent event) { presenter.onFerrySelected(vessel); } }); vesselMarkers.add(vesselMarker); } showFerries(); }