Search in sources :

Example 1 with MapLayer

use of org.activityinfo.legacy.shared.reports.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 : PointMapLayer(org.activityinfo.legacy.shared.reports.model.layers.PointMapLayer) MapLayer(org.activityinfo.legacy.shared.reports.model.layers.MapLayer) ArrayList(java.util.ArrayList)

Example 2 with MapLayer

use of org.activityinfo.legacy.shared.reports.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.legacy.shared.reports.model.layers.PolygonMapLayer) PolygonMapLayer(org.activityinfo.legacy.shared.reports.model.layers.PolygonMapLayer) MapLayer(org.activityinfo.legacy.shared.reports.model.layers.MapLayer)

Example 3 with MapLayer

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

the class MapEditor method createLayersOptionsPanel.

protected void createLayersOptionsPanel() {
    optionsPanel = new LayerOptionsPanel(dispatcher);
    optionsPanel.setVisible(false);
    optionsPanel.addListener(Events.Hide, new Listener<BaseEvent>() {

        @Override
        public void handleEvent(BaseEvent be) {
            mapPanel.setZoomControlOffsetX(ZOOM_CONTROL_LEFT_MARGIN);
        }
    });
    optionsPanel.addListener(Events.Show, new Listener<BaseEvent>() {

        @Override
        public void handleEvent(BaseEvent be) {
            mapPanel.setZoomControlOffsetX(LayerOptionsPanel.WIDTH + ZOOM_CONTROL_LEFT_MARGIN);
        }
    });
    optionsPanel.addValueChangeHandler(new ValueChangeHandler<MapLayer>() {

        @Override
        public void onValueChange(ValueChangeEvent<MapLayer> event) {
            MapEditor.this.mapReportElement.setFilter(event.getValue().getFilter());
            reportEventBus.fireChange();
        }
    });
    add(optionsPanel, new AbsoluteData(0, CONTROL_TOP_MARGIN));
}
Also used : MapLayer(org.activityinfo.legacy.shared.reports.model.layers.MapLayer) BaseEvent(com.extjs.gxt.ui.client.event.BaseEvent) AbsoluteData(com.extjs.gxt.ui.client.widget.layout.AbsoluteData) LayerOptionsPanel(org.activityinfo.ui.client.component.report.editor.map.layerOptions.LayerOptionsPanel)

Aggregations

MapLayer (org.activityinfo.legacy.shared.reports.model.layers.MapLayer)3 BaseEvent (com.extjs.gxt.ui.client.event.BaseEvent)1 AbsoluteData (com.extjs.gxt.ui.client.widget.layout.AbsoluteData)1 ArrayList (java.util.ArrayList)1 PointMapLayer (org.activityinfo.legacy.shared.reports.model.layers.PointMapLayer)1 PolygonMapLayer (org.activityinfo.legacy.shared.reports.model.layers.PolygonMapLayer)1 LayerOptionsPanel (org.activityinfo.ui.client.component.report.editor.map.layerOptions.LayerOptionsPanel)1