protected int getGeometryType(Geometry geometry) {
   WkbGeometryType type = WkbGeometryType.forClass(geometry.getClass());
   if (type == null)
     throw new UnsupportedConversionException(
         String.format(
             "Can't convert geometries of type %s", geometry.getClass().getCanonicalName()));
   return type.getTypeCode();
 }
Esempio n. 2
0
 protected int getGeometryType(Geometry<P> geometry) {
   // empty geometries have the same representation as an empty geometry collection
   if (geometry.isEmpty()) {
     return WkbGeometryType.GEOMETRY_COLLECTION.getTypeCode();
   }
   WkbGeometryType type = WkbGeometryType.forClass(geometry.getClass());
   if (type == null) {
     throw new UnsupportedConversionException(
         String.format(
             "Can't convert geometries of type %s", geometry.getClass().getCanonicalName()));
   }
   return type.getTypeCode();
 }