use of org.discotools.gwt.leaflet.client.marker.MarkerOptions in project activityinfo by bedatadriven.
the class LeafletMarkerFactory method createPieMapMarker.
public static Marker createPieMapMarker(PieMapMarker marker) {
StringBuilder sb = new StringBuilder();
sb.append("/icon?t=piechart&r=").append(marker.getRadius());
for (SliceValue slice : marker.getSlices()) {
sb.append("&value=").append(slice.getValue());
sb.append("&color=").append(slice.getColor());
}
String iconUrl = sb.toString();
int size = marker.getRadius() * 2;
IconOptions iconOptions = new IconOptions();
iconOptions.setIconUrl(iconUrl);
iconOptions.setIconAnchor(new Point(marker.getRadius(), marker.getRadius()));
iconOptions.setIconSize(new Point(size, size));
Options markerOptions = new MarkerOptions();
markerOptions.setProperty("icon", new Icon(iconOptions));
setModel(markerOptions.getJSObject(), marker);
return new Marker(toLatLng(marker), markerOptions);
}
use of org.discotools.gwt.leaflet.client.marker.MarkerOptions in project activityinfo by bedatadriven.
the class LeafletMarkerFactory method createIconMapMarker.
/**
* Creates a Leaflet marker based on an ActivityInfo MapIcon
*/
public static Marker createIconMapMarker(IconMapMarker model) {
MapIcon iconModel = model.getIcon();
String iconUrl = "mapicons/" + iconModel.getName() + ".png";
IconOptions iconOptions = new IconOptions();
iconOptions.setIconUrl(iconUrl);
iconOptions.setIconAnchor(new Point(iconModel.getAnchorX(), iconModel.getAnchorY()));
iconOptions.setIconSize(new Point(iconModel.getWidth(), iconModel.getHeight()));
Options markerOptions = new MarkerOptions();
markerOptions.setProperty("icon", new Icon(iconOptions));
setModel(markerOptions.getJSObject(), model);
return new Marker(toLatLng(model), markerOptions);
}
Aggregations