Ejemplo n.º 1
0
        public List <long> refs = new List <long>(); // 8, packed, signed, delta coded

        internal static Way Read(Stream stream)
        {
            Way  obj           = new Way();
            long lengthInBytes = OSMReader.ReadVarInt(stream);
            long end           = stream.Position + lengthInBytes;
            int  b             = stream.ReadByte();

            if (b != 8)
            {
                throw new NotImplementedException();
            }
            obj.id = OSMReader.ReadVarInt(stream);
            b      = stream.ReadByte();
            if (b == 18)
            {
                obj.keys = OSMReader.ReadPackedVarInts(stream).ConvertAll(x => (int)x).ToList();
                if (stream.Position > end)
                {
                    throw new NotImplementedException();
                }
                if (stream.Position == end)
                {
                    return(obj);
                }
                b = stream.ReadByte();
            }
            if (b == 26)
            {
                obj.vals = OSMReader.ReadPackedVarInts(stream).ConvertAll(x => (int)x).ToList();
                if (stream.Position > end)
                {
                    throw new NotImplementedException();
                }
                if (stream.Position == end)
                {
                    return(obj);
                }
                b = stream.ReadByte();
            }
            if (b == 34)
            {
                //obj.info = Info.Read(stream);
                OSMReader.SkipBytes(stream);
                if (stream.Position > end)
                {
                    throw new NotImplementedException();
                }
                if (stream.Position == end)
                {
                    return(obj);
                }
                b = stream.ReadByte();
            }
            if (b == 66)
            {
                obj.refs = OSMReader.ReadPackedDeltaCodedVarInts(stream);
                if (stream.Position > end)
                {
                    throw new NotImplementedException();
                }
                if (stream.Position == end)
                {
                    return(obj);
                }
                b = stream.ReadByte();
            }
            throw new NotImplementedException();
        }
Ejemplo n.º 2
0
        public List <bool> visible;   // 6, packed

        internal static DenseInfo Read(Stream stream)
        {
            DenseInfo obj           = new DenseInfo();
            long      lengthInBytes = OSMReader.ReadVarInt(stream);
            long      end           = stream.Position + lengthInBytes;
            int       b             = stream.ReadByte();

            if (b == 10)
            {
                obj.version = OSMReader.ReadPackedVarInts(stream).ConvertAll(x => (int)x).ToList();
                if (stream.Position > end)
                {
                    throw new NotImplementedException();
                }
                if (stream.Position == end)
                {
                    return(obj);
                }
                b = stream.ReadByte();
            }
            if (b == 18)
            {
                obj.timestamp = OSMReader.ReadPackedDeltaCodedVarInts(stream);
                if (stream.Position > end)
                {
                    throw new NotImplementedException();
                }
                if (stream.Position == end)
                {
                    return(obj);
                }
                b = stream.ReadByte();
            }
            if (b == 26)
            {
                obj.changeset = OSMReader.ReadPackedDeltaCodedVarInts(stream);
                if (stream.Position > end)
                {
                    throw new NotImplementedException();
                }
                if (stream.Position == end)
                {
                    return(obj);
                }
                b = stream.ReadByte();
            }
            if (b == 34)
            {
                obj.uid = OSMReader.ReadPackedDeltaCodedVarInts(stream).ConvertAll(x => (int)x).ToList();
                if (stream.Position > end)
                {
                    throw new NotImplementedException();
                }
                if (stream.Position == end)
                {
                    return(obj);
                }
                b = stream.ReadByte();
            }
            if (b == 42)
            {
                obj.user_sid = OSMReader.ReadPackedDeltaCodedVarInts(stream).ConvertAll(x => (int)x).ToList();
                if (stream.Position > end)
                {
                    throw new NotImplementedException();
                }
                if (stream.Position == end)
                {
                    return(obj);
                }
                b = stream.ReadByte();
            }
            if (b == 50)
            {
                OSMReader.SkipBytes(stream);
                if (stream.Position > end)
                {
                    throw new NotImplementedException();
                }
                if (stream.Position == end)
                {
                    return(obj);
                }
                b = stream.ReadByte();
            }
            throw new NotImplementedException();
        }