From e2aa0b715bce96275329ccc13d5dfed6dd79bbfc Mon Sep 17 00:00:00 2001 From: Denis Rouzaud Date: Sat, 29 Sep 2018 15:48:05 -0400 Subject: [PATCH] explicitely call int version of former calls to toMapCoordinates --- src/app/qgsmaptoolselectutils.cpp | 4 ++-- src/app/qgspointmarkeritem.cpp | 6 ++++-- src/core/qgsvectorlayerlabelprovider.cpp | 3 ++- src/core/raster/qgsrasterlayerrenderer.cpp | 4 ++-- src/gui/qgssnaptogridcanvasitem.cpp | 6 ++++-- 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/app/qgsmaptoolselectutils.cpp b/src/app/qgsmaptoolselectutils.cpp index 904f5f1bb5e..112ab344654 100644 --- a/src/app/qgsmaptoolselectutils.cpp +++ b/src/app/qgsmaptoolselectutils.cpp @@ -82,8 +82,8 @@ QgsRectangle QgsMapToolSelectUtils::expandSelectRectangle( QgsPointXY mapPoint, const QgsMapToPixel *transform = canvas->getCoordinateTransform(); QgsPointXY point = transform->transform( mapPoint ); - QgsPointXY ll = transform->toMapCoordinates( point.x() - boxSize, point.y() + boxSize ); - QgsPointXY ur = transform->toMapCoordinates( point.x() + boxSize, point.y() - boxSize ); + QgsPointXY ll = transform->toMapCoordinates( static_cast( point.x() - boxSize ), static_cast( point.y() + boxSize ) ); + QgsPointXY ur = transform->toMapCoordinates( static_cast( point.x() + boxSize ), static_cast( point.y() - boxSize ) ); return QgsRectangle( ll, ur ); } diff --git a/src/app/qgspointmarkeritem.cpp b/src/app/qgspointmarkeritem.cpp index 36fc80de792..9dc09aae128 100644 --- a/src/app/qgspointmarkeritem.cpp +++ b/src/app/qgspointmarkeritem.cpp @@ -108,8 +108,10 @@ void QgsPointMarkerItem::updateSize() mMarkerSymbol->startRender( rc, mFeature.fields() ); QRectF bounds = mMarkerSymbol->bounds( mLocation, rc, mFeature ); mMarkerSymbol->stopRender( rc ); - QgsRectangle r( mMapCanvas->mapSettings().mapToPixel().toMapCoordinates( bounds.x(), bounds.y() ), - mMapCanvas->mapSettings().mapToPixel().toMapCoordinates( bounds.x() + bounds.width() * 2, bounds.y() + bounds.height() * 2 ) ); + QgsRectangle r( mMapCanvas->mapSettings().mapToPixel().toMapCoordinates( static_cast( bounds.x() ), + static_cast( bounds.y() ) ), + mMapCanvas->mapSettings().mapToPixel().toMapCoordinates( static_cast( bounds.x() + bounds.width() * 2 ), + static_cast( bounds.y() + bounds.height() * 2 ) ) ); setRect( r ); } diff --git a/src/core/qgsvectorlayerlabelprovider.cpp b/src/core/qgsvectorlayerlabelprovider.cpp index 84066b65c5f..63c3ac6d988 100644 --- a/src/core/qgsvectorlayerlabelprovider.cpp +++ b/src/core/qgsvectorlayerlabelprovider.cpp @@ -319,7 +319,8 @@ QgsGeometry QgsVectorLayerLabelProvider::getPointObstacleGeometry( QgsFeature &f //TODO - remove when labeling is refactored to use screen units for ( int i = 0; i < boundLineString->numPoints(); ++i ) { - QgsPointXY point = context.mapToPixel().toMapCoordinates( boundLineString->xAt( i ), boundLineString->yAt( i ) ); + QgsPointXY point = context.mapToPixel().toMapCoordinates( static_cast( boundLineString->xAt( i ) ), + static_cast( boundLineString->yAt( i ) ) ); boundLineString->setXAt( i, point.x() ); boundLineString->setYAt( i, point.y() ); } diff --git a/src/core/raster/qgsrasterlayerrenderer.cpp b/src/core/raster/qgsrasterlayerrenderer.cpp index d44e42e5b54..59d8dca7d77 100644 --- a/src/core/raster/qgsrasterlayerrenderer.cpp +++ b/src/core/raster/qgsrasterlayerrenderer.cpp @@ -79,8 +79,8 @@ QgsRasterLayerRenderer::QgsRasterLayerRenderer( QgsRasterLayer *layer, QgsRender // TODO: provide a method of QgsMapToPixel to fetch map center // in geographical units QgsPointXY center = mapToPixel.toMapCoordinates( - mapToPixel.mapWidth() / 2.0, - mapToPixel.mapHeight() / 2.0 + static_cast( mapToPixel.mapWidth() / 2.0 ), + static_cast( mapToPixel.mapHeight() / 2.0 ) ); mapToPixel.setMapRotation( 0, center.x(), center.y() ); } diff --git a/src/gui/qgssnaptogridcanvasitem.cpp b/src/gui/qgssnaptogridcanvasitem.cpp index 46e81277f63..d47edb1b246 100644 --- a/src/gui/qgssnaptogridcanvasitem.cpp +++ b/src/gui/qgssnaptogridcanvasitem.cpp @@ -148,8 +148,10 @@ void QgsSnapToGridCanvasItem::updateZoomFactor() const QgsPointXY centerPoint = mMapCanvas->extent().center(); const QPointF canvasCenter = toCanvasCoordinates( centerPoint ); - const QgsPointXY pt1 = mMapCanvas->mapSettings().mapToPixel().toMapCoordinates( canvasCenter.x() - threshold, canvasCenter.y() - threshold ); - const QgsPointXY pt2 = mMapCanvas->mapSettings().mapToPixel().toMapCoordinates( canvasCenter.x() + threshold, canvasCenter.y() + threshold ); + const QgsPointXY pt1 = mMapCanvas->mapSettings().mapToPixel().toMapCoordinates( static_cast( canvasCenter.x() - threshold ), + static_cast( canvasCenter.y() - threshold ) ); + const QgsPointXY pt2 = mMapCanvas->mapSettings().mapToPixel().toMapCoordinates( static_cast( canvasCenter.x() + threshold ), + static_cast( canvasCenter.y() + threshold ) ); const QgsPointXY layerPt1 = mTransform.transform( pt1, QgsCoordinateTransform::ReverseTransform ); const QgsPointXY layerPt2 = mTransform.transform( pt2, QgsCoordinateTransform::ReverseTransform );