Comparteix a través de


GeoCollection Class

public final class GeoCollection
extends GeoObject

Represents a heterogeneous collection of GeoObject.

This class encapsulates a list of geometry objects and provides methods to access these objects. The objects can be of any type that extends GeoObject.

This class is useful when you want to work with a collection of geometry objects in a read-only manner. For example, you can use it to represent a complex geographic feature that is composed of multiple simple geographic features.

Constructor Summary

Constructor Description
GeoCollection(List<GeoObject> geometries)

Constructs a GeoCollection.

GeoCollection(List<GeoObject> geometries, GeoBoundingBox boundingBox, Map<String,Object> customProperties)

Constructs a GeoCollection.

Method Summary

Modifier and Type Method and Description
boolean equals(Object obj)
static GeoCollection fromJson(JsonReader jsonReader)

Reads a JSON stream into a GeoCollection.

List<GeoObject> getGeometries()

Unmodifiable representation of the GeoObject contained in this collection.

GeoObjectType getType()

Gets the GeoJSON type for this object.

int hashCode()
JsonWriter toJson(JsonWriter jsonWriter)

Methods inherited from GeoObject

Methods inherited from java.lang.Object

Constructor Details

GeoCollection

public GeoCollection(List<GeoObject> geometries)

Constructs a GeoCollection.

Parameters:

geometries - The geometries in the collection.

GeoCollection

public GeoCollection(List<GeoObject> geometries, GeoBoundingBox boundingBox, Map<String,Object> customProperties)

Constructs a GeoCollection.

Parameters:

geometries - The geometries in the collection.
boundingBox - Bounding box for the GeoCollection.
customProperties - Additional properties of the GeoCollection.

Method Details

equals

public boolean equals(Object obj)

Overrides:

GeoCollection.equals(Object obj)

Parameters:

obj

fromJson

public static GeoCollection fromJson(JsonReader jsonReader)

Reads a JSON stream into a GeoCollection.

Parameters:

jsonReader - The JsonReader being read.

Returns:

The GeoCollection that the JSON stream represented, or null if it pointed to JSON null.

Throws:

IOException

- If the type node exists and isn't equal to GeometryCollection.

getGeometries

public List<GeoObject> getGeometries()

Unmodifiable representation of the GeoObject contained in this collection.

Returns:

An unmodifiable representation of the GeoObject in this collection.

getType

public GeoObjectType getType()

Gets the GeoJSON type for this object.

Overrides:

GeoCollection.getType()

hashCode

public int hashCode()

Overrides:

GeoCollection.hashCode()

toJson

public JsonWriter toJson(JsonWriter jsonWriter)

Overrides:

GeoCollection.toJson(JsonWriter jsonWriter)

Parameters:

jsonWriter

Throws:

Applies to