Skip to content
Permalink
Browse files

[FEATURE][composer] Add tick styles for frames. Options include

drawing ticks only inside the map frame, drawing ticks outside
the frame, or drawing ticks both inside and outside the frame.
(fix #6954) (Sponsored by NIWA, New Zealand)
  • Loading branch information
nyalldawson committed Sep 3, 2014
1 parent 8544185 commit 53fa30f1bb103f6d398b5c486717aa9eeaa667bd
@@ -102,7 +102,7 @@ QgsComposerMapWidget::QgsComposerMapWidget( QgsComposerMap* composerMap ): QgsCo
mGridFrameFill2ColorButton->setShowNoColor( true );

//set initial state of frame style controls
toggleFrameControls( false );
toggleFrameControls( false, false );

if ( composerMap )
{
@@ -695,17 +695,17 @@ void QgsComposerMapWidget::blockAllSignals( bool b )
blockOverviewItemsSignals( b );
}

void QgsComposerMapWidget::toggleFrameControls( bool frameEnabled )
void QgsComposerMapWidget::toggleFrameControls( bool frameEnabled, bool frameFillEnabled )
{
//set status of frame controls
mFrameWidthSpinBox->setEnabled( frameEnabled );
mGridFramePenSizeSpinBox->setEnabled( frameEnabled );
mGridFramePenColorButton->setEnabled( frameEnabled );
mGridFrameFill1ColorButton->setEnabled( frameEnabled );
mGridFrameFill2ColorButton->setEnabled( frameEnabled );
mGridFrameFill1ColorButton->setEnabled( frameFillEnabled );
mGridFrameFill2ColorButton->setEnabled( frameFillEnabled );
mFrameWidthLabel->setEnabled( frameEnabled );
mFramePenLabel->setEnabled( frameEnabled );
mFrameFillLabel->setEnabled( frameEnabled );
mFrameFillLabel->setEnabled( frameFillEnabled );
mCheckGridLeftSide->setEnabled( frameEnabled );
mCheckGridRightSide->setEnabled( frameEnabled );
mCheckGridTopSide->setEnabled( frameEnabled );
@@ -1209,15 +1209,28 @@ void QgsComposerMapWidget::setGridItems( const QgsComposerMapGrid* grid )
//grid frame
mFrameWidthSpinBox->setValue( grid->gridFrameWidth() );
QgsComposerMap::GridFrameStyle gridFrameStyle = grid->gridFrameStyle();
if ( gridFrameStyle == QgsComposerMap::Zebra )
switch ( gridFrameStyle )
{
mFrameStyleComboBox->setCurrentIndex( 1 );
toggleFrameControls( true );
}
else //NoGridFrame
{
mFrameStyleComboBox->setCurrentIndex( 0 );
toggleFrameControls( false );
case QgsComposerMap::Zebra:
mFrameStyleComboBox->setCurrentIndex( 1 );
toggleFrameControls( true, true );
break;
case QgsComposerMap::InteriorTicks:
mFrameStyleComboBox->setCurrentIndex( 2 );
toggleFrameControls( true, false );
break;
case QgsComposerMap::ExteriorTicks:
mFrameStyleComboBox->setCurrentIndex( 3 );
toggleFrameControls( true, false );
break;
case QgsComposerMap::InteriorExteriorTicks:
mFrameStyleComboBox->setCurrentIndex( 4 );
toggleFrameControls( true, false );
break;
default:
mFrameStyleComboBox->setCurrentIndex( 0 );
toggleFrameControls( false, false );
break;
}

mCheckGridLeftSide->setChecked( grid->testGridFrameSideFlag( QgsComposerMapGrid::FrameLeft ) );
@@ -1557,12 +1570,27 @@ void QgsComposerMapWidget::on_mFrameStyleComboBox_currentIndexChanged( const QSt
if ( text == tr( "Zebra" ) )
{
grid->setGridFrameStyle( QgsComposerMap::Zebra );
toggleFrameControls( true );
toggleFrameControls( true, true );
}
else if ( text == tr( "Interior ticks" ) )
{
grid->setGridFrameStyle( QgsComposerMap::InteriorTicks );
toggleFrameControls( true, false );
}
else if ( text == tr( "Exterior ticks" ) )
{
grid->setGridFrameStyle( QgsComposerMap::ExteriorTicks );
toggleFrameControls( true, false );
}
else if ( text == tr( "Interior and exterior ticks" ) )
{
grid->setGridFrameStyle( QgsComposerMap::InteriorExteriorTicks );
toggleFrameControls( true, false );
}
else //no frame
{
grid->setGridFrameStyle( QgsComposerMap::NoGridFrame );
toggleFrameControls( false );
toggleFrameControls( false, false );
}
mComposerMap->updateBoundingRect();
mComposerMap->update();
@@ -179,7 +179,7 @@ class QgsComposerMapWidget: public QgsComposerItemBaseWidget, private Ui::QgsCom
void refreshMapComboBox();

/**Enables/disables grid frame related controls*/
void toggleFrameControls( bool frameEnabled );
void toggleFrameControls( bool frameEnabled , bool frameFillEnabled );

/**Enables or disables the atlas margin and predefined scales radio depending on the atlas coverage layer type*/
void toggleAtlasScalingOptionsByLayerType();
@@ -96,7 +96,10 @@ class CORE_EXPORT QgsComposerMap : public QgsComposerItem
enum GridFrameStyle
{
NoGridFrame = 0,
Zebra // black/white pattern
Zebra, // black/white pattern
InteriorTicks,
ExteriorTicks,
InteriorExteriorTicks
};

/**Enum for different frame borders*/

0 comments on commit 53fa30f

Please sign in to comment.
You can’t perform that action at this time.