summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorsten Rahn <rahn@kde.org>2016-11-09 20:05:16 (GMT)
committerTorsten Rahn <trahn@testo.de>2016-11-09 20:05:49 (GMT)
commit83f32cd936f30ff23ccdfa2863ea5fbbcb070bd1 (patch)
tree0506a92987d2e5c08b5fd3360f13d4322edbc630
parent867ec8cb24a7d57daed41e73949c5441ead5e64d (diff)
keep the color for displaying batch rendering of placemarks constant.
-rw-r--r--src/lib/marble/layers/PlacemarkLayer.cpp18
-rw-r--r--src/lib/marble/layers/PlacemarkLayer.h1
2 files changed, 17 insertions, 2 deletions
diff --git a/src/lib/marble/layers/PlacemarkLayer.cpp b/src/lib/marble/layers/PlacemarkLayer.cpp
index e92d23b..adab0e1 100644
--- a/src/lib/marble/layers/PlacemarkLayer.cpp
+++ b/src/lib/marble/layers/PlacemarkLayer.cpp
@@ -108,6 +108,7 @@ bool PlacemarkLayer::render( GeoPainter *geoPainter, ViewportParams *viewport,
if (i == hash.end()) {
fragment.count = 1;
fragment.pixmap = mark->symbolPixmap();
+ fragment.symbolId = mark->symbolId();
}
else {
fragment = i.value();
@@ -134,6 +135,7 @@ bool PlacemarkLayer::render( GeoPainter *geoPainter, ViewportParams *viewport,
if (i == hash.end()) {
fragment.count = 1;
fragment.pixmap = mark->symbolPixmap();
+ fragment.symbolId = mark->symbolId();
}
else {
fragment = i.value();
@@ -154,9 +156,21 @@ bool PlacemarkLayer::render( GeoPainter *geoPainter, ViewportParams *viewport,
#ifdef BATCH_RENDERING
for (auto& val : hash.values()) {
if (m_debugModeEnabled) {
-// qDebug() << "Batches" << val.count;
+// qDebug() << "Batches" << val.symbolId << val.count;
QPixmap debugPixmap(val.pixmap.size());
- debugPixmap.fill((quint64)(&val));
+ QColor backgroundColor;
+ QString idStr = val.symbolId.section('/', -1);
+ if (idStr.length() > 2) {
+ idStr.remove("shop_");
+ backgroundColor = QColor(
+ (10 * (int)(idStr[0].toLatin1()))%255,
+ (10 * (int)(idStr[1].toLatin1()))%255,
+ (10 * (int)(idStr[2].toLatin1()))%255 );
+ }
+ else {
+ backgroundColor = QColor((quint64)(&val.symbolId));
+ }
+ debugPixmap.fill(backgroundColor);
QPainter pixpainter;
pixpainter.begin(&debugPixmap);
pixpainter.drawPixmap(0, 0, val.pixmap);
diff --git a/src/lib/marble/layers/PlacemarkLayer.h b/src/lib/marble/layers/PlacemarkLayer.h
index 3bb3bd6..af4ad16 100644
--- a/src/lib/marble/layers/PlacemarkLayer.h
+++ b/src/lib/marble/layers/PlacemarkLayer.h
@@ -45,6 +45,7 @@ struct Fragment
QVarLengthArray<QPainter::PixmapFragment, 16> fragments;
int count;
QPixmap pixmap;
+ QString symbolId;
};
class PlacemarkLayer : public QObject, public LayerInterface