summaryrefslogtreecommitdiff
path: root/platform/qt/app/mapwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'platform/qt/app/mapwindow.cpp')
-rw-r--r--platform/qt/app/mapwindow.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/platform/qt/app/mapwindow.cpp b/platform/qt/app/mapwindow.cpp
index 03ca052ec4..c4efbfa318 100644
--- a/platform/qt/app/mapwindow.cpp
+++ b/platform/qt/app/mapwindow.cpp
@@ -254,8 +254,13 @@ void MapWindow::keyPressEvent(QKeyEvent *ev)
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 geometry { { { topLeft, bottomRight } } };
- QMapbox::LineAnnotation line { { QMapbox::ShapeAnnotationGeometry::LineStringType, geometry }, 0.5f, 1.0f, Qt::red };
+ QMapbox::CoordinatesCollections lineGeometry { { { topLeft, bottomRight } } };
+ QMapbox::ShapeAnnotationGeometry annotationGeometry { QMapbox::ShapeAnnotationGeometry::LineStringType, lineGeometry };
+ QMapbox::LineAnnotation line;
+ line.geometry = annotationGeometry;
+ line.opacity = 0.5f;
+ line.width = 1.0f;
+ line.color = Qt::red;
m_lineAnnotationId = m_map->addAnnotation(QVariant::fromValue<QMapbox::LineAnnotation>(line));
} else {
m_map->removeAnnotation(m_lineAnnotationId.toUInt());
@@ -269,8 +274,13 @@ void MapWindow::keyPressEvent(QKeyEvent *ev)
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 geometry { { { bottomLeft, bottomRight, topRight, topLeft, bottomLeft } } };
- QMapbox::FillAnnotation fill { { QMapbox::ShapeAnnotationGeometry::PolygonType, geometry }, 0.5f, Qt::green, QVariant::fromValue<QColor>(QColor(Qt::black)) };
+ QMapbox::CoordinatesCollections fillGeometry { { { bottomLeft, bottomRight, topRight, topLeft, bottomLeft } } };
+ QMapbox::ShapeAnnotationGeometry annotationGeometry { QMapbox::ShapeAnnotationGeometry::PolygonType, fillGeometry };
+ QMapbox::FillAnnotation fill;
+ fill.geometry = annotationGeometry;
+ fill.opacity = 0.5f;
+ fill.color = Qt::green;
+ fill.outlineColor = QVariant::fromValue<QColor>(QColor(Qt::black));
m_fillAnnotationId = m_map->addAnnotation(QVariant::fromValue<QMapbox::FillAnnotation>(fill));
} else {
m_map->removeAnnotation(m_fillAnnotationId.toUInt());
@@ -283,8 +293,8 @@ void MapWindow::keyPressEvent(QKeyEvent *ev)
m_map->removeLayer("circleLayer");
m_map->removeSource("circleSource");
} else {
- QMapbox::CoordinatesCollections geometry { { { m_map->coordinate() } } };
- QMapbox::Feature feature { QMapbox::Feature::PointType, geometry, {}, {} };
+ QMapbox::CoordinatesCollections point { { { m_map->coordinate() } } };
+ QMapbox::Feature feature { QMapbox::Feature::PointType, point, {}, {} };
QVariantMap circleSource;
circleSource["type"] = "geojson";