summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <tmpsantos@gmail.com>2018-01-10 18:23:57 +0200
committerThiago Marcos P. Santos <tmpsantos@gmail.com>2018-01-10 21:42:20 +0200
commitc5be54bf43aca927706884f86406afe0aace7771 (patch)
tree661a8b7d62ed92d384b094ea7f0d30a09c9a4a32
parent0a7b4e3eb8544ec662a571b5533e9b55913fe732 (diff)
downloadqtlocation-mapboxgl-c5be54bf43aca927706884f86406afe0aace7771.tar.gz
[qt] Make example app build on Windows
-rw-r--r--platform/qt/app/mapwindow.cpp48
1 files changed, 36 insertions, 12 deletions
diff --git a/platform/qt/app/mapwindow.cpp b/platform/qt/app/mapwindow.cpp
index c4efbfa318..fc346cdcde 100644
--- a/platform/qt/app/mapwindow.cpp
+++ b/platform/qt/app/mapwindow.cpp
@@ -252,10 +252,18 @@ void MapWindow::keyPressEvent(QKeyEvent *ev)
break;
case Qt::Key_2: {
if (m_lineAnnotationId.isNull()) {
- QMapbox::Coordinate topLeft = m_map->coordinateForPixel({ 0, 0 });
- QMapbox::Coordinate bottomRight = m_map->coordinateForPixel({ qreal(size().width()), qreal(size().height()) });
- QMapbox::CoordinatesCollections lineGeometry { { { topLeft, bottomRight } } };
- QMapbox::ShapeAnnotationGeometry annotationGeometry { QMapbox::ShapeAnnotationGeometry::LineStringType, lineGeometry };
+ QMapbox::Coordinates coordinates;
+ coordinates.push_back(m_map->coordinateForPixel({ 0, 0 }));
+ coordinates.push_back(m_map->coordinateForPixel({ qreal(size().width()), qreal(size().height()) }));
+
+ QMapbox::CoordinatesCollection collection;
+ collection.push_back(coordinates);
+
+ QMapbox::CoordinatesCollections lineGeometry;
+ lineGeometry.push_back(collection);
+
+ QMapbox::ShapeAnnotationGeometry annotationGeometry(QMapbox::ShapeAnnotationGeometry::LineStringType, lineGeometry);
+
QMapbox::LineAnnotation line;
line.geometry = annotationGeometry;
line.opacity = 0.5f;
@@ -270,12 +278,20 @@ void MapWindow::keyPressEvent(QKeyEvent *ev)
break;
case Qt::Key_3: {
if (m_fillAnnotationId.isNull()) {
- QMapbox::Coordinate topLeft = m_map->coordinateForPixel({ 0, 0 });
- QMapbox::Coordinate topRight = m_map->coordinateForPixel({ 0, qreal(size().height()) });
- QMapbox::Coordinate bottomLeft = m_map->coordinateForPixel({ qreal(size().width()), 0 });
- QMapbox::Coordinate bottomRight = m_map->coordinateForPixel({ qreal(size().width()), qreal(size().height()) });
- QMapbox::CoordinatesCollections fillGeometry { { { bottomLeft, bottomRight, topRight, topLeft, bottomLeft } } };
- QMapbox::ShapeAnnotationGeometry annotationGeometry { QMapbox::ShapeAnnotationGeometry::PolygonType, fillGeometry };
+ QMapbox::Coordinates coordinates;
+ coordinates.push_back(m_map->coordinateForPixel({ qreal(size().width()), 0 }));
+ coordinates.push_back(m_map->coordinateForPixel({ qreal(size().width()), qreal(size().height()) }));
+ coordinates.push_back(m_map->coordinateForPixel({ 0, qreal(size().height()) }));
+ coordinates.push_back(m_map->coordinateForPixel({ 0, 0 }));
+
+ QMapbox::CoordinatesCollection collection;
+ collection.push_back(coordinates);
+
+ QMapbox::CoordinatesCollections fillGeometry;
+ fillGeometry.push_back(collection);
+
+ QMapbox::ShapeAnnotationGeometry annotationGeometry(QMapbox::ShapeAnnotationGeometry::PolygonType, fillGeometry);
+
QMapbox::FillAnnotation fill;
fill.geometry = annotationGeometry;
fill.opacity = 0.5f;
@@ -293,8 +309,16 @@ void MapWindow::keyPressEvent(QKeyEvent *ev)
m_map->removeLayer("circleLayer");
m_map->removeSource("circleSource");
} else {
- QMapbox::CoordinatesCollections point { { { m_map->coordinate() } } };
- QMapbox::Feature feature { QMapbox::Feature::PointType, point, {}, {} };
+ QMapbox::Coordinates coordinates;
+ coordinates.push_back(m_map->coordinate());
+
+ QMapbox::CoordinatesCollection collection;
+ collection.push_back(coordinates);
+
+ QMapbox::CoordinatesCollections point;
+ point.push_back(collection);
+
+ QMapbox::Feature feature(QMapbox::Feature::PointType, point, {}, {});
QVariantMap circleSource;
circleSource["type"] = "geojson";