summaryrefslogtreecommitdiff
path: root/platform/qt/src
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2017-01-31 17:19:38 +0200
committerBruno de Oliveira Abinader <bruno@mapbox.com>2017-01-31 19:24:55 +0200
commit691398e9bde410efa095bb648366779995b98e84 (patch)
tree9a92fac35834144e9b7d8c15aaad55b269e6b46e /platform/qt/src
parentf3bcf836cdf5f422a2a4c51f665f17d3b64ca3ae (diff)
downloadqtlocation-mapboxgl-691398e9bde410efa095bb648366779995b98e84.tar.gz
[Qt] Avoid using brace-list init ctor in QMapboxGL
Diffstat (limited to 'platform/qt/src')
-rw-r--r--platform/qt/src/qmapboxgl.cpp38
1 files changed, 18 insertions, 20 deletions
diff --git a/platform/qt/src/qmapboxgl.cpp b/platform/qt/src/qmapboxgl.cpp
index 5e3a0f2a7c..bdc99994b5 100644
--- a/platform/qt/src/qmapboxgl.cpp
+++ b/platform/qt/src/qmapboxgl.cpp
@@ -885,43 +885,41 @@ mbgl::ShapeAnnotationGeometry asMapboxGLGeometry(const QMapbox::ShapeAnnotationG
mbgl::ShapeAnnotationGeometry result;
switch (geometry.type) {
case QMapbox::ShapeAnnotationGeometry::LineStringType:
- result = { asMapboxGLLineString(geometry.geometry.first().first()) };
+ result = asMapboxGLLineString(geometry.geometry.first().first());
break;
case QMapbox::ShapeAnnotationGeometry::PolygonType:
- result = { asMapboxGLPolygon(geometry.geometry.first()) };
+ result = asMapboxGLPolygon(geometry.geometry.first());
break;
case QMapbox::ShapeAnnotationGeometry::MultiLineStringType:
- result = { asMapboxGLMultiLineString(geometry.geometry.first()) };
+ result = asMapboxGLMultiLineString(geometry.geometry.first());
break;
case QMapbox::ShapeAnnotationGeometry::MultiPolygonType:
- result = { asMapboxGLMultiPolygon(geometry.geometry) };
+ result = asMapboxGLMultiPolygon(geometry.geometry);
break;
}
-
return result;
}
mbgl::Annotation asMapboxGLAnnotation(const QMapbox::Annotation & annotation) {
if (annotation.canConvert<QMapbox::SymbolAnnotation>()) {
- QMapbox::SymbolAnnotation symbolAnnotation = annotation.value<QMapbox::SymbolAnnotation>();
- QMapbox::Coordinate& pair = symbolAnnotation.geometry;
- return mbgl::SymbolAnnotation { mbgl::Point<double> { pair.second, pair.first }, symbolAnnotation.icon.toStdString() };
+ QMapbox::SymbolAnnotation symbol = annotation.value<QMapbox::SymbolAnnotation>();
+ QMapbox::Coordinate& pair = symbol.geometry;
+ return mbgl::SymbolAnnotation(mbgl::Point<double>(pair.second, pair.first), symbol.icon.toStdString());
} else if (annotation.canConvert<QMapbox::LineAnnotation>()) {
- QMapbox::LineAnnotation lineAnnotation = annotation.value<QMapbox::LineAnnotation>();
- auto color = mbgl::Color::parse(lineAnnotation.color.name().toStdString());
- return mbgl::LineAnnotation { asMapboxGLGeometry(lineAnnotation.geometry), lineAnnotation.opacity, lineAnnotation.width, { *color } };
+ QMapbox::LineAnnotation line = annotation.value<QMapbox::LineAnnotation>();
+ mbgl::style::PropertyValue<mbgl::Color> color = *mbgl::Color::parse(line.color.name().toStdString());
+ return mbgl::LineAnnotation(asMapboxGLGeometry(line.geometry), line.opacity, line.width, color);
} else if (annotation.canConvert<QMapbox::FillAnnotation>()) {
- QMapbox::FillAnnotation fillAnnotation = annotation.value<QMapbox::FillAnnotation>();
- auto color = mbgl::Color::parse(fillAnnotation.color.name().toStdString());
- if (fillAnnotation.outlineColor.canConvert<QColor>()) {
- auto outlineColor = mbgl::Color::parse(fillAnnotation.outlineColor.value<QColor>().name().toStdString());
- return mbgl::FillAnnotation { asMapboxGLGeometry(fillAnnotation.geometry), fillAnnotation.opacity, { *color }, { *outlineColor } };
- } else {
- return mbgl::FillAnnotation { asMapboxGLGeometry(fillAnnotation.geometry), fillAnnotation.opacity, { *color }, {} };
+ QMapbox::FillAnnotation fill = annotation.value<QMapbox::FillAnnotation>();
+ mbgl::style::PropertyValue<mbgl::Color> color = *mbgl::Color::parse(fill.color.name().toStdString());
+ mbgl::style::PropertyValue<mbgl::Color> outlineColor;
+ if (fill.outlineColor.canConvert<QColor>()) {
+ outlineColor = *mbgl::Color::parse(fill.outlineColor.value<QColor>().name().toStdString());
}
+ return mbgl::FillAnnotation(asMapboxGLGeometry(fill.geometry), fill.opacity, color, outlineColor);
} else if (annotation.canConvert<QMapbox::StyleSourcedAnnotation>()) {
- QMapbox::StyleSourcedAnnotation styleSourcedAnnotation = annotation.value<QMapbox::StyleSourcedAnnotation>();
- return mbgl::StyleSourcedAnnotation { asMapboxGLGeometry(styleSourcedAnnotation.geometry), styleSourcedAnnotation.layerID.toStdString() };
+ QMapbox::StyleSourcedAnnotation styleSourced = annotation.value<QMapbox::StyleSourcedAnnotation>();
+ return mbgl::StyleSourcedAnnotation(asMapboxGLGeometry(styleSourced.geometry), styleSourced.layerID.toStdString());
}
qWarning() << "Unable to convert annotation:" << annotation;