コード例 #1
0
        public int date_granularity = 1000;                                        // 18

        internal static PrimitiveBlock Read(Stream stream)
        {
            PrimitiveBlock obj = new PrimitiveBlock();
            int            b   = stream.ReadByte();

            if (b != 10)
            {
                throw new NotImplementedException();
            }
            obj.stringtable = StringTable.Read(stream);
            b = stream.ReadByte();
            while (b == 18)
            {
                obj.primitivegroup.Add(PrimitiveGroup.Read(stream));
                b = stream.ReadByte();
            }
            // NOTE: looks like those OSMSharp broken up files don't have any of these
            if (b == 136)
            {
                obj.granularity = (int)OSMReader.ReadVarInt(stream);
                b = stream.ReadByte();
            }
            if (b == 152)
            {
                obj.lat_offset = OSMReader.ReadVarInt(stream);
                b = stream.ReadByte();
            }
            if (b == 160)
            {
                obj.lon_offset = OSMReader.ReadVarInt(stream);
                b = stream.ReadByte();
            }
            if (b == 144)
            {
                obj.date_granularity = (int)OSMReader.ReadVarInt(stream);
                b = stream.ReadByte();
            }
            if (b != -1)
            {
                throw new NotImplementedException();
            }
            return(obj);
        }
コード例 #2
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();
        }