[QGIS Commit] r9174 - in trunk/qgis/src: app/composer core/composer gui

svn_qgis at osgeo.org svn_qgis at osgeo.org
Tue Aug 26 07:06:17 EDT 2008


Author: mhugent
Date: 2008-08-26 07:06:17 -0400 (Tue, 26 Aug 2008)
New Revision: 9174

Modified:
   trunk/qgis/src/app/composer/qgscomposer.h
   trunk/qgis/src/app/composer/qgscomposermapwidget.cpp
   trunk/qgis/src/core/composer/qgscomposermap.cpp
   trunk/qgis/src/gui/qgscomposerview.cpp
Log:
Better protection agains multiple map drawings with move content tool

Modified: trunk/qgis/src/app/composer/qgscomposer.h
===================================================================
--- trunk/qgis/src/app/composer/qgscomposer.h	2008-08-26 09:16:13 UTC (rev 9173)
+++ trunk/qgis/src/app/composer/qgscomposer.h	2008-08-26 11:06:17 UTC (rev 9174)
@@ -212,13 +212,6 @@
     /**Etablishes the signal slot connection for the class*/
     void connectSlots();
 
-    /** \brief move up the content of the file
-        \param file file
-    \param from starting position
-    \param shift shift in bytes
-    */
-    bool shiftFileContent( QFile *file, qint64 start, int shift );
-
     //! Set buttons up
     void setToolActionsOff( void );
 

Modified: trunk/qgis/src/app/composer/qgscomposermapwidget.cpp
===================================================================
--- trunk/qgis/src/app/composer/qgscomposermapwidget.cpp	2008-08-26 09:16:13 UTC (rev 9173)
+++ trunk/qgis/src/app/composer/qgscomposermapwidget.cpp	2008-08-26 11:06:17 UTC (rev 9174)
@@ -98,6 +98,11 @@
     return;
   }
 
+  if(mComposerMap->isDrawing())
+    {
+      return;
+    }
+
   QString comboText = mPreviewModeComboBox->currentText();
   if ( comboText == tr( "Cache" ) )
   {

Modified: trunk/qgis/src/core/composer/qgscomposermap.cpp
===================================================================
--- trunk/qgis/src/core/composer/qgscomposermap.cpp	2008-08-26 09:16:13 UTC (rev 9173)
+++ trunk/qgis/src/core/composer/qgscomposermap.cpp	2008-08-26 11:06:17 UTC (rev 9174)
@@ -100,6 +100,13 @@
     return;
   }
 
+  if ( mDrawing )
+  {
+    return;
+  }
+
+  mDrawing = true;
+
   QgsMapRenderer theMapRenderer;
   theMapRenderer.setExtent( extent );
   theMapRenderer.setOutputSize( size, dpi );
@@ -119,6 +126,8 @@
   theMapRenderer.setScale( scale() );
   theMapRenderer.render( painter );
   theMapRenderer.setScale( bk_scale );
+
+  mDrawing = false;
 }
 
 void QgsComposerMap::cache( void )
@@ -158,18 +167,11 @@
 
 void QgsComposerMap::paint( QPainter* painter, const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget )
 {
-  if ( mDrawing )
-  {
-    return;
-  }
-
   if ( !mComposition || !painter )
   {
     return;
   }
 
-  mDrawing = true;
-
   QRectF thisPaintRect = QRectF( 0, 0, QGraphicsRectItem::rect().width(), QGraphicsRectItem::rect().height() );
   painter->save();
   painter->setClipRect( thisPaintRect );
@@ -218,7 +220,6 @@
   painter->restore();
 
   mLastScaleFactorX =  currentScaleFactorX;
-  mDrawing = false;
 }
 
 void QgsComposerMap::mapCanvasChanged( void )
@@ -251,20 +252,23 @@
 
 void QgsComposerMap::moveContent( double dx, double dy )
 {
-  QRectF itemRect = rect();
-  double xRatio = dx / itemRect.width();
-  double yRatio = dy / itemRect.height();
-
-  double xMoveMapCoord = mExtent.width() * xRatio;
-  double yMoveMapCoord = -( mExtent.height() * yRatio );
-
-  mExtent.setXMinimum( mExtent.xMin() + xMoveMapCoord );
-  mExtent.setXMaximum( mExtent.xMax() + xMoveMapCoord );
-  mExtent.setYmin( mExtent.yMin() + yMoveMapCoord );
-  mExtent.setYmax( mExtent.yMax() + yMoveMapCoord );
-  emit extentChanged();
-  cache();
-  update();
+  if(!mDrawing)
+    {
+      QRectF itemRect = rect();
+      double xRatio = dx / itemRect.width();
+      double yRatio = dy / itemRect.height();
+      
+      double xMoveMapCoord = mExtent.width() * xRatio;
+      double yMoveMapCoord = -( mExtent.height() * yRatio );
+      
+      mExtent.setXMinimum( mExtent.xMin() + xMoveMapCoord );
+      mExtent.setXMaximum( mExtent.xMax() + xMoveMapCoord );
+      mExtent.setYmin( mExtent.yMin() + yMoveMapCoord );
+      mExtent.setYmax( mExtent.yMax() + yMoveMapCoord );
+      emit extentChanged();
+      cache();
+      update();
+    }
 }
 
 void QgsComposerMap::setSceneRect( const QRectF& rectangle )

Modified: trunk/qgis/src/gui/qgscomposerview.cpp
===================================================================
--- trunk/qgis/src/gui/qgscomposerview.cpp	2008-08-26 09:16:13 UTC (rev 9173)
+++ trunk/qgis/src/gui/qgscomposerview.cpp	2008-08-26 11:06:17 UTC (rev 9174)
@@ -189,7 +189,6 @@
         double moveX = scenePoint.x() - mMoveContentStartPos.x();
         double moveY = scenePoint.y() - mMoveContentStartPos.y();
         mMoveContentItem->moveContent( -moveX, -moveY );
-        mMoveContentItem->update();
         mMoveContentItem = 0;
       }
       break;



More information about the QGIS-commit mailing list