Search in sources :

Example 6 with MapLayer

use of org.activityinfo.shared.report.model.layers.MapLayer in project activityinfo by bedatadriven.

the class LayersWidget method updateStore.

private void updateStore() {
    // Save the selecteditem, because removing all items from the store
    // triggers
    // a selecteditem change
    int selectedItemIndex = store.indexOf(view.getSelectionModel().getSelectedItem());
    store.removeAll();
    if (mapElement != null) {
        for (MapLayer layer : mapElement.getLayers()) {
            LayerModel model = new LayerModel();
            model.setName(layer.getName());
            model.setVisible(layer.isVisible());
            model.setMapLayer(layer);
            model.setLayerType(layer.getTypeName());
            store.add(model);
        }
    }
    // Place selection back at original selection
    if ((selectedItemIndex != -1) && (selectedItemIndex < store.getCount())) {
        List<LayerModel> selectedItem = new ArrayList<LayerModel>();
        selectedItem.add(store.getAt(selectedItemIndex));
        view.getSelectionModel().setSelection(selectedItem);
    }
}
Also used : MapLayer(org.activityinfo.shared.report.model.layers.MapLayer) PointMapLayer(org.activityinfo.shared.report.model.layers.PointMapLayer) ArrayList(java.util.ArrayList)

Example 7 with MapLayer

use of org.activityinfo.shared.report.model.layers.MapLayer in project activityinfo by bedatadriven.

the class NewLayerWizard method createLayer.

public MapLayer createLayer() {
    MapLayer layer = layerTypePage.newLayer();
    layer.setName(composeName());
    for (Integer indicatorId : indicatorPage.getSelectedIds()) {
        layer.addIndicatorId(indicatorId);
    }
    if (layer instanceof PolygonMapLayer) {
        ((PolygonMapLayer) layer).setAdminLevelId(adminLevelPage.getSelectedLevelId());
    }
    return layer;
}
Also used : PolygonMapLayer(org.activityinfo.shared.report.model.layers.PolygonMapLayer) MapLayer(org.activityinfo.shared.report.model.layers.MapLayer) PolygonMapLayer(org.activityinfo.shared.report.model.layers.PolygonMapLayer)

Aggregations

MapLayer (org.activityinfo.shared.report.model.layers.MapLayer)7 BubbleMapLayer (org.activityinfo.shared.report.model.layers.BubbleMapLayer)4 IconMapLayer (org.activityinfo.shared.report.model.layers.IconMapLayer)4 PiechartMapLayer (org.activityinfo.shared.report.model.layers.PiechartMapLayer)4 ArrayList (java.util.ArrayList)3 PolygonMapLayer (org.activityinfo.shared.report.model.layers.PolygonMapLayer)3 JsonArray (com.google.gson.JsonArray)2 JsonObject (com.google.gson.JsonObject)2 Indicator (org.activityinfo.server.database.hibernate.entity.Indicator)2 BaseEvent (com.extjs.gxt.ui.client.event.BaseEvent)1 AbsoluteData (com.extjs.gxt.ui.client.widget.layout.AbsoluteData)1 JsonElement (com.google.gson.JsonElement)1 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1 LayerOptionsPanel (org.activityinfo.client.report.editor.map.layerOptions.LayerOptionsPanel)1 BubbleLayerGenerator (org.activityinfo.server.report.generator.map.BubbleLayerGenerator)1 IconLayerGenerator (org.activityinfo.server.report.generator.map.IconLayerGenerator)1 LayerGenerator (org.activityinfo.server.report.generator.map.LayerGenerator)1 Margins (org.activityinfo.server.report.generator.map.Margins)1 PiechartLayerGenerator (org.activityinfo.server.report.generator.map.PiechartLayerGenerator)1