Пример #1
0
        public List <int> keys_vals = new List <int>();  // 10, packed

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

            if (b == 10)
            {
                obj.id = OSMReader.ReadPackedDeltaCodedVarInts(stream);
                b      = stream.ReadByte();
            }
            if (b == 42)
            {
                //obj.denseinfo = DenseInfo.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.lat = OSMReader.ReadPackedDeltaCodedVarInts(stream);
                if (stream.Position > end)
                {
                    throw new NotImplementedException();
                }
                if (stream.Position == end)
                {
                    return(obj);
                }
                b = stream.ReadByte();
            }
            if (b == 74)
            {
                obj.lon = OSMReader.ReadPackedDeltaCodedVarInts(stream);
                if (stream.Position > end)
                {
                    throw new NotImplementedException();
                }
                if (stream.Position == end)
                {
                    return(obj);
                }
                b = stream.ReadByte();
            }
            if (b == 82)
            {
                //obj.keys_vals = OSM.ReadPackedVarInts(stream).ConvertAll(x => (int)x).ToList();
                OSMReader.SkipBytes(stream);
                if (stream.Position > end)
                {
                    throw new NotImplementedException();
                }
                if (stream.Position == end)
                {
                    return(obj);
                }
                b = stream.ReadByte();
            }
            throw new NotImplementedException();
        }
Пример #2
0
        internal static DenseNodes ReadNodeStart(MemoryStream stream)
        {
            DenseNodes obj           = new DenseNodes();
            long       lengthInBytes = OSMReader.ReadVarInt(stream);
            long       end           = stream.Position + lengthInBytes;
            int        b             = stream.ReadByte();

            if (b == 10)
            {
                obj.id = new List <long>();
                long length = OSMReader.ReadVarInt(stream);
                if (length > 0)
                {
                    obj.id.Add(OSMReader.ReadSignedVarInt(stream));
                }
                stream.Seek(end, SeekOrigin.Begin);
                return(obj);
            }
            if (b == 42)
            {
                OSMReader.SkipBytes(stream);
                if (stream.Position > end)
                {
                    throw new NotImplementedException();
                }
                if (stream.Position == end)
                {
                    return(obj);
                }
                b = stream.ReadByte();
            }
            if (b == 66)
            {
                OSMReader.SkipBytes(stream);
                if (stream.Position > end)
                {
                    throw new NotImplementedException();
                }
                if (stream.Position == end)
                {
                    return(obj);
                }
                b = stream.ReadByte();
            }
            if (b == 74)
            {
                OSMReader.SkipBytes(stream);
                if (stream.Position > end)
                {
                    throw new NotImplementedException();
                }
                if (stream.Position == end)
                {
                    return(obj);
                }
                b = stream.ReadByte();
            }
            if (b == 82)
            {
                OSMReader.SkipBytes(stream);
                if (stream.Position > end)
                {
                    throw new NotImplementedException();
                }
                if (stream.Position == end)
                {
                    return(obj);
                }
                b = stream.ReadByte();
            }
            throw new NotImplementedException();
        }
Пример #3
0
        public List <ChangeSet> changesets = new List <ChangeSet>();  // 5

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

            while (b == 10 || b == 18 || b == 26 || b == 34 || b == 42)
            {
                if (b == 10)
                {
                    OSMReader.SkipBytes(stream);
                    if (stream.Position > end)
                    {
                        throw new NotImplementedException();
                    }
                    if (stream.Position == end)
                    {
                        return(obj);
                    }
                    b = stream.ReadByte();
                }
                else if (b == 18)
                {
                    obj.dense.Add(DenseNodes.Read(stream));
                    if (stream.Position > end)
                    {
                        throw new NotImplementedException();
                    }
                    if (stream.Position == end)
                    {
                        return(obj);
                    }
                    b = stream.ReadByte();
                }
                else if (b == 26)
                {
                    obj.ways.Add(Way.Read(stream));
                    if (stream.Position > end)
                    {
                        throw new NotImplementedException();
                    }
                    if (stream.Position == end)
                    {
                        return(obj);
                    }
                    b = stream.ReadByte();
                }
                else if (b == 34)
                {
                    obj.relations.Add(Relation.Read(stream));
                    if (stream.Position > end)
                    {
                        throw new NotImplementedException();
                    }
                    if (stream.Position == end)
                    {
                        return(obj);
                    }
                    b = stream.ReadByte();
                }
                else if (b == 42)
                {
                    OSMReader.SkipBytes(stream);
                    if (stream.Position > end)
                    {
                        throw new NotImplementedException();
                    }
                    if (stream.Position == end)
                    {
                        return(obj);
                    }
                    b = stream.ReadByte();
                }
            }
            throw new NotImplementedException();
        }