Overpass API regression suite coverage (Saxony) / overpass_api/output_formats/output_xml.cc

overpass_api/output_formats/output_xml.cc

356 of 399 instrumented lines run by the suite (89.2%) at 8edf11b0419c (this file on GitHub).

runnever runcolumns: line, executions, queries (click for the queries that run the line)

1/** Copyright 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 Roland Olbricht et al.
2 *
3 * This file is part of Overpass_API.
4 *
5 * Overpass_API is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Affero General Public License as
7 * published by the Free Software Foundation, either version 3 of the
8 * License, or (at your option) any later version.
9 *
10 * Overpass_API is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU Affero General Public License
16 * along with Overpass_API. If not, see <http://www.gnu.org/licenses/>.
17 */
19#include "../../expat/escape_xml.h"
20#include "../core/settings.h"
21#include "../frontend/basic_formats.h"
22#include "output_xml.h"
25bool Output_XML::write_http_headers()
260{
270 std::cout<<"Content-type: application/osm3s+xml\n";
280 return true;
290}
32void Output_XML::write_payload_header
33 (const std::string& db_dir, const std::string& timestamp, const std::string& area_timestamp)
35558558 q std::cout<<
36558558 q "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<osm version=\"0.6\""
37558558 q " generator=\"Overpass API "<<basic_settings().version<<" "<<basic_settings().source_hash.substr(0, 8)<<"\">\n"
38558558 q "<note>The data included in this document is from www.openstreetmap.org. "
39558558 q "The data is made available under ODbL.</note>\n";
40558558 q std::cout<<"<meta osm_base=\""<<timestamp<<'\"';
41558558 q if (area_timestamp != "")
420 std::cout<<" areas=\""<<area_timestamp<<"\"";
43558558 q std::cout<<"/>\n\n";
47void Output_XML::write_footer()
49558558 q std::cout<<"\n</osm>\n";
53void Output_XML::display_remark(const std::string& text)
540{
550 std::cout<<"<remark> "<<text<<" </remark>\n";
560}
59void Output_XML::display_error(const std::string& text)
600{
610 std::cout<<"<remark> "<<text<<" </remark>\n";
620}
65void Output_XML::print_global_bbox(const Bbox_Double& bbox)
671515 q std::cout<<" <bounds"
681515 q " minlat=\""<<std::fixed<<std::setprecision(7)<<bbox.south<<"\""
691515 q " minlon=\""<<std::fixed<<std::setprecision(7)<<bbox.west<<"\""
701515 q " maxlat=\""<<std::fixed<<std::setprecision(7)<<bbox.north<<"\""
711515 q " maxlon=\""<<std::fixed<<std::setprecision(7)<<bbox.east<<"\""
721515 q "/>\n\n";
76template< typename Id_Type >
77void print_meta_xml(const OSM_Element_Metadata_Skeleton< Id_Type >& meta,
78 const std::map< uint32, std::string >& users)
7921480118 q{
8021480118 q std::cout<<" version=\""<<meta.version<<"\" timestamp=\""<<iso_string(meta.timestamp)
8121480118 q <<"\" changeset=\""<<meta.changeset<<"\" uid=\""<<meta.user_id<<"\"";
8221480118 q std::map< uint32, std::string >::const_iterator it = users.find(meta.user_id);
8321480118 q if (it != users.end())
8421480118 q std::cout<<" user=\""<<escape_xml(it->second)<<"\"";
8521480118 q}
88void prepend_action(const Output_Handler::Feature_Action& action, bool allow_delta = true)
896082400526 q{
906082400526 q if (action == Output_Handler::keep)
914335316462 q ;
92174708464 q else if (action == Output_Handler::show_from)
9381435 q std::cout<<"<action type=\"show_initial\">\n";
94173894164 q else if (action == Output_Handler::show_to)
951435275 q std::cout<<"<action type=\"show_final\">\n";
976082400526 q if (allow_delta)
986082400526 q {
996082400526 q if (action == Output_Handler::modify)
1008208547 q std::cout<<"<action type=\"modify\">\n<old>\n";
1016000315523 q else if (action == Output_Handler::create)
102146956159 q std::cout<<"<action type=\"create\">\n";
1034530754501 q else if (action == Output_Handler::erase || action == Output_Handler::push_away)
1044376835 q std::cout<<"<action type=\"delete\">\n<old>\n";
1056082400526 q }
1066082400526 q}
109void insert_action(const Output_Handler::Feature_Action& action)
1109267947 q{
1119267947 q if (action == Output_Handler::keep)
1120 ;
1139267947 q else if (action == Output_Handler::modify
1149267947 q || action == Output_Handler::erase || action == Output_Handler::push_away)
1159267947 q std::cout<<"</old>\n<new>\n";
1169267947 q}
119void append_action(const Output_Handler::Feature_Action& action, bool is_new = false, bool allow_delta = true)
1206082400526 q{
1216082400526 q if (action == Output_Handler::keep)
1224335316462 q ;
123174708464 q else if (action == Output_Handler::show_from || action == Output_Handler::show_to)
1241516705 q std::cout<<"</action>\n";
1266082400526 q if (allow_delta)
1276082400526 q {
1286082400526 q if (action == Output_Handler::modify)
1298208547 q std::cout<<"</new>\n</action>\n";
1306000315523 q else if (action == Output_Handler::create)
131146956159 q std::cout<<"</action>\n";
1324530754501 q else if (action == Output_Handler::erase || action == Output_Handler::push_away)
1334376835 q {
1344376835 q if (is_new)
1351059414 q std::cout<<"</new>\n</action>\n";
1363317421 q else
1373317421 q std::cout<<"</old>\n</action>\n";
1384376835 q }
1396082400526 q }
1406082400526 q}
143void print_tags(const std::vector< std::pair< std::string, std::string > >* tags,
144 Output_Mode mode, bool& inner_tags_printed)
1456164485526 q{
1466164485526 q if ((mode.mode & Output_Mode::TAGS) && tags && !tags->empty())
1471607940511 q {
1481607940511 q if (!inner_tags_printed)
149284098482 q {
150284098482 q std::cout<<">\n";
151284098482 q inner_tags_printed = true;
152284098482 q }
1531607940511 q for (std::vector< std::pair< std::string, std::string > >::const_iterator it = tags->begin();
1548984194511 q it != tags->end(); ++it)
1557376254511 q std::cout<<" <tag k=\""<<escape_xml(it->first)<<"\" v=\""<<escape_xml(it->second)<<"\"/>\n";
1561607940511 q }
1576164485526 q}
160void print_bounds(const Opaque_Geometry& geometry, Output_Mode mode, bool& inner_tags_printed)
1611636293362 q{
1621636293362 q if ((mode.mode & Output_Mode::BOUNDS) && geometry.has_bbox())
1634010117 q {
1644010117 q if (!inner_tags_printed)
1654010117 q {
1664010117 q std::cout<<">\n";
1674010117 q inner_tags_printed = true;
1684010117 q }
1694010117 q std::cout<<" <bounds"
1704010117 q " minlat=\""<<std::fixed<<std::setprecision(7)<<geometry.south()<<"\""
1714010117 q " minlon=\""<<std::fixed<<std::setprecision(7)<<geometry.west()<<"\""
1724010117 q " maxlat=\""<<std::fixed<<std::setprecision(7)<<geometry.north()<<"\""
1734010117 q " maxlon=\""<<std::fixed<<std::setprecision(7)<<geometry.east()<<"\""
1744010117 q "/>\n";
1754010117 q }
1761596192362 q else if ((mode.mode & Output_Mode::CENTER) && geometry.has_center())
1771742110 q {
1781742110 q if (!inner_tags_printed)
1791742110 q {
1801742110 q std::cout<<">\n";
1811742110 q inner_tags_printed = true;
1821742110 q }
1831742110 q std::cout<<" <center"
1841742110 q " lat=\""<<std::fixed<<std::setprecision(7)<<geometry.center_lat()<<"\""
1851742110 q " lon=\""<<std::fixed<<std::setprecision(7)<<geometry.center_lon()<<"\""
1861742110 q "/>\n";
1871742110 q }
1881636293362 q}
191void print_geometry(const Opaque_Geometry& geometry, Output_Mode mode, bool& inner_tags_printed,
192 const std::string& indent)
193178424455 q{
194178424455 q if ((mode.mode & Output_Mode::GEOMETRY) && geometry.has_components())
1950 {
1960 if (!inner_tags_printed)
1970 {
1980 std::cout<<">\n";
1990 inner_tags_printed = true;
2000 }
2010 const std::vector< Opaque_Geometry* >* components = geometry.get_components();
2020 for (std::vector< Opaque_Geometry* >::const_iterator it = components->begin(); it != components->end(); ++it)
2030 {
2040 if (*it)
2050 {
2060 std::cout<<indent<<"<group>\n";
2070 print_geometry(**it, mode, inner_tags_printed, indent + " ");
2080 std::cout<<indent<<"</group>\n";
2090 }
2100 }
2110 }
212178424455 q else if ((mode.mode & Output_Mode::GEOMETRY) && geometry.has_line_geometry())
213171 q {
214171 q if (!inner_tags_printed)
215171 q {
216171 q std::cout<<">\n";
217171 q inner_tags_printed = true;
218171 q }
219171 q const std::vector< Point_Double >* line = geometry.get_line_geometry();
220531 q for (std::vector< Point_Double >::const_iterator it = line->begin(); it != line->end(); ++it)
221361 q std::cout<<indent<<"<vertex"
222361 q " lat=\""<<std::fixed<<std::setprecision(7)<<it->lat<<"\""
223361 q " lon=\""<<std::fixed<<std::setprecision(7)<<it->lon<<"\""
224361 q "/>\n";
225171 q }
226178407455 q else if ((mode.mode & Output_Mode::GEOMETRY) && geometry.has_multiline_geometry())
227601211 q {
228601211 q if (!inner_tags_printed)
229601211 q {
230601211 q std::cout<<">\n";
231601211 q inner_tags_printed = true;
232601211 q }
233601211 q const std::vector< std::vector< Point_Double > >* linestrings = geometry.get_multiline_geometry();
234601211 q for (std::vector< std::vector< Point_Double > >::const_iterator iti = linestrings->begin();
2351202421 q iti != linestrings->end(); ++iti)
236601211 q {
237601211 q std::cout<<indent<<"<linestring>\n";
2383006051 q for (std::vector< Point_Double >::const_iterator it = iti->begin(); it != iti->end(); ++it)
2392404841 q std::cout<<indent<<" <vertex"
2402404841 q " lat=\""<<std::fixed<<std::setprecision(7)<<it->lat<<"\""
2412404841 q " lon=\""<<std::fixed<<std::setprecision(7)<<it->lon<<"\""
2422404841 q "/>\n";
243601211 q std::cout<<indent<<"</linestring>\n";
244601211 q }
245601211 q }
246118286455 q else if ((mode.mode & Output_Mode::GEOMETRY) && geometry.has_center())
24821 q if (!inner_tags_printed)
25021 q std::cout<<">\n";
25121 q inner_tags_printed = true;
25321 q std::cout<<indent<<"<point"
25421 q " lat=\""<<std::fixed<<std::setprecision(7)<<geometry.center_lat()<<"\""
25521 q " lon=\""<<std::fixed<<std::setprecision(7)<<geometry.center_lon()<<"\""
25621 q "/>\n";
258118284455 q else if ((mode.mode & Output_Mode::BOUNDS) && geometry.has_bbox())
2590 {
2600 if (!inner_tags_printed)
2610 {
2620 std::cout<<">\n";
2630 inner_tags_printed = true;
2640 }
2650 std::cout<<" <bounds"
2660 " minlat=\""<<std::fixed<<std::setprecision(7)<<geometry.south()<<"\""
2670 " minlon=\""<<std::fixed<<std::setprecision(7)<<geometry.west()<<"\""
2680 " maxlat=\""<<std::fixed<<std::setprecision(7)<<geometry.north()<<"\""
2690 " maxlon=\""<<std::fixed<<std::setprecision(7)<<geometry.east()<<"\""
2700 "/>\n";
2710 }
272118284455 q else if ((mode.mode & Output_Mode::CENTER) && geometry.has_center())
27411 q if (!inner_tags_printed)
27611 q std::cout<<">\n";
27711 q inner_tags_printed = true;
27911 q std::cout<<indent<<"<center"
28011 q " lat=\""<<std::fixed<<std::setprecision(7)<<geometry.center_lat()<<"\""
28111 q " lon=\""<<std::fixed<<std::setprecision(7)<<geometry.center_lon()<<"\""
28211 q "/>\n";
284178424455 q}
287void print_members(const Way_Skeleton& skel, const Opaque_Geometry& geometry,
288 Output_Mode mode, bool& inner_tags_printed)
2891431793286 q{
2901431793286 q if ((mode.mode & Output_Mode::NDS) && !skel.nds.empty())
2911088266168 q {
2921088266168 q if (!inner_tags_printed)
2931032159153 q {
2941032159153 q std::cout<<">\n";
2951032159153 q inner_tags_printed = true;
2961032159153 q }
29710345943168 q for (uint i = 0; i < skel.nds.size(); ++i)
2989257677168 q {
2999257677168 q std::cout<<" <nd ref=\""<<skel.nds[i].val()<<"\"";
3009257677168 q if (geometry.has_faithful_way_geometry() && geometry.way_pos_is_valid(i))
301343074 q std::cout<<" lat=\""<<std::fixed<<std::setprecision(7)<<geometry.way_pos_lat(i)
302343074 q <<"\" lon=\""<<std::fixed<<std::setprecision(7)<<geometry.way_pos_lon(i)<<'\"';
3039257677168 q std::cout<<"/>\n";
3049257677168 q }
3051088266168 q }
3061431793286 q}
309void print_members(const Relation_Skeleton& skel, const Opaque_Geometry& geometry,
310 const std::map< uint32, std::string >& roles,
311 Output_Mode mode, bool& inner_tags_printed)
312204500173 q{
313204500173 q if ((mode.mode & Output_Mode::MEMBERS) && !skel.members.empty())
314180656112 q {
315180656112 q if (!inner_tags_printed)
316179988101 q {
317179988101 q std::cout<<">\n";
318179988101 q inner_tags_printed = true;
319179988101 q }
3209872124112 q for (uint i = 0; i < skel.members.size(); ++i)
3219691468112 q {
3229691468112 q std::map< uint32, std::string >::const_iterator it = roles.find(skel.members[i].role);
3239691468112 q std::cout<<" <member type=\""<<member_type_name(skel.members[i].type)
3249691468112 q <<"\" ref=\""<<skel.members[i].ref.val()
3259691468112 q <<"\" role=\""<<escape_xml(it != roles.end() ? it->second : "???")<<"\"";
3279691468112 q if (skel.members[i].type == Relation_Entry::NODE)
32889006283 q {
32989006283 q if (geometry.has_faithful_relation_geometry() && geometry.relation_pos_is_valid(i))
3304103 q std::cout<<" lat=\""<<std::fixed<<std::setprecision(7)<<geometry.relation_pos_lat(i)
3314103 q <<"\" lon=\""<<std::fixed<<std::setprecision(7)<<geometry.relation_pos_lon(i)<<'\"';
33289006283 q std::cout<<"/>\n";
33389006283 q }
3348801406110 q else if (skel.members[i].type == Relation_Entry::WAY)
3358743326109 q {
3368743326109 q if (!geometry.has_faithful_relation_geometry())
3378574985103 q std::cout<<"/>\n";
3381683416 q else
3391683416 q {
3401683416 q bool has_some_geometry = false;
3411793506 q for (uint j = 0; j < geometry.relation_way_size(i); ++j)
342110094 q has_some_geometry |= geometry.relation_pos_is_valid(i, j);
3441683416 q if (!has_some_geometry)
3451670696 q std::cout<<"/>\n";
34612724 q else
34712724 q {
34812724 q std::cout<<">\n";
349118894 q for (uint j = 0; j < geometry.relation_way_size(i); ++j)
350106174 q {
351106174 q if (geometry.relation_pos_is_valid(i, j))
352102954 q std::cout<<" <nd lat=\""<<std::fixed<<std::setprecision(7)<<geometry.relation_pos_lat(i, j)
353102954 q <<"\" lon=\""<<std::fixed<<std::setprecision(7)<<geometry.relation_pos_lon(i, j)<<"\"/>\n";
3543221 q else
3553221 q std::cout<<" <nd/>\n";
356106174 q }
35712724 q std::cout<<" </member>\n";
35812724 q }
3591683416 q }
3608743326109 q }
3615808044 q else
3625808044 q std::cout<<"/>\n";
3639691468112 q }
364180656112 q }
365204500173 q}
368void print_node(const Node_Skeleton& skel,
369 const Opaque_Geometry& geometry,
370 const std::vector< std::pair< std::string, std::string > >* tags,
371 const OSM_Element_Metadata_Skeleton< Node::Id_Type >* meta,
372 const std::map< uint32, std::string >* users,
373 Output_Mode mode)
3744349768241 q{
3754349768241 q std::cout<<" <node";
3764349768241 q if (mode.mode & Output_Mode::ID)
3774349756241 q std::cout<<" id=\""<<skel.id.val()<<'\"';
3784349768241 q if ((mode.mode & (Output_Mode::COORDS | Output_Mode::GEOMETRY | Output_Mode::BOUNDS | Output_Mode::CENTER))
3794349768241 q && geometry.has_center())
3803052126137 q std::cout<<" lat=\""<<std::fixed<<std::setprecision(7)<<geometry.center_lat()
3813052126137 q <<"\" lon=\""<<std::fixed<<std::setprecision(7)<<geometry.center_lon()<<'\"';
3824349768241 q if ((mode.mode & (Output_Mode::VERSION | Output_Mode::META)) && meta && users)
38318341710 q print_meta_xml(*meta, *users);
3854349768241 q bool inner_tags_printed = false;
3864349768241 q print_tags(tags, mode, inner_tags_printed);
3874349768241 q if (!inner_tags_printed)
3884163391238 q std::cout<<"/>\n";
389186377114 q else
390186377114 q std::cout<<" </node>\n";
3914349768241 q}
394void print_way(const Way_Skeleton& skel,
395 const Opaque_Geometry& geometry,
396 const std::vector< std::pair< std::string, std::string > >* tags,
397 const OSM_Element_Metadata_Skeleton< Way::Id_Type >* meta,
398 const std::map< uint32, std::string >* users,
399 Output_Mode mode)
4001431793286 q{
4011431793286 q std::cout<<" <way";
4021431793286 q if (mode.mode & Output_Mode::ID)
4031431786286 q std::cout<<" id=\""<<skel.id.val()<<'\"';
4041431793286 q if ((mode.mode & (Output_Mode::VERSION | Output_Mode::META)) && meta && users)
4053095811 q print_meta_xml(*meta, *users);
4071431793286 q bool inner_tags_printed = false;
4081431793286 q print_bounds(geometry, mode, inner_tags_printed);
4091431793286 q print_members(skel, geometry, mode, inner_tags_printed);
4101431793286 q print_tags(tags, mode, inner_tags_printed);
4111431793286 q if (!inner_tags_printed)
412329551259 q std::cout<<"/>\n";
4131102242171 q else
4141102242171 q std::cout<<" </way>\n";
4151431793286 q}
418void print_relation(const Relation_Skeleton& skel,
419 const Opaque_Geometry& geometry,
420 const std::vector< std::pair< std::string, std::string > >* tags,
421 const OSM_Element_Metadata_Skeleton< Relation::Id_Type >* meta,
422 const std::map< uint32, std::string >* roles,
423 const std::map< uint32, std::string >* users,
424 Output_Mode mode)
425204500173 q{
426204500173 q std::cout<<" <relation";
427204500173 q if (mode.mode & Output_Mode::ID)
428204499173 q std::cout<<" id=\""<<skel.id.val()<<'\"';
429204500173 q if ((mode.mode & (Output_Mode::VERSION | Output_Mode::META)) && meta && users)
4303977 q print_meta_xml(*meta, *users);
432204500173 q bool inner_tags_printed = false;
433204500173 q print_bounds(geometry, mode, inner_tags_printed);
434204500173 q if (roles)
435204500173 q print_members(skel, geometry, *roles, mode, inner_tags_printed);
436204500173 q print_tags(tags, mode, inner_tags_printed);
437204500173 q if (!inner_tags_printed)
43823599145 q std::cout<<"/>\n";
439180901114 q else
440180901114 q std::cout<<" </relation>\n";
441204500173 q}
444template< typename Id_Type >
445void print_deleted(const std::string& type_name, const Id_Type& id,
446 const Output_Handler::Feature_Action& action,
447 const OSM_Element_Metadata_Skeleton< Id_Type >* meta,
448 const std::map< uint32, std::string >* users,
449 Output_Mode mode)
4501059414 q{
4511059414 q std::cout<<" <"<<type_name;
4521059414 q if (mode.mode & Output_Mode::ID)
4531059414 q std::cout<<" id=\""<<id.val()<<'\"';
4541059414 q if (action == Output_Handler::erase)
455927913 q std::cout<<" visible=\"false\"";
456131511 q else
457131511 q std::cout<<" visible=\"true\"";
4581059414 q if ((mode.mode & (Output_Mode::VERSION | Output_Mode::META)) && meta && users)
459292 q print_meta_xml(*meta, *users);
4601059414 q std::cout<<"/>\n";
4611059414 q}
464void Output_XML::print_item(const Node_Skeleton& skel,
465 const Opaque_Geometry& geometry,
466 const std::vector< std::pair< std::string, std::string > >* tags,
467 const OSM_Element_Metadata_Skeleton< Node::Id_Type >* meta,
468 const std::map< uint32, std::string >* users,
469 Output_Mode mode,
470 const Feature_Action& action,
471 const Node_Skeleton* new_skel,
472 const Opaque_Geometry* new_geometry,
473 const std::vector< std::pair< std::string, std::string > >* new_tags,
474 const OSM_Element_Metadata_Skeleton< Node::Id_Type >* new_meta)
4754285776241 q{
4764285776241 q prepend_action(action);
4784285776241 q print_node(skel, geometry, tags, meta, users, mode);
4804285776241 q if (new_skel)
4817308927 q {
4827308927 q insert_action(action);
4847308927 q if (action == Output_Handler::erase || action == Output_Handler::push_away)
485909710 q print_deleted("node", new_skel->id, action, new_meta, users, mode);
4866399227 q else
4876399227 q print_node(*new_skel, *new_geometry, new_tags, new_meta, users, mode);
4887308927 q }
4904285776241 q append_action(action, new_skel);
4914285776241 q}
494void Output_XML::print_item(const Way_Skeleton& skel,
495 const Opaque_Geometry& geometry,
496 const std::vector< std::pair< std::string, std::string > >* tags,
497 const OSM_Element_Metadata_Skeleton< Way::Id_Type >* meta,
498 const std::map< uint32, std::string >* users,
499 Output_Mode mode,
500 const Feature_Action& action,
501 const Way_Skeleton* new_skel,
502 const Opaque_Geometry* new_geometry,
503 const std::vector< std::pair< std::string, std::string > >* new_tags,
504 const OSM_Element_Metadata_Skeleton< Way::Id_Type >* new_meta)
5051413858286 q{
5061413858286 q prepend_action(action);
5081413858286 q print_way(skel, geometry, tags, meta, users, mode);
5101413858286 q if (new_skel)
5111943229 q {
5121943229 q insert_action(action);
5141943229 q if (action == Output_Handler::erase || action == Output_Handler::push_away)
515149711 q print_deleted("way", new_skel->id, action, new_meta, users, mode);
5161793529 q else
5171793529 q print_way(*new_skel, *new_geometry, new_tags, new_meta, users, mode);
5181943229 q }
5201413858286 q append_action(action, new_skel);
5211413858286 q}
524void Output_XML::print_item(const Relation_Skeleton& skel,
525 const Opaque_Geometry& geometry,
526 const std::vector< std::pair< std::string, std::string > >* tags,
527 const OSM_Element_Metadata_Skeleton< Relation::Id_Type >* meta,
528 const std::map< uint32, std::string >* roles,
529 const std::map< uint32, std::string >* users,
530 Output_Mode mode,
531 const Feature_Action& action,
532 const Relation_Skeleton* new_skel,
533 const Opaque_Geometry* new_geometry,
534 const std::vector< std::pair< std::string, std::string > >* new_tags,
535 const OSM_Element_Metadata_Skeleton< Relation::Id_Type >* new_meta)
536204342173 q{
537204342173 q prepend_action(action);
539204342173 q print_relation(skel, geometry, tags, meta, roles, users, mode);
541204342173 q if (new_skel)
5421589 q {
5431589 q insert_action(action);
5451589 q if (action == Output_Handler::erase || action == Output_Handler::push_away)
5460 print_deleted("relation", new_skel->id, action, new_meta, users, mode);
5471589 q else
5481589 q print_relation(*new_skel, *new_geometry, new_tags, new_meta, roles, users, mode);
5491589 q }
551204342173 q append_action(action, new_skel);
552204342173 q}
555void Output_XML::print_item(const Derived_Skeleton& skel,
556 const Opaque_Geometry& geometry,
557 const std::vector< std::pair< std::string, std::string > >* tags,
558 Output_Mode mode,
559 const Feature_Action& action)
560178424455 q{
561178424455 q prepend_action(action, true);
563178424455 q std::cout<<" <"<<skel.type_name;
564178424455 q if (mode.mode & Output_Mode::ID)
565178418455 q std::cout<<" id=\""<<skel.id.val()<<'\"';
567178424455 q bool inner_tags_printed = false;
568178424455 q print_geometry(geometry, mode, inner_tags_printed, " ");
569178424455 q print_tags(tags, mode, inner_tags_printed);
570178424455 q if (!inner_tags_printed)
57134036175 q std::cout<<"/>\n";
572144388454 q else
573144388454 q std::cout<<" </"<<skel.type_name<<">\n";
575178424455 q append_action(action, false, true);
576178424455 q}