/** * Parse an Array of "slim" Points (without endianness and type, part of * LinearRing and Linestring, but not MultiPoint! * * @param data ValueGetter containing the value to be parsed * @param haveZ flag indicating if Z values exist * @param haveM flag indicating if M values exist * @param path GeneralPath to provide the parsed value to */ private void parseCS(ValueGetter data, boolean haveZ, boolean haveM, GeneralPath path) { int count = data.getInt(); if (count > 0) { path.moveTo((float) data.getDouble(), (float) data.getDouble()); skipZM(data, haveZ, haveM); for (int i = 1; i < count; i++) { path.lineTo((float) data.getDouble(), (float) data.getDouble()); skipZM(data, haveZ, haveM); } } }
public long getLong() { long res = getLong(position); position += 8; return res; }
public int getInt() { int res = getInt(position); position += 4; return res; }
public int getInt() { int res = getInt(position); position += 4; return res; }
byte endian = data.getByte(); // skip and test endian flag if (endian != data.endian) { throw new IllegalArgumentException("Endian inconsistency!"); int typeword = data.getInt(); int newsrid = org.postgis.Geometry.parseSRID(data.getInt()); if (inheritSrid && newsrid != srid) { throw new IllegalArgumentException("Inconsistent srids in complex geometry: " + srid + ", " + newsrid);
private void parseCollection(ValueGetter data, GeneralPath path) { int count = data.getInt(); parseGeometryArray(data, count, path); } }
byte endian = data.getByte(); if (endian != data.endian) { throw new IllegalArgumentException("Endian inconsistency!"); } else { int typeword = data.getInt(); int realtype = typeword & 536870911; boolean haveZ = (typeword & -2147483648) != 0; boolean haveS = (typeword & 536870912) != 0; if (haveS) { int newsrid = org.postgis.Geometry.parseSRID(data.getInt()); if (inheritSrid && newsrid != srid) { throw new IllegalArgumentException("Inconsistent srids in complex geometry: " + srid + ", " + newsrid);
/** * Parse an Array of "slim" Points (without endianness and type, part of * LinearRing and Linestring, but not MultiPoint! * * @param haveZ * @param haveM */ private CoordinateSequence parseCS(ValueGetter data, boolean haveZ, boolean haveM) { int count = data.getInt(); int dims = haveZ ? 3 : 2; CoordinateSequence cs = new PackedCoordinateSequence.Double(count, dims); for (int i = 0; i < count; i++) { for (int d = 0; d < dims; d++) { cs.setOrdinate(i, d, data.getDouble()); } if (haveM) { // skip M value data.getDouble(); } } return cs; }
private Point parsePoint(ValueGetter data, boolean haveZ, boolean haveM) { double X = data.getDouble(); double Y = data.getDouble(); Point result; if (haveZ) { double Z = data.getDouble(); result = new Point(X, Y, Z); } else { result = new Point(X, Y); } if (haveM) { result.setM(data.getDouble()); } return result; }
public long getLong() { long res = getLong(position); position += 8; return res; }
private void parseMultiLineString(ValueGetter data, GeneralPath path) { int count = data.getInt(); parseGeometryArray(data, count, path); }
/** * Parse the given {@link org.postgis.binary.ValueGetter} into a JTS * {@link org.locationtech.jts.geom.CoordinateSequence}. * * @param data {@link org.postgis.binary.ValueGetter} to parse. * @param haveZ True if the {@link org.locationtech.jts.geom.CoordinateSequence} has a Z component. * @param haveM True if the {@link org.locationtech.jts.geom.CoordinateSequence} has a M component. * * @return The parsed {@link org.locationtech.jts.geom.CoordinateSequence}. */ private CoordinateSequence parseCS(ValueGetter data, boolean haveZ, boolean haveM) { int count = data.getInt(); int dims = haveZ ? 3 : 2; CoordinateSequence cs = new Double(count, dims); for(int i = 0; i < count; ++i) { for(int d = 0; d < dims; ++d) { cs.setOrdinate(i, d, data.getDouble()); } if (haveM) { data.getDouble(); } } return cs; }
private Point parsePoint(ValueGetter data, boolean haveZ, boolean haveM) { double X = data.getDouble(); double Y = data.getDouble(); Point result; if (haveZ) { double Z = data.getDouble(); result = new Point(X, Y, Z); } else { result = new Point(X, Y); } if (haveM) { result.setM(data.getDouble()); } return result; }
/** * Get a double. * * @return the double value */ public double getDouble() { long bitrep = getLong(); return Double.longBitsToDouble(bitrep); }
private void parseMultiPolygon(ValueGetter data, GeneralPath path) { int count = data.getInt(); parseGeometryArray(data, count, path); }