Class Viewpoint

  • All Implemented Interfaces:
    JsonSerializable

    public final class Viewpoint
    extends Object
    implements JsonSerializable
    A Viewpoint is the visible area and view location of a GeoView. It is what the user sees when viewing the map. It can be used to define and control the position, extent, scale and rotation of the view. It is an immutable object used to set a location on a view.
    Since:
    100.0.0
    See Also:
    GeoView
    • Constructor Detail

      • Viewpoint

        public Viewpoint​(Point center,
                         double scale)
        Creates a Viewpoint using a center point and scale. The spatial reference of the center point cannot be null.
        Parameters:
        center - the center of the visible area
        scale - the ratio between a distance on the map and the corresponding distance on the ground.
        Throws:
        IllegalArgumentException - if the specified center point is null
        IllegalArgumentException - if the specified scale is less than or equal to zero
        Since:
        100.0.0
      • Viewpoint

        public Viewpoint​(Point center,
                         double scale,
                         Camera camera)
        Creates a Viewpoint with center point, scale, and Camera.
        Parameters:
        center - the center of the visible area
        scale - the ratio between a distance on the map and the corresponding distance on the ground
        camera - a Camera object that defines the observer of the scene
        Throws:
        IllegalArgumentException - if center is null
        IllegalArgumentException - if scale is out of range
        IllegalArgumentException - if camera is null
        Since:
        100.0.0
      • Viewpoint

        public Viewpoint​(Point center,
                         double scale,
                         double rotation)
        Creates a Viewpoint with center point, scale, and rotation. Scale factor must be greater than 0.
        Parameters:
        center - the center of the visible area. The spatial reference of the center point cannot be null.
        scale - the ratio between a distance on the map and the corresponding distance on the ground
        rotation - the rotation angle in degrees between 0 and 360
        Throws:
        IllegalArgumentException - if the specified center point is null, if the specified scale is less than or equal to zero, or if the specified rotation is less than zero
        Since:
        100.0.0
      • Viewpoint

        public Viewpoint​(Point center,
                         double scale,
                         double rotation,
                         Camera camera)
        Creates a Viewpoint with center point, scale, rotation, and Camera.
        Parameters:
        center - the center point of the visible area. The spatial reference of the center point cannot be null.
        scale - the ratio between a distance on the map and the corresponding distance on the ground
        rotation - the rotation angle in degrees between 0 and 360
        camera - a Camera object that defines the observer for the scene
        Throws:
        IllegalArgumentException - if center is null
        IllegalArgumentException - if scale is out of range
        IllegalArgumentException - if camera is null
        Since:
        100.0.0
      • Viewpoint

        public Viewpoint​(Envelope targetExtent)
        Creates a Viewpoint from an Envelope, to be used as the bounding extent. The spatial reference of the targetExtent cannot be null.
        Parameters:
        targetExtent - the target extent to be used as the visible area. The targetExtent parameter cannot be null, and the spatial reference of the targetExtent cannot be null.
        Throws:
        IllegalArgumentException - if the targetExtent is null
        Since:
        100.0.0
      • Viewpoint

        public Viewpoint​(Envelope targetExtent,
                         Camera camera)
        Creates a Viewpoint with a bounding extent and a Camera.
        Parameters:
        targetExtent - the target extent to use as the visible area. The targetExtent parameter cannot be null, and the spatial reference of the targetExtent cannot be null.
        camera - a Camera object that defines the observer for the scene
        Throws:
        IllegalArgumentException - if the targetExtent is null
        IllegalArgumentException - if the camera is null
        Since:
        100.0.0
      • Viewpoint

        public Viewpoint​(Envelope targetExtent,
                         double rotation)
        Creates a Viewpoint with a bounding extent and rotation.
        Parameters:
        targetExtent - the target extent to use for the visible area. The targetExtent parameter cannot be null, and the spatial reference of the targetExtent cannot be null.
        rotation - the rotation angle in degrees between 0 and 360
        Throws:
        IllegalArgumentException - if the targetExtent is null or if the rotation is less than zero
        Since:
        100.0.0
      • Viewpoint

        public Viewpoint​(Envelope targetExtent,
                         double rotation,
                         Camera camera)
        Creates a Viewpoint with a bounding extent, rotation, and a camera.
        Parameters:
        targetExtent - the target extent for the view. The targetExtent parameter cannot be null, and the spatial reference of the targetExtent cannot be null.
        rotation - the rotation angle in degrees between 0 and 360
        camera - a Camera object that defines the observer of the scene
        Throws:
        IllegalArgumentException - if the targetExtent is null
        IllegalArgumentException - if the rotation is less than zero
        IllegalArgumentException - if the camera is null
        Since:
        100.0.0
      • Viewpoint

        public Viewpoint​(double latitude,
                         double longitude,
                         double scale)
        Creates a Viewpoint with latitude, longitude, and scale. The spatial reference for the defined point is WGS84.
        Parameters:
        latitude - the latitude coordinate for the viewpoint. Negative values are south of the equator.
        longitude - the longitude coordinate for the viewpoint. Negative values are west of the prime meridian.
        scale - the ratio between a distance on the map and the corresponding distance on the ground
        Throws:
        IllegalArgumentException - if the specified scale is less than or equal to zero
        Since:
        100.0.0
      • Viewpoint

        public Viewpoint​(double latitude,
                         double longitude,
                         double scale,
                         Camera camera)
        Create a Viewpoint with latitude, longitude, scale and Camera. The spatial reference for the point is WGS84.
        Parameters:
        latitude - the latitude coordinate for the viewpoint. Negative values are south of the equator
        longitude - the longitude coordinate for the viewpoint. Negative values are west of the prime meridian.
        scale - the scale the ratio between a distance on the map and the corresponding distance on the ground
        camera - a Camera object that defines the observer for the scene
        Throws:
        IllegalArgumentException - if camera is null
        IllegalArgumentException - if scale is out of range
        Since:
        100.0.0
    • Method Detail

      • getRotation

        public double getRotation()
        Gets the rotation angle of the viewpoint in degrees between 0 and 360.
        Returns:
        the rotation value.
        Since:
        100.0.0
      • getTargetGeometry

        public Geometry getTargetGeometry()
        Gets viewpoint target geometry.
        Returns:
        the geometry used by this viewpoint. The target geometry will have a non-null spatial reference.
        Since:
        100.0.0
        See Also:
        Viewpoint.Type
      • getTargetScale

        public double getTargetScale()
        Gets the viewpoint's target scale. The view extent that the user sees will be set to this map scale.
        Returns:
        the target scale used for this viewpoint
        Since:
        100.0.0
      • getCamera

        public Camera getCamera()
        Gets the camera for this viewpoint.
        Returns:
        the viewpoint's Camera
        Since:
        100.0.0
        See Also:
        Camera
      • getType

        public Viewpoint.Type getType()
        Gets the type of this viewpoint. Type will either be a Viewpoint defined by an Envelope geometry or a Viewpoint defined by a Point geometry and scale.
        Returns:
        the type of Viewpoint
        Since:
        100.0.0
        See Also:
        Viewpoint.Type
      • fromJson

        public static Viewpoint fromJson​(String json)
        Creates a Viewpoint instance from a JSON string.
        Parameters:
        json - a JSON string that represents a Viewpoint
        Returns:
        a Viewpoint instance
        Throws:
        IllegalArgumentException - if json is null or empty
        Since:
        100.0.0
      • toJson

        public String toJson()
        Description copied from interface: JsonSerializable
        Serializes this object to a JSON string. Note that unknown JSON is omitted from the serialized string.
        Specified by:
        toJson in interface JsonSerializable
        Returns:
        a JSON string
      • getUnknownJson

        public Map<String,​Object> getUnknownJson()
        Description copied from interface: JsonSerializable
        If this object was created from JSON, this method gets unknown data from the source JSON. Unknown JSON is a Map of values that were in the source JSON but are not known by the Runtime and therefore not exposed in the API.
        Specified by:
        getUnknownJson in interface JsonSerializable
        Returns:
        an unmodifiable Map containing unknown JSON data. The keys are Strings containing names. The types of the values depend on the types of tokens within the JSON as follows:
        • a Map<String, Object> represents an object in the JSON
        • a List<Object> represents an array in the JSON
        • a String represents a string in the JSON
        • a Double represents a number in the JSON
        • a Boolean represents true or false in the JSON
        • null represents null in the JSON
      • getUnsupportedJson

        public Map<String,​Object> getUnsupportedJson()
        Description copied from interface: JsonSerializable
        If this object was created from JSON, this method gets unsupported data from the source JSON. Unsupported JSON is a Map of values that are supported by webmaps and known to the version of the webmap specification the API supports (see system requirements), but are not explicitly exposed through the Runtime API.
        Specified by:
        getUnsupportedJson in interface JsonSerializable
        Returns:
        an unmodifiable Map containing unsupported JSON data. The keys are Strings containing names. The types of the values depend on the types of tokens within the JSON as follows:
        • a Map<String, Object> represents an object in the JSON
        • a List<Object> represents an array in the JSON
        • a String represents a string in the JSON
        • a Double represents a number in the JSON
        • a Boolean represents true or false in the JSON
        • null represents null in the JSON