/** Write an Array of "full" Geometries */ private int estimateGeometryArray(Geometry[] container) { int result = 0; for (int i = 0; i < container.length; i++) { result += estimateBytes(container[i]); } return result; }
/** Write an Array of "full" Geometries */ private int estimateGeometryArray(Geometry[] container) { int result = 0; for (int i = 0; i < container.length; i++) { result += estimateBytes(container[i]); } return result; }
private int estimateMultiPoint(MultiPoint geom) { // int size int result = 4; if (geom.numPoints() > 0) { // We can shortcut here, as all subgeoms have the same fixed size result += geom.numPoints() * estimateBytes(geom.getFirstPoint()); } return result; }
private int estimateMultiPoint(MultiPoint geom) { // int size int result = 4; if (geom.numPoints() > 0) { // We can shortcut here, as all subgeoms have the same fixed size result += geom.numPoints() * estimateBytes(geom.getFirstPoint()); } return result; }
/** * Write a hex encoded geometry * * Is synchronized to protect offset counter. (Unfortunately, Java does not * have neither call by reference nor multiple return values.) This is a * TODO item. * * The geometry you put in must be consistent, geom.checkConsistency() must * return true. If not, the result may be invalid WKB. * * @see Geometry#checkConsistency() the consistency checker * * @param geom the geometry to be written * @param REP endianness to write the bytes with * @return String containing the hex encoded geometry */ public synchronized String writeHexed(Geometry geom, byte REP) { int length = estimateBytes(geom); ByteSetter.StringByteSetter bytes = new ByteSetter.StringByteSetter(length); writeGeometry(geom, valueSetterForEndian(bytes, REP)); return bytes.result(); }
/** * Write a binary encoded geometry. * * Is synchronized to protect offset counter. (Unfortunately, Java does not * have neither call by reference nor multiple return values.) This is a * TODO item. * * The geometry you put in must be consistent, geom.checkConsistency() must * return true. If not, the result may be invalid WKB. * * @see Geometry#checkConsistency() * * @param geom the geometry to be written * @param REP endianness to write the bytes with * @return byte array containing the encoded geometry */ public synchronized byte[] writeBinary(Geometry geom, byte REP) { int length = estimateBytes(geom); ByteSetter.BinaryByteSetter bytes = new ByteSetter.BinaryByteSetter(length); writeGeometry(geom, valueSetterForEndian(bytes, REP)); return bytes.result(); }
/** * Write a binary encoded geometry. * * Is synchronized to protect offset counter. (Unfortunately, Java does not * have neither call by reference nor multiple return values.) This is a * TODO item. * * The geometry you put in must be consistent, geom.checkConsistency() must * return true. If not, the result may be invalid WKB. * * @see Geometry#checkConsistency() * * @param geom the geometry to be written * @param REP endianness to write the bytes with * @return byte array containing the encoded geometry */ public synchronized byte[] writeBinary(Geometry geom, byte REP) { int length = estimateBytes(geom); ByteSetter.BinaryByteSetter bytes = new ByteSetter.BinaryByteSetter(length); writeGeometry(geom, valueSetterForEndian(bytes, REP)); return bytes.result(); }
/** * Write a hex encoded geometry * * Is synchronized to protect offset counter. (Unfortunately, Java does not * have neither call by reference nor multiple return values.) This is a * TODO item. * * The geometry you put in must be consistent, geom.checkConsistency() must * return true. If not, the result may be invalid WKB. * * @see Geometry#checkConsistency() the consistency checker * * @param geom the geometry to be written * @param REP endianness to write the bytes with * @return String containing the hex encoded geometry */ public synchronized String writeHexed(Geometry geom, byte REP) { int length = estimateBytes(geom); ByteSetter.StringByteSetter bytes = new ByteSetter.StringByteSetter(length); writeGeometry(geom, valueSetterForEndian(bytes, REP)); return bytes.result(); }