Skip to content

Commit 4eeb818

Browse files
committed
[composer] Deprecate a bunch of map grid calls (sponsored
by NIWA, New Zealand)
1 parent f68b258 commit 4eeb818

File tree

5 files changed

+277
-182
lines changed

5 files changed

+277
-182
lines changed

src/app/composer/qgscomposermapwidget.cpp

+47-46
Original file line numberDiff line numberDiff line change
@@ -813,15 +813,15 @@ void QgsComposerMapWidget::handleChangedAnnotationPosition( QgsComposerMap::Bord
813813
mComposerMap->beginCommand( tr( "Annotation position changed" ) );
814814
if ( text == tr( "Inside frame" ) )
815815
{
816-
grid->setGridAnnotationPosition( QgsComposerMap::InsideMapFrame, border );
816+
grid->setAnnotationPosition( QgsComposerMap::InsideMapFrame, border );
817817
}
818818
else if ( text == tr( "Disabled" ) )
819819
{
820-
grid->setGridAnnotationPosition( QgsComposerMap::Disabled, border );
820+
grid->setAnnotationPosition( QgsComposerMap::Disabled, border );
821821
}
822822
else //Outside frame
823823
{
824-
grid->setGridAnnotationPosition( QgsComposerMap::OutsideMapFrame, border );
824+
grid->setAnnotationPosition( QgsComposerMap::OutsideMapFrame, border );
825825
}
826826

827827
mComposerMap->updateBoundingRect();
@@ -840,11 +840,11 @@ void QgsComposerMapWidget::handleChangedAnnotationDirection( QgsComposerMap::Bor
840840
mComposerMap->beginCommand( tr( "Changed annotation direction" ) );
841841
if ( text == tr( "Horizontal" ) )
842842
{
843-
grid->setGridAnnotationDirection( QgsComposerMap::Horizontal, border );
843+
grid->setAnnotationDirection( QgsComposerMap::Horizontal, border );
844844
}
845845
else if ( text == tr( "Vertical" ) )
846846
{
847-
grid->setGridAnnotationDirection( QgsComposerMap::Vertical, border );
847+
grid->setAnnotationDirection( QgsComposerMap::Vertical, border );
848848
}
849849

850850
mComposerMap->updateBoundingRect();
@@ -888,6 +888,7 @@ void QgsComposerMapWidget::initAnnotationDirectionBox( QComboBox* c, QgsComposer
888888
{
889889
c->setCurrentIndex( c->findText( tr( "Horizontal" ) ) );
890890
}
891+
891892
}
892893

893894
void QgsComposerMapWidget::refreshMapComboBox()
@@ -1153,19 +1154,19 @@ void QgsComposerMapWidget::setGridItems( const QgsComposerMapGrid* grid )
11531154
blockGridItemsSignals( true );
11541155

11551156
mGridCheckBox->setTitle( QString( tr( "Draw \"%1\" grid" ) ).arg( grid->name() ) );
1156-
mGridCheckBox->setChecked( grid->gridEnabled() );
1157-
mIntervalXSpinBox->setValue( grid->gridIntervalX() );
1158-
mIntervalYSpinBox->setValue( grid->gridIntervalY() );
1159-
mOffsetXSpinBox->setValue( grid->gridOffsetX() );
1160-
mOffsetYSpinBox->setValue( grid->gridOffsetY() );
1157+
mGridCheckBox->setChecked( grid->enabled() );
1158+
mIntervalXSpinBox->setValue( grid->intervalX() );
1159+
mIntervalYSpinBox->setValue( grid->intervalY() );
1160+
mOffsetXSpinBox->setValue( grid->offsetX() );
1161+
mOffsetYSpinBox->setValue( grid->offsetY() );
11611162
mCrossWidthSpinBox->setValue( grid->crossLength() );
11621163
mFrameWidthSpinBox->setValue( grid->gridFrameWidth() );
11631164
mGridFramePenSizeSpinBox->setValue( grid->gridFramePenSize() );
11641165
mGridFramePenColorButton->setColor( grid->gridFramePenColor() );
11651166
mGridFrameFill1ColorButton->setColor( grid->gridFrameFillColor1() );
11661167
mGridFrameFill2ColorButton->setColor( grid->gridFrameFillColor2() );
11671168

1168-
QgsComposerMap::GridStyle gridStyle = grid->gridStyle();
1169+
QgsComposerMap::GridStyle gridStyle = grid->style();
11691170
switch ( gridStyle )
11701171
{
11711172
case QgsComposerMap::Cross:
@@ -1257,21 +1258,21 @@ void QgsComposerMapWidget::setGridItems( const QgsComposerMapGrid* grid )
12571258

12581259
mGridBlendComboBox->setBlendMode( grid->blendMode() );
12591260

1260-
mDrawAnnotationGroupBox->setChecked( grid->showGridAnnotation() );
1261-
initAnnotationPositionBox( mAnnotationPositionLeftComboBox, grid->gridAnnotationPosition( QgsComposerMap::Left ) );
1262-
initAnnotationPositionBox( mAnnotationPositionRightComboBox, grid->gridAnnotationPosition( QgsComposerMap::Right ) );
1263-
initAnnotationPositionBox( mAnnotationPositionTopComboBox, grid->gridAnnotationPosition( QgsComposerMap::Top ) );
1264-
initAnnotationPositionBox( mAnnotationPositionBottomComboBox, grid->gridAnnotationPosition( QgsComposerMap::Bottom ) );
1261+
mDrawAnnotationGroupBox->setChecked( grid->annotationEnabled() );
1262+
initAnnotationPositionBox( mAnnotationPositionLeftComboBox, grid->annotationPosition( QgsComposerMap::Left ) );
1263+
initAnnotationPositionBox( mAnnotationPositionRightComboBox, grid->annotationPosition( QgsComposerMap::Right ) );
1264+
initAnnotationPositionBox( mAnnotationPositionTopComboBox, grid->annotationPosition( QgsComposerMap::Top ) );
1265+
initAnnotationPositionBox( mAnnotationPositionBottomComboBox, grid->annotationPosition( QgsComposerMap::Bottom ) );
12651266

1266-
initAnnotationDirectionBox( mAnnotationDirectionComboBoxLeft, grid->gridAnnotationDirection( QgsComposerMap::Left ) );
1267-
initAnnotationDirectionBox( mAnnotationDirectionComboBoxRight, grid->gridAnnotationDirection( QgsComposerMap::Right ) );
1268-
initAnnotationDirectionBox( mAnnotationDirectionComboBoxTop, grid->gridAnnotationDirection( QgsComposerMap::Top ) );
1269-
initAnnotationDirectionBox( mAnnotationDirectionComboBoxBottom, grid->gridAnnotationDirection( QgsComposerMap::Bottom ) );
1267+
initAnnotationDirectionBox( mAnnotationDirectionComboBoxLeft, grid->annotationDirection( QgsComposerMap::Left ) );
1268+
initAnnotationDirectionBox( mAnnotationDirectionComboBoxRight, grid->annotationDirection( QgsComposerMap::Right ) );
1269+
initAnnotationDirectionBox( mAnnotationDirectionComboBoxTop, grid->annotationDirection( QgsComposerMap::Top ) );
1270+
initAnnotationDirectionBox( mAnnotationDirectionComboBoxBottom, grid->annotationDirection( QgsComposerMap::Bottom ) );
12701271

1271-
mAnnotationFontColorButton->setColor( grid->gridAnnotationFontColor() );
1272+
mAnnotationFontColorButton->setColor( grid->annotationFontColor() );
12721273

12731274
//mAnnotationFormatComboBox
1274-
switch ( grid->gridAnnotationFormat() )
1275+
switch ( grid->annotationFormat() )
12751276
{
12761277
case QgsComposerMap::Decimal:
12771278
mAnnotationFormatComboBox->setCurrentIndex( 0 );
@@ -1299,7 +1300,7 @@ void QgsComposerMapWidget::setGridItems( const QgsComposerMapGrid* grid )
12991300
break;
13001301
}
13011302
mDistanceToMapFrameSpinBox->setValue( grid->annotationFrameDistance() );
1302-
mCoordinatePrecisionSpinBox->setValue( grid->gridAnnotationPrecision() );
1303+
mCoordinatePrecisionSpinBox->setValue( grid->annotationPrecision() );
13031304

13041305
//Unit
13051306
QgsComposerMapGrid::GridUnit gridUnit = grid->gridUnit();
@@ -1403,7 +1404,7 @@ void QgsComposerMapWidget::on_mIntervalXSpinBox_editingFinished()
14031404
}
14041405

14051406
mComposerMap->beginCommand( tr( "Grid interval changed" ) );
1406-
grid->setGridIntervalX( mIntervalXSpinBox->value() );
1407+
grid->setIntervalX( mIntervalXSpinBox->value() );
14071408
mComposerMap->updateBoundingRect();
14081409
mComposerMap->update();
14091410
mComposerMap->endCommand();
@@ -1418,7 +1419,7 @@ void QgsComposerMapWidget::on_mIntervalYSpinBox_editingFinished()
14181419
}
14191420

14201421
mComposerMap->beginCommand( tr( "Grid interval changed" ) );
1421-
grid->setGridIntervalY( mIntervalYSpinBox->value() );
1422+
grid->setIntervalY( mIntervalYSpinBox->value() );
14221423
mComposerMap->updateBoundingRect();
14231424
mComposerMap->update();
14241425
mComposerMap->endCommand();
@@ -1433,7 +1434,7 @@ void QgsComposerMapWidget::on_mOffsetXSpinBox_valueChanged( double value )
14331434
}
14341435

14351436
mComposerMap->beginCommand( tr( "Grid offset changed" ) );
1436-
grid->setGridOffsetX( value );
1437+
grid->setOffsetX( value );
14371438
mComposerMap->updateBoundingRect();
14381439
mComposerMap->update();
14391440
mComposerMap->endCommand();
@@ -1448,7 +1449,7 @@ void QgsComposerMapWidget::on_mOffsetYSpinBox_valueChanged( double value )
14481449
}
14491450

14501451
mComposerMap->beginCommand( tr( "Grid offset changed" ) );
1451-
grid->setGridOffsetY( value );
1452+
grid->setOffsetY( value );
14521453
mComposerMap->updateBoundingRect();
14531454
mComposerMap->update();
14541455
mComposerMap->endCommand();
@@ -1690,7 +1691,7 @@ void QgsComposerMapWidget::on_mGridTypeComboBox_currentIndexChanged( const QStri
16901691
mComposerMap->beginCommand( tr( "Grid type changed" ) );
16911692
if ( text == tr( "Cross" ) )
16921693
{
1693-
grid->setGridStyle( QgsComposerMap::Cross );
1694+
grid->setStyle( QgsComposerMap::Cross );
16941695
mCrossWidthSpinBox->setVisible( true );
16951696
mCrossWidthLabel->setVisible( true );
16961697
mGridLineStyleButton->setVisible( true );
@@ -1702,7 +1703,7 @@ void QgsComposerMapWidget::on_mGridTypeComboBox_currentIndexChanged( const QStri
17021703
}
17031704
else if ( text == tr( "Markers" ) )
17041705
{
1705-
grid->setGridStyle( QgsComposerMap::Markers );
1706+
grid->setStyle( QgsComposerMap::Markers );
17061707
mCrossWidthSpinBox->setVisible( false );
17071708
mCrossWidthLabel->setVisible( false );
17081709
mGridLineStyleButton->setVisible( false );
@@ -1714,7 +1715,7 @@ void QgsComposerMapWidget::on_mGridTypeComboBox_currentIndexChanged( const QStri
17141715
}
17151716
else if ( text == tr( "Solid" ) )
17161717
{
1717-
grid->setGridStyle( QgsComposerMap::Solid );
1718+
grid->setStyle( QgsComposerMap::Solid );
17181719
mCrossWidthSpinBox->setVisible( false );
17191720
mCrossWidthLabel->setVisible( false );
17201721
mGridLineStyleButton->setVisible( true );
@@ -1726,7 +1727,7 @@ void QgsComposerMapWidget::on_mGridTypeComboBox_currentIndexChanged( const QStri
17261727
}
17271728
else
17281729
{
1729-
grid->setGridStyle( QgsComposerMap::FrameAnnotationsOnly );
1730+
grid->setStyle( QgsComposerMap::FrameAnnotationsOnly );
17301731
mCrossWidthSpinBox->setVisible( false );
17311732
mCrossWidthLabel->setVisible( false );
17321733
mGridLineStyleButton->setVisible( false );
@@ -1773,7 +1774,7 @@ void QgsComposerMapWidget::on_mDrawAnnotationGroupBox_toggled( bool state )
17731774
}
17741775

17751776
mComposerMap->beginCommand( tr( "Annotation toggled" ) );
1776-
grid->setShowGridAnnotation( state );
1777+
grid->setAnnotationEnabled( state );
17771778
mComposerMap->updateBoundingRect();
17781779
mComposerMap->update();
17791780
mComposerMap->endCommand();
@@ -1847,12 +1848,12 @@ void QgsComposerMapWidget::on_mAnnotationFontButton_clicked()
18471848
// Native Mac dialog works only for Qt Carbon
18481849
QFont newFont = QFontDialog::getFont( &ok, grid->gridAnnotationFont(), 0, QString(), QFontDialog::DontUseNativeDialog );
18491850
#else
1850-
QFont newFont = QFontDialog::getFont( &ok, grid->gridAnnotationFont() );
1851+
QFont newFont = QFontDialog::getFont( &ok, grid->annotationFont() );
18511852
#endif
18521853
if ( ok )
18531854
{
18541855
mComposerMap->beginCommand( tr( "Annotation font changed" ) );
1855-
grid->setGridAnnotationFont( newFont );
1856+
grid->setAnnotationFont( newFont );
18561857
mComposerMap->updateBoundingRect();
18571858
mComposerMap->update();
18581859
mComposerMap->endCommand();
@@ -1868,7 +1869,7 @@ void QgsComposerMapWidget::on_mAnnotationFontColorButton_colorChanged( const QCo
18681869
}
18691870

18701871
mComposerMap->beginCommand( tr( "Annotation color changed" ) );
1871-
grid->setGridAnnotationFontColor( color );
1872+
grid->setAnnotationFontColor( color );
18721873
mComposerMap->update();
18731874
mComposerMap->endCommand();
18741875
}
@@ -1886,28 +1887,28 @@ void QgsComposerMapWidget::on_mAnnotationFormatComboBox_currentIndexChanged( int
18861887
switch ( index )
18871888
{
18881889
case 0:
1889-
grid->setGridAnnotationFormat( QgsComposerMap::Decimal );
1890+
grid->setAnnotationFormat( QgsComposerMap::Decimal );
18901891
break;
18911892
case 3:
1892-
grid->setGridAnnotationFormat( QgsComposerMap::DegreeMinute );
1893+
grid->setAnnotationFormat( QgsComposerMap::DegreeMinute );
18931894
break;
18941895
case 6:
1895-
grid->setGridAnnotationFormat( QgsComposerMap::DegreeMinuteSecond );
1896+
grid->setAnnotationFormat( QgsComposerMap::DegreeMinuteSecond );
18961897
break;
18971898
case 1:
1898-
grid->setGridAnnotationFormat( QgsComposerMap::DecimalWithSuffix );
1899+
grid->setAnnotationFormat( QgsComposerMap::DecimalWithSuffix );
18991900
break;
19001901
case 2:
1901-
grid->setGridAnnotationFormat( QgsComposerMap::DegreeMinuteNoSuffix );
1902+
grid->setAnnotationFormat( QgsComposerMap::DegreeMinuteNoSuffix );
19021903
break;
19031904
case 4:
1904-
grid->setGridAnnotationFormat( QgsComposerMap::DegreeMinutePadded );
1905+
grid->setAnnotationFormat( QgsComposerMap::DegreeMinutePadded );
19051906
break;
19061907
case 5:
1907-
grid->setGridAnnotationFormat( QgsComposerMap::DegreeMinuteSecondNoSuffix );
1908+
grid->setAnnotationFormat( QgsComposerMap::DegreeMinuteSecondNoSuffix );
19081909
break;
19091910
case 7:
1910-
grid->setGridAnnotationFormat( QgsComposerMap::DegreeMinuteSecondPadded );
1911+
grid->setAnnotationFormat( QgsComposerMap::DegreeMinuteSecondPadded );
19111912
break;
19121913
}
19131914

@@ -1926,7 +1927,7 @@ void QgsComposerMapWidget::on_mCoordinatePrecisionSpinBox_valueChanged( int valu
19261927
return;
19271928
}
19281929
mComposerMap->beginCommand( tr( "Changed annotation precision" ) );
1929-
grid->setGridAnnotationPrecision( value );
1930+
grid->setAnnotationPrecision( value );
19301931
mComposerMap->updateBoundingRect();
19311932
mComposerMap->update();
19321933
mComposerMap->endCommand();
@@ -1992,11 +1993,11 @@ void QgsComposerMapWidget::on_mGridCheckBox_toggled( bool state )
19921993
mComposerMap->beginCommand( tr( "Grid checkbox toggled" ) );
19931994
if ( state )
19941995
{
1995-
grid->setGridEnabled( true );
1996+
grid->setEnabled( true );
19961997
}
19971998
else
19981999
{
1999-
grid->setGridEnabled( false );
2000+
grid->setEnabled( false );
20002001
}
20012002
mComposerMap->updateBoundingRect();
20022003
mComposerMap->update();

0 commit comments

Comments
 (0)