Skip to content

Commit e2aa0b7

Browse files
committedSep 29, 2018
explicitely call int version of former calls to toMapCoordinates
1 parent 157ba0f commit e2aa0b7

File tree

5 files changed

+14
-9
lines changed

5 files changed

+14
-9
lines changed
 

‎src/app/qgsmaptoolselectutils.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ QgsRectangle QgsMapToolSelectUtils::expandSelectRectangle( QgsPointXY mapPoint,
8282

8383
const QgsMapToPixel *transform = canvas->getCoordinateTransform();
8484
QgsPointXY point = transform->transform( mapPoint );
85-
QgsPointXY ll = transform->toMapCoordinates( point.x() - boxSize, point.y() + boxSize );
86-
QgsPointXY ur = transform->toMapCoordinates( point.x() + boxSize, point.y() - boxSize );
85+
QgsPointXY ll = transform->toMapCoordinates( static_cast<int>( point.x() - boxSize ), static_cast<int>( point.y() + boxSize ) );
86+
QgsPointXY ur = transform->toMapCoordinates( static_cast<int>( point.x() + boxSize ), static_cast<int>( point.y() - boxSize ) );
8787
return QgsRectangle( ll, ur );
8888
}
8989

‎src/app/qgspointmarkeritem.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,10 @@ void QgsPointMarkerItem::updateSize()
108108
mMarkerSymbol->startRender( rc, mFeature.fields() );
109109
QRectF bounds = mMarkerSymbol->bounds( mLocation, rc, mFeature );
110110
mMarkerSymbol->stopRender( rc );
111-
QgsRectangle r( mMapCanvas->mapSettings().mapToPixel().toMapCoordinates( bounds.x(), bounds.y() ),
112-
mMapCanvas->mapSettings().mapToPixel().toMapCoordinates( bounds.x() + bounds.width() * 2, bounds.y() + bounds.height() * 2 ) );
111+
QgsRectangle r( mMapCanvas->mapSettings().mapToPixel().toMapCoordinates( static_cast<int>( bounds.x() ),
112+
static_cast<int>( bounds.y() ) ),
113+
mMapCanvas->mapSettings().mapToPixel().toMapCoordinates( static_cast<int>( bounds.x() + bounds.width() * 2 ),
114+
static_cast<int>( bounds.y() + bounds.height() * 2 ) ) );
113115
setRect( r );
114116
}
115117

‎src/core/qgsvectorlayerlabelprovider.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,8 @@ QgsGeometry QgsVectorLayerLabelProvider::getPointObstacleGeometry( QgsFeature &f
319319
//TODO - remove when labeling is refactored to use screen units
320320
for ( int i = 0; i < boundLineString->numPoints(); ++i )
321321
{
322-
QgsPointXY point = context.mapToPixel().toMapCoordinates( boundLineString->xAt( i ), boundLineString->yAt( i ) );
322+
QgsPointXY point = context.mapToPixel().toMapCoordinates( static_cast<int>( boundLineString->xAt( i ) ),
323+
static_cast<int>( boundLineString->yAt( i ) ) );
323324
boundLineString->setXAt( i, point.x() );
324325
boundLineString->setYAt( i, point.y() );
325326
}

‎src/core/raster/qgsrasterlayerrenderer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ QgsRasterLayerRenderer::QgsRasterLayerRenderer( QgsRasterLayer *layer, QgsRender
7979
// TODO: provide a method of QgsMapToPixel to fetch map center
8080
// in geographical units
8181
QgsPointXY center = mapToPixel.toMapCoordinates(
82-
mapToPixel.mapWidth() / 2.0,
83-
mapToPixel.mapHeight() / 2.0
82+
static_cast<int>( mapToPixel.mapWidth() / 2.0 ),
83+
static_cast<int>( mapToPixel.mapHeight() / 2.0 )
8484
);
8585
mapToPixel.setMapRotation( 0, center.x(), center.y() );
8686
}

‎src/gui/qgssnaptogridcanvasitem.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,10 @@ void QgsSnapToGridCanvasItem::updateZoomFactor()
148148
const QgsPointXY centerPoint = mMapCanvas->extent().center();
149149
const QPointF canvasCenter = toCanvasCoordinates( centerPoint );
150150

151-
const QgsPointXY pt1 = mMapCanvas->mapSettings().mapToPixel().toMapCoordinates( canvasCenter.x() - threshold, canvasCenter.y() - threshold );
152-
const QgsPointXY pt2 = mMapCanvas->mapSettings().mapToPixel().toMapCoordinates( canvasCenter.x() + threshold, canvasCenter.y() + threshold );
151+
const QgsPointXY pt1 = mMapCanvas->mapSettings().mapToPixel().toMapCoordinates( static_cast<int>( canvasCenter.x() - threshold ),
152+
static_cast<int>( canvasCenter.y() - threshold ) );
153+
const QgsPointXY pt2 = mMapCanvas->mapSettings().mapToPixel().toMapCoordinates( static_cast<int>( canvasCenter.x() + threshold ),
154+
static_cast<int>( canvasCenter.y() + threshold ) );
153155

154156
const QgsPointXY layerPt1 = mTransform.transform( pt1, QgsCoordinateTransform::ReverseTransform );
155157
const QgsPointXY layerPt2 = mTransform.transform( pt2, QgsCoordinateTransform::ReverseTransform );

0 commit comments

Comments
 (0)
Please sign in to comment.