Class GeoPolygonCollection
- All Implemented Interfaces:
com.azure.json.JsonSerializable<GeoObject>
Represents a collection of GeoPolygons in GeoJSON format.
This class encapsulates a list of GeoPolygon instances that form a collection of polygons. Each polygon
is defined by a list of GeoLinearRing instances that form the boundary of the polygon.
This class also provides a toJson(JsonWriter) method to serialize the collection of polygons to JSON,
and a fromJson(JsonReader) method to deserialize a collection of polygons from JSON.
This class is useful when you want to work with a collection of polygons in a geographic context. For example, you can use it to represent a complex geographic area on a map that is composed of multiple polygons.
Note: A polygon collection requires at least one ring for each polygon, and each ring requires at least 4 coordinates (with the first and last coordinates being the same to form a closed loop).
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionGeoPolygonCollection(List<GeoPolygon> polygons) Constructs aGeoPolygonCollection.GeoPolygonCollection(List<GeoPolygon> polygons, GeoBoundingBox boundingBox, Map<String, Object> customProperties) Constructs aGeoPolygonCollection. -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic GeoPolygonCollectionfromJson(com.azure.json.JsonReader jsonReader) Reads a JSON stream into aGeoPolygonCollection.Unmodifiable representation of thegeometric polygonsrepresenting this multi-polygon.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
-
GeoPolygonCollection
Constructs aGeoPolygonCollection.- Parameters:
polygons- The polygons that define the multi-polygon.- Throws:
NullPointerException- Ifpolygonsisnull.
-
GeoPolygonCollection
public GeoPolygonCollection(List<GeoPolygon> polygons, GeoBoundingBox boundingBox, Map<String, Object> customProperties) Constructs aGeoPolygonCollection.- Parameters:
polygons- The polygons that define the multi-polygon.boundingBox- Bounding box for the multi-polygon.customProperties- Additional properties of the multi-polygon.- Throws:
NullPointerException- Ifpolygonsisnull.
-
-
Method Details
-
getPolygons
Unmodifiable representation of thegeometric polygonsrepresenting this multi-polygon.- Returns:
- An unmodifiable representation of the
geometric polygonsrepresenting this multi-polygon.
-
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
public static GeoPolygonCollection fromJson(com.azure.json.JsonReader jsonReader) throws IOException Reads a JSON stream into aGeoPolygonCollection.- Parameters:
jsonReader- TheJsonReaderbeing read.- Returns:
- The
GeoPolygonCollectionthat the JSON stream represented, or null if it pointed to JSON null. - Throws:
IllegalStateException- If thetypenode exists and isn't equal toMultiPolygon.IOException- If aGeoPolygonCollectionfails to be read from thejsonReader.
-