private void updateData() {
Display.getDefault().asyncExec(new Runnable(){
public void run() {
IMap activeMap = ApplicationGIS.getActiveMap();
ViewportModel viewportModel = (ViewportModel) activeMap.getViewportModel();
activeMap.addMapListener(NavigationView.this);
activeMap.addMapCompositionListener(NavigationView.this);
ReferencedEnvelope bounds = viewportModel.getBounds();
double west = bounds.getMinX();
double east = bounds.getMaxX();
double north = bounds.getMaxY();
double south = bounds.getMinY();
if (lowerLeftText.isDisposed()) {
return;
}
lowerLeftText.setText(numFormatter.format(west) + ", " + numFormatter.format(south));
upperRightText.setText(numFormatter.format(east) + ", " + numFormatter.format(north));
canvas.redraw();
SortedSet<Double> preferredScaleDenominators = viewportModel.getPreferredScaleDenominators();
Double[] scalesArray = (Double[]) preferredScaleDenominators.toArray(new Double[preferredScaleDenominators.size()]);
String[] scales = new String[scalesArray.length];
for( int i = 0; i < scales.length; i++ ) {
scales[i] = "1:" + String.valueOf(scalesArray[i]);
}
int itemCount = scaleCombo.getItemCount();
int selectionIndex = scaleCombo.getSelectionIndex();
scaleCombo.setItems(scales);
if (scales.length == itemCount) {
scaleCombo.select(selectionIndex);
}
List<DateTime> availableTimesteps = viewportModel.getAvailableTimesteps();
if (availableTimesteps != null) {
dateTimeCombo.setEnabled(true);
dtDownButton.setEnabled(true);
dtUpButton.setEnabled(true);
String[] dates = new String[availableTimesteps.size()];
for( int i = 0; i < dates.length; i++ ) {
dates[i] = ISO_DATE_TIME_FORMATTER.print(availableTimesteps.get(i));
}
itemCount = dateTimeCombo.getItemCount();
selectionIndex = dateTimeCombo.getSelectionIndex();
dateTimeCombo.setItems(dates);
if (dates.length == itemCount) {
dateTimeCombo.select(selectionIndex);
}
} else {
dateTimeCombo.setEnabled(false);
dtDownButton.setEnabled(false);
dtUpButton.setEnabled(false);
}
List<Double> availableElevation = viewportModel.getAvailableElevation();
if (availableElevation != null) {
verticalCombo.setEnabled(true);
verticalDownButton.setEnabled(true);
verticalUpButton.setEnabled(true);
String[] elev = new String[availableElevation.size()];