public Object read(ByteBuffer buffer, ShapeType type, boolean flatGeometry) { if (type == ShapeType.NULL) { return createNull(); } int dimension = shapeType == ShapeType.POINTZ && !flatGeometry ? 3 : 2; CoordinateSequence cs = JTS.createCS(geometryFactory.getCoordinateSequenceFactory(), 1, dimension); cs.setOrdinate(0, 0, buffer.getDouble()); cs.setOrdinate(0, 1, buffer.getDouble()); if (shapeType == ShapeType.POINTM) { buffer.getDouble(); } if (dimension > 2) { cs.setOrdinate(0, 2, buffer.getDouble()); } return geometryFactory.createPoint(cs); }
public Object read(ByteBuffer buffer, ShapeType type) { if (type == ShapeType.NULL) { return createNull(); } double x = buffer.getDouble(); double y = buffer.getDouble(); double z = Double.NaN; if (shapeType == ShapeType.POINTM) { buffer.getDouble(); } if (shapeType == ShapeType.POINTZ) { z = buffer.getDouble(); } return geometryFactory.createPoint(new Coordinate(x, y, z)); }
public Object read(ByteBuffer buffer, ShapeType type, boolean flatGeometry) { if (type == ShapeType.NULL) { return createNull(); } int dimension = shapeType == ShapeType.POINTZ && !flatGeometry ? 3 : 2; CoordinateSequence cs = geometryFactory.getCoordinateSequenceFactory().create(1, dimension); cs.setOrdinate(0, 0, buffer.getDouble()); cs.setOrdinate(0, 1, buffer.getDouble()); if (shapeType == ShapeType.POINTM) { buffer.getDouble(); } if (dimension > 2) { cs.setOrdinate(0, 2, buffer.getDouble()); } return geometryFactory.createPoint(cs); }
public Object read(ByteBuffer buffer, ShapeType type, boolean flatGeometry) { if (type == ShapeType.NULL) { return createNull(); } int dimension = shapeType == ShapeType.POINTZ && !flatGeometry ? 3 : 2; CoordinateSequence cs = geometryFactory.getCoordinateSequenceFactory().create(1, dimension); cs.setOrdinate(0, 0, buffer.getDouble()); cs.setOrdinate(0, 1, buffer.getDouble()); if (shapeType == ShapeType.POINTM) { buffer.getDouble(); } if (dimension > 2) { cs.setOrdinate(0, 2, buffer.getDouble()); } return geometryFactory.createPoint(cs); }