[qt] Make example app build on Windows
This commit is contained in:
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user