summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Nienhüser <nienhueser@kde.org>2016-11-13 20:41:19 (GMT)
committerDennis Nienhüser <nienhueser@kde.org>2016-11-13 20:41:19 (GMT)
commit994f283eb593724b9e6b1b43f7b7f983ca198f69 (patch)
treeddd91e1305ced9322ac45073f111eadceed80f9e
parentc188ca3b4cbf17488560921e3cec9b27e528c0c6 (diff)
Provide a oid() method to return the original osm id, if present
-rw-r--r--src/lib/marble/osm/OsmPlacemarkData.cpp6
-rw-r--r--src/lib/marble/osm/OsmPlacemarkData.h1
-rw-r--r--tools/vectorosm-tilecreator/WayConcatenator.cpp22
-rw-r--r--tools/vectorosm-tilecreator/WayConcatenator.h1
4 files changed, 15 insertions, 15 deletions
diff --git a/src/lib/marble/osm/OsmPlacemarkData.cpp b/src/lib/marble/osm/OsmPlacemarkData.cpp
index 97635e3..d4bf966 100644
--- a/src/lib/marble/osm/OsmPlacemarkData.cpp
+++ b/src/lib/marble/osm/OsmPlacemarkData.cpp
@@ -32,6 +32,12 @@ qint64 OsmPlacemarkData::id() const
return m_id;
}
+qint64 OsmPlacemarkData::oid() const
+{
+ auto const value = m_tags.value(QStringLiteral("mx:oid")).toLong();
+ return value > 0 ? value : m_id;
+}
+
QString OsmPlacemarkData::changeset() const
{
return m_changeset;
diff --git a/src/lib/marble/osm/OsmPlacemarkData.h b/src/lib/marble/osm/OsmPlacemarkData.h
index 23b3f8c..1d164c1 100644
--- a/src/lib/marble/osm/OsmPlacemarkData.h
+++ b/src/lib/marble/osm/OsmPlacemarkData.h
@@ -54,6 +54,7 @@ public:
OsmPlacemarkData();
qint64 id() const;
+ qint64 oid() const;
QString version() const;
QString changeset() const;
QString uid() const;
diff --git a/tools/vectorosm-tilecreator/WayConcatenator.cpp b/tools/vectorosm-tilecreator/WayConcatenator.cpp
index 7d456b5..2f79e1e 100644
--- a/tools/vectorosm-tilecreator/WayConcatenator.cpp
+++ b/tools/vectorosm-tilecreator/WayConcatenator.cpp
@@ -43,8 +43,8 @@ WayConcatenator::WayConcatenator(GeoDataDocument *document) :
osmData.containsTagKey("waterway");
if (isWay) {
GeoDataLineString *line = static_cast<GeoDataLineString*>(placemark->geometry());
- qint64 firstId = osmId(osmData.nodeReference(line->first()));
- qint64 lastId = osmId(osmData.nodeReference(line->last()));
+ qint64 firstId = osmData.nodeReference(line->first()).oid();
+ qint64 lastId = osmData.nodeReference(line->last()).oid();
if (firstId > 0 && lastId > 0) {
++m_originalWays;
bool containsFirst = m_hash.contains(firstId);
@@ -109,12 +109,6 @@ int WayConcatenator::mergedWays() const
return m_mergedWays;
}
-qint64 WayConcatenator::osmId(const OsmPlacemarkData &osmData)
-{
- auto const value = osmData.tagValue(QStringLiteral("mx:oid")).toLong();
- return value > 0 ? value : osmData.id();
-}
-
void WayConcatenator::addWayChunks()
{
for (auto const &placemark: m_wayPlacemarks) {
@@ -171,8 +165,8 @@ WayChunk::Ptr WayConcatenator::wayChunk(const GeoDataPlacemark &placemark, qint6
void WayConcatenator::concatFirst(const PlacemarkPtr &placemark, const WayChunk::Ptr &chunk)
{
GeoDataLineString *line = static_cast<GeoDataLineString*>(placemark->geometry());
- qint64 firstId = osmId(placemark->osmData().nodeReference(line->first()));
- qint64 lastId = osmId(placemark->osmData().nodeReference(line->last()));
+ qint64 firstId = placemark->osmData().nodeReference(line->first()).oid();
+ qint64 lastId = placemark->osmData().nodeReference(line->last()).oid();
if (chunk->first() != chunk->last()) {
int chunksRemoved = m_hash.remove(firstId, chunk);
@@ -194,8 +188,8 @@ void WayConcatenator::concatFirst(const PlacemarkPtr &placemark, const WayChunk:
void WayConcatenator::concatLast(const PlacemarkPtr &placemark, const WayChunk::Ptr &chunk)
{
GeoDataLineString *line = static_cast<GeoDataLineString*>(placemark->geometry());
- qint64 firstId = osmId(placemark->osmData().nodeReference(line->first()));
- qint64 lastId = osmId(placemark->osmData().nodeReference(line->last()));
+ qint64 firstId = placemark->osmData().nodeReference(line->first()).oid();
+ qint64 lastId = placemark->osmData().nodeReference(line->last()).oid();
if (chunk->first() != chunk->last()) {
int chunksRemoved = m_hash.remove(lastId, chunk);
@@ -214,8 +208,8 @@ void WayConcatenator::concatLast(const PlacemarkPtr &placemark, const WayChunk::
void WayConcatenator::concatBoth(const PlacemarkPtr &placemark, const WayChunk::Ptr &chunk, const WayChunk::Ptr &otherChunk)
{
GeoDataLineString *line = static_cast<GeoDataLineString*>(placemark->geometry());
- qint64 firstId = osmId(placemark->osmData().nodeReference(line->first()));
- qint64 lastId = osmId(placemark->osmData().nodeReference(line->last()));
+ qint64 firstId = placemark->osmData().nodeReference(line->first()).oid();
+ qint64 lastId = placemark->osmData().nodeReference(line->last()).oid();
int chunksRemoved;
if (chunk->first() != chunk->last()) {
diff --git a/tools/vectorosm-tilecreator/WayConcatenator.h b/tools/vectorosm-tilecreator/WayConcatenator.h
index bc75cc0..3a95674 100644
--- a/tools/vectorosm-tilecreator/WayConcatenator.h
+++ b/tools/vectorosm-tilecreator/WayConcatenator.h
@@ -27,7 +27,6 @@ public:
int originalWays() const;
int mergedWays() const;
- static qint64 osmId(const OsmPlacemarkData &osmData);
private:
void createWayChunk(const PlacemarkPtr &placemark, qint64 firstId, qint64 lastId);