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

svn_qgis at osgeo.org svn_qgis at osgeo.org
Fri Nov 7 05:35:32 EST 2008


Author: timlinux
Date: 2008-11-07 05:35:32 -0500 (Fri, 07 Nov 2008)
New Revision: 9570

Modified:
   trunk/qgis/src/app/composer/qgscomposer.cpp
   trunk/qgis/src/app/composer/qgscompositionwidget.cpp
   trunk/qgis/src/core/composer/qgscomposerscalebar.cpp
   trunk/qgis/src/core/composer/qgscomposition.cpp
   trunk/qgis/src/core/composer/qgscomposition.h
   trunk/qgis/src/core/composer/qgsticksscalebarstyle.cpp
   trunk/qgis/src/core/composer/qgsticksscalebarstyle.h
Log:
API Tidy ups for composer

Modified: trunk/qgis/src/app/composer/qgscomposer.cpp
===================================================================
--- trunk/qgis/src/app/composer/qgscomposer.cpp	2008-11-07 09:56:02 UTC (rev 9569)
+++ trunk/qgis/src/app/composer/qgscomposer.cpp	2008-11-07 10:35:32 UTC (rev 9570)
@@ -456,7 +456,7 @@
     //set user-defined resolution
     if ( mComposition )
     {
-      printer.setResolution( mComposition->printoutResolution() );
+      printer.setResolution( mComposition->printResolution() );
     }
     QPainter p( &printer );
 
@@ -489,8 +489,8 @@
   }
 
   // Image size
-  int width = ( int )( mComposition->printoutResolution() * mComposition->paperWidth() / 25.4 );
-  int height = ( int )( mComposition-> printoutResolution() * mComposition->paperHeight() / 25.4 );
+  int width = ( int )( mComposition->printResolution() * mComposition->paperWidth() / 25.4 );
+  int height = ( int )( mComposition-> printResolution() * mComposition->paperHeight() / 25.4 );
 
   int memuse = width * height * 3 / 1000000;  // pixmap + image
   QgsDebugMsg( QString( "Image %1 x %2" ).arg( width ).arg( height ) );
@@ -592,8 +592,8 @@
   mView->setScene( 0 );
 
   QImage image( QSize( width, height ), QImage::Format_ARGB32 );
-  image.setDotsPerMeterX( mComposition->printoutResolution() / 25.4 * 1000 );
-  image.setDotsPerMeterY( mComposition->printoutResolution() / 25.4 * 1000 );
+  image.setDotsPerMeterX( mComposition->printResolution() / 25.4 * 1000 );
+  image.setDotsPerMeterY( mComposition->printResolution() / 25.4 * 1000 );
   image.fill( 0 );
   QPainter p( &image );
   QRectF sourceArea( 0, 0, mComposition->paperWidth(), mComposition->paperHeight() );

Modified: trunk/qgis/src/app/composer/qgscompositionwidget.cpp
===================================================================
--- trunk/qgis/src/app/composer/qgscompositionwidget.cpp	2008-11-07 09:56:02 UTC (rev 9569)
+++ trunk/qgis/src/app/composer/qgscompositionwidget.cpp	2008-11-07 10:35:32 UTC (rev 9570)
@@ -41,7 +41,7 @@
   //read printout resolution from composition
   if ( mComposition )
   {
-    mResolutionLineEdit->setText( QString::number( mComposition->printoutResolution() ) );
+    mResolutionLineEdit->setText( QString::number( mComposition->printResolution() ) );
   }
 }
 
@@ -281,12 +281,12 @@
   int resolution = text.toInt( &conversionOk );
   if ( conversionOk && mComposition )
   {
-    mComposition->setPrintoutResolution( resolution );
+    mComposition->setPrintResolution( resolution );
   }
   else if ( mComposition )
   {
     //set screen resolution per default
     QPrinter resolutionInfo( QPrinter::ScreenResolution );
-    mComposition->setPrintoutResolution( resolutionInfo.resolution() );
+    mComposition->setPrintResolution( resolutionInfo.resolution() );
   }
 }

Modified: trunk/qgis/src/core/composer/qgscomposerscalebar.cpp
===================================================================
--- trunk/qgis/src/core/composer/qgscomposerscalebar.cpp	2008-11-07 09:56:02 UTC (rev 9569)
+++ trunk/qgis/src/core/composer/qgscomposerscalebar.cpp	2008-11-07 10:35:32 UTC (rev 9570)
@@ -210,15 +210,15 @@
     QgsTicksScaleBarStyle* tickStyle = new QgsTicksScaleBarStyle( this );
     if ( styleName == tr( "Line Ticks Middle" ) )
     {
-      tickStyle->setTickPosition( QgsTicksScaleBarStyle::MIDDLE );
+      tickStyle->setTickPosition( QgsTicksScaleBarStyle::TicksMiddle );
     }
     else if ( styleName == tr( "Line Ticks Down" ) )
     {
-      tickStyle->setTickPosition( QgsTicksScaleBarStyle::DOWN );
+      tickStyle->setTickPosition( QgsTicksScaleBarStyle::TicksDown );
     }
     else if ( styleName == tr( "Line Ticks Up" ) )
     {
-      tickStyle->setTickPosition( QgsTicksScaleBarStyle::UP );
+      tickStyle->setTickPosition( QgsTicksScaleBarStyle::TicksUp );
     }
     mStyle = tickStyle;
   }

Modified: trunk/qgis/src/core/composer/qgscomposition.cpp
===================================================================
--- trunk/qgis/src/core/composer/qgscomposition.cpp	2008-11-07 09:56:02 UTC (rev 9569)
+++ trunk/qgis/src/core/composer/qgscomposition.cpp	2008-11-07 10:35:32 UTC (rev 9570)
@@ -30,7 +30,7 @@
   mPaperItem->setBrush( Qt::white );
   addItem( mPaperItem );
   mPaperItem->setZValue( 0 );
-  mPrintoutResolution = 300; //hardcoded default
+  mPrintResolution = 300; //hardcoded default
 }
 
 QgsComposition::QgsComposition(): QGraphicsScene( 0 ), mMapRenderer( 0 ), mPlotStyle( QgsComposition::Preview ), mPaperItem( 0 )

Modified: trunk/qgis/src/core/composer/qgscomposition.h
===================================================================
--- trunk/qgis/src/core/composer/qgscomposition.h	2008-11-07 09:56:02 UTC (rev 9569)
+++ trunk/qgis/src/core/composer/qgscomposition.h	2008-11-07 10:35:32 UTC (rev 9570)
@@ -69,8 +69,8 @@
      @return id or 0 pointer if the composer map item does not exist*/
     const QgsComposerMap* getComposerMapById( int id ) const;
 
-    int printoutResolution() const {return mPrintoutResolution;}
-    void setPrintoutResolution( int dpi ) {mPrintoutResolution = dpi;}
+    int printResolution() const {return mPrintResolution;}
+    void setPrintResolution( int dpi ) {mPrintResolution = dpi;}
 
     /**Returns pointer to map renderer of qgis map canvas*/
     QgsMapRenderer* mapRenderer() {return mMapRenderer;}
@@ -121,7 +121,7 @@
     QLinkedList<QgsComposerItem*> mItemZList;
 
     /**Dpi for printout*/
-    int mPrintoutResolution;
+    int mPrintResolution;
 
     QgsComposition(); //default constructor is forbidden
 

Modified: trunk/qgis/src/core/composer/qgsticksscalebarstyle.cpp
===================================================================
--- trunk/qgis/src/core/composer/qgsticksscalebarstyle.cpp	2008-11-07 09:56:02 UTC (rev 9569)
+++ trunk/qgis/src/core/composer/qgsticksscalebarstyle.cpp	2008-11-07 10:35:32 UTC (rev 9570)
@@ -20,12 +20,12 @@
 
 QgsTicksScaleBarStyle::QgsTicksScaleBarStyle( const QgsComposerScaleBar* bar ): QgsScaleBarStyle( bar )
 {
-  mTickPosition = MIDDLE;
+  mTickPosition = TicksMiddle;
 }
 
 QgsTicksScaleBarStyle::QgsTicksScaleBarStyle(): QgsScaleBarStyle( 0 )
 {
-  mTickPosition = MIDDLE;
+  mTickPosition = TicksMiddle;
 }
 
 QgsTicksScaleBarStyle::~QgsTicksScaleBarStyle()
@@ -37,11 +37,11 @@
 {
   switch ( mTickPosition )
   {
-    case UP:
+    case TicksUp:
       return "Line Ticks Up";
-    case DOWN:
+    case TicksDown:
       return "Line Ticks Down";
-    case MIDDLE:
+    case TicksMiddle:
       return "Line Ticks Middle";
   }
   return "";  // to make gcc happy
@@ -69,13 +69,13 @@
     p->drawLine( segmentIt->first + xOffset, barTopPosition, segmentIt->first + xOffset, barTopPosition + mScaleBar->height() );
     switch ( mTickPosition )
     {
-      case DOWN:
+      case TicksDown:
         p->drawLine( xOffset + segmentIt->first, barTopPosition, xOffset + segmentIt->first + mScaleBar->segmentMillimeters(), barTopPosition );
         break;
-      case MIDDLE:
+      case TicksMiddle:
         p->drawLine( xOffset + segmentIt->first, middlePosition, xOffset + segmentIt->first + mScaleBar->segmentMillimeters(), middlePosition );
         break;
-      case UP:
+      case TicksUp:
         p->drawLine( xOffset + segmentIt->first, bottomPosition, xOffset + segmentIt->first + mScaleBar->segmentMillimeters(), bottomPosition );
         break;
     }

Modified: trunk/qgis/src/core/composer/qgsticksscalebarstyle.h
===================================================================
--- trunk/qgis/src/core/composer/qgsticksscalebarstyle.h	2008-11-07 09:56:02 UTC (rev 9569)
+++ trunk/qgis/src/core/composer/qgsticksscalebarstyle.h	2008-11-07 10:35:32 UTC (rev 9570)
@@ -27,9 +27,9 @@
   public:
     enum TickPosition
     {
-      UP,
-      DOWN,
-      MIDDLE
+      TicksUp,
+      TicksDown,
+      TicksMiddle
     };
 
     QgsTicksScaleBarStyle( const QgsComposerScaleBar* bar );



More information about the QGIS-commit mailing list