Skip to content

Commit e5d6287

Browse files
author
timlinux
committed
API Tidy ups for composer
git-svn-id: http://svn.osgeo.org/qgis/trunk@9570 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent f123e65 commit e5d6287

7 files changed

+26
-26
lines changed

src/app/composer/qgscomposer.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ void QgsComposer::on_mActionPrint_activated( void )
456456
//set user-defined resolution
457457
if ( mComposition )
458458
{
459-
printer.setResolution( mComposition->printoutResolution() );
459+
printer.setResolution( mComposition->printResolution() );
460460
}
461461
QPainter p( &printer );
462462

@@ -489,8 +489,8 @@ void QgsComposer::on_mActionExportAsImage_activated( void )
489489
}
490490

491491
// Image size
492-
int width = ( int )( mComposition->printoutResolution() * mComposition->paperWidth() / 25.4 );
493-
int height = ( int )( mComposition-> printoutResolution() * mComposition->paperHeight() / 25.4 );
492+
int width = ( int )( mComposition->printResolution() * mComposition->paperWidth() / 25.4 );
493+
int height = ( int )( mComposition-> printResolution() * mComposition->paperHeight() / 25.4 );
494494

495495
int memuse = width * height * 3 / 1000000; // pixmap + image
496496
QgsDebugMsg( QString( "Image %1 x %2" ).arg( width ).arg( height ) );
@@ -592,8 +592,8 @@ void QgsComposer::on_mActionExportAsImage_activated( void )
592592
mView->setScene( 0 );
593593

594594
QImage image( QSize( width, height ), QImage::Format_ARGB32 );
595-
image.setDotsPerMeterX( mComposition->printoutResolution() / 25.4 * 1000 );
596-
image.setDotsPerMeterY( mComposition->printoutResolution() / 25.4 * 1000 );
595+
image.setDotsPerMeterX( mComposition->printResolution() / 25.4 * 1000 );
596+
image.setDotsPerMeterY( mComposition->printResolution() / 25.4 * 1000 );
597597
image.fill( 0 );
598598
QPainter p( &image );
599599
QRectF sourceArea( 0, 0, mComposition->paperWidth(), mComposition->paperHeight() );

src/app/composer/qgscompositionwidget.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ QgsCompositionWidget::QgsCompositionWidget( QWidget* parent, QgsComposition* c )
4141
//read printout resolution from composition
4242
if ( mComposition )
4343
{
44-
mResolutionLineEdit->setText( QString::number( mComposition->printoutResolution() ) );
44+
mResolutionLineEdit->setText( QString::number( mComposition->printResolution() ) );
4545
}
4646
}
4747

@@ -281,12 +281,12 @@ void QgsCompositionWidget::on_mResolutionLineEdit_textChanged( const QString& te
281281
int resolution = text.toInt( &conversionOk );
282282
if ( conversionOk && mComposition )
283283
{
284-
mComposition->setPrintoutResolution( resolution );
284+
mComposition->setPrintResolution( resolution );
285285
}
286286
else if ( mComposition )
287287
{
288288
//set screen resolution per default
289289
QPrinter resolutionInfo( QPrinter::ScreenResolution );
290-
mComposition->setPrintoutResolution( resolutionInfo.resolution() );
290+
mComposition->setPrintResolution( resolutionInfo.resolution() );
291291
}
292292
}

src/core/composer/qgscomposerscalebar.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -210,15 +210,15 @@ void QgsComposerScaleBar::setStyle( const QString& styleName )
210210
QgsTicksScaleBarStyle* tickStyle = new QgsTicksScaleBarStyle( this );
211211
if ( styleName == tr( "Line Ticks Middle" ) )
212212
{
213-
tickStyle->setTickPosition( QgsTicksScaleBarStyle::MIDDLE );
213+
tickStyle->setTickPosition( QgsTicksScaleBarStyle::TicksMiddle );
214214
}
215215
else if ( styleName == tr( "Line Ticks Down" ) )
216216
{
217-
tickStyle->setTickPosition( QgsTicksScaleBarStyle::DOWN );
217+
tickStyle->setTickPosition( QgsTicksScaleBarStyle::TicksDown );
218218
}
219219
else if ( styleName == tr( "Line Ticks Up" ) )
220220
{
221-
tickStyle->setTickPosition( QgsTicksScaleBarStyle::UP );
221+
tickStyle->setTickPosition( QgsTicksScaleBarStyle::TicksUp );
222222
}
223223
mStyle = tickStyle;
224224
}

src/core/composer/qgscomposition.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ QgsComposition::QgsComposition( QgsMapRenderer* mapRenderer ): QGraphicsScene( 0
3030
mPaperItem->setBrush( Qt::white );
3131
addItem( mPaperItem );
3232
mPaperItem->setZValue( 0 );
33-
mPrintoutResolution = 300; //hardcoded default
33+
mPrintResolution = 300; //hardcoded default
3434
}
3535

3636
QgsComposition::QgsComposition(): QGraphicsScene( 0 ), mMapRenderer( 0 ), mPlotStyle( QgsComposition::Preview ), mPaperItem( 0 )

src/core/composer/qgscomposition.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ class CORE_EXPORT QgsComposition: public QGraphicsScene
6969
@return id or 0 pointer if the composer map item does not exist*/
7070
const QgsComposerMap* getComposerMapById( int id ) const;
7171

72-
int printoutResolution() const {return mPrintoutResolution;}
73-
void setPrintoutResolution( int dpi ) {mPrintoutResolution = dpi;}
72+
int printResolution() const {return mPrintResolution;}
73+
void setPrintResolution( int dpi ) {mPrintResolution = dpi;}
7474

7575
/**Returns pointer to map renderer of qgis map canvas*/
7676
QgsMapRenderer* mapRenderer() {return mMapRenderer;}
@@ -121,7 +121,7 @@ class CORE_EXPORT QgsComposition: public QGraphicsScene
121121
QLinkedList<QgsComposerItem*> mItemZList;
122122

123123
/**Dpi for printout*/
124-
int mPrintoutResolution;
124+
int mPrintResolution;
125125

126126
QgsComposition(); //default constructor is forbidden
127127

src/core/composer/qgsticksscalebarstyle.cpp

+8-8
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@
2020

2121
QgsTicksScaleBarStyle::QgsTicksScaleBarStyle( const QgsComposerScaleBar* bar ): QgsScaleBarStyle( bar )
2222
{
23-
mTickPosition = MIDDLE;
23+
mTickPosition = TicksMiddle;
2424
}
2525

2626
QgsTicksScaleBarStyle::QgsTicksScaleBarStyle(): QgsScaleBarStyle( 0 )
2727
{
28-
mTickPosition = MIDDLE;
28+
mTickPosition = TicksMiddle;
2929
}
3030

3131
QgsTicksScaleBarStyle::~QgsTicksScaleBarStyle()
@@ -37,11 +37,11 @@ QString QgsTicksScaleBarStyle::name() const
3737
{
3838
switch ( mTickPosition )
3939
{
40-
case UP:
40+
case TicksUp:
4141
return "Line Ticks Up";
42-
case DOWN:
42+
case TicksDown:
4343
return "Line Ticks Down";
44-
case MIDDLE:
44+
case TicksMiddle:
4545
return "Line Ticks Middle";
4646
}
4747
return ""; // to make gcc happy
@@ -69,13 +69,13 @@ void QgsTicksScaleBarStyle::draw( QPainter* p, double xOffset ) const
6969
p->drawLine( segmentIt->first + xOffset, barTopPosition, segmentIt->first + xOffset, barTopPosition + mScaleBar->height() );
7070
switch ( mTickPosition )
7171
{
72-
case DOWN:
72+
case TicksDown:
7373
p->drawLine( xOffset + segmentIt->first, barTopPosition, xOffset + segmentIt->first + mScaleBar->segmentMillimeters(), barTopPosition );
7474
break;
75-
case MIDDLE:
75+
case TicksMiddle:
7676
p->drawLine( xOffset + segmentIt->first, middlePosition, xOffset + segmentIt->first + mScaleBar->segmentMillimeters(), middlePosition );
7777
break;
78-
case UP:
78+
case TicksUp:
7979
p->drawLine( xOffset + segmentIt->first, bottomPosition, xOffset + segmentIt->first + mScaleBar->segmentMillimeters(), bottomPosition );
8080
break;
8181
}

src/core/composer/qgsticksscalebarstyle.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ class CORE_EXPORT QgsTicksScaleBarStyle: public QgsScaleBarStyle
2727
public:
2828
enum TickPosition
2929
{
30-
UP,
31-
DOWN,
32-
MIDDLE
30+
TicksUp,
31+
TicksDown,
32+
TicksMiddle
3333
};
3434

3535
QgsTicksScaleBarStyle( const QgsComposerScaleBar* bar );

0 commit comments

Comments
 (0)