Search in sources :

Example 1 with NodeMarkerClusterCallback

use of org.opennms.features.vaadin.nodemaps.internal.gwt.client.event.NodeMarkerClusterCallback 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]);
    }
}
Also used : MapOptions(org.discotools.gwt.leaflet.client.map.MapOptions) Options(org.discotools.gwt.leaflet.client.Options) ZoomOptions(org.discotools.gwt.leaflet.client.controls.zoom.ZoomOptions) NodeMarkerClusterCallback(org.opennms.features.vaadin.nodemaps.internal.gwt.client.event.NodeMarkerClusterCallback) IconCreateCallback(org.opennms.features.vaadin.nodemaps.internal.gwt.client.event.IconCreateCallback)

Aggregations

Options (org.discotools.gwt.leaflet.client.Options)1 ZoomOptions (org.discotools.gwt.leaflet.client.controls.zoom.ZoomOptions)1 MapOptions (org.discotools.gwt.leaflet.client.map.MapOptions)1 IconCreateCallback (org.opennms.features.vaadin.nodemaps.internal.gwt.client.event.IconCreateCallback)1 NodeMarkerClusterCallback (org.opennms.features.vaadin.nodemaps.internal.gwt.client.event.NodeMarkerClusterCallback)1