コード例 #1
0
		public override IGeometry Read(Stream stream)
		{
			using (BinaryReader reader1 = new BinaryReader(stream))
			{
				int srid = -1;
				try
				{
					srid = reader1.ReadInt32();
				}
				catch
				{
				}
				if (srid == 0)
				{
					srid = -1;
				}

				ByteOrder byteOrder = (ByteOrder)stream.ReadByte();
				BinaryReader reader2;
				if (byteOrder == ByteOrder.BigEndian)
				{
					reader2 = new BEBinaryReader(stream);
				}
				else
				{
					reader2 = new BinaryReader(stream);
				}
				using (reader2)
				{
					IGeometry geometry = Read(reader2);
					geometry.SRID = srid;
					return geometry;
				}
			}
		}
コード例 #2
0
		public override IGeometry Read(Stream stream)
		{
			BinaryReader reader = null;
			ByteOrder byteOrder = (ByteOrder)stream.ReadByte();
			try
			{
				if (byteOrder == ByteOrder.BigEndian)
					reader = new BEBinaryReader(stream);
				else reader = new BinaryReader(stream);
				IGeometry geometry = Read(reader);
				int srid = -1;
				try
				{
					srid = reader.ReadInt32();
				}
				catch { }
				if (srid == 0)
					srid = -1;
				geometry.SRID = srid;
				return geometry;
			}
			finally
			{
				if (reader != null)
					reader.Close();
			}
		}
コード例 #3
0
ファイル: WKBReader.cs プロジェクト: DIVEROVIEDO/DotSpatial
 /// <summary>
 /// 
 /// </summary>
 /// <param name="stream"></param>
 /// <returns></returns>
 public virtual IGeometry Read(Stream stream)
 {
     BinaryReader reader = null;
     ByteOrder byteOrder = (ByteOrder) stream.ReadByte();
     try
     {
         if (byteOrder == ByteOrder.BigEndian)
              reader = new BEBinaryReader(stream);
         else reader = new BinaryReader(stream);
         return Read(reader);
     }
     finally
     {
         if (reader != null) 
             reader.Close();
     }
 }
コード例 #4
0
ファイル: PostGisReader.cs プロジェクト: ExRam/DotSpatial-PCL
        /// <summary>
        /// 
        /// </summary>
        /// <param name="stream"></param>
        /// <returns></returns>
        public IGeometry Read(Stream stream)
        {
            BinaryReader reader = null;
            ByteOrder byteOrder = (ByteOrder) stream.ReadByte();
			// "Rewind" to let Read(BinaryReader) skip this byte
			// in collection and non-collection geometries.
			stream.Position = 0;
            try
            {
                if (byteOrder == ByteOrder.BigEndian)
                     reader = new BEBinaryReader(stream);
                else reader = new BinaryReader(stream);
                return Read(reader);
            }
            finally
            {
                if (reader != null) 
                    reader.Close();
            }
        }
コード例 #5
0
        public override IGeometry Read(Stream stream)
        {
            BinaryReader reader    = null;
            ByteOrder    byteOrder = (ByteOrder)stream.ReadByte();

            try
            {
                if (byteOrder == ByteOrder.BigEndian)
                {
                    reader = new BEBinaryReader(stream);
                }
                else
                {
                    reader = new BinaryReader(stream);
                }
                IGeometry geometry = Read(reader);
                int       srid     = -1;
                try
                {
                    srid = reader.ReadInt32();
                }
                catch { }
                if (srid == 0)
                {
                    srid = -1;
                }
                geometry.SRID = srid;
                return(geometry);
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
            }
        }