Commit 0ed41dd9 authored by Mohammed Nafees's avatar Mohammed Nafees

Add level debugging to PlacemarkLayer

parent bb100344
......@@ -1306,18 +1306,21 @@ void MarbleMap::setLevelTagDebugModeEnabled(bool visible)
{
if (visible != d->m_geometryLayer.levelTagDebugModeEnabled()) {
d->m_geometryLayer.setLevelTagDebugModeEnabled(visible);
d->m_placemarkLayer.setLevelTagDebugModeEnabled(visible);
emit repaintNeeded();
}
}
bool MarbleMap::levelTagDebugModeEnabled() const
{
return d->m_geometryLayer.levelTagDebugModeEnabled();
return d->m_geometryLayer.levelTagDebugModeEnabled() &&
d->m_placemarkLayer.levelTagDebugModeEnabled();
}
void MarbleMap::setDebugLevelTag(int level)
{
d->m_geometryLayer.setDebugLevelTag(level);
d->m_placemarkLayer.setDebugLevelTag(level);
}
int MarbleMap::debugLevelTag() const
......
......@@ -111,7 +111,7 @@ public:
QSet<qint64> m_highlightedRouteRelations;
GeoDataRelation::RelationTypes m_visibleRelationTypes;
bool m_levelTagDebugModeEnabled;
int m_levelToDebug;
int m_debugLevelTag;
};
GeometryLayerPrivate::GeometryLayerPrivate(const QAbstractItemModel *model, const StyleBuilder *styleBuilder) :
......@@ -123,7 +123,7 @@ GeometryLayerPrivate::GeometryLayerPrivate(const QAbstractItemModel *model, cons
m_cachedItemCount(0),
m_visibleRelationTypes(GeoDataRelation::RouteFerry),
m_levelTagDebugModeEnabled(false),
m_levelToDebug(0)
m_debugLevelTag(0)
{
}
......@@ -258,7 +258,7 @@ bool GeometryLayer::render(GeoPainter *painter, ViewportParams *viewport,
QHash<QString, QString>::const_iterator tagIter = placemark->osmData().findTag(QStringLiteral("level"));
if (tagIter != placemark->osmData().tagsEnd()) {
const int val = tagIter.value().toInt();
if (val != d->m_levelToDebug) {
if (val != d->m_debugLevelTag) {
continue;
}
}
......@@ -699,15 +699,15 @@ bool GeometryLayer::levelTagDebugModeEnabled() const
void GeometryLayer::setDebugLevelTag(int level)
{
if (d->m_levelToDebug != level) {
d->m_levelToDebug = level;
if (d->m_debugLevelTag != level) {
d->m_debugLevelTag = level;
emit repaintNeeded();
}
}
int GeometryLayer::debugLevelTag() const
{
return d->m_levelToDebug;
return d->m_debugLevelTag;
}
}
......
......@@ -23,6 +23,7 @@
#include "ViewportParams.h"
#include "VisiblePlacemark.h"
#include "RenderState.h"
#include "osm/OsmPlacemarkData.h"
#define BATCH_RENDERING
......@@ -37,7 +38,9 @@ PlacemarkLayer::PlacemarkLayer(QAbstractItemModel *placemarkModel,
QObject( parent ),
m_layout( placemarkModel, selectionModel, clock, styleBuilder ),
m_debugModeEnabled(false),
m_tileLevel(0)
m_levelTagDebugModeEnabled(false),
m_tileLevel(0),
m_debugLevelTag(0)
{
m_useXWorkaround = testXBug();
mDebug() << "Use workaround: " << ( m_useXWorkaround ? "1" : "0" );
......@@ -83,6 +86,17 @@ bool PlacemarkLayer::render( GeoPainter *geoPainter, ViewportParams *viewport,
--visit;
VisiblePlacemark *const mark = *visit;
if (m_levelTagDebugModeEnabled) {
if (mark->placemark()->hasOsmData()) {
QHash<QString, QString>::const_iterator tagIter = mark->placemark()->osmData().findTag(QStringLiteral("level"));
if (tagIter != mark->placemark()->osmData().tagsEnd()) {
const int val = tagIter.value().toInt();
if (val != m_debugLevelTag) {
continue;
}
}
}
}
// Intentionally converting positions from floating point to pixel aligned screen grid below
QRect labelRect( mark->labelRect().toRect() );
......@@ -337,5 +351,26 @@ void PlacemarkLayer::renderDebug(GeoPainter *painter, ViewportParams *viewport,
painter->restore();
}
void PlacemarkLayer::setLevelTagDebugModeEnabled(bool enabled)
{
if (m_levelTagDebugModeEnabled != enabled) {
m_levelTagDebugModeEnabled = enabled;
emit repaintNeeded();
}
}
bool PlacemarkLayer::levelTagDebugModeEnabled() const
{
return m_levelTagDebugModeEnabled;
}
void PlacemarkLayer::setDebugLevelTag(int level)
{
if (m_debugLevelTag != level) {
m_debugLevelTag = level;
emit repaintNeeded();
}
}
#include "moc_PlacemarkLayer.cpp"
......@@ -89,6 +89,10 @@ class PlacemarkLayer : public QObject, public LayerInterface
bool isDebugModeEnabled() const;
void setDebugModeEnabled(bool enabled);
void setLevelTagDebugModeEnabled(bool enabled);
bool levelTagDebugModeEnabled() const;
void setDebugLevelTag(int level);
static bool m_useXWorkaround; // Indicates need for an X windows workaround.
public Q_SLOTS:
// earth
......@@ -114,7 +118,9 @@ class PlacemarkLayer : public QObject, public LayerInterface
PlacemarkLayout m_layout;
bool m_debugModeEnabled;
bool m_levelTagDebugModeEnabled;
int m_tileLevel;
int m_debugLevelTag;
};
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment