MCPcopy Create free account
hub / github.com/comaps/comaps / LoadMwmEdits

Method LoadMwmEdits

libs/editor/osm_editor.cpp:1116–1155  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1114}
1115
1116void Editor::LoadMwmEdits(FeaturesContainer & loadedFeatures, xml_node const & mwm, MwmId const & mwmId,
1117 bool needMigrate)
1118{
1119 LogHelper logHelper(mwmId);
1120
1121 for (auto const & section : kXmlSections)
1122 {
1123 for (auto const & nodeOrWay : mwm.child(section.m_sectionName).select_nodes("node|way"))
1124 {
1125 try
1126 {
1127 XMLFeature const xml(nodeOrWay.node());
1128
1129 auto const fid = GetFeatureIdByXmlFeature(loadedFeatures, xml, mwmId, section.m_status, needMigrate);
1130
1131 // Remove obsolete changes during migration.
1132 if (needMigrate && IsObsolete(xml, fid))
1133 continue;
1134
1135 FeatureTypeInfo fti;
1136 if (!FillFeatureInfo(section.m_status, xml, fid, fti))
1137 continue;
1138
1139 logHelper.OnStatus(section.m_status);
1140
1141 loadedFeatures[fid.m_mwmId].emplace(fid.m_index, std::move(fti));
1142 }
1143 catch (editor::XMLFeatureError const & ex)
1144 {
1145 std::ostringstream s;
1146 nodeOrWay.node().print(s, " ");
1147 LOG(LERROR, (ex.what(), "mwmId =", mwmId, "in section", section.m_sectionName, s.str()));
1148 }
1149 catch (editor::MigrationError const & ex)
1150 {
1151 LOG(LWARNING, (ex.what(), "mwmId =", mwmId, XMLFeature(nodeOrWay.node())));
1152 }
1153 }
1154 }
1155}
1156
1157bool Editor::HaveMapEditsToUpload(FeaturesContainer const & features)
1158{

Callers

nothing calls this directly

Calls 6

IsObsoleteFunction · 0.85
OnStatusMethod · 0.80
printMethod · 0.80
XMLFeatureClass · 0.70
emplaceMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected