diff --git a/src/main/java/datawave/data/type/util/AbstractGeometry.java b/src/main/java/datawave/data/type/util/AbstractGeometry.java index 625cfc0..6532b16 100644 --- a/src/main/java/datawave/data/type/util/AbstractGeometry.java +++ b/src/main/java/datawave/data/type/util/AbstractGeometry.java @@ -1,6 +1,7 @@ package datawave.data.type.util; import java.io.Serializable; +import java.util.Objects; /** * The base GeoWave geometry delegate object, which wraps the underlying JTS geometry @@ -19,7 +20,22 @@ public T getJTSGeometry() { return jtsGeom; } + @Override public String toString() { return jtsGeom.toText(); } + + @Override + public int hashCode() { + return Objects.hashCode(jtsGeom); + } + + @Override + public boolean equals(Object o) { + if (o instanceof Geometry) { + Geometry other = (Geometry) o; + return Objects.equals(jtsGeom, other.jtsGeom); + } + return false; + } } diff --git a/src/main/java/datawave/data/type/util/Geometry.java b/src/main/java/datawave/data/type/util/Geometry.java index 5b0ea6c..63b1abf 100644 --- a/src/main/java/datawave/data/type/util/Geometry.java +++ b/src/main/java/datawave/data/type/util/Geometry.java @@ -12,6 +12,14 @@ public Geometry(org.locationtech.jts.geom.Geometry jtsGeom) { @Override public int compareTo(Geometry o) { - return jtsGeom.compareTo(o.jtsGeom); + if (jtsGeom == o.jtsGeom) { + return 0; + } else if (jtsGeom == null) { + return -1; + } else if (o.jtsGeom == null) { + return 1; + } else { + return jtsGeom.compareTo(o.jtsGeom); + } } }