|
Collaborative ALM Free SaaS for open source projects on Amazon EC2 |
|
|
| Frequently Asked Questions |
|
|
| Tags: No tags associated yet. |
|
All Tags... |
Assuming you have a working WorldWind panel somewhere in your app, do this:
import gw.ShapefileLayer;
ShapefileLayer sf = new ShapefileLayer("shapefile.shp", worldwindPanel);
worldwindPanel.getModel().getLayers().add(sf);
Create an object that implements FeatureSelectionListener and pass it to addFeatureSelectionListener().
For example:
layer.addFeatureSelectionListener( new FeatureSelectionListener() {
public boolean featureSelected(Feature selected) {
if(selected == null) return true;
System.out.println("Feature selected!");
System.out.println(selected);
return true;
}
});
Note that returning true from this function allows the feature to be selected. If you return false it cancels the selection.
Add a MoveListener to a Layer, like so:
layer.addMoveListener( new MoveListener() {
public void moved(PositionEvent event) {
if(event != null && event.getPosition() != null) {
System.out.println(event.getPosition().toString());
}
}
}
layer.setPickEnabled(false); //(or true)
layer.setVisible(false);or
layer.setOpacity(0.0);
layer.flyTo(worldwindPanel);