[QGIS Commit] r8417 - trunk/qgis/src/app/composer

svn_qgis at osgeo.org svn_qgis at osgeo.org
Fri May 9 10:55:43 EDT 2008


Author: StevenB
Date: 2008-05-09 10:55:43 -0400 (Fri, 09 May 2008)
New Revision: 8417

Modified:
   trunk/qgis/src/app/composer/qgscomposerlabel.cpp
   trunk/qgis/src/app/composer/qgscomposermap.cpp
   trunk/qgis/src/app/composer/qgscomposerpicture.cpp
   trunk/qgis/src/app/composer/qgscomposerscalebar.cpp
   trunk/qgis/src/app/composer/qgscomposervectorlegend.cpp
   trunk/qgis/src/app/composer/qgscomposerview.cpp
   trunk/qgis/src/app/composer/qgscomposition.cpp
Log:
Cleaned up a bunch of debug statments.


Modified: trunk/qgis/src/app/composer/qgscomposerlabel.cpp
===================================================================
--- trunk/qgis/src/app/composer/qgscomposerlabel.cpp	2008-05-08 21:45:52 UTC (rev 8416)
+++ trunk/qgis/src/app/composer/qgscomposerlabel.cpp	2008-05-09 14:55:43 UTC (rev 8417)
@@ -31,7 +31,9 @@
 {
     setupUi(this);
 
-    //std::cout << "QgsComposerLabel::QgsComposerLabel()" << std::endl;
+#ifdef QGISDEBUG
+    std::cout << "QgsComposerLabel::QgsComposerLabel()" << std::endl;
+#endif
 
     mComposition = composition;
     mId  = id;
@@ -64,7 +66,9 @@
 QgsComposerLabel::QgsComposerLabel ( QgsComposition *composition, int id ) 
     : QAbstractGraphicsShapeItem(0)
 {
-    //std::cout << "QgsComposerLabel::QgsComposerLabel()" << std::endl;
+#ifdef QGISDEBUG
+    std::cout << "QgsComposerLabel::QgsComposerLabel()" << std::endl;
+#endif
 
     setupUi(this);
 
@@ -86,7 +90,10 @@
 
 QgsComposerLabel::~QgsComposerLabel()
 {
-    //std::cout << "QgsComposerLabel::~QgsComposerLabel" << std::endl;
+#ifdef QGISDEBUG
+    std::cout << "QgsComposerLabel::~QgsComposerLabel" << std::endl;
+#endif
+    //make ourselves disappear so there aren't any interesting effects when we get destroyed
     QGraphicsItem::hide();
 }
 
@@ -96,7 +103,9 @@
 #define WIDTH_EXTENSION 1.0
 void QgsComposerLabel::paint ( QPainter* painter, const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget )
 {
-    //std::cout << "QgsComposerLabel::paint" << std::endl;
+#ifdef QGISDEBUG
+    std::cout << "QgsComposerLabel::paint" << std::endl;
+#endif
 
     float size =  25.4 * mComposition->scale() * mFont.pointSizeF() / 72;
 
@@ -234,7 +243,9 @@
 
 QPolygonF QgsComposerLabel::areaPoints() const
 {
-    //std::cout << "QgsComposerLabel::areaPoints" << std::endl;
+#ifdef QGISDEBUG
+    std::cout << "QgsComposerLabel::areaPoints" << std::endl;
+#endif
     QRectF r = boundingRect();
 
     QPolygonF pa;
@@ -268,11 +279,12 @@
 
 void QgsComposerLabel::setSelected (  bool s ) 
 {
-    //std::cout << "QgsComposerLabel::setSelected" << std::endl;
+#ifdef QGISDEBUG
+    std::cout << "QgsComposerLabel::setSelected" << std::endl;
+#endif
+
     mSelected = s;
     QAbstractGraphicsShapeItem::update(); // show highlight
-            
-    std::cout << "mSelected = " << mSelected << std::endl;
 }    
 
 bool QgsComposerLabel::selected( void )

Modified: trunk/qgis/src/app/composer/qgscomposermap.cpp
===================================================================
--- trunk/qgis/src/app/composer/qgscomposermap.cpp	2008-05-08 21:45:52 UTC (rev 8416)
+++ trunk/qgis/src/app/composer/qgscomposermap.cpp	2008-05-09 14:55:43 UTC (rev 8417)
@@ -42,8 +42,9 @@
 QgsComposerMap::QgsComposerMap ( QgsComposition *composition, int id, int x, int y, int width, int height )
     : QWidget(), QGraphicsRectItem(0,0,width,height,0)
 {
-std::cout << "QgsComposerMap::QgsComposerMap()" << std::endl;
-
+#ifdef QGISDEBUG
+    std::cout << "QgsComposerMap::QgsComposerMap()" << std::endl;
+#endif
     setupUi(this);
 
     mComposition = composition;
@@ -119,7 +120,9 @@
 
 QgsComposerMap::~QgsComposerMap()
 {
+#ifdef QGISDEBUG
      std::cerr << "QgsComposerMap::~QgsComposerMap" << std::endl;
+#endif
 }
 
 /* This function is called by paint() and cache() to render the map.  It does not override any functions
@@ -265,7 +268,9 @@
 
 void QgsComposerMap::cache ( void )
 {
+#ifdef QGISDEBUG
     std::cout << "QgsComposerMap::cache()" << std::endl;
+#endif
 
     // Create preview on some reasonable size. It was slow with cca 1500x1500 points on 2x1.5GHz 
     // Note: The resolution should also respect the line widths, it means that 
@@ -278,8 +283,10 @@
     // It can happen that extent is not initialised well -> check 
     if ( h < 1 || h > 10000 ) h = w; 
 
+#ifdef QGISDEBUG
     std::cout << "extent = " << mExtent.width() <<  " x " << mExtent.height() << std::endl;
     std::cout << "cache = " << w <<  " x " << h << std::endl;
+#endif
 
     mCacheExtent = QgsRect ( mExtent );
     double scale = mExtent.width() / w;
@@ -299,7 +306,9 @@
 * on both the cache, screen render, and print.
 */
 
+#ifdef QGISDEBUG
     std::cout << "transform = " << transform.showParameters().toLocal8Bit().data() << std::endl;
+#endif
     
     mCachePixmap.fill(QColor(255,255,255));
 
@@ -317,12 +326,12 @@
   if ( mDrawing ) return; 
   mDrawing = true;
 
+#ifdef QGISDEBUG
   std::cout << "QgsComposerMapt::paint mPlotStyle = " << plotStyle() 
             << " mPreviewMode = " << mPreviewMode << std::endl;
+#endif
     
   if ( plotStyle() == QgsComposition::Preview &&  mPreviewMode == Cache ) { // Draw from cache
-    std::cout << "use cache" << std::endl;
-
     if ( !mCacheUpdated || mMapCanvas->layerCount() != mNumCachedLayers ) 
     {
       cache();
@@ -330,8 +339,10 @@
   
     // Scale so that the cache fills the map rectangle
     double scale = 1.0 * QGraphicsRectItem::rect().width() / mCachePixmap.width();
+    #ifdef QGISDEBUG
     std::cout << "scale = " << scale << std::endl;
-  
+    #endif
+
     painter->save();
 
     painter->translate(0, 0); //do we need this?
@@ -346,7 +357,9 @@
             plotStyle() == QgsComposition::Print ||
             plotStyle() == QgsComposition::Postscript ) 
   {
+    #ifdef QGISDEBUG
     std::cout << "render" << std::endl;
+    #endif
   
     double scale = mExtent.width() / QGraphicsRectItem::rect().width();
     QgsMapToPixel transform(scale, QGraphicsRectItem::rect().height(), mExtent.yMin(), mExtent.xMin() );
@@ -503,8 +516,9 @@
 
 void QgsComposerMap::mapCanvasChanged ( void ) 
 {
+#ifdef QGISDEBUG
     std::cout << "QgsComposerMap::canvasChanged" << std::endl;
-
+#endif
     mCacheUpdated = false;
     QGraphicsRectItem::update();
 }
@@ -562,9 +576,11 @@
     mExtent.setYmax ( yc + height/2  );
   }
 
+#ifdef QGISDEBUG
   std::cout << "mUserExtent = " << mUserExtent.stringRep().toLocal8Bit().data() << std::endl;
   std::cout << "mScale = " << mScale << std::endl;
   std::cout << "mExtent = " << mExtent.stringRep().toLocal8Bit().data() << std::endl;
+#endif
 
   setOptions();
   mCacheUpdated = false;
@@ -581,8 +597,10 @@
 
 
 void QgsComposerMap::setOptions ( void )
-{ 
+{
+#ifdef QGISDEBUG
   std::cout << "QgsComposerMap::setOptions" << std::endl;
+#endif
     
   mNameLabel->setText ( mName );
     

Modified: trunk/qgis/src/app/composer/qgscomposerpicture.cpp
===================================================================
--- trunk/qgis/src/app/composer/qgscomposerpicture.cpp	2008-05-08 21:45:52 UTC (rev 8416)
+++ trunk/qgis/src/app/composer/qgscomposerpicture.cpp	2008-05-09 14:55:43 UTC (rev 8417)
@@ -33,8 +33,6 @@
 
 #define PI 3.14159265358979323846
 
-#define QGISDEBUG 1
-
 QgsComposerPicture::QgsComposerPicture ( QgsComposition *composition, 
 					int id, QString file ) 
     : QWidget(composition),

Modified: trunk/qgis/src/app/composer/qgscomposerscalebar.cpp
===================================================================
--- trunk/qgis/src/app/composer/qgscomposerscalebar.cpp	2008-05-08 21:45:52 UTC (rev 8416)
+++ trunk/qgis/src/app/composer/qgscomposerscalebar.cpp	2008-05-09 14:55:43 UTC (rev 8417)
@@ -36,7 +36,10 @@
 {
   setupUi(this);
 
+#ifdef QGISDEBUG
   std::cout << "QgsComposerScalebar::QgsComposerScalebar()" << std::endl;
+#endif
+
   mId = id;
   mSelected = false;
 
@@ -120,7 +123,9 @@
     mMap(0),
     mBrush(QColor(150,150,150))
 {
+#ifdef QGISDEBUG
   std::cout << "QgsComposerScalebar::QgsComposerScalebar()" << std::endl;
+#endif
 
   setupUi(this);
 
@@ -410,7 +415,9 @@
 
 void QgsComposerScalebar::recalculate(void)
 {
+#ifdef QGISDEBUG
   std::cout << "QgsComposerScalebar::recalculate" << std::endl;
+#endif
 
   // !!! prepareGeometryChange() MUST BE called before the value returned by areaPoints() changes
   //Is this still true after the port to GraphicsView?
@@ -423,13 +430,17 @@
 
 QRectF QgsComposerScalebar::boundingRect(void) const
 {
+#ifdef QGISDEBUG
   std::cout << "QgsComposerScalebar::boundingRect" << std::endl;
+#endif
   return mBoundingRect;
 }
 
 QPolygonF QgsComposerScalebar::areaPoints(void) const
 {
+#ifdef QGISDEBUG
   std::cout << "QgsComposerScalebar::areaPoints" << std::endl;
+#endif
 
   QRectF r = boundingRect();
   QPolygonF pa;
@@ -496,7 +507,10 @@
 
 bool QgsComposerScalebar::writeSettings(void)
 {
+#ifdef QGISDEBUG
   std::cout << "QgsComposerScalebar::writeSettings" << std::endl;
+#endif
+
   QString path;
   path.sprintf("/composition_%d/scalebar_%d/", mComposition->id(), mId);
 

Modified: trunk/qgis/src/app/composer/qgscomposervectorlegend.cpp
===================================================================
--- trunk/qgis/src/app/composer/qgscomposervectorlegend.cpp	2008-05-08 21:45:52 UTC (rev 8416)
+++ trunk/qgis/src/app/composer/qgscomposervectorlegend.cpp	2008-05-09 14:55:43 UTC (rev 8417)
@@ -41,7 +41,9 @@
 {
   setupUi(this);
 
-  //std::cout << "QgsComposerVectorLegend::QgsComposerVectorLegend()" << std::endl;
+#ifdef QGISDEBUG
+  std::cout << "QgsComposerVectorLegend::QgsComposerVectorLegend()" << std::endl;
+#endif
 
   mComposition = composition;
   mId  = id;
@@ -76,7 +78,9 @@
 QgsComposerVectorLegend::QgsComposerVectorLegend ( QgsComposition *composition, int id ) 
     : QGraphicsRectItem(0,0,10,10,0)
 {
-    //std::cout << "QgsComposerVectorLegend::QgsComposerVectorLegend()" << std::endl;
+#ifdef QGISDEBUG
+    std::cout << "QgsComposerVectorLegend::QgsComposerVectorLegend()" << std::endl;
+#endif
 
     setupUi(this);
 
@@ -142,7 +146,9 @@
 #define FONT_WORKAROUND_SCALE 10
 QRectF QgsComposerVectorLegend::render ( QPainter *p )
 {
-  //std::cout << "QgsComposerVectorLegend::render p = " << p << std::endl;
+#ifdef QGISDEBUG
+  std::cout << "QgsComposerVectorLegend::render p = " << p << std::endl;
+#endif
 
   // Painter can be 0, create dummy to avoid many if below
   QPainter *painter = NULL;
@@ -350,7 +356,7 @@
       double groupStartHeight = height;
       for ( int j = groupLayers.size()-1; j >= 0; j-- )
       {
-	    std::cout << "layer = " << groupLayers[j] << std::endl;
+	    //std::cout << "layer = " << groupLayers[j] << std::endl;
 
 	    double localHeight = groupStartHeight;
 	
@@ -463,9 +469,11 @@
 
 void QgsComposerVectorLegend::cache ( void )
 {
+#ifdef QGISDEBUG
     std::cout << "QgsComposerVectorLegend::cache()" << std::endl;
+#endif
 
-//typical boundingRect size is 15 units wide,
+    //typical boundingRect size is 15 units wide,
     mCachePixmap = QPixmap((int)QGraphicsRectItem::rect().width(), (int)QGraphicsRectItem::rect().height() );
 
 
@@ -552,7 +560,9 @@
 void QgsComposerVectorLegend::on_mPreviewModeComboBox_activated ( int i )
 {
     mPreviewMode = (PreviewMode) i;
+#ifdef QGISDEBUG
     std::cout << "mPreviewMode = " << mPreviewMode << std::endl;
+#endif
     writeSettings();
 }
 
@@ -586,7 +596,9 @@
 
 void QgsComposerVectorLegend::recalculate ( void ) 
 {
+#ifdef QGISDEBUG
     std::cout << "QgsComposerVectorLegend::recalculate" << std::endl;
+#endif
     
     // Recalculate sizes according to current font size
     
@@ -596,9 +608,6 @@
     mSectionFont = mFont;
     mSectionFont.setPointSizeFloat ( 1.2 * mFont.pointSizeFloat() );
     
-    std::cout << "font size = " << mFont.pointSizeFloat() << std::endl;
-    std::cout << "title font size = " << mTitleFont.pointSizeFloat() << std::endl;
-
     // Font size in canvas units
     float size = 25.4 * mComposition->scale() * mFont.pointSizeFloat() / 72;
 
@@ -607,9 +616,14 @@
     mSymbolWidth = 3.5 * size;
     mSymbolSpace = 0.4 * size;
 
+#ifdef QGISDEBUG
+    std::cout << "font size = " << mFont.pointSizeFloat() << std::endl;
+    std::cout << "title font size = " << mTitleFont.pointSizeFloat() << std::endl;
+
     std::cout << "mMargin = " << mMargin << " mSymbolHeight = " << mSymbolHeight
               << "mSymbolWidth = " << mSymbolWidth << " mSymbolSpace = " << mSymbolSpace << std::endl;
-     
+#endif
+
     QRectF r = render(0);
 
     QGraphicsRectItem::setRect(0, 0, r.width(), r.height() );
@@ -695,7 +709,9 @@
 
 void QgsComposerVectorLegend::contextMenuEvent( QContextMenuEvent *event)
 {
+#ifdef QGISDEBUG
   std::cout << "QgsComposerVectorLegend::contextMenuEvent" << std::endl;
+#endif
 
   QMenu layersPopupMenu( this);
   layersPopupMenu.addAction( tr("Combine selected layers"), this, SLOT(groupLayers()) );
@@ -748,7 +764,9 @@
 
 void QgsComposerVectorLegend::layerChanged ( QTreeWidgetItem *lvi )
 {
+#ifdef QGISDEBUG
     std::cout << "QgsComposerVectorLegend::layerChanged" << std::endl;
+#endif
 
     if ( lvi == 0 ) return; 
     
@@ -764,7 +782,9 @@
 
 void QgsComposerVectorLegend::groupLayers ( void ) 
 {
+#ifdef QGISDEBUG
   std::cout << "QgsComposerVectorLegend::groupLayers" << std::endl;
+#endif
 
   QTreeWidgetItemIterator it( mLayersListView );
   int count = 0;
@@ -772,7 +792,9 @@
   QString id;
   while ( *it ) {
     if ( (*it)->isSelected() ) {
+      #ifdef QGISDEBUG
       std::cout << "selected: " << (*it)->text(0).toLocal8Bit().data() << " " << (*it)->text(2).toLocal8Bit().data() << std::endl;
+      #endif
 
       id = (*it)->text(2);
       setLayerGroup ( id, mNextLayerGroup );
@@ -787,11 +809,13 @@
     lastItem->setText(1,"" );
   }
 
+#ifdef QGISDEBUG
   std::cout << "Groups:" << std::endl;
 
   for ( std::map<QString,int>::iterator it3 = mLayersGroups.begin(); it3 != mLayersGroups.end(); ++it3 ) {
     std::cout << "layer: " << (it3->first).toLocal8Bit().data() << " group: " << it3->second << std::endl;
   }
+#endif
     
   mNextLayerGroup++;
     
@@ -810,7 +834,10 @@
 
 bool QgsComposerVectorLegend::writeSettings ( void )  
 {
+#ifdef QGISDEBUG
   std::cout << "QgsComposerVectorLegend::writeSettings" << std::endl;
+#endif
+
   QString path;
   path.sprintf("/composition_%d/vectorlegend_%d/", mComposition->id(), mId ); 
 

Modified: trunk/qgis/src/app/composer/qgscomposerview.cpp
===================================================================
--- trunk/qgis/src/app/composer/qgscomposerview.cpp	2008-05-08 21:45:52 UTC (rev 8416)
+++ trunk/qgis/src/app/composer/qgscomposerview.cpp	2008-05-09 14:55:43 UTC (rev 8417)
@@ -72,7 +72,9 @@
  *  Really, we should do something like re-center the window.
 */
     //mComposer->zoomFull();
-std::cout << "resize anchor: " << resizeAnchor() << std::endl;
+#ifdef QGISDEBUG
+  std::cout << "resize anchor: " << resizeAnchor() << std::endl;
+#endif
 }
 
 //TODO: add mouse wheel event forwarding

Modified: trunk/qgis/src/app/composer/qgscomposition.cpp
===================================================================
--- trunk/qgis/src/app/composer/qgscomposition.cpp	2008-05-08 21:45:52 UTC (rev 8416)
+++ trunk/qgis/src/app/composer/qgscomposition.cpp	2008-05-09 14:55:43 UTC (rev 8417)
@@ -388,11 +388,10 @@
 void QgsComposition::mouseMoveEvent(QMouseEvent* e)
 {
 #ifdef QGISDEBUG
-#endif
   std::cerr << "QgsComposition::mouseMoveEvent() mTool = " << mTool << " mToolStep = "
     << mToolStep << std::endl;
+#endif
 
-
   QPointF p = mView->mapToScene(e->pos());
 
   switch ( mTool ) {



More information about the QGIS-commit mailing list