Пример #1
0
        private void ProcessNode(PrimitiveBlock block, Formats.Pbf.Node node)
        {
            var latitude  = .000000001 * (block.lat_offset + (block.granularity * (double)node.lat));
            var longitude = .000000001 * (block.lon_offset + (block.granularity * (double)node.lon));

            var elementNode = new Entities.Node();

            elementNode.Id         = node.id;
            elementNode.Coordinate = new GeoCoordinate(latitude, longitude);

            if (node.keys.Any())
            {
                elementNode.Tags = new TagCollection(node.keys.Count);
                for (int tagIdx = 0; tagIdx < node.keys.Count; tagIdx++)
                {
                    var    keyBytes   = block.stringtable.s[(int)node.keys[tagIdx]];
                    string key        = Encoding.UTF8.GetString(keyBytes, 0, keyBytes.Length);
                    var    valueBytes = block.stringtable.s[(int)node.vals[tagIdx]];
                    string value      = Encoding.UTF8.GetString(valueBytes, 0, valueBytes.Length);
                    //if (elementNode.Tags.ContainsKey(key))
                    //    continue;
                    elementNode.Tags.Add(key, value);
                }
            }
            _envelop.Extend(elementNode.Coordinate);
            _context.Builder.ProcessNode(elementNode, node.keys.Count);
        }
Пример #2
0
 /// <summary>
 /// Returns the length of the <see cref="NodeV31"/> entity provided.
 /// </summary>
 /// <param name="entity">
 /// An entity of type Node who length is required.
 /// </param>
 /// <returns>
 /// The number of bytes used to store the node.
 /// </returns>
 public override int GetLength(Entities.Node entity)
 {
     return(BaseLength +
            sizeof(int) + // Length of the ranked signatures count number
            (entity.Children.Length * NodeFactoryShared.NodeIndexLengthV31) +
            (entity.NumericChildren.Length * NodeNumericIndexLength) +
            (entity.RankedSignatureCount * sizeof(int)));
 }
Пример #3
0
 /// <summary>
 /// Returns the length of the <see cref="NodeV32"/> entity provided.
 /// </summary>
 /// <param name="entity">
 /// An entity of type Node who length is required.
 /// </param>
 /// <returns>
 /// The number of bytes used to store the node.
 /// </returns>
 public override int GetLength(Entities.Node entity)
 {
     return(BaseLength +
            sizeof(ushort) + // Length of the ranked signatures count number
            (entity.Children.Length * NodeFactoryShared.NodeIndexLengthV32) +
            (entity.NumericChildren.Length * NodeNumericIndexLength) +
            // If the ranked signature count is zero then nothing follows. If it's
            // great than 0 then the next 4 bytes are the index of the first signature.
            (entity.RankedSignatureCount == 0 ? 0 : sizeof(int)));
 }
Пример #4
0
 public abstract bool CheckExcludeAtivity(string sourceState, Entities.Node w, Entities.Transition i);