diff options
author | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2017-03-01 11:15:08 -0800 |
---|---|---|
committer | Paolo Angelelli <paolo.angelelli@qt.io> | 2017-03-06 22:08:44 +0000 |
commit | 2c4811a1c33412cc47e92df1df63b7d1131439b3 (patch) | |
tree | f7365554e7dbcd62b97fd5c005ded93ead64b40f /src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp | |
parent | 9c2bf32b1185cdfcf448a76dbc4a9ba18ae68b05 (diff) | |
download | qtlocation-2c4811a1c33412cc47e92df1df63b7d1131439b3.tar.gz |
Fix line rendering when ending and joining
Change-Id: I30e1ae3ec70e8ab36ef3344cecb7a66b1d37a952
Reviewed-by: Thiago Marcos P. Santos <tmpsantos@gmail.com>
Reviewed-by: Paolo Angelelli <paolo.angelelli@qt.io>
Diffstat (limited to 'src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp')
-rw-r--r-- | src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp b/src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp index 70502e70..eccc64b8 100644 --- a/src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp +++ b/src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp @@ -194,6 +194,7 @@ QList<QSharedPointer<QMapboxGLStyleChange>> QMapboxGLStyleChange::addMapItem(QDe changes << QMapboxGLStyleAddLayer::fromFeature(feature); changes << QMapboxGLStyleAddSource::fromFeature(feature); changes << QMapboxGLStyleSetPaintProperty::fromMapItem(item); + changes << QMapboxGLStyleSetLayoutProperty::fromMapItem(item); return changes; } @@ -246,6 +247,36 @@ QList<QSharedPointer<QMapboxGLStyleChange>> QMapboxGLStyleSetLayoutProperty::fro return changes; } +QList<QSharedPointer<QMapboxGLStyleChange>> QMapboxGLStyleSetLayoutProperty::fromMapItem(QDeclarativeGeoMapItemBase *item) +{ + switch (item->itemType()) { + case QGeoMap::MapPolyline: + return fromMapItem(static_cast<QDeclarativePolylineMapItem *>(item)); + default: + qWarning() << "Unsupported QGeoMap item type: " << item->itemType(); + return QList<QSharedPointer<QMapboxGLStyleChange>>(); + } +} + +QList<QSharedPointer<QMapboxGLStyleChange>> QMapboxGLStyleSetLayoutProperty::fromMapItem(QDeclarativePolylineMapItem *item) +{ + QList<QSharedPointer<QMapboxGLStyleChange>> changes; + changes.reserve(2); + + const QString id = getId(item); + + changes << QSharedPointer<QMapboxGLStyleChange>( + new QMapboxGLStyleSetLayoutProperty(id, QStringLiteral("line-cap"), QStringLiteral("square"))); + changes << QSharedPointer<QMapboxGLStyleChange>( + new QMapboxGLStyleSetLayoutProperty(id, QStringLiteral("line-join"), QStringLiteral("bevel"))); + + return changes; +} + +QMapboxGLStyleSetLayoutProperty::QMapboxGLStyleSetLayoutProperty(const QString& layer, const QString& property, const QVariant &value) + : m_layer(layer), m_property(property), m_value(value) +{ +} // QMapboxGLStyleSetPaintProperty |