Ejemplo n.º 1
0
        private static void WriteLineString(ILineString geom, WriteCoordinates writeCoordinates, GaiaExport gaiaExport, BinaryWriter bw)
        {
            var seq = geom.CoordinateSequence;

            gaiaExport.WriteInt32(bw, seq.Count);
            writeCoordinates(geom.CoordinateSequence, gaiaExport, bw);
        }
Ejemplo n.º 2
0
 private static void WritePolygon(IPolygon geom, WriteCoordinates writeCoordinates, GaiaExport gaiaExport, BinaryWriter bw)
 {
     gaiaExport.WriteInt32(bw, geom.NumInteriorRings + 1);
     WriteLineString(geom.Shell, writeCoordinates, gaiaExport, bw);
     for (var i = 0; i < geom.NumInteriorRings; i++)
     {
         WriteLineString(geom.GetInteriorRingN(i), writeCoordinates, gaiaExport, bw);
     }
 }
Ejemplo n.º 3
0
 private static void WriteMultiPolygon(IGeometryCollection geom, WriteCoordinates writeCoordinates, GaiaExport gaiaExport, BinaryWriter bw)
 {
     gaiaExport.WriteInt32(bw, geom.NumGeometries);
     for (var i = 0; i < geom.NumGeometries; i++)
     {
         bw.Write((byte)GaiaGeoBlobMark.GAIA_MARK_ENTITY);
         gaiaExport.WriteInt32(bw, gaiaExport.CoordinateFlag | (int)GaiaGeoGeometry.GAIA_POLYGON);
         WritePolygon((IPolygon)geom[i], writeCoordinates, gaiaExport, bw);
     }
 }
Ejemplo n.º 4
0
 private static void WriteMultiLineString(IMultiLineString geom, WriteCoordinates writeCoordinates, GaiaExport gaiaExport, BinaryWriter bw)
 {
     gaiaExport.WriteInt32(bw, geom.NumGeometries);
     for (var i = 0; i < geom.NumGeometries; i++)
     {
         bw.Write((byte)GaiaGeoBlobMark.GAIA_MARK_ENTITY);
         gaiaExport.WriteInt32(bw, gaiaExport.CoordinateFlag | (int)GaiaGeoGeometry.GAIA_LINESTRING);
         WriteLineString((ILineString)geom[i], writeCoordinates, gaiaExport, bw);
     }
 }
Ejemplo n.º 5
0
        private static void WriteGeometry(IGeometry geom, GaiaExport gaiaExport, BinaryWriter bw)
        {
            WriteCoordinates writeCoordinates = SetWriteCoordinatesFunction(gaiaExport);

            //Geometry type
            int coordinateFlag = gaiaExport.CoordinateFlag;
            int coordinateFlagNotValidForCompression = coordinateFlag > 1000000
                                                           ? coordinateFlag - 1000000
                                                           : coordinateFlag;

            switch (geom.GeometryType.ToUpper())
            {
            case "POINT":
                gaiaExport.WriteInt32(bw, (int)(GaiaGeoGeometry.GAIA_POINT) | coordinateFlagNotValidForCompression);
                WritePoint((IPoint)geom, writeCoordinates, gaiaExport, bw);
                break;

            case "LINESTRING":
                gaiaExport.WriteInt32(bw, (int)GaiaGeoGeometry.GAIA_LINESTRING | coordinateFlag);
                WriteLineString((ILineString)geom, writeCoordinates, gaiaExport, bw);
                break;

            case "POLYGON":
                gaiaExport.WriteInt32(bw, (int)GaiaGeoGeometry.GAIA_POLYGON | coordinateFlag);
                WritePolygon((IPolygon)geom, writeCoordinates, gaiaExport, bw);
                break;

            case "MULTIPOINT":
                gaiaExport.WriteInt32(bw, (int)GaiaGeoGeometry.GAIA_MULTIPOINT | coordinateFlagNotValidForCompression);
                WriteMultiPoint((IMultiPoint)geom, writeCoordinates, gaiaExport, bw);
                break;

            case "MULTILINESTRING":
                gaiaExport.WriteInt32(bw, (int)GaiaGeoGeometry.GAIA_MULTILINESTRING | coordinateFlag);
                WriteMultiLineString((IMultiLineString)geom, writeCoordinates, gaiaExport, bw);
                break;

            case "MULTIPOLYGON":
                gaiaExport.WriteInt32(bw, (int)GaiaGeoGeometry.GAIA_MULTIPOLYGON | coordinateFlag);
                WriteMultiPolygon((IMultiPolygon)geom, writeCoordinates, gaiaExport, bw);
                break;

            case "GEOMETRYCOLLECTION":
                gaiaExport.WriteInt32(bw, (int)GaiaGeoGeometry.GAIA_GEOMETRYCOLLECTION | coordinateFlagNotValidForCompression);
                WriteGeometryCollection((IGeometryCollection)geom, gaiaExport, bw);
                break;

            default:
                throw new ArgumentException("unknown geometry type");
            }
        }
Ejemplo n.º 6
0
        private static void WriteMultiPoint(IMultiPoint geom, WriteCoordinates writeCoordinates, GaiaExport gaiaExport, BinaryWriter bw)
        {
            var wi = gaiaExport.WriteInt32;

            // number of coordinates
            wi(bw, geom.NumGeometries);

            // get the coordinate flag
            var coordinateFlag = gaiaExport.CoordinateFlagUncompressed;

            for (var i = 0; i < geom.NumGeometries; i++)
            {
                //write entity begin marker
                bw.Write((byte)GaiaGeoBlobMark.GAIA_MARK_ENTITY);

                //write entity marker
                wi(bw, coordinateFlag + (int)GaiaGeoGeometryEntity.GAIA_TYPE_POINT);

                //write coordinates
                writeCoordinates(((IPoint)geom[i]).CoordinateSequence, gaiaExport, bw);
            }
        }
Ejemplo n.º 7
0
 private static void WritePoint(IPoint geom, WriteCoordinates writeCoordinates, GaiaExport gaiaExport, BinaryWriter bw)
 {
     writeCoordinates(geom.CoordinateSequence, gaiaExport, bw);
 }
Ejemplo n.º 8
0
 private static void WritePoint(IPoint geom, WriteCoordinates writeCoordinates, GaiaExport gaiaExport, BinaryWriter bw)
 {
     writeCoordinates(geom.CoordinateSequence, gaiaExport, bw);
 }
Ejemplo n.º 9
0
 private static void WriteLineString(ILineString geom, WriteCoordinates writeCoordinates, GaiaExport gaiaExport, BinaryWriter bw)
 {
     var seq = geom.CoordinateSequence;
     gaiaExport.WriteInt32(bw, seq.Count);
     writeCoordinates(geom.CoordinateSequence, gaiaExport, bw);
 }
Ejemplo n.º 10
0
 private static void WritePolygon(IPolygon geom, WriteCoordinates writeCoordinates, GaiaExport gaiaExport, BinaryWriter bw)
 {
     gaiaExport.WriteInt32(bw, geom.NumInteriorRings + 1);
     WriteLineString(geom.Shell, writeCoordinates, gaiaExport, bw);
     for (var i = 0; i < geom.NumInteriorRings; i++)
         WriteLineString(geom.GetInteriorRingN(i), writeCoordinates, gaiaExport, bw);
 }
Ejemplo n.º 11
0
        private static void WriteMultiPoint(IMultiPoint geom, WriteCoordinates writeCoordinates, GaiaExport gaiaExport, BinaryWriter bw)
        {
            var wi = gaiaExport.WriteInt32;

            // number of coordinates
            wi(bw, geom.NumGeometries);

            // get the coordinate flag
            var coordinateFlag = gaiaExport.CoordinateFlagUncompressed;

            for (var i = 0; i < geom.NumGeometries; i++)
            {
                //write entity begin marker
                bw.Write((byte)GaiaGeoBlobMark.GAIA_MARK_ENTITY);

                //write entity marker
                wi(bw, coordinateFlag + (int)GaiaGeoGeometryEntity.GAIA_TYPE_POINT);

                //write coordinates
                writeCoordinates(((IPoint)geom[i]).CoordinateSequence, gaiaExport, bw);
            }
        }
Ejemplo n.º 12
0
 private static void WriteMultiLineString(IMultiLineString geom, WriteCoordinates writeCoordinates, GaiaExport gaiaExport, BinaryWriter bw)
 {
     gaiaExport.WriteInt32(bw, geom.NumGeometries);
     for (var i = 0; i < geom.NumGeometries; i++)
     {
         bw.Write((byte)GaiaGeoBlobMark.GAIA_MARK_ENTITY);
         gaiaExport.WriteInt32(bw, gaiaExport.CoordinateFlag | (int)GaiaGeoGeometry.GAIA_LINESTRING);
         WriteLineString((ILineString)geom[i], writeCoordinates, gaiaExport, bw);
     }
 }
Ejemplo n.º 13
0
 private static void WriteMultiPolygon(IGeometryCollection geom, WriteCoordinates writeCoordinates, GaiaExport gaiaExport, BinaryWriter bw)
 {
     gaiaExport.WriteInt32(bw, geom.NumGeometries);
     for (var i = 0; i < geom.NumGeometries; i++)
     {
         bw.Write((byte)GaiaGeoBlobMark.GAIA_MARK_ENTITY);
         gaiaExport.WriteInt32(bw, gaiaExport.CoordinateFlag | (int)GaiaGeoGeometry.GAIA_POLYGON);
         WritePolygon((IPolygon)geom[i], writeCoordinates, gaiaExport, bw);
     }
 }