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.
    Since:
    100.0.0
    See Also:
    GeoView
    • Constructor Detail

      • Viewpoint

        public Viewpoint​(Point center,
                         double scale)
        Creates an instance using a Point geometry to center the view on and a scale factor.
        Parameters:
        center - a point that this view will center around
        scale - scale factor for the view
        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,
                         double rotation)
        Creates an instance from a Point geometry, a scale factor and a rotation angle. The geometry may not be null. Scale factor must be greater than 0. Rotation may not me less than 0.
        Parameters:
        center - a point that this view will center around
        scale - scale factor for the view
        rotation - the rotation angle for the view
        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)
        Create a viewpoint with center point, scale and Camera.
        Parameters:
        center - the center point
        scale - the scale
        rotation - the rotation angle for the view
        camera - the camera to use
        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 an instance from an Envelope, to be used as the extent.
        Parameters:
        targetExtent - the target extent for the view. This cannot be null
        Throws:
        IllegalArgumentException - if the targetExtent is null
        Since:
        100.0.0
      • Viewpoint

        public Viewpoint​(Envelope targetExtent,
                         Camera camera)
        Creates an instance from an Envelope, to be used as the extent and a camera.
        Parameters:
        targetExtent - the target extent for the view. This cannot be null
        camera - the camera
        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 an instance using an Envelope for the extent and a rotation value.
        Parameters:
        targetExtent - the target extent for the view. This cannot be null
        rotation - the rotation angle for the view
        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 an instance from an Envelope, to be used as the extent, a rotation and a camera.
        Parameters:
        targetExtent - the target extent for the view. This cannot be null
        camera - the camera
        rotation - the rotation angle for the view
        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 an instance using lat/lon values and a scale factor.
        Parameters:
        latitude -
        longitude -
        scale -
        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.
        Parameters:
        latitude - the latitude
        longitude - the longitude
        scale - the scale
        camera - the camera
        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.
        Returns:
        the rotation value.
        Since:
        100.0.0
      • getTargetGeometry

        public Geometry getTargetGeometry()
        Gets the geometry of the Viewpoint. This is how the view that one sees on the map is calculated.
        Returns:
        the geometry used by this Viewpoint.
        Since:
        100.0.0
      • getTargetScale

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

        public Camera getCamera()
        Gets the camera for this viewpoint.
        Returns:
        the camera for this viewpoint
        Since:
        100.0.0
      • 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
      • 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