Ejemplo n.º 1
0
    OSMWay(const ::OSMPBF::Way &way)
        : id(way.id()), size(way.refs_size()) {
        nodes = (uint64_t *)malloc(size * sizeof(uint64_t));

        uint64_t node_id = 0;
        for (size_t i = 0; i < size; ++i) {
            node_id += way.refs(i);
            nodes[i] = node_id;
        }
    }
Ejemplo n.º 2
0
void
QcOsmPbfReader::read_ways(OSMPBF::PrimitiveGroup primitive_group)
{
  enter_way_transactions();

  int number_of_ways = primitive_group.ways_size();
  for (int i = 0; i < number_of_ways; i++) {
    OSMPBF::Way way = primitive_group.ways(i);
    int64_t way_id = way.id();

    QVector<int64_t> node_ids(way.refs_size());
    int j = 0;
    DeltaCodedInt64 node_id;
    for (auto ref : way.refs()) {
      node_ids[j++] = node_id.update(ref);
    }

    // qDebug().nospace() << "way" << i << way_id << node_ids;

    int number_of_attributes = way.keys_size();
    QVector<KeyValPair> attributes(number_of_attributes);
    for (int i = 0; i < number_of_attributes; i++) {
      int32_t key_id = way.keys(i);
      int32_t val_id = way.vals(i);
      // qDebug() << "  key_val" << way_id << m_string_table[key_id] << m_string_table[val_id];
      attributes[i] = KeyValPair(key_id, val_id);
    }

    yield_way(way_id, node_ids, attributes);

    if (m_read_metadatas and way.has_info()) {
      // qDebug().nospace() << "        with meta-info";
      OSMPBF::Info info = way.info();
      int32_t version = info.version();
      int64_t timestamp = to_timestamp(info.timestamp());
      int64_t changeset = info.changeset();
      int32_t uid = info.uid();
      int32_t user_sid = info.user_sid();
      // bool visible = info.visible();
      // qDebug() << "Meta information:" << version << timestamp << changeset << uid << user_sid;
      // yield_way_metadata(way_id, version, timestamp, changeset, uid, user_sid);
    }
  }

  leave_way_transactions();
}