case 18: case 28: handler = new MultiPointHandler(this, gf); break; default:
public Object read(ByteBuffer buffer, ShapeType type, boolean flatGeometry) { if (type == ShapeType.NULL) { return createNull(); } // read bounding box (not needed) buffer.position(buffer.position() + 4 * 8); int numpoints = buffer.getInt(); int dimensions = shapeType == shapeType.MULTIPOINTZ && !flatGeometry ? 3 : 2; CoordinateSequence cs = JTS.createCS(geometryFactory.getCoordinateSequenceFactory(), numpoints, dimensions); DoubleBuffer dbuffer = buffer.asDoubleBuffer(); double[] ordinates = new double[numpoints * 2]; dbuffer.get(ordinates); for (int t = 0; t < numpoints; t++) { cs.setOrdinate(t, 0, ordinates[t * 2]); cs.setOrdinate(t, 1, ordinates[t * 2 + 1]); } if (dimensions > 2) { dbuffer.position(dbuffer.position() + 2); dbuffer.get(ordinates, 0, numpoints); for (int t = 0; t < numpoints; t++) { cs.setOrdinate(t, 2, ordinates[t]); // z } } return geometryFactory.createMultiPoint(cs); }
public Object read(ByteBuffer buffer, ShapeType type) { if (type == ShapeType.NULL) { return createNull(); } //read bounding box (not needed) buffer.position( buffer.position() + 4 * 8); int numpoints = buffer.getInt(); Coordinate[] coords = new Coordinate[numpoints]; for (int t = 0; t < numpoints; t++) { double x = buffer.getDouble(); double y = buffer.getDouble(); coords[t] = new Coordinate(x, y); } if (shapeType == ShapeType.MULTIPOINTZ) { buffer.position( buffer.position() + 2 * 8); for (int t = 0; t < numpoints; t++) { coords[t].z = buffer.getDouble(); //z } } return geometryFactory.createMultiPoint(coords); }
/** Each ShapeType corresponds to a handler. In the future this should probably go * else where to allow different handlers, or something... * @throws ShapefileException If the ShapeType is bogus. * @return The correct handler for this ShapeType. Returns a new one. */ public ShapeHandler getShapeHandler() throws ShapefileException { ShapeHandler handler; switch (id) { case 1: case 11: case 21: handler = new PointHandler(this); break; case 3: case 13: case 23: handler = new MultiLineHandler(this); break; case 5: case 15: case 25: handler = new PolygonHandler(this); break; case 8: case 18: case 28: handler = new MultiPointHandler(this); break; default: handler = null; } return handler; }
public Object read(ByteBuffer buffer, ShapeType type, boolean flatGeometry) { if (type == ShapeType.NULL) { return createNull(); } // read bounding box (not needed) buffer.position(buffer.position() + 4 * 8); int numpoints = buffer.getInt(); int dimensions = shapeType == shapeType.MULTIPOINTZ && !flatGeometry ? 3 : 2; CoordinateSequence cs = geometryFactory.getCoordinateSequenceFactory().create(numpoints, dimensions); DoubleBuffer dbuffer = buffer.asDoubleBuffer(); double[] ordinates = new double[numpoints * 2]; dbuffer.get(ordinates); for (int t = 0; t < numpoints; t++) { cs.setOrdinate(t, 0, ordinates[t * 2]); cs.setOrdinate(t, 1, ordinates[t * 2 + 1]); } if (dimensions > 2) { dbuffer.position(dbuffer.position() + 2); dbuffer.get(ordinates, 0, numpoints); for (int t = 0; t < numpoints; t++) { cs.setOrdinate(t, 2, ordinates[t]); // z } } return geometryFactory.createMultiPoint(cs); }
case 18: case 28: handler = new MultiPointHandler(this, gf); break; default:
public Object read(ByteBuffer buffer, ShapeType type, boolean flatGeometry) { if (type == ShapeType.NULL) { return createNull(); } // read bounding box (not needed) buffer.position(buffer.position() + 4 * 8); int numpoints = buffer.getInt(); int dimensions = shapeType == shapeType.MULTIPOINTZ && !flatGeometry ? 3 : 2; CoordinateSequence cs = geometryFactory.getCoordinateSequenceFactory().create(numpoints, dimensions); DoubleBuffer dbuffer = buffer.asDoubleBuffer(); double[] ordinates = new double[numpoints * 2]; dbuffer.get(ordinates); for (int t = 0; t < numpoints; t++) { cs.setOrdinate(t, 0, ordinates[t * 2]); cs.setOrdinate(t, 1, ordinates[t * 2 + 1]); } if (dimensions > 2) { dbuffer.position(dbuffer.position() + 2); dbuffer.get(ordinates, 0, numpoints); for (int t = 0; t < numpoints; t++) { cs.setOrdinate(t, 2, ordinates[t]); // z } } return geometryFactory.createMultiPoint(cs); }
case 18: case 28: handler = new MultiPointHandler(this, gf); break; default: