本文整理汇总了C++中osmium::OSMObject::version方法的典型用法代码示例。如果您正苦于以下问题:C++ OSMObject::version方法的具体用法?C++ OSMObject::version怎么用?C++ OSMObject::version使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osmium::OSMObject
的用法示例。
在下文中一共展示了OSMObject::version方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: write_meta
void write_meta(const osmium::OSMObject& object) {
oprintf(m_out, " id=\"%" PRId64 "\"", object.id());
if (object.version()) {
oprintf(m_out, " version=\"%d\"", object.version());
}
if (object.timestamp()) {
m_out += " timestamp=\"";
m_out += object.timestamp().to_iso();
m_out += "\"";
}
if (!object.user_is_anonymous()) {
oprintf(m_out, " uid=\"%d\" user=\"", object.uid());
xml_string(m_out, object.user());
m_out += "\"";
}
if (object.changeset()) {
oprintf(m_out, " changeset=\"%d\"", object.changeset());
}
if (m_write_visible_flag) {
if (object.visible()) {
m_out += " visible=\"true\"";
} else {
m_out += " visible=\"false\"";
}
}
}
示例2: add_metadata
static void add_metadata(gdalcpp::Feature& feature, const osmium::OSMObject& object) {
feature.set_field("version", int32_t(object.version()));
feature.set_field("changeset", int32_t(object.changeset()));
feature.set_field("timestamp", object.timestamp().to_iso().c_str());
feature.set_field("uid", int32_t(object.uid()));
feature.set_field("user", object.user());
}
示例3: print_meta
void print_meta(const osmium::OSMObject& object) {
*m_out << m_prefix
<< " id="
<< object.id()
<< "\n";
*m_out << m_prefix
<< " version="
<< object.version()
<< "\n";
*m_out << m_prefix
<< " uid="
<< object.uid()
<< "\n";
*m_out << m_prefix
<< " user=|"
<< object.user()
<< "|\n";
*m_out << m_prefix
<< " changeset="
<< object.changeset()
<< "\n";
*m_out << m_prefix
<< " timestamp="
<< object.timestamp().to_iso()
<< "\n";
*m_out << m_prefix
<< " visible="
<< (object.visible() ? "yes" : "no")
<< "\n";
Dump dump(*m_out, m_with_size, m_prefix + " ");
osmium::apply(object.cbegin(), object.cend(), dump);
}
示例4: update
void update(const osmium::OSMObject& object) {
update_int64(object.id());
update_bool(object.visible());
update_int32(object.version());
update(object.timestamp());
update_int32(object.uid());
update_string(object.user());
update(object.tags());
}
示例5: copy_attributes
void copy_attributes(T& builder, const osmium::OSMObject& object) {
// The setter functions on the builder object all return the same
// builder object so they can be chained.
builder.set_id(object.id())
.set_version(object.version())
.set_changeset(object.changeset())
.set_timestamp(object.timestamp())
.set_uid(object.uid())
.set_user(object.user());
}
示例6: initialize_from_object
/**
* Initialize area attributes from the attributes of the given object.
*/
void initialize_from_object(const osmium::OSMObject& source) {
osmium::Area& area = object();
area.set_id(osmium::object_id_to_area_id(source.id(), source.type()));
area.set_version(source.version());
area.set_changeset(source.changeset());
area.set_timestamp(source.timestamp());
area.set_visible(source.visible());
area.set_uid(source.uid());
add_user(source.user());
}
示例7: add_attributes
void ExportFormatJSON::add_attributes(const osmium::OSMObject& object) {
if (!options().type.empty()) {
m_writer.String(options().type);
if (object.type() == osmium::item_type::area) {
if (static_cast<const osmium::Area&>(object).from_way()) {
m_writer.String("way");
} else {
m_writer.String("relation");
}
} else {
m_writer.String(osmium::item_type_to_name(object.type()));
}
}
if (!options().id.empty()) {
m_writer.String(options().id);
m_writer.Int64(object.type() == osmium::item_type::area ? osmium::area_id_to_object_id(object.id()) : object.id());
}
if (!options().version.empty()) {
m_writer.String(options().version);
m_writer.Int64(object.version());
}
if (!options().changeset.empty()) {
m_writer.String(options().changeset);
m_writer.Int64(object.changeset());
}
if (!options().uid.empty()) {
m_writer.String(options().uid);
m_writer.Int64(object.uid());
}
if (!options().user.empty()) {
m_writer.String(options().user);
m_writer.String(object.user());
}
if (!options().timestamp.empty()) {
m_writer.String(options().timestamp);
m_writer.Int64(object.timestamp().seconds_since_epoch());
}
if (!options().way_nodes.empty() && object.type() == osmium::item_type::way) {
m_writer.String(options().way_nodes);
m_writer.StartArray();
for (const auto& nr : static_cast<const osmium::Way&>(object).nodes()) {
m_writer.Int64(nr.ref());
}
m_writer.EndArray();
}
}
示例8: write_meta
void write_meta(const osmium::OSMObject& object) {
output_int(object.id());
if (m_options.add_metadata) {
*m_out += ' ';
write_field_int('v', object.version());
*m_out += " d";
*m_out += (object.visible() ? 'V' : 'D');
*m_out += ' ';
write_field_int('c', object.changeset());
*m_out += ' ';
write_field_timestamp('t', object.timestamp());
*m_out += ' ';
write_field_int('i', object.uid());
*m_out += " u";
append_encoded_string(object.user());
}
write_tags(object.tags());
}
示例9: write_meta
void write_meta(const osmium::OSMObject& object) {
output_formatted("%" PRId64 " v%d d", object.id(), object.version());
*m_out += (object.visible() ? 'V' : 'D');
output_formatted(" c%d t", object.changeset());
*m_out += object.timestamp().to_iso();
output_formatted(" i%d u", object.uid());
append_encoded_string(object.user());
*m_out += " T";
bool first = true;
for (const auto& tag : object.tags()) {
if (first) {
first = false;
} else {
*m_out += ',';
}
append_encoded_string(tag.key());
*m_out += '=';
append_encoded_string(tag.value());
}
}
示例10: operator
bool operator()(const osmium::OSMObject& lhs, const osmium::OSMObject& rhs) const noexcept {
return const_tie(lhs.type(), lhs.id() < 0, lhs.positive_id(), rhs.version(), rhs.timestamp()) <
const_tie(rhs.type(), rhs.id() < 0, rhs.positive_id(), lhs.version(), lhs.timestamp());
}
示例11: version
osmium::object_version_type version() const noexcept {
return m_curr->version();
}
示例12: filter_tags
bool lua_tagtransform_t::filter_tags(osmium::OSMObject const &o, int *polygon,
int *roads, export_list const &,
taglist_t &out_tags, bool)
{
switch (o.type()) {
case osmium::item_type::node:
lua_getglobal(L, m_node_func.c_str());
break;
case osmium::item_type::way:
lua_getglobal(L, m_way_func.c_str());
break;
case osmium::item_type::relation:
lua_getglobal(L, m_rel_func.c_str());
break;
default:
throw std::runtime_error("Unknown OSM type");
}
lua_newtable(L); /* key value table */
lua_Integer sz = 0;
for (auto const &t : o.tags()) {
lua_pushstring(L, t.key());
lua_pushstring(L, t.value());
lua_rawset(L, -3);
++sz;
}
if (m_extra_attributes && o.version() > 0) {
taglist_t tags;
tags.add_attributes(o);
for (auto const &t : tags) {
lua_pushstring(L, t.key.c_str());
lua_pushstring(L, t.value.c_str());
lua_rawset(L, -3);
}
sz += tags.size();
}
lua_pushinteger(L, sz);
if (lua_pcall(L, 2, (o.type() == osmium::item_type::way) ? 4 : 2, 0)) {
fprintf(stderr,
"Failed to execute lua function for basic tag processing: %s\n",
lua_tostring(L, -1));
/* lua function failed */
return 1;
}
if (o.type() == osmium::item_type::way) {
if (roads) {
*roads = (int)lua_tointeger(L, -1);
}
lua_pop(L, 1);
if (polygon) {
*polygon = (int)lua_tointeger(L, -1);
}
lua_pop(L, 1);
}
lua_pushnil(L);
while (lua_next(L, -2) != 0) {
const char *key = lua_tostring(L, -2);
const char *value = lua_tostring(L, -1);
out_tags.emplace_back(key, value);
lua_pop(L, 1);
}
bool filter = lua_tointeger(L, -2);
lua_pop(L, 2);
return filter;
}