Package com.esri.arcgisruntime.mapping
Class Viewpoint
- java.lang.Object
-
- com.esri.arcgisruntime.mapping.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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Viewpoint.Type
The different types ofViewpoint
.
-
Constructor Summary
Constructors Constructor Description Viewpoint(double latitude, double longitude, double scale)
Creates a Viewpoint with latitude, longitude, and scale.Viewpoint(double latitude, double longitude, double scale, Camera camera)
Create a Viewpoint with latitude, longitude, scale andCamera
.Viewpoint(Envelope targetExtent)
Creates a Viewpoint from an Envelope, to be used as the bounding extent.Viewpoint(Envelope targetExtent, double rotation)
Creates a Viewpoint with a bounding extent and rotation.Viewpoint(Envelope targetExtent, double rotation, Camera camera)
Creates a Viewpoint with a bounding extent, rotation, and aCamera
.Viewpoint(Envelope targetExtent, Camera camera)
Creates a Viewpoint with a bounding extent and aCamera
.Viewpoint(Point center, double scale)
Creates a Viewpoint using a center point and scale.Viewpoint(Point center, double scale, double rotation)
Creates a Viewpoint with center point, scale, and rotation.Viewpoint(Point center, double scale, double rotation, Camera camera)
Creates a Viewpoint with center point, scale, rotation, andCamera
.Viewpoint(Point center, double scale, Camera camera)
Creates a Viewpoint with center point, scale, andCamera
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Viewpoint
fromJson(String json)
Creates a Viewpoint instance from a JSON string.Camera
getCamera()
Gets theCamera
for this viewpoint.double
getRotation()
Gets the rotation angle of the viewpoint in degrees between 0 and 360.Geometry
getTargetGeometry()
Gets viewpoint target geometry.double
getTargetScale()
Gets the viewpoint's target scale.Viewpoint.Type
getType()
Gets the type of this viewpoint.Map<String,Object>
getUnknownJson()
If this object was created from JSON, this method gets unknown data from the source JSON.Map<String,Object>
getUnsupportedJson()
If this object was created from JSON, this method gets unsupported data from the source JSON.String
toJson()
Serializes this object to a JSON string.
-
-
-
Constructor Detail
-
Viewpoint
public Viewpoint(Point center, double scale)
Creates a Viewpoint using a center point and scale.- Parameters:
center
- the center of the visible areascale
- the ratio between a distance on the map and the corresponding distance on the ground.- Throws:
IllegalArgumentException
- if the specified center point is nullIllegalArgumentException
- 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, andCamera
.- Parameters:
center
- the center of the visible areascale
- the ratio between a distance on the map and the corresponding distance on the groundcamera
- aCamera
object that defines the observer of the scene- Throws:
IllegalArgumentException
- if center is nullIllegalArgumentException
- if scale is out of rangeIllegalArgumentException
- 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 areascale
- the ratio between a distance on the map and the corresponding distance on the groundrotation
- 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, andCamera
.- Parameters:
center
- the center point of the visible area.scale
- the ratio between a distance on the map and the corresponding distance on the groundrotation
- the rotation angle in degrees between 0 and 360camera
- aCamera
object that defines the observer for the scene- Throws:
IllegalArgumentException
- if center is nullIllegalArgumentException
- if scale is out of rangeIllegalArgumentException
- 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.- Parameters:
targetExtent
- the target extent to be used as the visible area. The targetExtent parameter 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 aCamera
.- Parameters:
targetExtent
- the target extent to use as the visible area. The targetExtent parameter cannot be null.camera
- aCamera
object that defines the observer for the scene- Throws:
IllegalArgumentException
- if the targetExtent is nullIllegalArgumentException
- 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.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 aCamera
.- Parameters:
targetExtent
- the target extent for the view. The targetExtent parameter cannot be null.rotation
- the rotation angle in degrees between 0 and 360camera
- aCamera
object that defines the observer of the scene- Throws:
IllegalArgumentException
- if the targetExtent is nullIllegalArgumentException
- if the rotation is less than zeroIllegalArgumentException
- if the camera is null- Since:
- 100.0.0
- See Also:
Camera
-
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 andCamera
. The spatial reference for the point is WGS84.- Parameters:
latitude
- the latitude coordinate for the viewpoint. Negative values are south of the equatorlongitude
- 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 groundcamera
- aCamera
object that defines the observer for the scene- Throws:
IllegalArgumentException
- if camera is nullIllegalArgumentException
- 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
-
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 interfaceJsonSerializable
- 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 interfaceJsonSerializable
- 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
- a
-
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 interfaceJsonSerializable
- 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
- a
-
-