CodeBeamer
Collaborative ALM as a Service
CodeBeamer 5.4.2 on Amazon EC2 medium instance
         
Frequently Asked Questions
Tags:   No tags associated yet.
All Tags...

Frequently Asked Questions

How do I load a shapefile and add it to the globe?

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);

How do I respond to the user clicking on features?

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.

How do I know where the mouse is pointing/elevation of that point/etc.

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());
       }
    }
}

How do I enable/disable layers being clickable?


 layer.setPickEnabled(false);  //(or true)

How do I hide a layer?


 layer.setVisible(false);

or
 layer.setOpacity(0.0);

How do I fly to a layer?


 layer.flyTo(worldwindPanel);