Class GeoPoint

java.lang.Object
com.azure.core.models.GeoObject
com.azure.core.models.GeoPoint
All Implemented Interfaces:
com.azure.json.JsonSerializable<GeoObject>

public final class GeoPoint extends GeoObject
Represents a geometric point.
  • Constructor Details

    • GeoPoint

      public GeoPoint(double longitude, double latitude)
      Constructs a GeoPoint.
      Parameters:
      longitude - The longitudinal position of the point.
      latitude - The latitudinal position of the point.
    • GeoPoint

      public GeoPoint(double longitude, double latitude, Double altitude)
      Constructs a GeoPoint.
      Parameters:
      longitude - The longitudinal position of the point.
      latitude - The latitudinal position of the point.
      altitude - The altitude of the point.
    • GeoPoint

      public GeoPoint(GeoPosition position)
      Constructs a geometric point.
      Parameters:
      position - The geometric position of the point.
      Throws:
      NullPointerException - If position is null.
    • GeoPoint

      public GeoPoint(GeoPosition position, GeoBoundingBox boundingBox, Map<String,Object> customProperties)
      Constructs a geometric point.
      Parameters:
      position - The geometric position of the point.
      boundingBox - Bounding box for the point.
      customProperties - Additional properties of the geometric point.
      Throws:
      NullPointerException - If position is null.
  • Method Details

    • getCoordinates

      public GeoPosition getCoordinates()
      The geometric position of the point.
      Returns:
      The geometric position of the point.
    • getType

      public GeoObjectType getType()
      Description copied from class: GeoObject
      Gets the GeoJSON type for this object.
      Specified by:
      getType in class GeoObject
      Returns:
      The GeoJSON type for this object.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class GeoObject
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class GeoObject
    • toJson

      public com.azure.json.JsonWriter toJson(com.azure.json.JsonWriter jsonWriter) throws IOException
      Description copied from interface: com.azure.json.JsonSerializable
      Writes the object to the passed JsonWriter.

      The contract for writing JSON to JsonWriter is that the object being written will handle opening and closing its own JSON object. So, for objects calling out to other JsonSerializable objects for serialization, they'll write the field name only then pass the JsonWriter to the other JsonSerializable object. This way objects writing JSON will be self-encapsulated for writing properly formatted JSON.

      Specified by:
      toJson in interface com.azure.json.JsonSerializable<GeoObject>
      Overrides:
      toJson in class GeoObject
      Parameters:
      jsonWriter - Where the object's JSON will be written.
      Returns:
      The JsonWriter where the JSON was written.
      Throws:
      IOException - If the object fails to be written to the jsonWriter.
    • fromJson

      public static GeoPoint fromJson(com.azure.json.JsonReader jsonReader) throws IOException
      Reads a JSON stream into a GeoPoint.
      Parameters:
      jsonReader - The JsonReader being read.
      Returns:
      The GeoPoint that the JSON stream represented, or null if it pointed to JSON null.
      Throws:
      IllegalStateException - If the type node exists and isn't equal to Point.
      IOException - If a GeoPoint fails to be read from the jsonReader.