}
jGrassMapsetGeoResource = selectedLayers.get(0);
String windPath = jGrassMapsetGeoResource.getActiveRegionWindowPath();
windPathText.setText(windPath);
JGrassRegion jgR = jGrassMapsetGeoResource.getActiveRegionWindow();
CoordinateReferenceSystem crs = jGrassMapsetGeoResource.getLocationCrs();
commitToBlackboards(jgR, crs, windPath);
}
});
// the group for the region
Group regionGroup = new Group(c, SWT.BORDER);
GridLayout layout2 = new GridLayout(2, true);
regionGroup.setLayout(layout2);
regionGroup.setText("Region settings");
regionGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
northLabel = new Label(regionGroup, SWT.NONE);
northLabel.setText("north");
northLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
northText = new Text(regionGroup, SWT.BORDER);
northText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
southLabel = new Label(regionGroup, SWT.NONE);
southLabel.setText("south");
southLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
southText = new Text(regionGroup, SWT.BORDER);
southText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
westLabel = new Label(regionGroup, SWT.NONE);
westLabel.setText("west");
westLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
westText = new Text(regionGroup, SWT.BORDER);
westText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
eastLabel = new Label(regionGroup, SWT.NONE);
eastLabel.setText("east");
eastLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
eastText = new Text(regionGroup, SWT.BORDER);
eastText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
rowsLabel = new Label(regionGroup, SWT.NONE);
rowsLabel.setText("rows");
rowsLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
rowsText = new Text(regionGroup, SWT.BORDER);
rowsText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
colsLabel = new Label(regionGroup, SWT.NONE);
colsLabel.setText("cols");
colsLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
colsText = new Text(regionGroup, SWT.BORDER);
colsText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
xresLabel = new Label(regionGroup, SWT.NONE);
xresLabel.setText("xres");
xresLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
xresText = new Text(regionGroup, SWT.BORDER);
xresText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
yresLabel = new Label(regionGroup, SWT.NONE);
yresLabel.setText("yres");
yresLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
yresText = new Text(regionGroup, SWT.BORDER);
yresText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
// the group for the style
Group styleGroup = new Group(c, SWT.BORDER);
GridLayout layout3 = new GridLayout(2, true);
styleGroup.setLayout(layout3);
styleGroup.setText("Style properties");
styleGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
gridButton = new Button(styleGroup, SWT.BORDER | SWT.CHECK);
gridButton.setText("visualize active region grid");
GridData gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
gridData.horizontalSpan = 2;
gridButton.setLayoutData(gridData);
Label backgroundColourLabel = new Label(styleGroup, SWT.NONE);
backgroundColourLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
backgroundColourLabel.setText("background color");
backgroundColour = new ColorEditor(styleGroup);
backgroundColour.getButton().setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
Label backgroundAlphaLabel = new Label(styleGroup, SWT.NONE);
backgroundAlphaLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
backgroundAlphaLabel.setText("background alpha (0-1)");
backgroundAlphaText = new Text(styleGroup, SWT.BORDER);
backgroundAlphaText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
Label foregroundColourLabel = new Label(styleGroup, SWT.NONE);
foregroundColourLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
foregroundColourLabel.setText("foreground color");
foregroundColor = new ColorEditor(styleGroup);
foregroundColor.getButton().setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
Label forgroundAlphaLabel = new Label(styleGroup, SWT.NONE);
forgroundAlphaLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
forgroundAlphaLabel.setText("foreground alpha (0-1)");
forgroundAlphaText = new Text(styleGroup, SWT.BORDER);
forgroundAlphaText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
// the group for the set region to map
final Group settoGroup = new Group(c, SWT.BORDER);
GridLayout layout4 = new GridLayout(1, true);
settoGroup.setLayout(layout4);
settoGroup.setText("Set region to...");
settoGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
rasterMapSetButton = new Button(settoGroup, SWT.NONE);
rasterMapSetButton.setText("set region to raster map");
rasterMapSetButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
rasterMapSetButton.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter(){
public void widgetSelected( org.eclipse.swt.events.SelectionEvent e ) {
JGRasterChooserDialog tree = new JGRasterChooserDialog(null);
tree.open(settoGroup.getShell(), SWT.SINGLE);
update(tree.getSelectedResources());
}
});
featuresMapSetButton = new Button(settoGroup, SWT.NONE);
featuresMapSetButton.setText("set region to vector map");
featuresMapSetButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
featuresMapSetButton.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter(){
public void widgetSelected( org.eclipse.swt.events.SelectionEvent e ) {
FeatureChooserDialog tree = new FeatureChooserDialog();
tree.open(settoGroup.getShell(), SWT.SINGLE);
update(tree.getSelectedResources());
}
});
resetToActiveButton = new Button(settoGroup, SWT.NONE);
resetToActiveButton.setText("reset back to actual region");
resetToActiveButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
resetToActiveButton.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter(){
public void widgetSelected( org.eclipse.swt.events.SelectionEvent e ) {
String windPath = windPathText.getText();
try {
JGrassRegion jgR = new JGrassRegion(windPath);
setWidgetsToWindow(jgR);
} catch (IOException e1) {
e1.printStackTrace();
}
}