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 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 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 ILineString ParseWkbLineString(byte[] blob, ref int offset, IGeometryFactory factory, ReadCoordinatesFunction readCoordinates, GaiaImport gaiaImport)
 {
     return(ParseWkbLineString(blob, ref offset, factory, factory.CreateLineString, readCoordinates,
                               gaiaImport));
 }
        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 IPoint ParseWkbPoint(byte[] blob, ref int offset, IGeometryFactory factory, ReadCoordinatesFunction readCoordinates, GaiaImport gaiaImport)
 {
     return(factory.CreatePoint(readCoordinates(blob, ref offset, 1, gaiaImport, factory.CoordinateSequenceFactory, factory.PrecisionModel)));
 }
        private static IMultiPoint ParseWkbMultiPoint(byte[] blob, ref int offset, IGeometryFactory factory, ReadCoordinatesFunction readCoordinates, GaiaImport gaiaImport)
        {
            var getInt32  = gaiaImport.GetInt32;
            var getDouble = gaiaImport.GetDouble;

            var number = getInt32(blob, ref offset);
            var coords = new Coordinate[number];

            for (var i = 0; i < number; i++)
            {
                if (blob[offset++] != (byte)GaiaGeoBlobMark.GAIA_MARK_ENTITY)
                {
                    throw new Exception();
                }

                var gt = getInt32(blob, ref offset);
                if (ToBaseGeometryType((GaiaGeoGeometry)gt) != GaiaGeoGeometry.GAIA_POINT)
                {
                    throw new Exception();
                }

                coords[i] = new Coordinate(getDouble(blob, ref offset),
                                           getDouble(blob, ref offset));
                if (gaiaImport.HasZ)
                {
                    coords[i].Z = getDouble(blob, ref offset);
                }
                if (gaiaImport.HasM)
                {
                    /*coords[i].M =*/
                    getDouble(blob, ref offset);
                }
            }
            return(factory.CreateMultiPoint(coords));
        }
Exemplo n.º 8
0
        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);
        }
Exemplo n.º 9
0
        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);
        }
Exemplo n.º 10
0
        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);
        }
Exemplo n.º 11
0
 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);
 }
Exemplo n.º 12
0
 private static ILineString ParseWkbLineString(byte[] blob, ref int offset, IGeometryFactory factory, ReadCoordinatesFunction readCoordinates, GaiaImport gaiaImport)
 {
     return ParseWkbLineString(blob, ref offset, factory, factory.CreateLineString, readCoordinates,
                               gaiaImport);
 }
Exemplo n.º 13
0
        private static IMultiPoint ParseWkbMultiPoint(byte[] blob, ref int offset, IGeometryFactory factory, ReadCoordinatesFunction readCoordinates, GaiaImport gaiaImport)
        {
            var getInt32 = gaiaImport.GetInt32;
            var getDouble = gaiaImport.GetDouble;

            var number = getInt32(blob, ref offset);
            var coords = new Coordinate[number];
            for (var i = 0; i < number; i++)
            {
                if (blob[offset++] != (byte)GaiaGeoBlobMark.GAIA_MARK_ENTITY)
                    throw new Exception();

                var gt = getInt32(blob, ref offset);
                if (ToBaseGeometryType((GaiaGeoGeometry)gt) != GaiaGeoGeometry.GAIA_POINT)
                    throw new Exception();

                coords[i] = new Coordinate(getDouble(blob, ref offset),
                                           getDouble(blob, ref offset));
                if (gaiaImport.HasZ)
                    coords[i].Z = getDouble(blob, ref offset);
                if (gaiaImport.HasM)
                    /*coords[i].M =*/
                    getDouble(blob, ref offset);
            }
            return factory.CreateMultiPoint(coords);
        }
Exemplo n.º 14
0
 private static IPoint ParseWkbPoint(byte[] blob, ref int offset, IGeometryFactory factory, ReadCoordinatesFunction readCoordinates, GaiaImport gaiaImport)
 {
     return factory.CreatePoint(readCoordinates(blob, ref offset, 1, gaiaImport, factory.CoordinateSequenceFactory, factory.PrecisionModel));
 }