use of org.opennms.features.vaadin.nodemaps.internal.gwt.client.event.IconCreateCallback in project opennms by OpenNMS.
the class NodeMapWidget method addMarkerLayer.
private void addMarkerLayer() {
LOG.info("NodeMapWidget.addMarkerLayer()");
if (m_markerClusterGroup != null) {
m_map.removeLayer(m_markerClusterGroup);
}
final Options markerClusterOptions = new Options();
markerClusterOptions.setProperty("zoomToBoundsOnClick", false);
markerClusterOptions.setProperty("iconCreateFunction", new IconCreateCallback());
// markerClusterOptions.setProperty("disableClusteringAtZoom", 13);
m_markerClusterGroup = new MarkerClusterGroup(markerClusterOptions);
final NodeMarkerClusterCallback callback = new NodeMarkerClusterCallback();
m_markerClusterGroup.on("clusterclick", callback);
m_markerClusterGroup.on("clustertouchend", callback);
m_map.addLayer(m_markerClusterGroup);
m_stateClusterGroups = new MarkerClusterGroup[52];
LOG.info("Creating marker cluster with maximum cluster radius " + m_maxClusterRadius);
final Options[] stateClusterOptions = new Options[m_stateClusterGroups.length];
for (int i = 0; i < m_stateClusterGroups.length; i++) {
// stateClusterOptions[i] = new Options();
stateClusterOptions[i] = markerClusterOptions;
stateClusterOptions[i].setProperty("maxClusterRadius", m_maxClusterRadius > 0 ? m_maxClusterRadius : 350);
stateClusterOptions[i].setProperty("inUs", true);
stateClusterOptions[i].setProperty("stateID", i);
stateClusterOptions[i].setProperty("stateData", StatesData.getPolygonInfo(i, StatesData.getInstance()));
// stateClusterOptions[i].setProperty("zoomToBoundsOnClick", false);
// stateClusterOptions[i].setProperty("iconCreateFunction", new IconCreateCallback());
m_stateClusterGroups[i] = new MarkerClusterGroup(stateClusterOptions[i]);
m_stateClusterGroups[i].on("clusterclick", callback);
m_stateClusterGroups[i].on("clustertouchend", callback);
m_map.addLayer(m_stateClusterGroups[i]);
}
}
Aggregations