[QGIS Commit] r11679 - trunk/qgis/src/app

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sat Sep 19 08:16:11 EDT 2009


Author: mhugent
Date: 2009-09-19 08:16:10 -0400 (Sat, 19 Sep 2009)
New Revision: 11679

Modified:
   trunk/qgis/src/app/qgsmaptoolrotatepointsymbols.cpp
   trunk/qgis/src/app/qgspointrotationitem.cpp
   trunk/qgis/src/app/qgspointrotationitem.h
Log:
Rotate values to integer degrees in rotate tool

Modified: trunk/qgis/src/app/qgsmaptoolrotatepointsymbols.cpp
===================================================================
--- trunk/qgis/src/app/qgsmaptoolrotatepointsymbols.cpp	2009-09-19 10:18:45 UTC (rev 11678)
+++ trunk/qgis/src/app/qgsmaptoolrotatepointsymbols.cpp	2009-09-19 12:16:10 UTC (rev 11679)
@@ -128,7 +128,7 @@
     mRotationItem->setPointLocation( snapResults.at( 0 ).snappedVertex );
   }
   mCurrentMouseAzimut = calculateAzimut( e->pos() );
-  setPixmapItemRotation( mCurrentMouseAzimut );
+  setPixmapItemRotation( (int)(mCurrentMouseAzimut) );
   mRotating = true;
 }
 
@@ -161,7 +161,7 @@
   {
     mCurrentMouseAzimut -= 360;
   }
-  setPixmapItemRotation( mCurrentRotationFeature );
+  setPixmapItemRotation( (int)(mCurrentRotationFeature) );
 }
 
 void QgsMapToolRotatePointSymbols::canvasReleaseEvent( QMouseEvent * e )
@@ -175,7 +175,7 @@
     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;
       }

Modified: trunk/qgis/src/app/qgspointrotationitem.cpp
===================================================================
--- trunk/qgis/src/app/qgspointrotationitem.cpp	2009-09-19 10:18:45 UTC (rev 11678)
+++ trunk/qgis/src/app/qgspointrotationitem.cpp	2009-09-19 12:16:10 UTC (rev 11679)
@@ -69,7 +69,7 @@
   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 )
@@ -82,7 +82,7 @@
 {
   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 )

Modified: trunk/qgis/src/app/qgspointrotationitem.h
===================================================================
--- trunk/qgis/src/app/qgspointrotationitem.h	2009-09-19 10:18:45 UTC (rev 11678)
+++ trunk/qgis/src/app/qgspointrotationitem.h	2009-09-19 12:16:10 UTC (rev 11679)
@@ -34,7 +34,7 @@
 
     /**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 );
@@ -45,7 +45,7 @@
     QFont mFont;
     /**Symboll pixmap*/
     QPixmap mPixmap;
-    double mRotation;
+    int mRotation;
 };
 
 #endif // QGSPOINTROTATIONITEM_H



More information about the QGIS-commit mailing list