public class KMLApplicationController extends java.lang.Object implements SelectListener, java.beans.PropertyChangeListener
BalloonController
. If a BalloonController is set, this
controller will open the description balloon for a KML feature when the feature is clicked in the feature tree.Modifier and Type | Field and Description |
---|---|
protected BalloonController |
balloonController
Controller to open balloons when KML features are selected.
|
protected TreeNode |
highlightedNode
Indicates the
TreeNode currently under the cursor. |
protected WorldWindow |
wwd
Indicates the
WorldWindow this controller listens to for select events and property change events. |
Constructor and Description |
---|
KMLApplicationController(WorldWindow wwd)
Creates a new
KMLApplicationController with the specified WorldWindow . |
Modifier and Type | Method and Description |
---|---|
protected boolean |
canMoveTo(KMLAbstractFeature feature)
Determines if the view can be moved to look at a KML feature.
|
protected boolean |
canSelect(KMLAbstractFeature feature)
Determines if there is a some action (fly to and/or open description balloon) to take when the user selects a KML
feature in the tree.
|
protected boolean |
canShowBalloon(KMLAbstractFeature feature)
Determines if a balloon can be opened for a KML feature.
|
BalloonController |
getBalloonController()
Indicates the BalloonController associated with this controller.
|
protected void |
moveTo(KMLAbstractFeature feature)
Smoothly moves the
WorldWindow 's View to the specified
KMLAbstractFeature . |
protected void |
moveTo(KMLAbstractView view)
Smoothly moves the
WorldWindow 's View to the specified KMLAbstractView . |
protected void |
onFeatureSelected(KMLAbstractFeature feature)
Invoked when a feature is selected in the KML feature tree.
|
protected void |
onNetworkLinkRefreshed(KMLNetworkLink networkLink)
Called from
propertyChange when a KMLNetworkLink sends a property change event. |
void |
propertyChange(java.beans.PropertyChangeEvent event)
Handles property change events sent from
KMLNetworkLink objects to the SceneController . |
void |
selected(SelectEvent event)
Animate the globe to a KML feature when the feature is clicked in the tree.
|
void |
setBalloonController(BalloonController balloonController)
Specifies a BalloonController that this controller can use to open balloons when KML features are selected.
|
protected void |
setCursor(java.awt.Cursor cursor)
Set the mouse cursor.
|
protected BalloonController balloonController
protected TreeNode highlightedNode
TreeNode
currently under the cursor. Initially null
.protected WorldWindow wwd
WorldWindow
this controller listens to for select events and property change events.
Initialized during construction.public KMLApplicationController(WorldWindow wwd)
KMLApplicationController
with the specified WorldWindow
. The new
KMLApplicationController
listens KML tree node select events, and KMLNetworkLink
refresh property change events.wwd
- the WorldWindow
this listens to, and who's View
is moved upon a refresh
event.java.lang.IllegalArgumentException
- if the wwd
is null
.protected boolean canMoveTo(KMLAbstractFeature feature)
feature
- KML feature to test.true
if the feature has a view associated with it. This can be an explicit Camera or
LookAt, or a default view for a geographic feature. Not all features have a default view. For
example, features attached to screen (ScreenOverlay) and container features (Document and
Folder) do not have default views.protected boolean canSelect(KMLAbstractFeature feature)
feature
- KML feature to test.true
if the controller can either animate the view or open a balloon for the feature.protected boolean canShowBalloon(KMLAbstractFeature feature)
feature
- KML feature to test.true
if the feature has a balloon.public BalloonController getBalloonController()
null
if no BalloonController is set.protected void moveTo(KMLAbstractFeature feature)
WorldWindow
's View
to the specified
KMLAbstractFeature
.feature
- the KMLAbstractFeature
to move to.protected void moveTo(KMLAbstractView view)
WorldWindow
's View
to the specified KMLAbstractView
.view
- the KMLAbstractView
to move to.protected void onFeatureSelected(KMLAbstractFeature feature)
feature
- Feature that was selected.protected void onNetworkLinkRefreshed(KMLNetworkLink networkLink)
propertyChange
when a KMLNetworkLink
sends a AVKey.RETRIEVAL_STATE_SUCCESSFUL
property change event. This attempts to fly to
a view associated with the link's KML resource.
This does nothing if the networkLink
is null
.networkLink
- the KMLNetworkLink
that has been refreshed.public void propertyChange(java.beans.PropertyChangeEvent event)
KMLNetworkLink
objects to the SceneController
.
Upon receiving a AVKey.RETRIEVAL_STATE_SUCCESSFUL
event from a
KMLNetworkLink
, this attempts to fly to a KMLAbstractView
associated with the link's
KML resource.
If the KMLNetworkLink
's flyToView
property is 0
or false
,
this ignores the event. Otherwise, this attempts to get a KMLAbstractView
from features in the
link's KML resource as follows: NetworkLinkControl
child of link's KML resource.AbstractFeature
child of link's KML resource.WorldWindow
's View
to fly to the feature's KMLAbstractView
using a KMLViewController
propertyChange
in interface java.beans.PropertyChangeListener
event
- a property change event from the SceneController
.public void selected(SelectEvent event)
selected
in interface SelectListener
event
- Select event.public void setBalloonController(BalloonController balloonController)
balloonController
- New BalloonController. May be null
to unset the balloon controller.protected void setCursor(java.awt.Cursor cursor)
cursor
- New cursor. Pass null
to reset the default cursor.