public abstract class KMLViewController extends Object
LookAt
or Camera
view, or to animate to a default view a KML feature that does not define a view.
Subclasses of this base class implement animator logic for particular types of View
, for example OrbitView
.
An application that provides a custom View implementation can extend this base class to provide a KML controller for
the custom view.Modifier and Type | Field and Description |
---|---|
static double |
DEFAULT_VIEW_ALTITUDE
Default altitude from which to view a KML feature.
|
protected double |
viewAltitude
Default altitude from which to view a KML feature.
|
protected WorldWindow |
wwd
WorldWindow that holds the view to animate.
|
Modifier | Constructor and Description |
---|---|
protected |
KMLViewController(WorldWindow wwd)
Create the view controller.
|
Modifier and Type | Method and Description |
---|---|
static KMLViewController |
create(WorldWindow wwd)
Convenience method to create a new view controller appropriate for the
WorldWindow 's current
View . |
protected double |
findMaxAltitude(List<? extends Position> positions)
Get the maximum altitude in a list of positions.
|
double |
getViewAltitude()
Get the default altitude for viewing a KML placemark when the globe flies to a placemark.
|
void |
goTo(KMLAbstractFeature feature)
Animate the view to look at a KML feature.
|
void |
goTo(KMLAbstractView view)
Animates the
View attached to this controller's WorldWindow to look at the specified KML
view . |
protected abstract void |
goTo(KMLCamera camera)
Animate the view to the position described by a KML
Camera . |
protected abstract void |
goTo(KMLLookAt lookAt)
Animate the view to the position described by a KML
LookAt . |
protected void |
goToDefaultGroundOverlayView(KMLGroundOverlay overlay)
Go to a default view of GroundOverlay.
|
protected void |
goToDefaultPlacemarkView(KMLPlacemark placemark)
Go to a default view of a Placemark.
|
void |
goToDefaultView(KMLAbstractFeature feature)
Move the view to look at a KML feature.
|
protected void |
goToDefaultView(List<? extends Position> positions)
Go to a view of a list of positions.
|
void |
setViewAltitude(double viewAltitude)
Set the default altitude for viewing a KML placemark when the globe flies to a placemark.
|
public static final double DEFAULT_VIEW_ALTITUDE
protected double viewAltitude
protected WorldWindow wwd
protected KMLViewController(WorldWindow wwd)
wwd
- WorldWindow that holds the view to animate.public static KMLViewController create(WorldWindow wwd)
WorldWindow
's current
View
. Accepted view types are as follows: . If the View
is not one of
the recognized types, this returns null
and logs a warning.wwd
- the WorldWindow
to create a view controller for.null
if the WorldWindow
's View
type is
not one of the recognized types.protected double findMaxAltitude(List<? extends Position> positions)
positions
- List of positions to search for max altitude.Double.MIN_VALUE
if positions
is
empty.public double getViewAltitude()
public void goTo(KMLAbstractFeature feature)
LookAt
or Camera
, the view
will animate to the view specified in KML. Otherwise the view will animate to a default position looking straight
down at the feature from an altitude that brings the entire feature into view.feature
- Feature to look at.public void goTo(KMLAbstractView view)
View
attached to this controller's WorldWindow to look at the specified KML
view
. The view
may be one of the following types: If the
view
is not null
and is not one of the recognized types, this logs a warning but
otherwise does nothing.view
- the KML view to animate to.IllegalArgumentException
- if view
is null
.protected abstract void goTo(KMLCamera camera)
Camera
.camera
- KML Camera that describes the desired view.protected abstract void goTo(KMLLookAt lookAt)
LookAt
.lookAt
- KML LookAt that describes the desired view.protected void goToDefaultGroundOverlayView(KMLGroundOverlay overlay)
overlay
- Overlay to look atprotected void goToDefaultPlacemarkView(KMLPlacemark placemark)
placemark
- Placemark to look atpublic void goToDefaultView(KMLAbstractFeature feature)
feature
- Feature to look at.protected void goToDefaultView(List<? extends Position> positions)
positions
- List of positions to bring into viewpublic void setViewAltitude(double viewAltitude)
viewAltitude
- Default altitude from which to view a placemark.