Class KmlTourController


  • public final class KmlTourController
    extends java.lang.Object
    Controls the execution of a KML tour on a SceneView.

    Use it to play, pause or reset a KmlTour, and play sound cues or show/hide balloon popup as specified in a KML tour.

    One may need to declare a corresponding WAKE_LOCK permission <uses-permission> element. This class requires the Manifest.permission.INTERNET permission when used with network-based content.

    Since:
    100.5.0
    • Constructor Detail

      • KmlTourController

        public KmlTourController​(android.content.Context context)
        Constructs a KmlTourController object.
        Parameters:
        context - the Android application Context
        Throws:
        java.lang.IllegalArgumentException - if context is null
        Since:
        100.5.0
    • Method Detail

      • getTour

        public KmlTour getTour()
        Gets the KML tour associated with the tour controller.
        Returns:
        the KmlTour object
        Since:
        100.5.0
      • setTour

        public void setTour​(KmlTour kmlTour)
        Sets the KML tour on the controller and initializes it.

        The KmlTour status becomes KmlTourStatus.INITIALIZED after it is set to a controller. To play the tour, the KmlLayer that the KmlTour is obtained from needs to be visible on a SceneView. If a new KmlTour is set on the controller while a previous KML Tour is playing, the previous execution is aborted and its status goes back to KmlTourStatus.NOT_INITIALIZED.

        Parameters:
        kmlTour - the KML tour, or null to reset the controller
        Since:
        100.5.0
        See Also:
        KmlTourStatus
      • getTotalDuration

        public double getTotalDuration()
        Gets the total duration of the KML tour.
        Returns:
        the total duration in seconds, or zero if the tour is null
        Since:
        100.5.0
      • getCurrentPosition

        public double getCurrentPosition()
        Gets the current position of the KML tour.
        Returns:
        the current position of the tour in seconds
        Since:
        100.6.0
      • play

        public void play()
        Starts or resumes playing of the KML tour, which may include audio contents.
        Since:
        100.5.0
      • pause

        public void pause()
        Pauses the execution of the KML tour.
        Since:
        100.5.0
      • reset

        public void reset()
        Resets the execution of the KML tour to the beginning.

        Use this to reset the tour to the beginning, which includes resetting any KML content to its original state before the tour was played.

        Since:
        100.5.0
      • addTotalDurationChangedListener

        public void addTotalDurationChangedListener​(KmlTourTotalDurationChangedListener listener)
        Adds a total duration changed listener to the controller.
        Parameters:
        listener - the listener
        Throws:
        java.lang.IllegalArgumentException - if listener is null
        Since:
        100.5.0
      • removeTotalDurationChangedListener

        public boolean removeTotalDurationChangedListener​(KmlTourTotalDurationChangedListener listener)
        Removes a total duration changed listener from the controller.
        Parameters:
        listener - the listener
        Returns:
        true, if successful
        Since:
        100.5.0
      • addCurrentPositionChangedListener

        public void addCurrentPositionChangedListener​(KmlTourCurrentPositionChangedListener listener)
        Adds a current position changed listener to the controller.
        Parameters:
        listener - the listener
        Throws:
        java.lang.IllegalArgumentException - if listener is null
        Since:
        100.6.0
      • removeCurrentChangedListener

        public boolean removeCurrentChangedListener​(KmlTourCurrentPositionChangedListener listener)
        Removes a current position changed listener from the controller.
        Parameters:
        listener - the listener
        Returns:
        true, if successful
        Since:
        100.6.0