They are really easy to call and give back the list of the selected resource:
JGRasterChooserDialog tree = new JGRasterChooserDialog();
tree.open(elevationGroup.getShell(), SWT.SINGLE);
JGrassMapGeoResource selected = tree.getSelectedResources().get(0);
String layerName =selected.getTypeNames()[0];
Which looks like the following two images, depending on whether you want to pick up the resource from the loaded layers in the project or also from the resources loaded in the catalog:
Here I loaded I GRASS raster map,
and here all the maps in the locations that is loaded in the catalog are seen.
The same applies for the featuresources:
FeatureChooserDialog tree = new FeatureChooserDialog();
tree.open(reachShapeGroup.getShell(), SWT.SINGLE);
DataStore selected = tree.getSelectedResources().get(0);
String layerName =selected.getTypeNames()[0];
and catalog.
Fairly easy, isn't it? :)
No comments:
Post a Comment