Skip to content

Commit

Permalink
Rotate values to integer degrees in rotate tool
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@11679 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Sep 19, 2009
1 parent ca68766 commit 2ac4ab7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/app/qgsmaptoolrotatepointsymbols.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ void QgsMapToolRotatePointSymbols::canvasPressEvent( QMouseEvent * e )
mRotationItem->setPointLocation( snapResults.at( 0 ).snappedVertex );
}
mCurrentMouseAzimut = calculateAzimut( e->pos() );
setPixmapItemRotation( mCurrentMouseAzimut );
setPixmapItemRotation( (int)(mCurrentMouseAzimut) );
mRotating = true;
}

Expand Down Expand Up @@ -161,7 +161,7 @@ void QgsMapToolRotatePointSymbols::canvasMoveEvent( QMouseEvent * e )
{
mCurrentMouseAzimut -= 360;
}
setPixmapItemRotation( mCurrentRotationFeature );
setPixmapItemRotation( (int)(mCurrentRotationFeature) );
}

void QgsMapToolRotatePointSymbols::canvasReleaseEvent( QMouseEvent * e )
Expand All @@ -175,7 +175,7 @@ void QgsMapToolRotatePointSymbols::canvasReleaseEvent( QMouseEvent * e )
QList<int>::const_iterator it = mCurrentRotationAttributes.constBegin();
for ( ; it != mCurrentRotationAttributes.constEnd(); ++it )
{
if ( !mActiveLayer->changeAttributeValue( mFeatureNumber, *it, mCurrentRotationFeature, true ) )
if ( !mActiveLayer->changeAttributeValue( mFeatureNumber, *it, (int)(mCurrentRotationFeature), true ) )
{
rotateSuccess = false;
}
Expand Down
4 changes: 2 additions & 2 deletions src/app/qgspointrotationitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void QgsPointRotationItem::paint( QPainter * painter )
QFontMetricsF fm( mFont );
painter->fillRect( mPixmap.width(), 0, mItemSize.width() - mPixmap.width(), mItemSize.height(), QColor( Qt::white ) );
painter->setFont( mFont );
painter->drawText( mPixmap.width(), mPixmap.height() / 2.0 + fm.height() / 2.0, QString::number( mRotation, 'f', 2 ) );
painter->drawText( mPixmap.width(), mPixmap.height() / 2.0 + fm.height() / 2.0, QString::number( mRotation) );
}

void QgsPointRotationItem::setPointLocation( const QgsPoint& p )
Expand All @@ -82,7 +82,7 @@ void QgsPointRotationItem::setSymbol( const QString& symbolPath )
{
mPixmap = QPixmap( symbolPath );
QFontMetricsF fm( mFont );
mItemSize.setWidth( mPixmap.width() + fm.width( "360.99" ) );
mItemSize.setWidth( mPixmap.width() + fm.width( "360" ) );
double pixmapHeight = mPixmap.height();
double fontHeight = fm.height();
if ( pixmapHeight >= fontHeight )
Expand Down
4 changes: 2 additions & 2 deletions src/app/qgspointrotationitem.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class QgsPointRotationItem: public QgsMapCanvasItem

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

/**Sets a symbol from image file*/
void setSymbol( const QString& symbolPath );
Expand All @@ -45,7 +45,7 @@ class QgsPointRotationItem: public QgsMapCanvasItem
QFont mFont;
/**Symboll pixmap*/
QPixmap mPixmap;
double mRotation;
int mRotation;
};

#endif // QGSPOINTROTATIONITEM_H

0 comments on commit 2ac4ab7

Please sign in to comment.