blob: 1e25f75a29f556ccad010c04ef35a9c6b97a4ec4 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2018 Agence spatiale canadienne / Canadian Space Agency
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Pierre Allard,
* Regent L'Archeveque - initial API and implementation
*
* SPDX-License-Identifier: EPL-1.0
*
*******************************************************************************/
package org.eclipse.apogy.core.environment.surface.ui.composites;
import org.eclipse.apogy.core.environment.surface.CartesianTriangularMeshMapLayer;
import org.eclipse.apogy.core.environment.surface.Map;
import org.eclipse.apogy.core.environment.surface.MapLayerPresentation;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.forms.widgets.ExpandableComposite;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.ScrolledForm;
import org.eclipse.ui.forms.widgets.Section;
import org.eclipse.ui.forms.widgets.TableWrapData;
import org.eclipse.ui.forms.widgets.TableWrapLayout;
public class DEMsComposite extends Composite {
private Map map;
private final DEMListComposite demListComposite;
private final DEMOverviewComposite demOverviewComposite;
private final DEMDetailsComposite demDetailsComposite;
private final DEMPresentationComposite demPresentationComposite;
private final MapLayerPresentationListComposite mapLayerPresentationListComposite;
private final MapLayerPresentationDetailsComposite mapLayerPresentationDetailsComposite;
private final MapLayerPresentationOverviewComposite mapLayerPresentationOverviewComposite;
private final FormToolkit formToolkit = new FormToolkit(Display.getDefault());
public DEMsComposite(Composite parent, int style) {
super(parent, style);
setLayout(new GridLayout(2, true));
ScrolledForm scrldfrmDEM = this.formToolkit.createScrolledForm(this);
scrldfrmDEM.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
this.formToolkit.paintBordersFor(scrldfrmDEM);
scrldfrmDEM.setText("DEM Layers");
{
TableWrapLayout tableWrapLayout = new TableWrapLayout();
tableWrapLayout.numColumns = 2;
tableWrapLayout.makeColumnsEqualWidth = true;
scrldfrmDEM.getBody().setLayout(tableWrapLayout);
}
Section sctnDemlist = this.formToolkit.createSection(scrldfrmDEM.getBody(),
ExpandableComposite.EXPANDED | ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR);
TableWrapData twd_sctnDemlist = new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP, 3, 1);
twd_sctnDemlist.valign = TableWrapData.FILL;
twd_sctnDemlist.grabVertical = true;
sctnDemlist.setLayoutData(twd_sctnDemlist);
this.formToolkit.paintBordersFor(sctnDemlist);
sctnDemlist.setText("DEMs");
this.demListComposite = new DEMListComposite(sctnDemlist, SWT.NONE) {
@Override
protected void newCartesianTriangularMeshMapLayerSelected(
CartesianTriangularMeshMapLayer cartesianTriangularMeshMapLayer) {
DEMsComposite.this.demOverviewComposite
.setCartesianTriangularMeshMapLayer(cartesianTriangularMeshMapLayer);
DEMsComposite.this.demDetailsComposite
.setCartesianTriangularMeshMapLayer(cartesianTriangularMeshMapLayer);
DEMsComposite.this.demPresentationComposite
.setCartesianTriangularMeshMapLayer(cartesianTriangularMeshMapLayer);
DEMsComposite.this.mapLayerPresentationListComposite
.setCartesianTriangularMeshMapLayer(cartesianTriangularMeshMapLayer);
}
};
this.formToolkit.adapt(this.demListComposite);
this.formToolkit.paintBordersFor(this.demListComposite);
sctnDemlist.setClient(this.demListComposite);
Section sctnDemoverview = this.formToolkit.createSection(scrldfrmDEM.getBody(),
ExpandableComposite.EXPANDED | ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR);
this.formToolkit.paintBordersFor(sctnDemoverview);
sctnDemoverview.setText("DEM Overview");
this.demOverviewComposite = new DEMOverviewComposite(sctnDemoverview, SWT.NONE);
this.formToolkit.adapt(this.demOverviewComposite);
this.formToolkit.paintBordersFor(this.demOverviewComposite);
sctnDemoverview.setClient(this.demOverviewComposite);
Section sctnDemdetails = this.formToolkit.createSection(scrldfrmDEM.getBody(),
ExpandableComposite.EXPANDED | ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR);
this.formToolkit.paintBordersFor(sctnDemdetails);
sctnDemdetails.setText("DEM Details");
this.demDetailsComposite = new DEMDetailsComposite(sctnDemdetails, SWT.NONE);
this.formToolkit.adapt(this.demDetailsComposite);
this.formToolkit.paintBordersFor(this.demDetailsComposite);
sctnDemdetails.setClient(this.demDetailsComposite);
Section sctnDemPresentation = this.formToolkit.createSection(scrldfrmDEM.getBody(),
ExpandableComposite.EXPANDED | ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR);
this.formToolkit.paintBordersFor(sctnDemPresentation);
sctnDemPresentation.setText("DEM Presentation");
this.demPresentationComposite = new DEMPresentationComposite(sctnDemPresentation, SWT.NONE);
this.formToolkit.adapt(this.demPresentationComposite);
this.formToolkit.paintBordersFor(this.demPresentationComposite);
sctnDemPresentation.setClient(this.demPresentationComposite);
/////////////// Layers
ScrolledForm scrldfrmLayers = this.formToolkit.createScrolledForm(this);
scrldfrmLayers.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, true, true, 1, 1));
this.formToolkit.paintBordersFor(scrldfrmLayers);
scrldfrmLayers.setText("Layer Presentations");
{
TableWrapLayout tableWrapLayout = new TableWrapLayout();
tableWrapLayout.numColumns = 2;
tableWrapLayout.makeColumnsEqualWidth = true;
scrldfrmLayers.getBody().setLayout(tableWrapLayout);
}
Section sctnMapLayersList = this.formToolkit.createSection(scrldfrmLayers.getBody(),
ExpandableComposite.EXPANDED | ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR);
TableWrapData twd_sctnMapLayersList = new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP, 2, 1);
twd_sctnMapLayersList.valign = TableWrapData.FILL;
twd_sctnMapLayersList.grabVertical = true;
sctnMapLayersList.setLayoutData(twd_sctnMapLayersList);
this.formToolkit.paintBordersFor(sctnMapLayersList);
sctnMapLayersList.setText("Layers");
this.mapLayerPresentationListComposite = new MapLayerPresentationListComposite(sctnMapLayersList, SWT.NONE) {
@Override
protected void newMapLayerPresentationSelected(MapLayerPresentation newMapLayerPresentation) {
DEMsComposite.this.mapLayerPresentationDetailsComposite
.setMapLayerPresentation(newMapLayerPresentation);
DEMsComposite.this.mapLayerPresentationOverviewComposite
.setMapLayerPresentation(newMapLayerPresentation);
}
};
this.formToolkit.adapt(this.mapLayerPresentationListComposite);
this.formToolkit.paintBordersFor(this.mapLayerPresentationListComposite);
sctnMapLayersList.setClient(this.mapLayerPresentationListComposite);
Section sctnLayerOverview = this.formToolkit.createSection(scrldfrmLayers.getBody(),
ExpandableComposite.EXPANDED | ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR);
this.formToolkit.paintBordersFor(sctnLayerOverview);
sctnLayerOverview.setText("Layer Overview");
this.mapLayerPresentationOverviewComposite = new MapLayerPresentationOverviewComposite(sctnLayerOverview,
SWT.NONE);
this.formToolkit.adapt(this.mapLayerPresentationOverviewComposite);
this.formToolkit.paintBordersFor(this.mapLayerPresentationOverviewComposite);
sctnLayerOverview.setClient(this.mapLayerPresentationOverviewComposite);
Section sctnLayerDetails = this.formToolkit.createSection(scrldfrmLayers.getBody(),
ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR);
TableWrapData twd_sctnNewSection_1 = new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP, 1, 1);
twd_sctnNewSection_1.align = TableWrapData.FILL;
sctnLayerDetails.setLayoutData(twd_sctnNewSection_1);
this.formToolkit.paintBordersFor(sctnLayerDetails);
sctnLayerDetails.setText("Layer Details");
this.mapLayerPresentationDetailsComposite = new MapLayerPresentationDetailsComposite(sctnLayerDetails,
SWT.NONE);
this.formToolkit.adapt(this.mapLayerPresentationDetailsComposite);
this.formToolkit.paintBordersFor(this.mapLayerPresentationDetailsComposite);
sctnLayerDetails.setClient(this.mapLayerPresentationDetailsComposite);
}
public Map getMap() {
return this.map;
}
public void setMap(Map newMap) {
this.map = newMap;
this.demListComposite.setMap(newMap);
this.demDetailsComposite.setCartesianTriangularMeshMapLayer(null);
this.demPresentationComposite.setCartesianTriangularMeshMapLayer(null);
}
}