Esempio n. 1
0
        public object NullSafeGet(IDataReader rs, string[] names, object owner)
        {
            var value = rs.GetValue(rs.GetOrdinal(names[0]));

            if (value == DBNull.Value)
            {
                return(null);
            }

            return(Reader.Read((byte[])value));
        }
Esempio n. 2
0
        /// <summary>
        /// Reads a sequence of geometries.<br/>
        /// If an <see cref="Offset"/> is specified, geometries read up to the offset count are skipped.
        /// If a <see cref="Limit"/> is specified, no more than <see cref="Limit"/> geometries are read.
        /// </summary>
        /// <param name="streamReader">The stream reader to use.</param>
        /// <exception cref="IOException">Thrown if an I/O exception was encountered</exception>
        /// <exception cref="Gisoft.GeoAPI.IO.ParseException">Thrown if an error occured reading a geometry</exception>
        private ICollection <IGeometry> Read(StreamReader streamReader)
        {
            var geoms = new List <IGeometry>();
            var count = 0;

            while (!IsAtEndOfFile(streamReader) && !IsAtLimit(geoms))
            {
                var line = streamReader.ReadLine();
                if (string.IsNullOrEmpty(line))
                {
                    continue;
                }

                var g = _wkbReader.Read(WKBReader.HexToBytes(line));
                if (count >= Offset)
                {
                    geoms.Add(g);
                }
                count++;
            }
            return(geoms);
        }
 /// <summary>
 ///     This API supports the Entity Framework Core infrastructure and is not intended to be used
 ///     directly from your code. This API may change or be removed in future releases.
 /// </summary>
 public GeometryValueConverter(IBinaryGeometryReader reader, IBinaryGeometryWriter writer)
     : base(
         g => new SqlBytes(writer.Write(g)),
         b => (TGeometry)reader.Read(b.Value))
 {
 }
Esempio n. 4
0
 ValueTask <T> ReadCore <T>(NpgsqlReadBuffer buf, int len)
     where T : IGeometry
 => new ValueTask <T>((T)_reader.Read(buf.GetStream(len, false)));