Example #1
0
            void changeset(const osmium::Changeset& changeset) {
                print_title("CHANGESET", changeset);
                m_out << m_prefix
                      << "  id="
                      << changeset.id()
                      << "\n";
                m_out << m_prefix
                      << "  num_changes="
                      << changeset.num_changes()
                      << "\n";
                m_out << m_prefix
                      << "  uid="
                      << changeset.uid()
                      << "\n";
                m_out << m_prefix
                      << "  user=|"
                      << changeset.user()
                      << "|\n";
                m_out << m_prefix
                      << "  created_at="
                      << changeset.created_at().to_iso()
                      << "\n";
                m_out << m_prefix
                      << "  closed_at="
                      << changeset.closed_at().to_iso()
                      << "\n";
                m_out << m_prefix
                      << "  bounds=";

                if (changeset.bounds()) {
                    m_out << '('
                          << changeset.bounds().bottom_left().lon_without_check()
                          << ','
                          << changeset.bounds().bottom_left().lat_without_check()
                          << ','
                          << changeset.bounds().top_right().lon_without_check()
                          << ','
                          << changeset.bounds().top_right().lat_without_check()
                          << ')';
                } else {
                    m_out << "(undefined)";
                }

                m_out << "\n";

                Dump dump(m_out, m_with_size, m_prefix + "  ");
                osmium::apply(changeset.cbegin(), changeset.cend(), dump);
            }
                void changeset(const osmium::Changeset& changeset) {
                    write_prefix();
                    m_out += "<changeset";

                    oprintf(m_out, " id=\"%" PRId32 "\"", changeset.id());

                    if (changeset.created_at()) {
                        m_out += " created_at=\"";
                        m_out += changeset.created_at().to_iso();
                        m_out += "\"";
                    }

                    oprintf(m_out, " num_changes=\"%" PRId32 "\"", changeset.num_changes());

                    if (changeset.closed_at()) {
                        m_out += " closed_at=\"";
                        m_out += changeset.closed_at().to_iso();
                        m_out += "\" open=\"false\"";
                    } else {
                        m_out += " open=\"true\"";
                    }

                    if (changeset.bounds()) {
                        oprintf(m_out, " min_lon=\"%.7f\"", changeset.bounds().bottom_left().lon_without_check());
                        oprintf(m_out, " min_lat=\"%.7f\"", changeset.bounds().bottom_left().lat_without_check());
                        oprintf(m_out, " max_lon=\"%.7f\"", changeset.bounds().top_right().lon_without_check());
                        oprintf(m_out, " max_lat=\"%.7f\"", changeset.bounds().top_right().lat_without_check());
                    }

                    if (!changeset.user_is_anonymous()) {
                        m_out += " user=\"";
                        xml_string(m_out, changeset.user());
                        oprintf(m_out, "\" uid=\"%d\"", changeset.uid());
                    }

                    if (changeset.tags().empty()) {
                        m_out += "/>\n";
                        return;
                    }

                    m_out += ">\n";

                    write_tags(changeset.tags());

                    write_prefix();
                    m_out += "</changeset>\n";
                }