From c5be54bf43aca927706884f86406afe0aace7771 Mon Sep 17 00:00:00 2001 From: "Thiago Marcos P. Santos" Date: Wed, 10 Jan 2018 18:23:57 +0200 Subject: [qt] Make example app build on Windows --- platform/qt/app/mapwindow.cpp | 48 ++++++++++++++++++++++++++++++++----------- 1 file changed, 36 insertions(+), 12 deletions(-) (limited to 'platform/qt/app') 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"; -- cgit v1.2.1