提交 54b2b09c authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Fix dimension system detection for empty geometries (EWKB and EWKT only)

上级 df4cc289
......@@ -366,6 +366,7 @@ public final class EWKBUtils {
case DIMENSION_SYSTEM_XYM:
useM = true;
}
target.dimensionSystem((useZ ? DIMENSION_SYSTEM_XYZ : 0) | (useM ? DIMENSION_SYSTEM_XYM : 0));
type %= 1_000;
switch (type) {
case POINT:
......
......@@ -715,6 +715,7 @@ public final class EWKTUtils {
type = POLYGON;
break;
}
target.dimensionSystem(dimensionSystem);
switch (type) {
case POINT: {
if (parentType != 0 && parentType != MULTI_POINT && parentType != GEOMETRY_COLLECTION) {
......
......@@ -27,6 +27,15 @@ public final class GeometryUtils {
protected void init(int srid) {
}
/**
* Invoked to add dimension system requirement.
*
* @param dimensionSystem
* dimension system
*/
protected void dimensionSystem(int dimensionSystem) {
}
/**
* Invoked before writing a POINT.
*/
......@@ -238,6 +247,16 @@ public final class GeometryUtils {
public DimensionSystemTarget() {
}
@Override
protected void dimensionSystem(int dimensionSystem) {
if ((dimensionSystem & DIMENSION_SYSTEM_XYZ) != 0) {
hasZ = true;
}
if ((dimensionSystem & DIMENSION_SYSTEM_XYM) != 0) {
hasM = true;
}
}
@Override
protected void addCoordinate(double x, double y, double z, double m, int index, int total) {
if (!hasZ && !Double.isNaN(z)) {
......@@ -288,6 +307,16 @@ public final class GeometryUtils {
public EnvelopeAndDimensionSystemTarget() {
}
@Override
protected void dimensionSystem(int dimensionSystem) {
if ((dimensionSystem & DIMENSION_SYSTEM_XYZ) != 0) {
hasZ = true;
}
if ((dimensionSystem & DIMENSION_SYSTEM_XYM) != 0) {
hasM = true;
}
}
@Override
protected void startPoint() {
enabled = true;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论