Example #1
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();
        }