Class GeoLinearRing

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

public final class GeoLinearRing extends Object implements com.azure.json.JsonSerializable<GeoLinearRing>

Represents a linear ring that is part of a GeoPolygon.

This class encapsulates a list of GeoPosition instances that form a closed loop, which is a component of a GeoPolygon. The first and last positions of the loop are the same, forming a closed ring.

This class is useful when you want to work with a linear ring in a geographic context. For example, you can use it to define the boundary of a geographic area in a GeoPolygon.

Note: A linear ring requires at least 4 coordinates, and the first and last coordinates must be the same.

See Also:
  • Constructor Details

    • GeoLinearRing

      public GeoLinearRing(List<GeoPosition> coordinates)
      Constructs a new linear ring with the passed coordinates.
      Parameters:
      coordinates - The coordinates of the linear ring.
      Throws:
      NullPointerException - If coordinates is null.
      IllegalArgumentException - If coordinates has less than 4 elements or the first and last elements aren't equivalent.
  • Method Details

    • getCoordinates

      public List<GeoPosition> getCoordinates()
      Unmodifiable representation of the geometric positions representing this linear ring.
      Returns:
      An unmodifiable representation of the geometric positions representing this linear ring.
    • hashCode

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

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

      public com.azure.json.JsonWriter toJson(com.azure.json.JsonWriter jsonWriter) throws IOException
      Specified by:
      toJson in interface com.azure.json.JsonSerializable<GeoLinearRing>
      Throws:
      IOException
    • fromJson

      public static GeoLinearRing fromJson(com.azure.json.JsonReader jsonReader) throws IOException
      Reads a JSON stream into a GeoLinearRing.
      Parameters:
      jsonReader - The JsonReader being read.
      Returns:
      The GeoLinearRing that the JSON stream represented, or null if it pointed to JSON null.
      Throws:
      IOException - If a GeoLinearRing fails to be read from the jsonReader.