public abstract class AbstractGeometryAdapter<T extends com.vividsolutions.jts.geom.Geometry> extends Object implements com.google.gson.JsonSerializer<T>, com.google.gson.JsonDeserializer<T>
| Constructor and Description |
|---|
AbstractGeometryAdapter(com.vividsolutions.jts.geom.GeometryFactory geoFactory)
Simple Constructor.
|
AbstractGeometryAdapter(String geometryType,
double decimalFactor,
com.vividsolutions.jts.geom.GeometryFactory geoFactory) |
| Modifier and Type | Method and Description |
|---|---|
protected com.google.gson.JsonArray |
coordinatesToJsonArray(com.vividsolutions.jts.geom.Coordinate... coordinates)
Converts an array of Coordinates to a JsonArray.
|
protected com.google.gson.JsonArray |
coordinateToJsonArray(com.vividsolutions.jts.geom.Coordinate coordinate)
Converts a single Coordinate to a JsonArray.
|
T |
deserialize(com.google.gson.JsonElement json,
Type typeOfT,
com.google.gson.JsonDeserializationContext context) |
protected abstract T |
deserializeGeometry(com.google.gson.JsonArray coordinates,
com.vividsolutions.jts.geom.GeometryFactory factory)
Creates a Geometry object by deserializing its Coordinates JsonArray.
|
protected com.vividsolutions.jts.geom.Coordinate |
jsonArrayToCoordinate(com.google.gson.JsonArray jsonArray)
Creates a single Coordinate out of a JsonArray.
|
protected com.vividsolutions.jts.geom.Coordinate[] |
jsonArrayToCoordinates(com.google.gson.JsonArray jsonArray)
Creates an array of Coordinates out of a JsonArray.
|
com.google.gson.JsonElement |
serialize(T src,
Type typeOfSrc,
com.google.gson.JsonSerializationContext context) |
protected abstract com.google.gson.JsonArray |
serializeCoordinates(T src)
Serializes the Coordinates of a Geometry to a JsonArray.
|
public AbstractGeometryAdapter(com.vividsolutions.jts.geom.GeometryFactory geoFactory)
geoFactory - the GeometryFactory used to create deserialized objectspublic AbstractGeometryAdapter(String geometryType, double decimalFactor, com.vividsolutions.jts.geom.GeometryFactory geoFactory)
public com.google.gson.JsonElement serialize(T src, Type typeOfSrc, com.google.gson.JsonSerializationContext context)
serialize in interface com.google.gson.JsonSerializer<T extends com.vividsolutions.jts.geom.Geometry>public T deserialize(com.google.gson.JsonElement json, Type typeOfT, com.google.gson.JsonDeserializationContext context) throws com.google.gson.JsonParseException
deserialize in interface com.google.gson.JsonDeserializer<T extends com.vividsolutions.jts.geom.Geometry>com.google.gson.JsonParseExceptionprotected abstract T deserializeGeometry(com.google.gson.JsonArray coordinates, com.vividsolutions.jts.geom.GeometryFactory factory)
coordinates - a JsonArray of Coordinatesfactory - the GeometryFactory used for building the outputprotected abstract com.google.gson.JsonArray serializeCoordinates(T src)
src - a Geometry the Coordinates of which are to be serializedprotected com.google.gson.JsonArray coordinatesToJsonArray(com.vividsolutions.jts.geom.Coordinate... coordinates)
coordinates - the Coordinates which are to be serializedprotected com.google.gson.JsonArray coordinateToJsonArray(com.vividsolutions.jts.geom.Coordinate coordinate)
coordinate - the Coordinate which is to be serializedprotected com.vividsolutions.jts.geom.Coordinate jsonArrayToCoordinate(com.google.gson.JsonArray jsonArray)
jsonArray - the JsonArray that is to be parsedprotected com.vividsolutions.jts.geom.Coordinate[] jsonArrayToCoordinates(com.google.gson.JsonArray jsonArray)
jsonArray - the JsonArray that is to be parsedCopyright © 2017–2019. All rights reserved.