forked from organicmaps/organicmaps
[editor] Create OSM object code in ChangesetWrapper.
This commit is contained in:
parent
51ae713240
commit
93c26d54bd
2 changed files with 15 additions and 0 deletions
|
@ -6,6 +6,7 @@
|
|||
#include "geometry/mercator.hpp"
|
||||
|
||||
#include "base/logging.hpp"
|
||||
#include "base/macros.hpp"
|
||||
|
||||
#include "std/algorithm.hpp"
|
||||
#include "std/sstream.hpp"
|
||||
|
@ -101,6 +102,17 @@ XMLFeature ChangesetWrapper::GetMatchingAreaFeatureFromOSM(vector<m2::PointD> co
|
|||
MYTHROW(OsmObjectWasDeletedException, ("OSM does not have any matching way for feature"));
|
||||
}
|
||||
|
||||
void ChangesetWrapper::Create(XMLFeature node)
|
||||
{
|
||||
if (m_changesetId == kInvalidChangesetId)
|
||||
m_changesetId = m_api.CreateChangeSet(m_changesetComments);
|
||||
|
||||
// Changeset id should be updated for every OSM server commit.
|
||||
node.SetAttribute("changeset", strings::to_string(m_changesetId));
|
||||
// TODO(AlexZ): Think about storing/logging returned OSM ids.
|
||||
UNUSED_VALUE(m_api.CreateElement(node));
|
||||
}
|
||||
|
||||
void ChangesetWrapper::Modify(XMLFeature node)
|
||||
{
|
||||
if (m_changesetId == kInvalidChangesetId)
|
||||
|
|
|
@ -37,6 +37,9 @@ public:
|
|||
editor::XMLFeature GetMatchingNodeFeatureFromOSM(m2::PointD const & center);
|
||||
editor::XMLFeature GetMatchingAreaFeatureFromOSM(vector<m2::PointD> const & geomerty);
|
||||
|
||||
/// Throws exceptions from above list.
|
||||
void Create(editor::XMLFeature node);
|
||||
|
||||
/// Throws exceptions from above list.
|
||||
/// Node should have correct OSM "id" attribute set.
|
||||
void Modify(editor::XMLFeature node);
|
||||
|
|
Loading…
Add table
Reference in a new issue