Skip to content

Commit 2ac4ab7

Browse files
author
mhugent
committedSep 19, 2009
Rotate values to integer degrees in rotate tool
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@11679 c8812cc2-4d05-0410-92ff-de0c093fc19c

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed
 

‎src/app/qgsmaptoolrotatepointsymbols.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ void QgsMapToolRotatePointSymbols::canvasPressEvent( QMouseEvent * e )
128128
mRotationItem->setPointLocation( snapResults.at( 0 ).snappedVertex );
129129
}
130130
mCurrentMouseAzimut = calculateAzimut( e->pos() );
131-
setPixmapItemRotation( mCurrentMouseAzimut );
131+
setPixmapItemRotation( (int)(mCurrentMouseAzimut) );
132132
mRotating = true;
133133
}
134134

@@ -161,7 +161,7 @@ void QgsMapToolRotatePointSymbols::canvasMoveEvent( QMouseEvent * e )
161161
{
162162
mCurrentMouseAzimut -= 360;
163163
}
164-
setPixmapItemRotation( mCurrentRotationFeature );
164+
setPixmapItemRotation( (int)(mCurrentRotationFeature) );
165165
}
166166

167167
void QgsMapToolRotatePointSymbols::canvasReleaseEvent( QMouseEvent * e )
@@ -175,7 +175,7 @@ void QgsMapToolRotatePointSymbols::canvasReleaseEvent( QMouseEvent * e )
175175
QList<int>::const_iterator it = mCurrentRotationAttributes.constBegin();
176176
for ( ; it != mCurrentRotationAttributes.constEnd(); ++it )
177177
{
178-
if ( !mActiveLayer->changeAttributeValue( mFeatureNumber, *it, mCurrentRotationFeature, true ) )
178+
if ( !mActiveLayer->changeAttributeValue( mFeatureNumber, *it, (int)(mCurrentRotationFeature), true ) )
179179
{
180180
rotateSuccess = false;
181181
}

‎src/app/qgspointrotationitem.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ void QgsPointRotationItem::paint( QPainter * painter )
6969
QFontMetricsF fm( mFont );
7070
painter->fillRect( mPixmap.width(), 0, mItemSize.width() - mPixmap.width(), mItemSize.height(), QColor( Qt::white ) );
7171
painter->setFont( mFont );
72-
painter->drawText( mPixmap.width(), mPixmap.height() / 2.0 + fm.height() / 2.0, QString::number( mRotation, 'f', 2 ) );
72+
painter->drawText( mPixmap.width(), mPixmap.height() / 2.0 + fm.height() / 2.0, QString::number( mRotation) );
7373
}
7474

7575
void QgsPointRotationItem::setPointLocation( const QgsPoint& p )
@@ -82,7 +82,7 @@ void QgsPointRotationItem::setSymbol( const QString& symbolPath )
8282
{
8383
mPixmap = QPixmap( symbolPath );
8484
QFontMetricsF fm( mFont );
85-
mItemSize.setWidth( mPixmap.width() + fm.width( "360.99" ) );
85+
mItemSize.setWidth( mPixmap.width() + fm.width( "360" ) );
8686
double pixmapHeight = mPixmap.height();
8787
double fontHeight = fm.height();
8888
if ( pixmapHeight >= fontHeight )

‎src/app/qgspointrotationitem.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class QgsPointRotationItem: public QgsMapCanvasItem
3434

3535
/**Sets the rotation of the symbol and displays the new rotation number. \
3636
Units are degrees, starting from north direction, clockwise direction*/
37-
void setSymbolRotation( double r ) {mRotation = r;}
37+
void setSymbolRotation( int r ) {mRotation = r;}
3838

3939
/**Sets a symbol from image file*/
4040
void setSymbol( const QString& symbolPath );
@@ -45,7 +45,7 @@ class QgsPointRotationItem: public QgsMapCanvasItem
4545
QFont mFont;
4646
/**Symboll pixmap*/
4747
QPixmap mPixmap;
48-
double mRotation;
48+
int mRotation;
4949
};
5050

5151
#endif // QGSPOINTROTATIONITEM_H

0 commit comments

Comments
 (0)
Please sign in to comment.