-
Notifications
You must be signed in to change notification settings - Fork 982
/
PointZShape.java
51 lines (39 loc) · 1.69 KB
/
PointZShape.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package org.nocrala.tools.gis.data.esri.shapefile.shape.shapes;
import org.nocrala.tools.gis.data.esri.shapefile.ValidationPreferences;
import org.nocrala.tools.gis.data.esri.shapefile.exception.InvalidShapeFileException;
import org.nocrala.tools.gis.data.esri.shapefile.shape.Const;
import org.nocrala.tools.gis.data.esri.shapefile.shape.ShapeHeader;
import org.nocrala.tools.gis.data.esri.shapefile.shape.ShapeType;
import org.nocrala.tools.gis.data.esri.shapefile.util.ISUtil;
import java.io.IOException;
import java.io.InputStream;
/**
* Represents a PointZ Shape object, as defined by the ESRI Shape file
* specification.
*/
public class PointZShape extends AbstractPointShape {
private static final int FIXED_CONTENT_LENGTH = (4 + 8 + 8 + 8 + 8) / 2;
private double z;
private double m;
public PointZShape(final ShapeHeader shapeHeader, final ShapeType shapeType,
final InputStream is, final ValidationPreferences rules)
throws IOException, InvalidShapeFileException {
super(shapeHeader, shapeType, is, rules);
if (!rules.isAllowBadContentLength()
&& this.header.getContentLength() != FIXED_CONTENT_LENGTH) {
throw new InvalidShapeFileException(
"Invalid PointZ shape header's content length. " + "Expected "
+ FIXED_CONTENT_LENGTH + " 16-bit words but found "
+ this.header.getContentLength() + ". " + Const.PREFERENCES);
}
this.z = ISUtil.readLeDouble(is);
this.m = ISUtil.readLeDouble(is);
}
// Getters
public double getZ() {
return z;
}
public double getM() {
return m;
}
}