Class KmlViewpoint


  • public final class KmlViewpoint
    extends Object
    A KML viewpoint contains information about a viewer's position, defined as either a LookAt relationship to another object or a camera.

    See the guide documentation and samples for information about converting KmlViewpoints into Runtime viewpoints.

    Since:
    100.4.0
    • Method Detail

      • createCameraViewpoint

        public static KmlViewpoint createCameraViewpoint​(Point point,
                                                         double heading,
                                                         double pitch,
                                                         double roll,
                                                         KmlAltitudeMode altitudeMode)
        Creates a KML viewpoint based on the provided camera location.

        A KML viewpoint defines either a stand alone camera independent of the point of interest being observed or a virtual camera in relation to the observed point of interest.

        Parameters:
        point - the location of camera
        heading - the heading in degrees
        pitch - the pitch in degrees
        roll - the roll in degrees
        altitudeMode - a KmlAltitudeMode
        Throws:
        IllegalArgumentException - if point is null
        IllegalArgumentException - if altitudeMode is null
        Since:
        100.6.0
      • createLookAtViewpoint

        public static KmlViewpoint createLookAtViewpoint​(Point point,
                                                         double heading,
                                                         double pitch,
                                                         double range,
                                                         KmlAltitudeMode altitudeMode)
        Creates a KML viewpoint based on the provided LookAt location.

        A KML viewpoint defines either a stand alone camera independent of the point of interest being observed or a virtual camera in relation to the observed point of interest.

        Parameters:
        point - the location of viewpoint
        heading - the heading in degrees
        pitch - the pitch in degrees
        range - the distance in meters from the point specified by geometry to the view look at position.
        altitudeMode - a KmlAltitudeMode
        Returns:
        a KmlViewpoint
        Throws:
        IllegalArgumentException - if point is null
        IllegalArgumentException - if range is negative number
        IllegalArgumentException - if altitudeMode is null
        Since:
        100.6.0
      • createWithViewpoint

        public static KmlViewpoint createWithViewpoint​(Viewpoint viewpoint)
        Creates a KML viewpoint from a Viewpoint.

        The KML viewpoint defines either a look at point or a camera, whereas a Viewpoint must always have a look at point, and optionally also have a camera. A Viewpoint that has a camera will create a KML viewpoint of type KmlViewpoint.Type.CAMERA. A Viewpoint that has no camera will create a KML viewpoint of type KmlViewpoint.Type.LOOK_AT.

        Parameters:
        viewpoint - a Viewpoint
        Returns:
        a KmlViewpoint
        Throws:
        IllegalArgumentException - if viewpoint is null
        Since:
        100.6.0
      • getAltitudeMode

        public KmlAltitudeMode getAltitudeMode()
        Gets the KML viewpoint's altitude mode, which determines how altitude values should be interpreted. The default is KmlAltitudeMode.RELATIVE_TO_GROUND.
        Returns:
        the KML viewpoint's altitude mode
        Since:
        100.4.0
      • getHeading

        public double getHeading()
        Gets the KML viewpoint's heading in degrees. Values range from 0 (North) to 360, with 90 being East.
        Returns:
        the KML viewpoint's heading
        Since:
        100.4.0
      • getLocation

        public Point getLocation()
        Gets the KML viewpoint's location.

        For KmlViewpoint.Type.LOOK_AT viewpoints, this defines the position of an object for the camera to observe. See <LookAt> in Google's KML Reference, for more information. For KmlViewpoint.Type.CAMERA viewpoints, this defines the position of the camera directly. See <Camera> in Google's KML Reference, for more information.

        Returns:
        the KML viewpoint's location.
        Since:
        100.4.0
      • getRange

        public double getRange()
        Gets the KML viewpoint's range, which only applies to LookAt viewpoints. Range is the distance in meters between the getLocation() and the camera.
        Returns:
        the KML viewpoint's range
        Since:
        100.4.0
      • getRoll

        public double getRoll()
        Gets the KML viewpoint's rotation of the camera around the z-axis. Values range from -180 to 180 degrees.
        Returns:
        the KML viewpoint's roll
        Since:
        100.4.0
      • getPitch

        public double getPitch()
        Gets the KML viewpoint's Pitch.

        The range of the pitch is from -180 to 180 degrees. A value of 0 indicates that the view is aimed straight down towards the earth (the default). A value of 90 indicates that the view is aimed toward the horizon. Values greater than 90 indicate that the view is pointed towards the sky.

        Corresponds to the 'tilt' property from the KML specification.

        Returns:
        the KML viewpoint's pitch
        Since:
        100.4.0
      • getType

        public KmlViewpoint.Type getType()
        Gets the KML viewpoint's Type. CAMERA viewpoints define the position of the camera directly. LOOK_AT viewpoints define the position of the camera relative to a point of interest. See <Camera> in Google's KML Reference for details about KML viewpoint (abstractView) specification, including diagrams.
        Returns:
        the KML viewpoint's type
        Since:
        100.4.0