mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-03 00:02:25 -05:00
[FEATURE][layouts] Add new grid frame style "Zebra (Nautical)",
which shows nautical-style blocks in the grid corners when a margin is set for the grid.
This commit is contained in:
parent
11258c05b0
commit
34f6e371a7
@ -203,7 +203,8 @@ An individual grid which is drawn above the map content in a
|
||||
ExteriorTicks,
|
||||
InteriorExteriorTicks,
|
||||
LineBorder,
|
||||
LineBorderNautical
|
||||
LineBorderNautical,
|
||||
ZebraNautical,
|
||||
};
|
||||
|
||||
enum FrameSideFlag
|
||||
|
@ -37,12 +37,14 @@ QgsLayoutMapGridWidget::QgsLayoutMapGridWidget( QgsLayoutItemMapGrid *mapGrid, Q
|
||||
|
||||
mFrameStyleComboBox->addItem( tr( "No Frame" ), QgsLayoutItemMapGrid::NoFrame );
|
||||
mFrameStyleComboBox->addItem( tr( "Zebra" ), QgsLayoutItemMapGrid::Zebra );
|
||||
mFrameStyleComboBox->addItem( tr( "Zebra (Nautical)" ), QgsLayoutItemMapGrid::ZebraNautical );
|
||||
mFrameStyleComboBox->addItem( tr( "Interior Ticks" ), QgsLayoutItemMapGrid::InteriorTicks );
|
||||
mFrameStyleComboBox->addItem( tr( "Exterior Ticks" ), QgsLayoutItemMapGrid::ExteriorTicks );
|
||||
mFrameStyleComboBox->addItem( tr( "Interior and Exterior Ticks" ), QgsLayoutItemMapGrid::InteriorExteriorTicks );
|
||||
mFrameStyleComboBox->addItem( tr( "Line Border" ), QgsLayoutItemMapGrid::LineBorder );
|
||||
mFrameStyleComboBox->addItem( tr( "Line Border (Nautical)" ), QgsLayoutItemMapGrid::LineBorderNautical );
|
||||
|
||||
mGridFrameMarginSpinBox->setShowClearButton( true );
|
||||
mGridFrameMarginSpinBox->setClearValue( 0 );
|
||||
|
||||
connect( mIntervalXSpinBox, &QgsDoubleSpinBox::editingFinished, this, &QgsLayoutMapGridWidget::mIntervalXSpinBox_editingFinished );
|
||||
@ -537,6 +539,7 @@ void QgsLayoutMapGridWidget::setGridItems()
|
||||
switch ( gridFrameStyle )
|
||||
{
|
||||
case QgsLayoutItemMapGrid::Zebra:
|
||||
case QgsLayoutItemMapGrid::ZebraNautical:
|
||||
toggleFrameControls( true, true, true );
|
||||
break;
|
||||
case QgsLayoutItemMapGrid::InteriorTicks:
|
||||
@ -854,6 +857,7 @@ void QgsLayoutMapGridWidget::mFrameStyleComboBox_currentIndexChanged( int )
|
||||
switch ( style )
|
||||
{
|
||||
case QgsLayoutItemMapGrid::Zebra:
|
||||
case QgsLayoutItemMapGrid::ZebraNautical:
|
||||
toggleFrameControls( true, true, true );
|
||||
break;
|
||||
case QgsLayoutItemMapGrid::InteriorTicks:
|
||||
|
@ -775,6 +775,7 @@ void QgsLayoutItemMapGrid::drawGridFrameBorder( QPainter *p, const QMap< double,
|
||||
switch ( mGridFrameStyle )
|
||||
{
|
||||
case QgsLayoutItemMapGrid::Zebra:
|
||||
case QgsLayoutItemMapGrid::ZebraNautical:
|
||||
drawGridFrameZebraBorder( p, borderPos, border, extension );
|
||||
break;
|
||||
case QgsLayoutItemMapGrid::InteriorTicks:
|
||||
@ -871,13 +872,17 @@ void QgsLayoutItemMapGrid::drawGridFrameZebraBorder( QPainter *p, const QMap< do
|
||||
currentCoord = posIt.key();
|
||||
color1 = !color1;
|
||||
}
|
||||
//draw corners
|
||||
width = height = ( mGridFrameWidth + mGridFrameMargin ) ;
|
||||
p->setBrush( QBrush( mGridFrameFillColor1 ) );
|
||||
p->drawRect( QRectF( -( mGridFrameWidth + mGridFrameMargin ), -( mGridFrameWidth + mGridFrameMargin ), width, height ) );
|
||||
p->drawRect( QRectF( mMap->rect().width(), -( mGridFrameWidth + mGridFrameMargin ), width, height ) );
|
||||
p->drawRect( QRectF( -( mGridFrameWidth + mGridFrameMargin ), mMap->rect().height(), width, height ) );
|
||||
p->drawRect( QRectF( mMap->rect().width(), mMap->rect().height(), width, height ) );
|
||||
|
||||
if ( mGridFrameStyle == ZebraNautical )
|
||||
{
|
||||
//draw corners
|
||||
width = height = ( mGridFrameWidth + mGridFrameMargin ) ;
|
||||
p->setBrush( QBrush( mGridFrameFillColor1 ) );
|
||||
p->drawRect( QRectF( -( mGridFrameWidth + mGridFrameMargin ), -( mGridFrameWidth + mGridFrameMargin ), width, height ) );
|
||||
p->drawRect( QRectF( mMap->rect().width(), -( mGridFrameWidth + mGridFrameMargin ), width, height ) );
|
||||
p->drawRect( QRectF( -( mGridFrameWidth + mGridFrameMargin ), mMap->rect().height(), width, height ) );
|
||||
p->drawRect( QRectF( mMap->rect().width(), mMap->rect().height(), width, height ) );
|
||||
}
|
||||
}
|
||||
|
||||
void QgsLayoutItemMapGrid::drawGridFrameTicks( QPainter *p, const QMap< double, double > &borderPos, QgsLayoutItemMapGrid::BorderSide border, double *extension ) const
|
||||
@ -1067,6 +1072,7 @@ void QgsLayoutItemMapGrid::drawCoordinateAnnotation( QPainter *p, QPointF pos, c
|
||||
break;
|
||||
|
||||
case QgsLayoutItemMapGrid::Zebra:
|
||||
case QgsLayoutItemMapGrid::ZebraNautical:
|
||||
case QgsLayoutItemMapGrid::LineBorder:
|
||||
case QgsLayoutItemMapGrid::LineBorderNautical:
|
||||
gridFrameDistance += ( mGridFramePenThickness / 2.0 );
|
||||
@ -1091,7 +1097,7 @@ void QgsLayoutItemMapGrid::drawCoordinateAnnotation( QPainter *p, QPointF pos, c
|
||||
|
||||
if ( mLeftGridAnnotationPosition == QgsLayoutItemMapGrid::InsideMapFrame )
|
||||
{
|
||||
if ( mGridFrameStyle == QgsLayoutItemMapGrid::Zebra || mGridFrameStyle == QgsLayoutItemMapGrid::ExteriorTicks )
|
||||
if ( mGridFrameStyle == QgsLayoutItemMapGrid::Zebra || mGridFrameStyle == QgsLayoutItemMapGrid::ZebraNautical || mGridFrameStyle == QgsLayoutItemMapGrid::ExteriorTicks )
|
||||
{
|
||||
gridFrameDistance = 0;
|
||||
}
|
||||
@ -1163,7 +1169,7 @@ void QgsLayoutItemMapGrid::drawCoordinateAnnotation( QPainter *p, QPointF pos, c
|
||||
|
||||
if ( mRightGridAnnotationPosition == QgsLayoutItemMapGrid::InsideMapFrame )
|
||||
{
|
||||
if ( mGridFrameStyle == QgsLayoutItemMapGrid::Zebra || mGridFrameStyle == QgsLayoutItemMapGrid::ExteriorTicks )
|
||||
if ( mGridFrameStyle == QgsLayoutItemMapGrid::Zebra || mGridFrameStyle == QgsLayoutItemMapGrid::ZebraNautical || mGridFrameStyle == QgsLayoutItemMapGrid::ExteriorTicks )
|
||||
{
|
||||
gridFrameDistance = 0;
|
||||
}
|
||||
@ -1235,7 +1241,7 @@ void QgsLayoutItemMapGrid::drawCoordinateAnnotation( QPainter *p, QPointF pos, c
|
||||
|
||||
if ( mBottomGridAnnotationPosition == QgsLayoutItemMapGrid::InsideMapFrame )
|
||||
{
|
||||
if ( mGridFrameStyle == QgsLayoutItemMapGrid::Zebra || mGridFrameStyle == QgsLayoutItemMapGrid::ExteriorTicks )
|
||||
if ( mGridFrameStyle == QgsLayoutItemMapGrid::Zebra || mGridFrameStyle == QgsLayoutItemMapGrid::ZebraNautical || mGridFrameStyle == QgsLayoutItemMapGrid::ExteriorTicks )
|
||||
{
|
||||
gridFrameDistance = 0;
|
||||
}
|
||||
@ -1311,7 +1317,7 @@ void QgsLayoutItemMapGrid::drawCoordinateAnnotation( QPainter *p, QPointF pos, c
|
||||
|
||||
if ( mTopGridAnnotationPosition == QgsLayoutItemMapGrid::InsideMapFrame )
|
||||
{
|
||||
if ( mGridFrameStyle == QgsLayoutItemMapGrid::Zebra || mGridFrameStyle == QgsLayoutItemMapGrid::ExteriorTicks )
|
||||
if ( mGridFrameStyle == QgsLayoutItemMapGrid::Zebra || mGridFrameStyle == QgsLayoutItemMapGrid::ZebraNautical || mGridFrameStyle == QgsLayoutItemMapGrid::ExteriorTicks )
|
||||
{
|
||||
gridFrameDistance = 0;
|
||||
}
|
||||
|
@ -233,7 +233,8 @@ class CORE_EXPORT QgsLayoutItemMapGrid : public QgsLayoutItemMapItem
|
||||
ExteriorTicks, //!< Tick markers drawn outside map frame
|
||||
InteriorExteriorTicks, //!< Tick markers drawn both inside and outside the map frame
|
||||
LineBorder, //!< Simple solid line frame
|
||||
LineBorderNautical //!< Simple solid line frame, with nautical style diagonals on corners
|
||||
LineBorderNautical, //!< Simple solid line frame, with nautical style diagonals on corners
|
||||
ZebraNautical, //!< Black/white pattern, with nautical style diagonals on corners
|
||||
};
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user