List of usage examples for com.google.gwt.maps.client.overlay MarkerOptions newInstance
public static MarkerOptions newInstance()
From source file:com.claudiushauptmann.gwt.maps.gxt.samples.client.OverlayEditor.java
License:Apache License
public void onModuleLoad() { // Map/* w ww. j a v a2 s. c o m*/ mapWidget = new MapWidget(); mapWidget.setCenter(LatLng.newInstance(48.136559, 11.576318), 13); mapWidget.setWidth("100%"); mapWidget.setHeight("100%"); mapWidget.addControl(new LargeMapControl()); mapWidget.setContinuousZoom(true); mapWidget.setScrollWheelZoomEnabled(true); RootPanel.get().add(mapWidget); // MapController mapGxtController = new MapGXTController(mapWidget); mapMenuProvider = new MapMenuProvider(); mapGxtController.setMenuProvider(mapMenuProvider); // Marker MarkerOptions mo = MarkerOptions.newInstance(); mo.setClickable(true); mo.setDraggable(true); Marker marker = new Marker(mapWidget.getCenter(), mo); mapWidget.addOverlay(marker); new MyMarkerEditController(mapGxtController, marker, "Marienplatz", "Marienplatz is a central square in the" + " city center of Munich, Germany since 1158.<br/>" + " In the Middle Ages markets and tournaments were held in this" + " city square. The Glockenspiel in the new city hall was inspired" + " by these tournaments, and draws millions of tourists a year."); // Polyline LatLng[] llline = new LatLng[3]; llline[0] = LatLng.newInstance(48.131955, 11.527061); llline[1] = LatLng.newInstance(48.11809, 11.579247); llline[2] = LatLng.newInstance(48.127143, 11.638298); PolylineOptions plo = PolylineOptions.newInstance(true, false); Polyline line = new Polyline(llline, "#FF0000", 2, 1.0, plo); mapWidget.addOverlay(line); new MyPolylineEditController(mapGxtController, line, "Polyline", "This is a polyline."); // Polygon LatLng[] llpolygon = new LatLng[4]; llpolygon[0] = LatLng.newInstance(48.119809, 11.539936); llpolygon[1] = LatLng.newInstance(48.158185, 11.541138); llpolygon[2] = LatLng.newInstance(48.155894, 11.569118); llpolygon[3] = llpolygon[0]; PolygonOptions pgo = PolygonOptions.newInstance(true); Polygon polygon = new Polygon(llpolygon, "#0000FF", 2, 1.0, "#0000FF", 0.3, pgo); mapWidget.addOverlay(polygon); new MyPolygonEditController(mapGxtController, polygon, "Polygon", "This is a polygon."); }
From source file:com.google.gwt.maps.sample.hellomaps.client.DragMarkerDemo.java
License:Apache License
@Override public void onShow() { map.clearOverlays();//from www . j a v a 2s . c o m MarkerOptions options = MarkerOptions.newInstance(); options.setDraggable(true); final Marker marker = new Marker(map.getCenter(), options); final InfoWindow info = map.getInfoWindow(); marker.addMarkerDragEndHandler(new MarkerDragEndHandler() { public void onDragEnd(MarkerDragEndEvent event) { info.open(marker, new InfoWindowContent("Just bouncing along...")); } }); marker.addMarkerDragStartHandler(new MarkerDragStartHandler() { public void onDragStart(MarkerDragStartEvent event) { info.setVisible(false); } }); map.addOverlay(marker); }
From source file:com.google.gwt.maps.sample.hellomaps.client.IconClassDemo.java
License:Apache License
/** * Creates a marker whose info window displays the letter corresponding to the * given index./*from w w w.ja v a 2 s .c om*/ */ private Marker createMarker(LatLng point, int index) { // Create a lettered icon for this point using our icon class final char letter = (char) ('A' + index); Icon icon = Icon.newInstance(baseIcon); icon.setImageURL("http://www.google.com/mapfiles/marker" + letter + ".png"); MarkerOptions options = MarkerOptions.newInstance(); options.setIcon(icon); final Marker marker = new Marker(point, options); marker.addMarkerClickHandler(new MarkerClickHandler() { public void onClick(MarkerClickEvent event) { InfoWindow info = map.getInfoWindow(); info.open(event.getSender(), new InfoWindowContent("Marker <b>" + letter + "</b>")); } }); return marker; }
From source file:com.google.gwt.maps.sample.hellomaps.client.IconDemo.java
License:Apache License
@Override public void onShow() { map.clearOverlays();/* w w w . j a v a2s . c o m*/ // Create our "tiny" marker icon Icon icon = Icon.newInstance("http://labs.google.com/ridefinder/images/mm_20_red.png"); icon.setShadowURL("http://labs.google.com/ridefinder/images/mm_20_shadow.png"); icon.setIconSize(Size.newInstance(12, 20)); icon.setShadowSize(Size.newInstance(22, 20)); icon.setIconAnchor(Point.newInstance(6, 20)); icon.setInfoWindowAnchor(Point.newInstance(5, 1)); // Add 10 markers to the map at random locations LatLngBounds bounds = map.getBounds(); LatLng southWest = bounds.getSouthWest(); LatLng northEast = bounds.getNorthEast(); double lngSpan = northEast.getLongitude() - southWest.getLongitude(); double latSpan = northEast.getLatitude() - southWest.getLatitude(); MarkerOptions options = MarkerOptions.newInstance(); options.setIcon(icon); for (int i = 0; i < 10; i++) { LatLng point = LatLng.newInstance(southWest.getLatitude() + latSpan * Math.random(), southWest.getLongitude() + lngSpan * Math.random()); map.addOverlay(new Marker(point, options)); } }
From source file:com.google.gwt.maps.sample.hellomaps.client.MapEventDemo.java
License:Apache License
public MapEventDemo() { VerticalPanel vp = new VerticalPanel(); // Center the new map on Midtown Atlanta map = new MapWidget(ATLANTA, 13); map.setSize("500px", "300px"); map.addControl(new SmallMapControl()); map.addControl(new MapTypeControl()); MarkerOptions opt = MarkerOptions.newInstance(); opt.setDraggable(true);//from ww w. j a v a 2s .co m marker = new Marker(ATLANTA, opt); Panel hp1 = createActionButtons(); HorizontalPanel hp2 = createListenerListBox(); // Make a spacer HorizontalPanel hp3 = new HorizontalPanel(); hp3.add(new Label(" ")); hp3.setSize("1em", "1em"); handlerTable = new FlexTable(); clearListenerTable(); vp.add(map); vp.add(hp1); vp.add(hp2); vp.add(hp3); vp.add(handlerTable); initWidget(vp); }
From source file:org.maps.client.TRIFacilitiesLayer.java
License:Apache License
@Override protected void refreshMarkers(LatLngBounds bounds, final IRefreshMarkersCallback callback) { if (getMap().getZoomLevel() < getStartZoomLevel()) { List<Marker> newMarkers = new ArrayList<Marker>(); callback.onRefresh(newMarkers);// ww w .j ava 2 s.com return; } setCurrentZoomLevel(getMap().getZoomLevel()); AsyncCallback<List<ITRIFacility>> serviceCallback = new AsyncCallback<List<ITRIFacility>>() { public void onFailure(Throwable caught) { callback.onError(caught); } public void onSuccess(List<ITRIFacility> result) { for (ITRIFacility facility : result) { MarkerOptions options = MarkerOptions.newInstance(); options.setTitle(facility.getFacilityName()); if (facility.getNumberOfFacilities() > 1) { String url = "images/cluster.png"; Icon icon = Icon.newInstance(url); options.setIcon(icon); } options.setDraggable(false); LatLng location = LatLng.newInstance(facility.getLatitude(), facility.getLongitude()); Marker marker = new Marker(location, options); if (facility.getNumberOfFacilities() > 1) { marker.addMarkerClickHandler(getClusterClickHandler()); } else { marker.addMarkerClickHandler(getFacilityClickHandler()); } register(marker, facility); } callback.onRefresh(getMarkers()); } }; double swLat = bounds.getSouthWest().getLatitude(); double swLng = bounds.getSouthWest().getLongitude(); double neLat = bounds.getNorthEast().getLatitude(); double neLng = bounds.getNorthEast().getLongitude(); service.get(swLat, swLng, neLat, neLng, serviceCallback); }
From source file:org.onebusaway.webapp.gwt.oba_application.view.ResultsTablePresenter.java
License:Apache License
private Marker getMarker(int index, LocalSearchResult entry) { ImageResource resource = getMarkerResource(index); Icon icon = Icon.newInstance(resource.getURL()); icon.setIconSize(Size.newInstance(24, 31)); icon.setIconAnchor(Point.newInstance(12, 31)); MarkerOptions opts = MarkerOptions.newInstance(); opts.setClickable(true);//from w w w . j a v a2s. co m opts.setIcon(icon); LatLng point = LatLng.newInstance(entry.getLat(), entry.getLon()); return new Marker(point, opts); }
From source file:org.onebusaway.webapp.gwt.where_library.view.stops.TransitMapManager.java
License:Apache License
private Marker getStopMarker(final StopBean stop, final LatLng p, ESize size) { MarkerOptions opts = MarkerOptions.newInstance(); boolean isSelected = false; Icon icon = StopIconFactory.getStopIcon(stop, size, isSelected); opts.setIcon(icon);//ww w .j a va 2s . c o m return new Marker(p, opts); }
From source file:org.opennms.features.poller.remote.gwt.client.GoogleMapsPanel.java
License:Open Source License
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);/*from w w w.ja v a 2s. co m*/ 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; }
From source file:org.ow2.aspirerdfid.tracking.demo.client.TrackingDemo.java
License:Open Source License
private Marker createMarker(LatLng point, int index, final TagEventSerialObject tobj) { // Create a lettered icon for this point using our icon class Icon icon = Icon.newInstance(baseIcon); if (index <= 9) { final char digit = (char) ('0' + index); icon.setImageURL("http://google-maps-icons.googlecode.com/files/red" + '0' + digit + ".png"); } else {//from w w w .j av a2 s . c om final char firstDigit = (char) ('0' + index / 10); final char lastDigit = (char) ('0' + index % 10); icon.setImageURL("http://google-maps-icons.googlecode.com/files/red" + firstDigit + lastDigit + ".png"); } MarkerOptions options = MarkerOptions.newInstance(); options.setIcon(icon); final Marker marker = new Marker(point, options); marker.addMarkerClickHandler(new MarkerClickHandler() { public void onClick(MarkerClickEvent event) { InfoWindow info = map.getInfoWindow(); info.open(event.getSender(), new InfoWindowContent("Company Name:" + tobj.getName() + "<br />" + "Description:" + tobj.getDescription() + "<br />" + "Address:" + tobj.getAddress() + "<br />" + "Country:" + tobj.getCountry() + "<br />" + "Region:" + tobj.getRegion() + "<br />" + "Email:" + tobj.getEmail() + "<br />" + "Tel:" + tobj.getTel() + "<br />" + "Fax:" + tobj.getFax())); } }); return marker; }