org.geolatte.geom.codec.MySqlWkbDialect Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of geolatte-geom Show documentation
Show all versions of geolatte-geom Show documentation
This geoLatte-geom library offers a geometry model that conforms to the OGC Simple Features for SQL
specification.
The newest version!
package org.geolatte.geom.codec;
import org.geolatte.geom.AbstractGeometryCollection;
import org.geolatte.geom.ByteBuffer;
import org.geolatte.geom.Geometry;
import org.geolatte.geom.Position;
class MySqlWkbDialect extends Sfa110WkbDialect {
final public static WkbDialect INSTANCE = new MySqlWkbDialect();
@Override
protected int extraHeaderSize(Geometry
geom) {
return 4;
}
@Override
protected
int sizeEmptyGeometry(Geometry
geometry) {
return ByteBuffer.UINT_SIZE;
}
private
boolean hasEmpty(Geometry
geometry) {
if (geometry.isEmpty()) {
return true;
}
if (geometry instanceof AbstractGeometryCollection) {
for (Geometry
part : (AbstractGeometryCollection
) geometry) {
if (hasEmpty(part)) return true;
}
}
return false;
}
}