예제 #1
0
        private void ProcessWay(PrimitiveBlock block, Formats.Pbf.Way way)
        {
            long nodeId   = 0;
            var  nodeIds  = new List <long>();
            var  refCount = way.refs.Count;

            for (int nodeIdx = 0; nodeIdx < refCount; nodeIdx++)
            {
                nodeId = nodeId + way.refs[nodeIdx];
                nodeIds.Add(nodeId);
            }

            var elementWay = new Entities.Way {
                Id = way.id, NodeIds = nodeIds
            };

            if (way.keys.Any())
            {
                var keyCount = way.keys.Count;
                elementWay.Tags = new TagCollection(keyCount);
                for (int tagIdx = 0; tagIdx < keyCount; tagIdx++)
                {
                    var    keyBytes   = block.stringtable.s[(int)way.keys[tagIdx]];
                    string key        = String.Intern(Encoding.UTF8.GetString(keyBytes, 0, keyBytes.Length));
                    var    valueBytes = block.stringtable.s[(int)way.vals[tagIdx]];
                    string value      = String.Intern(Encoding.UTF8.GetString(valueBytes, 0, valueBytes.Length));
                    elementWay.Tags.Add(key, value);
                }
            }
            _context.Builder.ProcessWay(elementWay, way.keys.Count);
        }
예제 #2
0
        /// <inheritdoc />
        public override void VisitWay(Entities.Way way)
        {
            if (!IsArea(way.Tags))
            {
                ModelLoader.LoadWay(Tile, new Way
                {
                    Id     = way.Id,
                    Points = way.Coordinates,
                    Tags   = way.Tags
                });

                return;
            }

            if (way.Coordinates.Count <= 2)
            {
                return;
            }

            ModelLoader.LoadArea(Tile, new Area
            {
                Id     = way.Id,
                Points = way.Coordinates,
                Tags   = way.Tags
            });
        }