List of usage examples for com.google.gwt.maps.client.geom Size newInstance
public static native Size newInstance(int width, int height) ;
From source file:org.onebusaway.webapp.gwt.oba_application.view.ActiveResultPresenter.java
License:Apache License
private Icon getStar15Marker() { OneBusAwayStandardResources resources = OneBusAwayStandardResources.INSTANCE; ImageResource r = resources.getStar15(); Icon icon = Icon.newInstance(r.getURL()); icon.setIconSize(Size.newInstance(15, 14)); icon.setIconAnchor(Point.newInstance(8, 7)); return icon;//from ww w. ja va 2s. c o m }
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 ww w . ja va 2 s .c o m opts.setIcon(icon); LatLng point = LatLng.newInstance(entry.getLat(), entry.getLon()); return new Marker(point, opts); }
From source file:org.onebusaway.webapp.gwt.oba_application.view.SearchOriginMapPresenter.java
License:Apache License
public void handleUpdate(StateEvent event) { State state = event.getState(); if (state instanceof SearchLocationUpdatedState) { if (_marker != null) { _mapOverlayManager.removeOverlay(_marker); _marker = null;// w w w. j a v a 2 s . c o m } LatLng location = _queryModel.getLocation(); if (location == null) { System.err.println("PROBLEM!"); return; } MapResources resources = MapResources.INSTANCE; DataResource resource = resources.getImageRouteStart(); Icon icon = Icon.newInstance(); icon.setImageURL(resource.getUrl()); icon.setIconSize(Size.newInstance(20, 34)); icon.setIconAnchor(Point.newInstance(10, 34)); MarkerOptions opts = MarkerOptions.newInstance(icon); _marker = new Marker(location, opts); _mapOverlayManager.addOverlay(_marker); } }
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 www.ja v a2s .c o 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
protected void buildUi() { LatLng AthensCity = LatLng.newInstance(37.58, 23.43); map = new MapWidget(AthensCity, 2); map.setSize("100%", "100%"); // Add some controls for the zoom level map.addControl(new LargeMapControl()); map.setScrollWheelZoomEnabled(true); // // Add a marker // map.addOverlay(new Marker(AthensCity)); mainPanel.add(map);//from w w w .j a v a 2s. c o m // Create a base icon for all of our markers that specifies the // shadow, icon dimensions, etc. baseIcon = Icon.newInstance(); baseIcon.setShadowURL("http://google-maps-icons.googlecode.com/files/shadow.png"); baseIcon.setIconSize(Size.newInstance(20, 34)); baseIcon.setShadowSize(Size.newInstance(37, 34)); baseIcon.setIconAnchor(Point.newInstance(9, 34)); baseIcon.setInfoWindowAnchor(Point.newInstance(9, 2)); }
From source file:org.sigmah.client.map.GcIconFactory.java
License:Open Source License
/** * Creates an icon based on the specified options * Supported options are: width, height, primaryColor, * strokeColor, and cornerColor.// w w w . ja va 2 s . co m * * @return Icon for GoogleMaps */ public Icon createMarkerIcon() { String baseUrl = "http://chart.apis.google.com/chart?cht=mm"; String iconUrl = baseUrl + "&chs=" + width + "x" + height + "&chco=" + cornerColor.replace("#", "") + "," + primaryColor.replace("#", "") + "," + strokeColor.replace("#", "") + "&ext=.png"; Icon icon = Icon.newInstance(iconUrl); icon.setIconSize(Size.newInstance(width, height)); icon.setShadowSize(Size.newInstance((int) Math.floor(width * 1.6), height)); icon.setIconAnchor(Point.newInstance(width / 2, height)); icon.setInfoWindowAnchor(Point.newInstance(width / 2, (int) Math.floor(height / 12))); icon.setPrintImageURL(iconUrl + "&chof=gif"); icon.setMozPrintImageURL(iconUrl + "&chf=bg,s,ECECD8" + "&chof=gif"); iconUrl = baseUrl + "&chs=" + width + "x" + height + "&chco=" + cornerColor.replace("#", "") + "," + primaryColor.replace("#", "") + "," + strokeColor.replace("#", ""); icon.setTransparentImageURL(iconUrl + "&chf=a,s,ffffff11&ext=.png"); icon.setImageMap(new int[] { width / 2, height, (int) ((7d / 16d) * width), (int) ((5d / 8d) * height), (int) ((5d / 16d) * width), (int) ((7d / 16d) * height), (int) ((7d / 32d) * width), (int) ((5d / 16d) * height), (int) ((5d / 16d) * width), (int) ((1d / 8d) * height), (int) ((1d / 2d) * width), 0, (int) ((11d / 16d) * width), (int) ((1d / 8d) * height), (int) ((25d / 32d) * width), (int) ((5d / 16d) * height), (int) ((11d / 16d) * width), (int) ((7d / 16d) * height), (int) ((9d / 16d) * width), (int) ((5d / 8d) * height) }); return icon; }
From source file:org.sigmah.client.map.GcIconFactory.java
License:Open Source License
/** * Creates a flat icon based on the specified options * Supported options are: width, height, primaryColor, * shadowColor, label, labelColor, labelSize, and shape.. * * @return Icon object for use in GoogleMaps *///w ww . j a v a 2 s. co m public Icon createFlatIcon() { String shapeCode = ("circle".equals(shape)) ? "it" : "itr"; String baseUrl = "http://chart.apis.google.com/chart?cht=" + shapeCode; String iconUrl = baseUrl + "&chs=" + width + "x" + height + "&chco=" + primaryColor.replace("#", "") + "," + shadowColor.replace("#", "") + "ff,ffffff01" + "&chl=" + label + "&chx=" + labelColor.replace("#", "") + "," + labelSize; Icon icon = Icon.newInstance(Icon.DEFAULT_ICON); icon.setImageURL(iconUrl + "&chf=bg,s,00000000" + "&ext=.png"); icon.setIconSize(Size.newInstance(width, height)); icon.setShadowSize(Size.newInstance(0, 0)); icon.setIconAnchor(Point.newInstance(width / 2, height / 2)); icon.setInfoWindowAnchor(Point.newInstance(width / 2, height / 2)); icon.setPrintImageURL(iconUrl + "&chof=gif"); icon.setMozPrintImageURL(iconUrl + "&chf=bg,s,ECECD8" + "&chof=gif"); icon.setTransparentImageURL(iconUrl + "&chf=a,s,ffffff01&ext=.png"); if (shapeCode.equals("itr")) { icon.setImageMap(new int[] { 0, 0, width, 0, width, height, 0, height }); } else { icon.setImageMap(createCircleImageMap(width, height, 8)); } return icon; }
From source file:org.sigmah.client.map.IconFactory.java
License:Open Source License
/** * Creates a Google Maps icon based on an ActivityInfo MapIcon * * @author Alex Bertram/*from w w w. j a v a 2 s .c o m*/ */ public static Icon createIconMapMarker(IconMapMarker marker) { MapIcon mapIcon = marker.getIcon(); String iconUrl = "mapicons/" + mapIcon.getName() + ".png"; Icon icon = Icon.newInstance(Icon.DEFAULT_ICON); icon.setImageURL(iconUrl); icon.setIconSize(Size.newInstance(mapIcon.getWidth(), mapIcon.getHeight())); icon.setShadowSize(Size.newInstance(0, 0)); Point anchor = Point.newInstance(mapIcon.getAnchorX(), mapIcon.getAnchorY()); icon.setIconAnchor(anchor); icon.setInfoWindowAnchor(anchor); icon.setPrintImageURL(iconUrl + "&chof=gif"); icon.setMozPrintImageURL(iconUrl); return icon; }
From source file:org.sigmah.client.map.IconFactory.java
License:Open Source License
public static Icon createBubbleMapMarker(BubbleMapMarker marker) { StringBuilder sb = new StringBuilder(); sb.append("icon?t=bubble&r=").append(marker.getRadius()).append("&c=").append(marker.getColor()); String iconUrl = sb.toString(); int size = marker.getRadius() * 2; Icon icon = Icon.newInstance(Icon.DEFAULT_ICON); icon.setImageURL(iconUrl);/* www . j a va 2 s .c o m*/ icon.setIconSize(Size.newInstance(size, size)); icon.setShadowSize(Size.newInstance(0, 0)); Point anchor = Point.newInstance(marker.getRadius(), marker.getRadius()); icon.setIconAnchor(anchor); icon.setInfoWindowAnchor(anchor); icon.setPrintImageURL(iconUrl); icon.setMozPrintImageURL(iconUrl); return icon; }
From source file:org.sigmah.client.ui.widget.map.GoogleWorldMap.java
License:Open Source License
@Override protected Marker createNativePin(Pin pin) { final MarkerOptions options = MarkerOptions.newInstance(); if (pin.getTitle() != null) { options.setTitle(pin.getTitle()); }/* w ww . ja v a2s. c o m*/ options.setDraggable(pin.isDraggable()); if (pin.getImageURL() != null) { final Icon icon = Icon.newInstance(pin.getImageURL()); icon.setIconSize(Size.newInstance(pin.getImageWidth(), pin.getImageHeight())); icon.setIconAnchor(Point.newInstance( // Horizontal center pin.getImageWidth() / 2, // Bottom pin.getImageHeight())); options.setIcon(icon); } return new Marker(LatLng.newInstance(pin.getLatitude(), pin.getLongitude()), options); }