Search in sources :

Example 1 with MapView

use of org.openlca.app.components.mapview.MapView in project olca-app by GreenDelta.

the class ResultMap method on.

static ResultMap on(Composite body, FormToolkit tk) {
    Section section = UI.section(body, tk, M.Map);
    UI.gridData(section, true, true);
    Composite comp = UI.sectionClient(section, tk);
    comp.setLayout(new FillLayout());
    UI.gridData(comp, true, true);
    ResultMap m = new ResultMap();
    m.map = new MapView(comp);
    m.map.addBaseLayers();
    Actions.bind(section, Actions.create(M.Export, Icon.EXPORT.descriptor(), m::export));
    return m;
}
Also used : Composite(org.eclipse.swt.widgets.Composite) MapView(org.openlca.app.components.mapview.MapView) FillLayout(org.eclipse.swt.layout.FillLayout) Section(org.eclipse.ui.forms.widgets.Section)

Example 2 with MapView

use of org.openlca.app.components.mapview.MapView in project olca-app by GreenDelta.

the class MapSection method render.

void render(Composite body, FormToolkit tk) {
    var section = UI.section(body, tk, "Geographic data");
    UI.gridData(section, true, true).minimumHeight = 250;
    var comp = UI.sectionClient(section, tk);
    comp.setLayout(new FillLayout());
    UI.gridData(comp, true, true);
    // render the initial feature
    map = new MapView(comp);
    map.addBaseLayers();
    feature = GeoJSON.unpack(location().geodata);
    if (feature != null) {
        updateMap();
    }
    // bind actions
    if (!editor.isEditable())
        return;
    var edit = Actions.onEdit(() -> {
        new GeoJSONDialog().open();
    });
    Actions.bind(section, edit);
}
Also used : MapView(org.openlca.app.components.mapview.MapView) FillLayout(org.eclipse.swt.layout.FillLayout)

Aggregations

FillLayout (org.eclipse.swt.layout.FillLayout)2 MapView (org.openlca.app.components.mapview.MapView)2 Composite (org.eclipse.swt.widgets.Composite)1 Section (org.eclipse.ui.forms.widgets.Section)1