private static IGeometry ParseWkbGeometry(GaiaGeoGeometry type, byte[] blob, ref int offset, IGeometryFactory factory, GaiaImport gaiaImport)
        {
            var readCoordinates = SetReadCoordinatesFunction(gaiaImport, type);

            switch (ToBaseGeometryType(type))
            {
            case GaiaGeoGeometry.GAIA_POINT:
                return(ParseWkbPoint(blob, ref offset, factory, readCoordinates, gaiaImport));

            case GaiaGeoGeometry.GAIA_MULTIPOINT:
                return(ParseWkbMultiPoint(blob, ref offset, factory, readCoordinates, gaiaImport));

            case GaiaGeoGeometry.GAIA_LINESTRING:
                return(ParseWkbLineString(blob, ref offset, factory, readCoordinates, gaiaImport));

            case GaiaGeoGeometry.GAIA_MULTILINESTRING:
                return(ParseWkbMultiLineString(blob, ref offset, factory, readCoordinates, gaiaImport));

            case GaiaGeoGeometry.GAIA_POLYGON:
                return(ParseWkbPolygon(blob, ref offset, factory, readCoordinates, gaiaImport));

            case GaiaGeoGeometry.GAIA_MULTIPOLYGON:
                return(ParseWkbMultiPolygon(blob, ref offset, factory, readCoordinates, gaiaImport));

            case GaiaGeoGeometry.GAIA_GEOMETRYCOLLECTION:
                return(ParseWkbGeometryCollection(blob, ref offset, factory, gaiaImport));
            }
            return(null);
        }
Esempio n. 2
0
        public void SetGeometryType(GaiaGeoGeometry geometryTypeFlag)
        {
            //Debug.Assert(geometryTypeFlag != GaiaGeoGeometry.GAIA_UNKNOWN);
            //Debug.Assert(geometryTypeFlag > 0);

            var cflag = ((int)geometryTypeFlag);
            if (cflag > 1000000)
            {
                Compressed = true;
                cflag -= 1000000;
            }

            if (cflag > 3000)
                cflag = 3000;
            else if (cflag > 2000)
                cflag = 2000;
            else if (cflag > 1000)
                cflag = 1000;
            else
                cflag = 0;

            CoordinateFlag = cflag | (Compressed ? 1000000 : 0);

            HasZ = (cflag == 1000) || (cflag == 3000);
            HasM = (cflag == 2000) || (cflag == 3000);

            Dimension = GaiaDimensionModels.GAIA_XY;
            if (HasZ) Dimension |= GaiaDimensionModels.GAIA_Z;
            if (HasM) Dimension |= GaiaDimensionModels.GAIA_M;
        }
Esempio n. 3
0
 private GaiaExport(GaiaGeoGeometry geometryType, WriteDoubleFunction writeDouble, WriteSingleFunction writeSingle,
                    WriteInt32Function writeInt32)
     : base(geometryType)
 {
     WriteDouble = writeDouble;
     WriteSingle = writeSingle;
     WriteInt32  = writeInt32;
 }
Esempio n. 4
0
 private GaiaImport(GaiaGeoGeometry geometryType, GetDoubleFunction getDouble, GetDoublesFunction getDoubles, GetSingleFunction getSingle, GetSinglesFunction getSingles, GetInt32Function getInt32, Ordinates handleOrdinates)
     : base(geometryType)
 {
     GetDouble       = getDouble;
     GetDoubles      = getDoubles;
     GetSingle       = getSingle;
     GetSingles      = getSingles;
     GetInt32        = getInt32;
     HandleOrdinates = handleOrdinates;
 }
Esempio n. 5
0
        public void SetGeometryType(GaiaGeoGeometry geometryTypeFlag)
        {
            //Debug.Assert(geometryTypeFlag != GaiaGeoGeometry.GAIA_UNKNOWN);
            //Debug.Assert(geometryTypeFlag > 0);

            var cflag = ((int)geometryTypeFlag);

            if (cflag > 1000000)
            {
                Compressed = true;
                cflag     -= 1000000;
            }

            if (cflag > 3000)
            {
                cflag = 3000;
            }
            else if (cflag > 2000)
            {
                cflag = 2000;
            }
            else if (cflag > 1000)
            {
                cflag = 1000;
            }
            else
            {
                cflag = 0;
            }

            CoordinateFlag = cflag | (Compressed ? 1000000 : 0);

            HasZ = (cflag == 1000) || (cflag == 3000);
            HasM = (cflag == 2000) || (cflag == 3000);

            Dimension = GaiaDimensionModels.GAIA_XY;
            if (HasZ)
            {
                Dimension |= GaiaDimensionModels.GAIA_Z;
            }
            if (HasM)
            {
                Dimension |= GaiaDimensionModels.GAIA_M;
            }
        }
        private static GaiaGeoGeometry ToBaseGeometryType(GaiaGeoGeometry geometry)
        {
            var geometryInt = (int)geometry;

            if (geometryInt > 1000000)
            {
                geometryInt -= 1000000;
            }
            if (geometryInt > 3000)
            {
                geometryInt -= 3000;
            }
            if (geometryInt > 2000)
            {
                geometryInt -= 2000;
            }
            if (geometryInt > 1000)
            {
                geometryInt -= 1000;
            }
            return((GaiaGeoGeometry)geometryInt);
        }
Esempio n. 7
0
 protected GaiaGeoIO(GaiaGeoGeometry geometryType)
 {
     SetGeometryType(geometryType);
 }
        private static ReadCoordinatesFunction SetReadCoordinatesFunction(GaiaImport gaiaImport, GaiaGeoGeometry type)
        {
            gaiaImport.SetGeometryType(type);

            if (gaiaImport.Uncompressed)
            {
                if (gaiaImport.HasZ && gaiaImport.HasM)
                {
                    return(ReadXYZM);
                }
                if (gaiaImport.HasM)
                {
                    return(ReadXYM);
                }
                if (gaiaImport.HasZ)
                {
                    return(ReadXYZ);
                }
                return(ReadXY);
            }

            if (gaiaImport.HasZ && gaiaImport.HasM)
            {
                return(ReadCompressedXYZM);
            }
            if (gaiaImport.HasM)
            {
                return(ReadCompressedXYM);
            }
            if (gaiaImport.HasZ)
            {
                return(ReadCompressedXYZ);
            }
            return(ReadCompressedXY);
        }
Esempio n. 9
0
 private GaiaExport(GaiaGeoGeometry geometryType, WriteDoubleFunction writeDouble, WriteSingleFunction writeSingle,
                    WriteInt32Function writeInt32)
     : base(geometryType)
 {
     WriteDouble = writeDouble;
     WriteSingle = writeSingle;
     WriteInt32 = writeInt32;
 }
Esempio n. 10
0
 private GaiaImport(GaiaGeoGeometry geometryType, GetDoubleFunction getDouble, GetDoublesFunction getDoubles, GetSingleFunction getSingle, GetSinglesFunction getSingles, GetInt32Function getInt32, Ordinates handleOrdinates)
     : base(geometryType)
 {
     GetDouble = getDouble;
     GetDoubles = getDoubles;
     GetSingle = getSingle;
     GetSingles = getSingles;
     GetInt32 = getInt32;
     HandleOrdinates = handleOrdinates;
 }
Esempio n. 11
0
 protected GaiaGeoIO(GaiaGeoGeometry geometryType)
 {
     SetGeometryType(geometryType);
 }
Esempio n. 12
0
        private static IGeometry ParseWkbGeometry(GaiaGeoGeometry type, byte[] blob, ref int offset, IGeometryFactory factory, GaiaImport gaiaImport)
        {
            var readCoordinates = SetReadCoordinatesFunction(gaiaImport, type);

            switch (ToBaseGeometryType(type))
            {
                case GaiaGeoGeometry.GAIA_POINT:
                    return ParseWkbPoint(blob, ref offset, factory, readCoordinates, gaiaImport);

                case GaiaGeoGeometry.GAIA_MULTIPOINT:
                    return ParseWkbMultiPoint(blob, ref offset, factory, readCoordinates, gaiaImport);

                case GaiaGeoGeometry.GAIA_LINESTRING:
                    return ParseWkbLineString(blob, ref offset, factory, readCoordinates, gaiaImport);

                case GaiaGeoGeometry.GAIA_MULTILINESTRING:
                    return ParseWkbMultiLineString(blob, ref offset, factory, readCoordinates, gaiaImport);

                case GaiaGeoGeometry.GAIA_POLYGON:
                    return ParseWkbPolygon(blob, ref offset, factory, readCoordinates, gaiaImport);

                case GaiaGeoGeometry.GAIA_MULTIPOLYGON:
                    return ParseWkbMultiPolygon(blob, ref offset, factory, readCoordinates, gaiaImport);

                case GaiaGeoGeometry.GAIA_GEOMETRYCOLLECTION:
                    return ParseWkbGeometryCollection(blob, ref offset, factory, gaiaImport);
            }
            return null;
        }
Esempio n. 13
0
 private static GaiaGeoGeometry ToBaseGeometryType(GaiaGeoGeometry geometry)
 {
     var geometryInt = (int)geometry;
     if (geometryInt > 1000000) geometryInt -= 1000000;
     if (geometryInt > 3000) geometryInt -= 3000;
     if (geometryInt > 2000) geometryInt -= 2000;
     if (geometryInt > 1000) geometryInt -= 1000;
     return (GaiaGeoGeometry)geometryInt;
 }
Esempio n. 14
0
        private static ReadCoordinatesFunction SetReadCoordinatesFunction(GaiaImport gaiaImport, GaiaGeoGeometry type)
        {
            gaiaImport.SetGeometryType(type);

            if (gaiaImport.Uncompressed)
            {
                if (gaiaImport.HasZ && gaiaImport.HasM)
                    return ReadXYZM;
                if (gaiaImport.HasM)
                    return ReadXYM;
                if (gaiaImport.HasZ)
                    return ReadXYZ;
                return ReadXY;
            }

            if (gaiaImport.HasZ && gaiaImport.HasM)
                return ReadCompressedXYZM;
            if (gaiaImport.HasM)
                return ReadCompressedXYM;
            if (gaiaImport.HasZ)
                return ReadCompressedXYZ;
            return ReadCompressedXY;
        }