Package com.azure.core.models
Class GeoPoint
java.lang.Object
com.azure.core.models.GeoObject
com.azure.core.models.GeoPoint
- All Implemented Interfaces:
com.azure.json.JsonSerializable<GeoObject>
Represents a geometric point in GeoJSON format.
This class encapsulates a point defined by a GeoPosition which includes the longitude, latitude, and
optionally the altitude of the point.
This class also provides a toJson(JsonWriter) method to serialize the geometric point to JSON, and
a fromJson(JsonReader) method to deserialize a geometric point from JSON.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionGeoPoint(double longitude, double latitude) Constructs aGeoPoint.Constructs aGeoPoint.GeoPoint(GeoPosition position) Constructs a geometric point.GeoPoint(GeoPosition position, GeoBoundingBox boundingBox, Map<String, Object> customProperties) Constructs a geometric point. -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic GeoPointfromJson(com.azure.json.JsonReader jsonReader) Reads a JSON stream into aGeoPoint.Thegeometric positionof the point.getType()Gets the GeoJSON type for this object.inthashCode()com.azure.json.JsonWritertoJson(com.azure.json.JsonWriter jsonWriter) Methods inherited from class com.azure.core.models.GeoObject
getBoundingBox, getCustomPropertiesMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.azure.json.JsonSerializable
toJson, toJson, toJsonBytes, toJsonString
-
Constructor Details
-
GeoPoint
public GeoPoint(double longitude, double latitude) Constructs aGeoPoint.- Parameters:
longitude- The longitudinal position of the point.latitude- The latitudinal position of the point.
-
GeoPoint
Constructs aGeoPoint.- Parameters:
longitude- The longitudinal position of the point.latitude- The latitudinal position of the point.altitude- The altitude of the point.
-
GeoPoint
Constructs a geometric point.- Parameters:
position- Thegeometric positionof the point.- Throws:
NullPointerException- Ifpositionisnull.
-
GeoPoint
public GeoPoint(GeoPosition position, GeoBoundingBox boundingBox, Map<String, Object> customProperties) Constructs a geometric point.- Parameters:
position- Thegeometric positionof the point.boundingBox- Bounding box for the point.customProperties- Additional properties of the geometric point.- Throws:
NullPointerException- Ifpositionisnull.
-
-
Method Details
-
getCoordinates
Thegeometric positionof the point.- Returns:
- The
geometric positionof the point.
-
getType
Description copied from class:GeoObjectGets the GeoJSON type for this object. -
hashCode
public int hashCode() -
equals
-
toJson
- Specified by:
toJsonin interfacecom.azure.json.JsonSerializable<GeoObject>- Overrides:
toJsonin classGeoObject- Throws:
IOException
-
fromJson
Reads a JSON stream into aGeoPoint.- Parameters:
jsonReader- TheJsonReaderbeing read.- Returns:
- The
GeoPointthat the JSON stream represented, or null if it pointed to JSON null. - Throws:
IllegalStateException- If thetypenode exists and isn't equal toPoint.IOException- If aGeoPointfails to be read from thejsonReader.
-