use of org.discotools.gwt.leaflet.client.types.Icon in project opennms by OpenNMS.
the class NodeMapConnector method initializeIcons.
private void initializeIcons() {
if (m_icons == null) {
m_icons = new HashMap<String, Icon>();
for (final String severity : new String[] { "Normal", "Warning", "Minor", "Major", "Critical" }) {
IconOptions options = new IconOptions();
options.setIconSize(new Point(25, 41));
options.setIconAnchor(new Point(12, 41));
options.setPopupAnchor(new Point(1, -34));
options.setShadowUrl(new Point(41, 41));
String basePath = GWT.getModuleBaseForStaticFiles() + "images/";
if (isRetina()) {
options.setIconUrl(basePath + severity + "@2x.png");
} else {
options.setIconUrl(basePath + severity + ".png");
}
Icon icon = new Icon(options);
m_icons.put(severity, icon);
}
}
}
use of org.discotools.gwt.leaflet.client.types.Icon 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.types.Icon 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