|
|
|
|
@ -103,7 +103,7 @@ abstract class GeoConverters {
@@ -103,7 +103,7 @@ abstract class GeoConverters {
|
|
|
|
|
* @since 1.5 |
|
|
|
|
*/ |
|
|
|
|
@ReadingConverter |
|
|
|
|
static enum DocumentToPointConverter implements Converter<Document, Point> { |
|
|
|
|
enum DocumentToPointConverter implements Converter<Document, Point> { |
|
|
|
|
|
|
|
|
|
INSTANCE; |
|
|
|
|
|
|
|
|
|
@ -134,7 +134,7 @@ abstract class GeoConverters {
@@ -134,7 +134,7 @@ abstract class GeoConverters {
|
|
|
|
|
* @author Thomas Darimont |
|
|
|
|
* @since 1.5 |
|
|
|
|
*/ |
|
|
|
|
static enum PointToDocumentConverter implements Converter<Point, Document> { |
|
|
|
|
enum PointToDocumentConverter implements Converter<Point, Document> { |
|
|
|
|
|
|
|
|
|
INSTANCE; |
|
|
|
|
|
|
|
|
|
@ -149,13 +149,13 @@ abstract class GeoConverters {
@@ -149,13 +149,13 @@ abstract class GeoConverters {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Converts a {@link Box} into a {@link BasicDBList}. |
|
|
|
|
* Converts a {@link Box} into a {@link Document}. |
|
|
|
|
* |
|
|
|
|
* @author Thomas Darimont |
|
|
|
|
* @since 1.5 |
|
|
|
|
*/ |
|
|
|
|
@WritingConverter |
|
|
|
|
static enum BoxToDocumentConverter implements Converter<Box, Document> { |
|
|
|
|
enum BoxToDocumentConverter implements Converter<Box, Document> { |
|
|
|
|
|
|
|
|
|
INSTANCE; |
|
|
|
|
|
|
|
|
|
@ -178,13 +178,13 @@ abstract class GeoConverters {
@@ -178,13 +178,13 @@ abstract class GeoConverters {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Converts a {@link BasicDBList} into a {@link Box}. |
|
|
|
|
* Converts a {@link Document} into a {@link Box}. |
|
|
|
|
* |
|
|
|
|
* @author Thomas Darimont |
|
|
|
|
* @since 1.5 |
|
|
|
|
*/ |
|
|
|
|
@ReadingConverter |
|
|
|
|
static enum DocumentToBoxConverter implements Converter<Document, Box> { |
|
|
|
|
enum DocumentToBoxConverter implements Converter<Document, Box> { |
|
|
|
|
|
|
|
|
|
INSTANCE; |
|
|
|
|
|
|
|
|
|
@ -207,12 +207,12 @@ abstract class GeoConverters {
@@ -207,12 +207,12 @@ abstract class GeoConverters {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Converts a {@link Circle} into a {@link BasicDBList}. |
|
|
|
|
* Converts a {@link Circle} into a {@link Document}. |
|
|
|
|
* |
|
|
|
|
* @author Thomas Darimont |
|
|
|
|
* @since 1.5 |
|
|
|
|
*/ |
|
|
|
|
static enum CircleToDocumentConverter implements Converter<Circle, Document> { |
|
|
|
|
enum CircleToDocumentConverter implements Converter<Circle, Document> { |
|
|
|
|
|
|
|
|
|
INSTANCE; |
|
|
|
|
|
|
|
|
|
@ -278,7 +278,7 @@ abstract class GeoConverters {
@@ -278,7 +278,7 @@ abstract class GeoConverters {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Converts a {@link Sphere} into a {@link BasicDBList}. |
|
|
|
|
* Converts a {@link Sphere} into a {@link Document}. |
|
|
|
|
* |
|
|
|
|
* @author Thomas Darimont |
|
|
|
|
* @since 1.5 |
|
|
|
|
@ -307,13 +307,13 @@ abstract class GeoConverters {
@@ -307,13 +307,13 @@ abstract class GeoConverters {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Converts a {@link BasicDBList} into a {@link Sphere}. |
|
|
|
|
* Converts a {@link Document} into a {@link Sphere}. |
|
|
|
|
* |
|
|
|
|
* @author Thomas Darimont |
|
|
|
|
* @since 1.5 |
|
|
|
|
*/ |
|
|
|
|
@ReadingConverter |
|
|
|
|
static enum DocumentToSphereConverter implements Converter<Document, Sphere> { |
|
|
|
|
enum DocumentToSphereConverter implements Converter<Document, Sphere> { |
|
|
|
|
|
|
|
|
|
INSTANCE; |
|
|
|
|
|
|
|
|
|
@ -349,12 +349,12 @@ abstract class GeoConverters {
@@ -349,12 +349,12 @@ abstract class GeoConverters {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Converts a {@link Polygon} into a {@link BasicDBList}. |
|
|
|
|
* Converts a {@link Polygon} into a {@link Document}. |
|
|
|
|
* |
|
|
|
|
* @author Thomas Darimont |
|
|
|
|
* @since 1.5 |
|
|
|
|
*/ |
|
|
|
|
static enum PolygonToDocumentConverter implements Converter<Polygon, Document> { |
|
|
|
|
enum PolygonToDocumentConverter implements Converter<Polygon, Document> { |
|
|
|
|
|
|
|
|
|
INSTANCE; |
|
|
|
|
|
|
|
|
|
@ -370,7 +370,7 @@ abstract class GeoConverters {
@@ -370,7 +370,7 @@ abstract class GeoConverters {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
List<Point> points = source.getPoints(); |
|
|
|
|
List<Document> pointTuples = new ArrayList<Document>(points.size()); |
|
|
|
|
List<Document> pointTuples = new ArrayList<>(points.size()); |
|
|
|
|
|
|
|
|
|
for (Point point : points) { |
|
|
|
|
pointTuples.add(PointToDocumentConverter.INSTANCE.convert(point)); |
|
|
|
|
@ -383,13 +383,13 @@ abstract class GeoConverters {
@@ -383,13 +383,13 @@ abstract class GeoConverters {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Converts a {@link BasicDBList} into a {@link Polygon}. |
|
|
|
|
* Converts a {@link Document} into a {@link Polygon}. |
|
|
|
|
* |
|
|
|
|
* @author Thomas Darimont |
|
|
|
|
* @since 1.5 |
|
|
|
|
*/ |
|
|
|
|
@ReadingConverter |
|
|
|
|
static enum DocumentToPolygonConverter implements Converter<Document, Polygon> { |
|
|
|
|
enum DocumentToPolygonConverter implements Converter<Document, Polygon> { |
|
|
|
|
|
|
|
|
|
INSTANCE; |
|
|
|
|
|
|
|
|
|
@ -406,7 +406,7 @@ abstract class GeoConverters {
@@ -406,7 +406,7 @@ abstract class GeoConverters {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
List<Document> points = (List<Document>) source.get("points"); |
|
|
|
|
List<Point> newPoints = new ArrayList<Point>(points.size()); |
|
|
|
|
List<Point> newPoints = new ArrayList<>(points.size()); |
|
|
|
|
|
|
|
|
|
for (Document element : points) { |
|
|
|
|
|
|
|
|
|
@ -419,12 +419,12 @@ abstract class GeoConverters {
@@ -419,12 +419,12 @@ abstract class GeoConverters {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Converts a {@link Sphere} into a {@link BasicDBList}. |
|
|
|
|
* Converts a {@link Sphere} into a {@link Document}. |
|
|
|
|
* |
|
|
|
|
* @author Thomas Darimont |
|
|
|
|
* @since 1.5 |
|
|
|
|
*/ |
|
|
|
|
static enum GeoCommandToDocumentConverter implements Converter<GeoCommand, Document> { |
|
|
|
|
enum GeoCommandToDocumentConverter implements Converter<GeoCommand, Document> { |
|
|
|
|
|
|
|
|
|
INSTANCE; |
|
|
|
|
|
|
|
|
|
@ -484,7 +484,7 @@ abstract class GeoConverters {
@@ -484,7 +484,7 @@ abstract class GeoConverters {
|
|
|
|
|
* @since 1.7 |
|
|
|
|
*/ |
|
|
|
|
@SuppressWarnings("rawtypes") |
|
|
|
|
static enum GeoJsonToDocumentConverter implements Converter<GeoJson, Document> { |
|
|
|
|
enum GeoJsonToDocumentConverter implements Converter<GeoJson, Document> { |
|
|
|
|
|
|
|
|
|
INSTANCE; |
|
|
|
|
|
|
|
|
|
@ -547,7 +547,7 @@ abstract class GeoConverters {
@@ -547,7 +547,7 @@ abstract class GeoConverters {
|
|
|
|
|
* @author Christoph Strobl |
|
|
|
|
* @since 1.7 |
|
|
|
|
*/ |
|
|
|
|
static enum GeoJsonPointToDocumentConverter implements Converter<GeoJsonPoint, Document> { |
|
|
|
|
enum GeoJsonPointToDocumentConverter implements Converter<GeoJsonPoint, Document> { |
|
|
|
|
|
|
|
|
|
INSTANCE; |
|
|
|
|
|
|
|
|
|
@ -565,7 +565,7 @@ abstract class GeoConverters {
@@ -565,7 +565,7 @@ abstract class GeoConverters {
|
|
|
|
|
* @author Christoph Strobl |
|
|
|
|
* @since 1.7 |
|
|
|
|
*/ |
|
|
|
|
static enum GeoJsonPolygonToDocumentConverter implements Converter<GeoJsonPolygon, Document> { |
|
|
|
|
enum GeoJsonPolygonToDocumentConverter implements Converter<GeoJsonPolygon, Document> { |
|
|
|
|
|
|
|
|
|
INSTANCE; |
|
|
|
|
|
|
|
|
|
@ -583,7 +583,7 @@ abstract class GeoConverters {
@@ -583,7 +583,7 @@ abstract class GeoConverters {
|
|
|
|
|
* @author Christoph Strobl |
|
|
|
|
* @since 1.7 |
|
|
|
|
*/ |
|
|
|
|
static enum DocumentToGeoJsonPointConverter implements Converter<Document, GeoJsonPoint> { |
|
|
|
|
enum DocumentToGeoJsonPointConverter implements Converter<Document, GeoJsonPoint> { |
|
|
|
|
|
|
|
|
|
INSTANCE; |
|
|
|
|
|
|
|
|
|
@ -611,7 +611,7 @@ abstract class GeoConverters {
@@ -611,7 +611,7 @@ abstract class GeoConverters {
|
|
|
|
|
* @author Christoph Strobl |
|
|
|
|
* @since 1.7 |
|
|
|
|
*/ |
|
|
|
|
static enum DocumentToGeoJsonPolygonConverter implements Converter<Document, GeoJsonPolygon> { |
|
|
|
|
enum DocumentToGeoJsonPolygonConverter implements Converter<Document, GeoJsonPolygon> { |
|
|
|
|
|
|
|
|
|
INSTANCE; |
|
|
|
|
|
|
|
|
|
@ -656,7 +656,7 @@ abstract class GeoConverters {
@@ -656,7 +656,7 @@ abstract class GeoConverters {
|
|
|
|
|
String.format("Cannot convert type '%s' to MultiPolygon.", source.get("type"))); |
|
|
|
|
|
|
|
|
|
List dbl = (List) source.get("coordinates"); |
|
|
|
|
List<GeoJsonPolygon> polygones = new ArrayList<GeoJsonPolygon>(); |
|
|
|
|
List<GeoJsonPolygon> polygones = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
for (Object polygon : dbl) { |
|
|
|
|
polygones.add(toGeoJsonPolygon((List) polygon)); |
|
|
|
|
@ -670,7 +670,7 @@ abstract class GeoConverters {
@@ -670,7 +670,7 @@ abstract class GeoConverters {
|
|
|
|
|
* @author Christoph Strobl |
|
|
|
|
* @since 1.7 |
|
|
|
|
*/ |
|
|
|
|
static enum DocumentToGeoJsonLineStringConverter implements Converter<Document, GeoJsonLineString> { |
|
|
|
|
enum DocumentToGeoJsonLineStringConverter implements Converter<Document, GeoJsonLineString> { |
|
|
|
|
|
|
|
|
|
INSTANCE; |
|
|
|
|
|
|
|
|
|
@ -698,7 +698,7 @@ abstract class GeoConverters {
@@ -698,7 +698,7 @@ abstract class GeoConverters {
|
|
|
|
|
* @author Christoph Strobl |
|
|
|
|
* @since 1.7 |
|
|
|
|
*/ |
|
|
|
|
static enum DocumentToGeoJsonMultiPointConverter implements Converter<Document, GeoJsonMultiPoint> { |
|
|
|
|
enum DocumentToGeoJsonMultiPointConverter implements Converter<Document, GeoJsonMultiPoint> { |
|
|
|
|
|
|
|
|
|
INSTANCE; |
|
|
|
|
|
|
|
|
|
@ -726,7 +726,7 @@ abstract class GeoConverters {
@@ -726,7 +726,7 @@ abstract class GeoConverters {
|
|
|
|
|
* @author Christoph Strobl |
|
|
|
|
* @since 1.7 |
|
|
|
|
*/ |
|
|
|
|
static enum DocumentToGeoJsonMultiLineStringConverter implements Converter<Document, GeoJsonMultiLineString> { |
|
|
|
|
enum DocumentToGeoJsonMultiLineStringConverter implements Converter<Document, GeoJsonMultiLineString> { |
|
|
|
|
|
|
|
|
|
INSTANCE; |
|
|
|
|
|
|
|
|
|
@ -800,7 +800,7 @@ abstract class GeoConverters {
@@ -800,7 +800,7 @@ abstract class GeoConverters {
|
|
|
|
|
@SuppressWarnings("unchecked") |
|
|
|
|
static List<Point> toListOfPoint(List listOfCoordinatePairs) { |
|
|
|
|
|
|
|
|
|
List<Point> points = new ArrayList<Point>(); |
|
|
|
|
List<Point> points = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
for (Object point : listOfCoordinatePairs) { |
|
|
|
|
|
|
|
|
|
|