Skip to content

Commit d5bede7

Browse files
committed
allow z and m values to be manually changed
1 parent fde1ce2 commit d5bede7

1 file changed

Lines changed: 40 additions & 2 deletions

File tree

src/main/java/mil/nga/sf/Geometry.java

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ public abstract class Geometry implements Serializable {
2525
/**
2626
* Has z coordinates
2727
*/
28-
private final boolean hasZ;
28+
private boolean hasZ;
2929

3030
/**
3131
* Has m values
3232
*/
33-
private final boolean hasM;
33+
private boolean hasM;
3434

3535
/**
3636
* Constructor
@@ -66,6 +66,17 @@ public boolean hasZ() {
6666
return hasZ;
6767
}
6868

69+
/**
70+
* Set if the geometry has z coordinates
71+
*
72+
* @param hasZ
73+
* true if has z coordinates
74+
* @since 2.0.3
75+
*/
76+
public void setHasZ(boolean hasZ) {
77+
this.hasZ = hasZ;
78+
}
79+
6980
/**
7081
* Does the geometry have z coordinates
7182
*
@@ -85,6 +96,33 @@ public boolean hasM() {
8596
return hasM;
8697
}
8798

99+
/**
100+
* Set if the geometry has m coordinates
101+
*
102+
* @param hasM
103+
* true if has m coordinates
104+
* @since 2.0.3
105+
*/
106+
public void setHasM(boolean hasM) {
107+
this.hasM = hasM;
108+
}
109+
110+
/**
111+
* Update currently false hasZ and hasM values using the provided geometry
112+
*
113+
* @param geometry
114+
* geometry
115+
* @since 2.0.3
116+
*/
117+
protected void updateZM(Geometry geometry) {
118+
if (!hasZ()) {
119+
setHasZ(geometry.hasZ());
120+
}
121+
if (!hasM()) {
122+
setHasM(geometry.hasM());
123+
}
124+
}
125+
88126
/**
89127
* Does the geometry have m coordinates.
90128
*

0 commit comments

Comments
 (0)