private static IMultiLineString ParseWkbMultiLineString(byte[] blob, ref int offset, IGeometryFactory factory, ReadCoordinatesFunction readCoordinates, GaiaImport gaiaImport) { int number = gaiaImport.GetInt32(blob, ref offset); var lineStrings = new ILineString[number]; for (var i = 0; i < number; i++) { if (blob[offset++] != (byte)GaiaGeoBlobMark.GAIA_MARK_ENTITY) { throw new Exception(); } var gt = gaiaImport.GetInt32(blob, ref offset); if (ToBaseGeometryType((GaiaGeoGeometry)gt) != GaiaGeoGeometry.GAIA_LINESTRING) { throw new Exception(); } //Since Uncompressed MultiGeom can contain compressed we need to set it here also readCoordinates = SetReadCoordinatesFunction(gaiaImport, (GaiaGeoGeometry)gt); lineStrings[i] = ParseWkbLineString(blob, ref offset, factory, factory.CreateLineString, readCoordinates, gaiaImport); } return(factory.CreateMultiLineString(lineStrings)); }
private static IGeometry ParseWkbMultiPolygon(byte[] blob, ref int offset, IGeometryFactory factory, ReadCoordinatesFunction readCoordinates, GaiaImport gaiaImport) { var number = gaiaImport.GetInt32(blob, ref offset); var polygons = new IPolygon[number]; for (var i = 0; i < number; i++) { if (blob[offset++] != (byte)GaiaGeoBlobMark.GAIA_MARK_ENTITY) { throw new Exception(); } var gt = gaiaImport.GetInt32(blob, ref offset); if (ToBaseGeometryType((GaiaGeoGeometry)gt) != GaiaGeoGeometry.GAIA_POLYGON) { throw new Exception(); } //Since Uncompressed MultiGeom can contain compressed we need to set it here also readCoordinates = SetReadCoordinatesFunction(gaiaImport, (GaiaGeoGeometry)gt); polygons[i] = ParseWkbPolygon(blob, ref offset, factory, readCoordinates, gaiaImport); } return(factory.CreateMultiPolygon(polygons)); }
private static IGeometryCollection ParseWkbGeometryCollection(byte[] blob, ref int offset, IGeometryFactory factory, GaiaImport gaiaImport) { var number = gaiaImport.GetInt32(blob, ref offset); var geometries = new IGeometry[number]; for (var i = 0; i < number; i++) { if (blob[offset++] != (byte)GaiaGeoBlobMark.GAIA_MARK_ENTITY) { throw new Exception(); } geometries[i] = ParseWkbGeometry((GaiaGeoGeometry)gaiaImport.GetInt32(blob, ref offset), blob, ref offset, factory, gaiaImport); } return(factory.CreateGeometryCollection(geometries)); }
private static ILineString ParseWkbLineString(byte[] blob, ref int offset, IGeometryFactory factory, CreateLineStringFunction createLineStringFunction, ReadCoordinatesFunction readCoordinates, GaiaImport gaiaImport) { var number = gaiaImport.GetInt32(blob, ref offset); var sequence = readCoordinates(blob, ref offset, number, gaiaImport, factory.CoordinateSequenceFactory, factory.PrecisionModel); return(createLineStringFunction(sequence)); }
private static IPolygon ParseWkbPolygon(byte[] blob, ref int offset, IGeometryFactory factory, ReadCoordinatesFunction readCoordinates, GaiaImport gaiaImport) { var number = gaiaImport.GetInt32(blob, ref offset) - 1; var shell = (ILinearRing)ParseWkbLineString(blob, ref offset, factory, factory.CreateLinearRing, readCoordinates, gaiaImport); var holes = new ILinearRing[number]; for (var i = 0; i < number; i++) { holes[i] = (ILinearRing)ParseWkbLineString(blob, ref offset, factory, factory.CreateLinearRing, readCoordinates, gaiaImport); } return(factory.CreatePolygon(shell, holes)); }
private static IGeometryCollection ParseWkbGeometryCollection(byte[] blob, ref int offset, IGeometryFactory factory, GaiaImport gaiaImport) { var number = gaiaImport.GetInt32(blob, ref offset); var geometries = new IGeometry[number]; for (var i = 0; i < number; i++) { if (blob[offset++] != (byte)GaiaGeoBlobMark.GAIA_MARK_ENTITY) throw new Exception(); geometries[i] = ParseWkbGeometry((GaiaGeoGeometry)gaiaImport.GetInt32(blob, ref offset), blob, ref offset, factory, gaiaImport); } return factory.CreateGeometryCollection(geometries); }
private static IGeometry ParseWkbMultiPolygon(byte[] blob, ref int offset, IGeometryFactory factory, ReadCoordinatesFunction readCoordinates, GaiaImport gaiaImport) { var number = gaiaImport.GetInt32(blob, ref offset); var polygons = new IPolygon[number]; for (var i = 0; i < number; i++) { if (blob[offset++] != (byte)GaiaGeoBlobMark.GAIA_MARK_ENTITY) throw new Exception(); var gt = gaiaImport.GetInt32(blob, ref offset); if (ToBaseGeometryType((GaiaGeoGeometry)gt) != GaiaGeoGeometry.GAIA_POLYGON) throw new Exception(); //Since Uncompressed MultiGeom can contain compressed we need to set it here also readCoordinates = SetReadCoordinatesFunction(gaiaImport, (GaiaGeoGeometry)gt); polygons[i] = ParseWkbPolygon(blob, ref offset, factory, readCoordinates, gaiaImport); } return factory.CreateMultiPolygon(polygons); }
private static IPolygon ParseWkbPolygon(byte[] blob, ref int offset, IGeometryFactory factory, ReadCoordinatesFunction readCoordinates, GaiaImport gaiaImport) { var number = gaiaImport.GetInt32(blob, ref offset) - 1; var shell = (ILinearRing)ParseWkbLineString(blob, ref offset, factory, factory.CreateLinearRing, readCoordinates, gaiaImport); var holes = new ILinearRing[number]; for (var i = 0; i < number; i++) holes[i] = (ILinearRing)ParseWkbLineString(blob, ref offset, factory, factory.CreateLinearRing, readCoordinates, gaiaImport); return factory.CreatePolygon(shell, holes); }
private static IMultiLineString ParseWkbMultiLineString(byte[] blob, ref int offset, IGeometryFactory factory, ReadCoordinatesFunction readCoordinates, GaiaImport gaiaImport) { int number = gaiaImport.GetInt32(blob, ref offset); var lineStrings = new ILineString[number]; for (var i = 0; i < number; i++) { if (blob[offset++] != (byte)GaiaGeoBlobMark.GAIA_MARK_ENTITY) throw new Exception(); var gt = gaiaImport.GetInt32(blob, ref offset); if (ToBaseGeometryType((GaiaGeoGeometry)gt) != GaiaGeoGeometry.GAIA_LINESTRING) throw new Exception(); //Since Uncompressed MultiGeom can contain compressed we need to set it here also readCoordinates = SetReadCoordinatesFunction(gaiaImport, (GaiaGeoGeometry)gt); lineStrings[i] = ParseWkbLineString(blob, ref offset, factory, factory.CreateLineString, readCoordinates, gaiaImport); } return factory.CreateMultiLineString(lineStrings); }
private static ILineString ParseWkbLineString(byte[] blob, ref int offset, IGeometryFactory factory, CreateLineStringFunction createLineStringFunction, ReadCoordinatesFunction readCoordinates, GaiaImport gaiaImport) { var number = gaiaImport.GetInt32(blob, ref offset); var sequence = readCoordinates(blob, ref offset, number, gaiaImport, factory.CoordinateSequenceFactory, factory.PrecisionModel); return createLineStringFunction(sequence); }