mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
[FEATURE][composer] Finer control of frame and annotation display
Previously, for rotated maps or reprojected grids, the composer would draw all coordinates for every map side. This resulted in a mix of latitude/y and longitude/x coordinates showing on a side. This change allows users to control whether they want all coordinates, latitude only or longitude only for each map frame side. Similar options have also been added for controlling how a map grid frame is divided. In related news... the composer map dialog is now the ugliest, most cluttered and un-user friendly dialog in all of QGIS. I'd love suggestions/mockups from the UX team for ways this could be improved.
This commit is contained in:
parent
991f94d3fb
commit
ac9220d35b
@ -138,14 +138,25 @@ class QgsComposerMapGrid : QgsComposerMapItem
|
||||
Markers, /*< draw markers at intersections of grid lines */
|
||||
FrameAnnotationsOnly /*< no grid lines over the map, only draw frame and annotations */
|
||||
};
|
||||
|
||||
/** Display settings for grid annotations and frames
|
||||
*/
|
||||
enum DisplayMode
|
||||
{
|
||||
ShowAll = 0, /*< show both latitude and longitude annotations/divisions */
|
||||
LatitudeOnly, /*< show latitude/y annotations/divisions only */
|
||||
LongitudeOnly, /*< show longitude/x annotations/divisions only */
|
||||
HideAll /*< no annotations */
|
||||
};
|
||||
|
||||
/** Position for grid annotations
|
||||
*/
|
||||
enum AnnotationPosition
|
||||
{
|
||||
InsideMapFrame,
|
||||
InsideMapFrame = 0,
|
||||
OutsideMapFrame, /*< draw annotations outside the map frame */
|
||||
Disabled /*< disable annotation */
|
||||
Disabled /*< disable annotation
|
||||
* @deprecated in QGIS 2.7, use QgsComposerMapGrid::HideAll instead */
|
||||
};
|
||||
|
||||
/** Direction of grid annotations
|
||||
@ -488,6 +499,25 @@ class QgsComposerMapGrid : QgsComposerMapItem
|
||||
* @see setAnnotationPrecision
|
||||
*/
|
||||
int annotationPrecision() const;
|
||||
|
||||
/**Sets what types of grid annotations should be drawn for a specified side of the map frame,
|
||||
* or whether grid annotations should be disabled for the side.
|
||||
* @param display display mode for annotations
|
||||
* @param border side of map for annotations
|
||||
* @see annotationDisplay
|
||||
* @note added in QGIS 2.7
|
||||
*/
|
||||
void setAnnotationDisplay( const DisplayMode display, const BorderSide border );
|
||||
|
||||
/**Gets the display mode for the grid annotations on a specified side of the map
|
||||
* frame. This property also specifies whether annotations have been disabled
|
||||
* from a side of the map frame.
|
||||
* @param border side of map for annotations
|
||||
* @returns display mode for grid annotations
|
||||
* @see setAnnotationDisplay
|
||||
* @note added in QGIS 2.7
|
||||
*/
|
||||
DisplayMode annotationDisplay( const BorderSide border ) const;
|
||||
|
||||
/**Sets the position for the grid annotations on a specified side of the map
|
||||
* frame.
|
||||
@ -565,6 +595,22 @@ class QgsComposerMapGrid : QgsComposerMapItem
|
||||
*/
|
||||
FrameStyle frameStyle() const;
|
||||
|
||||
/**Sets what type of grid divisions should be used for frames on a specified side of the map.
|
||||
* @param divisions grid divisions for frame
|
||||
* @param border side of map for frame
|
||||
* @see frameDivisions
|
||||
* @note added in QGIS 2.7
|
||||
*/
|
||||
void setFrameDivisions( const DisplayMode divisions, const BorderSide border );
|
||||
|
||||
/**Gets the type of grid divisions which are used for frames on a specified side of the map.
|
||||
* @param border side of map for frame
|
||||
* @returns grid divisions for frame
|
||||
* @see setFrameDivisions
|
||||
* @note added in QGIS 2.7
|
||||
*/
|
||||
DisplayMode frameDivisions( const BorderSide border ) const;
|
||||
|
||||
/**Sets flags for grid frame sides. Setting these flags controls which sides
|
||||
* of the map item the grid frame is drawn on.
|
||||
* @param flags flags for grid frame sides
|
||||
|
@ -69,6 +69,11 @@ QgsComposerMapWidget::QgsComposerMapWidget( QgsComposerMap* composerMap ): QgsCo
|
||||
mGridTypeComboBox->insertItem( 2, tr( "Markers" ) );
|
||||
mGridTypeComboBox->insertItem( 3, tr( "Frame and annotations only" ) );
|
||||
|
||||
insertFrameDisplayEntries( mFrameDivisionsLeftComboBox );
|
||||
insertFrameDisplayEntries( mFrameDivisionsRightComboBox );
|
||||
insertFrameDisplayEntries( mFrameDivisionsTopComboBox );
|
||||
insertFrameDisplayEntries( mFrameDivisionsBottomComboBox );
|
||||
|
||||
mAnnotationFormatComboBox->insertItem( 0, tr( "Decimal" ) );
|
||||
mAnnotationFormatComboBox->insertItem( 1, tr( "Decimal with suffix" ) );
|
||||
mAnnotationFormatComboBox->insertItem( 2, tr( "Degree, minute" ) );
|
||||
@ -78,11 +83,15 @@ QgsComposerMapWidget::QgsComposerMapWidget( QgsComposerMap* composerMap ): QgsCo
|
||||
mAnnotationFormatComboBox->insertItem( 6, tr( "Degree, minute, second with suffix" ) );
|
||||
mAnnotationFormatComboBox->insertItem( 7, tr( "Degree, minute, second aligned" ) );
|
||||
|
||||
|
||||
mAnnotationFontColorButton->setColorDialogTitle( tr( "Select font color" ) );
|
||||
mAnnotationFontColorButton->setAllowAlpha( true );
|
||||
mAnnotationFontColorButton->setContext( "composer" );
|
||||
|
||||
insertAnnotationDisplayEntries( mAnnotationDisplayLeftComboBox );
|
||||
insertAnnotationDisplayEntries( mAnnotationDisplayRightComboBox );
|
||||
insertAnnotationDisplayEntries( mAnnotationDisplayTopComboBox );
|
||||
insertAnnotationDisplayEntries( mAnnotationDisplayBottomComboBox );
|
||||
|
||||
insertAnnotationPositionEntries( mAnnotationPositionLeftComboBox );
|
||||
insertAnnotationPositionEntries( mAnnotationPositionRightComboBox );
|
||||
insertAnnotationPositionEntries( mAnnotationPositionTopComboBox );
|
||||
@ -757,6 +766,50 @@ void QgsComposerMapWidget::blockAllSignals( bool b )
|
||||
blockOverviewItemsSignals( b );
|
||||
}
|
||||
|
||||
void QgsComposerMapWidget::handleChangedFrameDisplay( QgsComposerMapGrid::BorderSide border, const QgsComposerMapGrid::DisplayMode mode )
|
||||
{
|
||||
QgsComposerMapGrid* grid = currentGrid();
|
||||
if ( !grid )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
mComposerMap->beginCommand( tr( "Frame divisions changed" ) );
|
||||
grid->setFrameDivisions( mode, border );
|
||||
mComposerMap->endCommand();
|
||||
}
|
||||
|
||||
void QgsComposerMapWidget::handleChangedAnnotationDisplay( QgsComposerMapGrid::BorderSide border, const QString &text )
|
||||
{
|
||||
QgsComposerMapGrid* grid = currentGrid();
|
||||
if ( !grid )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
mComposerMap->beginCommand( tr( "Annotation display changed" ) );
|
||||
if ( text == tr( "Show all" ) )
|
||||
{
|
||||
grid->setAnnotationDisplay( QgsComposerMapGrid::ShowAll, border );
|
||||
}
|
||||
else if ( text == tr( "Show latitude only" ) )
|
||||
{
|
||||
grid->setAnnotationDisplay( QgsComposerMapGrid::LatitudeOnly, border );
|
||||
}
|
||||
else if ( text == tr( "Show longitude only" ) )
|
||||
{
|
||||
grid->setAnnotationDisplay( QgsComposerMapGrid::LongitudeOnly, border );
|
||||
}
|
||||
else //disabled
|
||||
{
|
||||
grid->setAnnotationDisplay( QgsComposerMapGrid::HideAll, border );
|
||||
}
|
||||
|
||||
mComposerMap->updateBoundingRect();
|
||||
mComposerMap->update();
|
||||
mComposerMap->endCommand();
|
||||
}
|
||||
|
||||
void QgsComposerMapWidget::toggleFrameControls( bool frameEnabled, bool frameFillEnabled, bool frameSizeEnabled )
|
||||
{
|
||||
//set status of frame controls
|
||||
@ -772,6 +825,14 @@ void QgsComposerMapWidget::toggleFrameControls( bool frameEnabled, bool frameFil
|
||||
mCheckGridRightSide->setEnabled( frameEnabled );
|
||||
mCheckGridTopSide->setEnabled( frameEnabled );
|
||||
mCheckGridBottomSide->setEnabled( frameEnabled );
|
||||
mFrameDivisionsLeftComboBox->setEnabled( frameEnabled );
|
||||
mFrameDivisionsRightComboBox->setEnabled( frameEnabled );
|
||||
mFrameDivisionsTopComboBox->setEnabled( frameEnabled );
|
||||
mFrameDivisionsBottomComboBox->setEnabled( frameEnabled );
|
||||
mLeftDivisionsLabel->setEnabled( frameEnabled );
|
||||
mRightDivisionsLabel->setEnabled( frameEnabled );
|
||||
mTopDivisionsLabel->setEnabled( frameEnabled );
|
||||
mBottomDivisionsLabel->setEnabled( frameEnabled );
|
||||
}
|
||||
|
||||
void QgsComposerMapWidget::on_mUpdatePreviewButton_clicked()
|
||||
@ -849,7 +910,6 @@ void QgsComposerMapWidget::insertAnnotationPositionEntries( QComboBox* c )
|
||||
{
|
||||
c->insertItem( 0, tr( "Inside frame" ) );
|
||||
c->insertItem( 1, tr( "Outside frame" ) );
|
||||
c->insertItem( 2, tr( "Disabled" ) );
|
||||
}
|
||||
|
||||
void QgsComposerMapWidget::insertAnnotationDirectionEntries( QComboBox* c )
|
||||
@ -858,6 +918,40 @@ void QgsComposerMapWidget::insertAnnotationDirectionEntries( QComboBox* c )
|
||||
c->insertItem( 1, tr( "Vertical" ) );
|
||||
}
|
||||
|
||||
void QgsComposerMapWidget::initFrameDisplayBox( QComboBox *c, QgsComposerMapGrid::DisplayMode display )
|
||||
{
|
||||
if ( !c )
|
||||
{
|
||||
return;
|
||||
}
|
||||
c->setCurrentIndex( c->findData( display ) );
|
||||
}
|
||||
|
||||
void QgsComposerMapWidget::initAnnotationDisplayBox( QComboBox *c, QgsComposerMapGrid::DisplayMode display )
|
||||
{
|
||||
if ( !c )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ( display == QgsComposerMapGrid::ShowAll )
|
||||
{
|
||||
c->setCurrentIndex( c->findText( tr( "Show all" ) ) );
|
||||
}
|
||||
else if ( display == QgsComposerMapGrid::LatitudeOnly )
|
||||
{
|
||||
c->setCurrentIndex( c->findText( tr( "Show latitude only" ) ) );
|
||||
}
|
||||
else if ( display == QgsComposerMapGrid::LongitudeOnly )
|
||||
{
|
||||
c->setCurrentIndex( c->findText( tr( "Show longitude only" ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
c->setCurrentIndex( c->findText( tr( "Disabled" ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
void QgsComposerMapWidget::handleChangedAnnotationPosition( QgsComposerMapGrid::BorderSide border, const QString& text )
|
||||
{
|
||||
QgsComposerMapGrid* grid = currentGrid();
|
||||
@ -907,6 +1001,21 @@ void QgsComposerMapWidget::handleChangedAnnotationDirection( QgsComposerMapGrid:
|
||||
mComposerMap->endCommand();
|
||||
}
|
||||
|
||||
void QgsComposerMapWidget::insertFrameDisplayEntries( QComboBox *c )
|
||||
{
|
||||
c->addItem( tr( "All" ), QgsComposerMapGrid::ShowAll );
|
||||
c->addItem( tr( "Latitude/Y only" ), QgsComposerMapGrid::LatitudeOnly );
|
||||
c->addItem( tr( "Longitude/X only" ), QgsComposerMapGrid::LongitudeOnly );
|
||||
}
|
||||
|
||||
void QgsComposerMapWidget::insertAnnotationDisplayEntries( QComboBox *c )
|
||||
{
|
||||
c->insertItem( 0, tr( "Show all" ) );
|
||||
c->insertItem( 1, tr( "Show latitude only" ) );
|
||||
c->insertItem( 2, tr( "Show longitude only" ) );
|
||||
c->insertItem( 3, tr( "Disabled" ) );
|
||||
}
|
||||
|
||||
void QgsComposerMapWidget::initAnnotationPositionBox( QComboBox* c, QgsComposerMapGrid::AnnotationPosition pos )
|
||||
{
|
||||
if ( !c )
|
||||
@ -918,14 +1027,10 @@ void QgsComposerMapWidget::initAnnotationPositionBox( QComboBox* c, QgsComposerM
|
||||
{
|
||||
c->setCurrentIndex( c->findText( tr( "Inside frame" ) ) );
|
||||
}
|
||||
else if ( pos == QgsComposerMapGrid::OutsideMapFrame )
|
||||
else
|
||||
{
|
||||
c->setCurrentIndex( c->findText( tr( "Outside frame" ) ) );
|
||||
}
|
||||
else //disabled
|
||||
{
|
||||
c->setCurrentIndex( c->findText( tr( "Disabled" ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
void QgsComposerMapWidget::initAnnotationDirectionBox( QComboBox* c, QgsComposerMapGrid::AnnotationDirection dir )
|
||||
@ -1160,6 +1265,10 @@ void QgsComposerMapWidget::setGridItemsEnabled( bool enabled )
|
||||
mGridFramePenColorButton->setEnabled( enabled );
|
||||
mGridFrameFill1ColorButton->setEnabled( enabled );
|
||||
mGridFrameFill2ColorButton->setEnabled( enabled );
|
||||
mFrameDivisionsLeftComboBox->setEnabled( enabled );
|
||||
mFrameDivisionsRightComboBox->setEnabled( enabled );
|
||||
mFrameDivisionsTopComboBox->setEnabled( enabled );
|
||||
mFrameDivisionsBottomComboBox->setEnabled( enabled );
|
||||
}
|
||||
|
||||
void QgsComposerMapWidget::blockGridItemsSignals( bool block )
|
||||
@ -1185,16 +1294,24 @@ void QgsComposerMapWidget::blockGridItemsSignals( bool block )
|
||||
mCheckGridRightSide->blockSignals( block );
|
||||
mCheckGridTopSide->blockSignals( block );
|
||||
mCheckGridBottomSide->blockSignals( block );
|
||||
mFrameDivisionsLeftComboBox->blockSignals( block );
|
||||
mFrameDivisionsRightComboBox->blockSignals( block );
|
||||
mFrameDivisionsTopComboBox->blockSignals( block );
|
||||
mFrameDivisionsBottomComboBox->blockSignals( block );
|
||||
|
||||
//grid annotation
|
||||
mDrawAnnotationGroupBox->blockSignals( block );
|
||||
mAnnotationFormatComboBox->blockSignals( block );
|
||||
mAnnotationDisplayLeftComboBox->blockSignals( block );
|
||||
mAnnotationPositionLeftComboBox->blockSignals( block );
|
||||
mAnnotationDirectionComboBoxLeft->blockSignals( block );
|
||||
mAnnotationDisplayRightComboBox->blockSignals( block );
|
||||
mAnnotationPositionRightComboBox->blockSignals( block );
|
||||
mAnnotationDirectionComboBoxRight->blockSignals( block );
|
||||
mAnnotationDisplayTopComboBox->blockSignals( block );
|
||||
mAnnotationPositionTopComboBox->blockSignals( block );
|
||||
mAnnotationDirectionComboBoxTop->blockSignals( block );
|
||||
mAnnotationDisplayBottomComboBox->blockSignals( block );
|
||||
mAnnotationPositionBottomComboBox->blockSignals( block );
|
||||
mAnnotationDirectionComboBoxBottom->blockSignals( block );
|
||||
mDistanceToMapFrameSpinBox->blockSignals( block );
|
||||
@ -1310,6 +1427,11 @@ void QgsComposerMapWidget::setGridItems( const QgsComposerMapGrid* grid )
|
||||
mCheckGridTopSide->setChecked( grid->testFrameSideFlag( QgsComposerMapGrid::FrameTop ) );
|
||||
mCheckGridBottomSide->setChecked( grid->testFrameSideFlag( QgsComposerMapGrid::FrameBottom ) );
|
||||
|
||||
initFrameDisplayBox( mFrameDivisionsLeftComboBox, grid->frameDivisions( QgsComposerMapGrid::Left ) );
|
||||
initFrameDisplayBox( mFrameDivisionsRightComboBox, grid->frameDivisions( QgsComposerMapGrid::Right ) );
|
||||
initFrameDisplayBox( mFrameDivisionsTopComboBox, grid->frameDivisions( QgsComposerMapGrid::Top ) );
|
||||
initFrameDisplayBox( mFrameDivisionsBottomComboBox, grid->frameDivisions( QgsComposerMapGrid::Bottom ) );
|
||||
|
||||
//line style
|
||||
updateGridLineSymbolMarker( grid );
|
||||
//marker style
|
||||
@ -1318,6 +1440,11 @@ void QgsComposerMapWidget::setGridItems( const QgsComposerMapGrid* grid )
|
||||
mGridBlendComboBox->setBlendMode( grid->blendMode() );
|
||||
|
||||
mDrawAnnotationGroupBox->setChecked( grid->annotationEnabled() );
|
||||
initAnnotationDisplayBox( mAnnotationDisplayLeftComboBox, grid->annotationDisplay( QgsComposerMapGrid::Left ) );
|
||||
initAnnotationDisplayBox( mAnnotationDisplayRightComboBox, grid->annotationDisplay( QgsComposerMapGrid::Right ) );
|
||||
initAnnotationDisplayBox( mAnnotationDisplayTopComboBox, grid->annotationDisplay( QgsComposerMapGrid::Top ) );
|
||||
initAnnotationDisplayBox( mAnnotationDisplayBottomComboBox, grid->annotationDisplay( QgsComposerMapGrid::Bottom ) );
|
||||
|
||||
initAnnotationPositionBox( mAnnotationPositionLeftComboBox, grid->annotationPosition( QgsComposerMapGrid::Left ) );
|
||||
initAnnotationPositionBox( mAnnotationPositionRightComboBox, grid->annotationPosition( QgsComposerMapGrid::Right ) );
|
||||
initAnnotationPositionBox( mAnnotationPositionTopComboBox, grid->annotationPosition( QgsComposerMapGrid::Top ) );
|
||||
@ -1598,6 +1725,26 @@ void QgsComposerMapWidget::on_mCheckGridBottomSide_toggled( bool checked )
|
||||
mComposerMap->endCommand();
|
||||
}
|
||||
|
||||
void QgsComposerMapWidget::on_mFrameDivisionsLeftComboBox_currentIndexChanged( int index )
|
||||
{
|
||||
handleChangedFrameDisplay( QgsComposerMapGrid::Left, ( QgsComposerMapGrid::DisplayMode ) mFrameDivisionsLeftComboBox->itemData( index ).toInt() );
|
||||
}
|
||||
|
||||
void QgsComposerMapWidget::on_mFrameDivisionsRightComboBox_currentIndexChanged( int index )
|
||||
{
|
||||
handleChangedFrameDisplay( QgsComposerMapGrid::Right, ( QgsComposerMapGrid::DisplayMode ) mFrameDivisionsRightComboBox->itemData( index ).toInt() );
|
||||
}
|
||||
|
||||
void QgsComposerMapWidget::on_mFrameDivisionsTopComboBox_currentIndexChanged( int index )
|
||||
{
|
||||
handleChangedFrameDisplay( QgsComposerMapGrid::Top, ( QgsComposerMapGrid::DisplayMode ) mFrameDivisionsTopComboBox->itemData( index ).toInt() );
|
||||
}
|
||||
|
||||
void QgsComposerMapWidget::on_mFrameDivisionsBottomComboBox_currentIndexChanged( int index )
|
||||
{
|
||||
handleChangedFrameDisplay( QgsComposerMapGrid::Bottom, ( QgsComposerMapGrid::DisplayMode ) mFrameDivisionsBottomComboBox->itemData( index ).toInt() );
|
||||
}
|
||||
|
||||
void QgsComposerMapWidget::on_mGridFramePenSizeSpinBox_valueChanged( double d )
|
||||
{
|
||||
QgsComposerMapGrid* grid = currentGrid();
|
||||
@ -1839,6 +1986,26 @@ void QgsComposerMapWidget::on_mDrawAnnotationGroupBox_toggled( bool state )
|
||||
mComposerMap->endCommand();
|
||||
}
|
||||
|
||||
void QgsComposerMapWidget::on_mAnnotationDisplayLeftComboBox_currentIndexChanged( const QString &text )
|
||||
{
|
||||
handleChangedAnnotationDisplay( QgsComposerMapGrid::Left, text );
|
||||
}
|
||||
|
||||
void QgsComposerMapWidget::on_mAnnotationDisplayRightComboBox_currentIndexChanged( const QString &text )
|
||||
{
|
||||
handleChangedAnnotationDisplay( QgsComposerMapGrid::Right, text );
|
||||
}
|
||||
|
||||
void QgsComposerMapWidget::on_mAnnotationDisplayTopComboBox_currentIndexChanged( const QString &text )
|
||||
{
|
||||
handleChangedAnnotationDisplay( QgsComposerMapGrid::Top, text );
|
||||
}
|
||||
|
||||
void QgsComposerMapWidget::on_mAnnotationDisplayBottomComboBox_currentIndexChanged( const QString &text )
|
||||
{
|
||||
handleChangedAnnotationDisplay( QgsComposerMapGrid::Bottom, text );
|
||||
}
|
||||
|
||||
void QgsComposerMapWidget::on_mAnnotationPositionLeftComboBox_currentIndexChanged( const QString& text )
|
||||
{
|
||||
handleChangedAnnotationPosition( QgsComposerMapGrid::Left, text );
|
||||
|
@ -98,7 +98,20 @@ class QgsComposerMapWidget: public QgsComposerItemBaseWidget, private Ui::QgsCom
|
||||
void on_mCheckGridTopSide_toggled( bool checked );
|
||||
void on_mCheckGridBottomSide_toggled( bool checked );
|
||||
|
||||
//frame divisions display
|
||||
void on_mFrameDivisionsLeftComboBox_currentIndexChanged( int index );
|
||||
void on_mFrameDivisionsRightComboBox_currentIndexChanged( int index );
|
||||
void on_mFrameDivisionsTopComboBox_currentIndexChanged( int index );
|
||||
void on_mFrameDivisionsBottomComboBox_currentIndexChanged( int index );
|
||||
|
||||
void on_mDrawAnnotationGroupBox_toggled( bool state );
|
||||
|
||||
//annotation display
|
||||
void on_mAnnotationDisplayLeftComboBox_currentIndexChanged( const QString& text );
|
||||
void on_mAnnotationDisplayRightComboBox_currentIndexChanged( const QString& text );
|
||||
void on_mAnnotationDisplayTopComboBox_currentIndexChanged( const QString& text );
|
||||
void on_mAnnotationDisplayBottomComboBox_currentIndexChanged( const QString& text );
|
||||
|
||||
//annotation position
|
||||
void on_mAnnotationPositionLeftComboBox_currentIndexChanged( const QString& text );
|
||||
void on_mAnnotationPositionRightComboBox_currentIndexChanged( const QString& text );
|
||||
@ -168,12 +181,18 @@ class QgsComposerMapWidget: public QgsComposerItemBaseWidget, private Ui::QgsCom
|
||||
/**Blocks / unblocks the signals of all GUI elements*/
|
||||
void blockAllSignals( bool b );
|
||||
|
||||
void handleChangedFrameDisplay( QgsComposerMapGrid::BorderSide border, const QgsComposerMapGrid::DisplayMode mode );
|
||||
void handleChangedAnnotationDisplay( QgsComposerMapGrid::BorderSide border, const QString& text );
|
||||
void handleChangedAnnotationPosition( QgsComposerMapGrid::BorderSide border, const QString& text );
|
||||
void handleChangedAnnotationDirection( QgsComposerMapGrid::BorderSide border, const QString& text );
|
||||
|
||||
void insertFrameDisplayEntries( QComboBox* c );
|
||||
void insertAnnotationDisplayEntries( QComboBox* c );
|
||||
void insertAnnotationPositionEntries( QComboBox* c );
|
||||
void insertAnnotationDirectionEntries( QComboBox* c );
|
||||
|
||||
void initFrameDisplayBox( QComboBox* c, QgsComposerMapGrid::DisplayMode display );
|
||||
void initAnnotationDisplayBox( QComboBox* c, QgsComposerMapGrid::DisplayMode display );
|
||||
void initAnnotationPositionBox( QComboBox* c, QgsComposerMapGrid::AnnotationPosition pos );
|
||||
void initAnnotationDirectionBox( QComboBox* c, QgsComposerMapGrid::AnnotationDirection dir );
|
||||
|
||||
|
@ -1694,7 +1694,14 @@ bool QgsComposerMap::showGridAnnotation() const
|
||||
void QgsComposerMap::setGridAnnotationPosition( QgsComposerMap::GridAnnotationPosition p, QgsComposerMap::Border border )
|
||||
{
|
||||
QgsComposerMapGrid* g = grid();
|
||||
g->setAnnotationPosition(( QgsComposerMapGrid::AnnotationPosition )p, ( QgsComposerMapGrid::BorderSide )border );
|
||||
if ( p != QgsComposerMap::Disabled )
|
||||
{
|
||||
g->setAnnotationPosition(( QgsComposerMapGrid::AnnotationPosition )p, ( QgsComposerMapGrid::BorderSide )border );
|
||||
}
|
||||
else
|
||||
{
|
||||
g->setAnnotationDisplay( QgsComposerMapGrid::HideAll, ( QgsComposerMapGrid::BorderSide )border );
|
||||
}
|
||||
}
|
||||
|
||||
QgsComposerMap::GridAnnotationPosition QgsComposerMap::gridAnnotationPosition( QgsComposerMap::Border border ) const
|
||||
|
@ -154,6 +154,10 @@ QgsComposerMapGrid::QgsComposerMapGrid( const QString& name, QgsComposerMap* map
|
||||
, mGridAnnotationFontColor( Qt::black )
|
||||
, mGridAnnotationPrecision( 3 )
|
||||
, mShowGridAnnotation( false )
|
||||
, mLeftGridAnnotationDisplay( QgsComposerMapGrid::ShowAll )
|
||||
, mRightGridAnnotationDisplay( QgsComposerMapGrid::ShowAll )
|
||||
, mTopGridAnnotationDisplay( QgsComposerMapGrid::ShowAll )
|
||||
, mBottomGridAnnotationDisplay( QgsComposerMapGrid::ShowAll )
|
||||
, mLeftGridAnnotationPosition( QgsComposerMapGrid::OutsideMapFrame )
|
||||
, mRightGridAnnotationPosition( QgsComposerMapGrid::OutsideMapFrame )
|
||||
, mTopGridAnnotationPosition( QgsComposerMapGrid::OutsideMapFrame )
|
||||
@ -173,6 +177,10 @@ QgsComposerMapGrid::QgsComposerMapGrid( const QString& name, QgsComposerMap* map
|
||||
, mGridFrameFillColor1( Qt::white )
|
||||
, mGridFrameFillColor2( Qt::black )
|
||||
, mCrossLength( 3 )
|
||||
, mLeftFrameDivisions( QgsComposerMapGrid::ShowAll )
|
||||
, mRightFrameDivisions( QgsComposerMapGrid::ShowAll )
|
||||
, mTopFrameDivisions( QgsComposerMapGrid::ShowAll )
|
||||
, mBottomFrameDivisions( QgsComposerMapGrid::ShowAll )
|
||||
, mGridLineSymbol( 0 )
|
||||
, mGridMarkerSymbol( 0 )
|
||||
, mGridUnit( MapUnit )
|
||||
@ -269,6 +277,10 @@ bool QgsComposerMapGrid::writeXML( QDomElement& elem, QDomDocument& doc ) const
|
||||
mapGridElem.setAttribute( "gridFramePenColor", QgsSymbolLayerV2Utils::encodeColor( mGridFramePenColor ) );
|
||||
mapGridElem.setAttribute( "frameFillColor1", QgsSymbolLayerV2Utils::encodeColor( mGridFrameFillColor1 ) );
|
||||
mapGridElem.setAttribute( "frameFillColor2", QgsSymbolLayerV2Utils::encodeColor( mGridFrameFillColor2 ) );
|
||||
mapGridElem.setAttribute( "leftFrameDivisions", mLeftFrameDivisions );
|
||||
mapGridElem.setAttribute( "rightFrameDivisions", mRightFrameDivisions );
|
||||
mapGridElem.setAttribute( "topFrameDivisions", mTopFrameDivisions );
|
||||
mapGridElem.setAttribute( "bottomFrameDivisions", mBottomFrameDivisions );
|
||||
if ( mCRS.isValid() )
|
||||
{
|
||||
mCRS.writeXML( mapGridElem, doc );
|
||||
@ -276,6 +288,10 @@ bool QgsComposerMapGrid::writeXML( QDomElement& elem, QDomDocument& doc ) const
|
||||
|
||||
mapGridElem.setAttribute( "annotationFormat", mGridAnnotationFormat );
|
||||
mapGridElem.setAttribute( "showAnnotation", mShowGridAnnotation );
|
||||
mapGridElem.setAttribute( "leftAnnotationDisplay", mLeftGridAnnotationDisplay );
|
||||
mapGridElem.setAttribute( "rightAnnotationDisplay", mRightGridAnnotationDisplay );
|
||||
mapGridElem.setAttribute( "topAnnotationDisplay", mTopGridAnnotationDisplay );
|
||||
mapGridElem.setAttribute( "bottomAnnotationDisplay", mBottomGridAnnotationDisplay );
|
||||
mapGridElem.setAttribute( "leftAnnotationPosition", mLeftGridAnnotationPosition );
|
||||
mapGridElem.setAttribute( "rightAnnotationPosition", mRightGridAnnotationPosition );
|
||||
mapGridElem.setAttribute( "topAnnotationPosition", mTopGridAnnotationPosition );
|
||||
@ -320,6 +336,10 @@ bool QgsComposerMapGrid::readXML( const QDomElement& itemElem, const QDomDocumen
|
||||
mGridFramePenColor = QgsSymbolLayerV2Utils::decodeColor( itemElem.attribute( "gridFramePenColor", "0,0,0" ) );
|
||||
mGridFrameFillColor1 = QgsSymbolLayerV2Utils::decodeColor( itemElem.attribute( "frameFillColor1", "255,255,255,255" ) );
|
||||
mGridFrameFillColor2 = QgsSymbolLayerV2Utils::decodeColor( itemElem.attribute( "frameFillColor2", "0,0,0,255" ) );
|
||||
mLeftFrameDivisions = QgsComposerMapGrid::DisplayMode( itemElem.attribute( "leftFrameDivisions", "0" ).toInt() );
|
||||
mRightFrameDivisions = QgsComposerMapGrid::DisplayMode( itemElem.attribute( "rightFrameDivisions", "0" ).toInt() );
|
||||
mTopFrameDivisions = QgsComposerMapGrid::DisplayMode( itemElem.attribute( "topFrameDivisions", "0" ).toInt() );
|
||||
mBottomFrameDivisions = QgsComposerMapGrid::DisplayMode( itemElem.attribute( "bottomFrameDivisions", "0" ).toInt() );
|
||||
|
||||
QDomElement lineStyleElem = itemElem.firstChildElement( "lineStyle" );
|
||||
if ( !lineStyleElem.isNull() )
|
||||
@ -371,6 +391,32 @@ bool QgsComposerMapGrid::readXML( const QDomElement& itemElem, const QDomDocumen
|
||||
mRightGridAnnotationPosition = QgsComposerMapGrid::AnnotationPosition( itemElem.attribute( "rightAnnotationPosition", "0" ).toInt() );
|
||||
mTopGridAnnotationPosition = QgsComposerMapGrid::AnnotationPosition( itemElem.attribute( "topAnnotationPosition", "0" ).toInt() );
|
||||
mBottomGridAnnotationPosition = QgsComposerMapGrid::AnnotationPosition( itemElem.attribute( "bottomAnnotationPosition", "0" ).toInt() );
|
||||
mLeftGridAnnotationDisplay = QgsComposerMapGrid::DisplayMode( itemElem.attribute( "leftAnnotationDisplay", "0" ).toInt() );
|
||||
mRightGridAnnotationDisplay = QgsComposerMapGrid::DisplayMode( itemElem.attribute( "rightAnnotationDisplay", "0" ).toInt() );
|
||||
mTopGridAnnotationDisplay = QgsComposerMapGrid::DisplayMode( itemElem.attribute( "topAnnotationDisplay", "0" ).toInt() );
|
||||
mBottomGridAnnotationDisplay = QgsComposerMapGrid::DisplayMode( itemElem.attribute( "bottomAnnotationDisplay", "0" ).toInt() );
|
||||
//upgrade pre-2.7 projects
|
||||
if ( mLeftGridAnnotationPosition == QgsComposerMapGrid::Disabled )
|
||||
{
|
||||
mLeftGridAnnotationDisplay = QgsComposerMapGrid::HideAll;
|
||||
mLeftGridAnnotationPosition = QgsComposerMapGrid::OutsideMapFrame;
|
||||
}
|
||||
if ( mRightGridAnnotationPosition == QgsComposerMapGrid::Disabled )
|
||||
{
|
||||
mRightGridAnnotationDisplay = QgsComposerMapGrid::HideAll;
|
||||
mRightGridAnnotationPosition = QgsComposerMapGrid::OutsideMapFrame;
|
||||
}
|
||||
if ( mTopGridAnnotationPosition == QgsComposerMapGrid::Disabled )
|
||||
{
|
||||
mTopGridAnnotationDisplay = QgsComposerMapGrid::HideAll;
|
||||
mTopGridAnnotationPosition = QgsComposerMapGrid::OutsideMapFrame;
|
||||
}
|
||||
if ( mBottomGridAnnotationPosition == QgsComposerMapGrid::Disabled )
|
||||
{
|
||||
mBottomGridAnnotationDisplay = QgsComposerMapGrid::HideAll;
|
||||
mBottomGridAnnotationPosition = QgsComposerMapGrid::OutsideMapFrame;
|
||||
}
|
||||
|
||||
mLeftGridAnnotationDirection = QgsComposerMapGrid::AnnotationDirection( itemElem.attribute( "leftAnnotationDirection", "0" ).toInt() );
|
||||
mRightGridAnnotationDirection = QgsComposerMapGrid::AnnotationDirection( itemElem.attribute( "rightAnnotationDirection", "0" ).toInt() );
|
||||
mTopGridAnnotationDirection = QgsComposerMapGrid::AnnotationDirection( itemElem.attribute( "topAnnotationDirection", "0" ).toInt() );
|
||||
@ -1019,6 +1065,12 @@ void QgsComposerMapGrid::drawCoordinateAnnotation( QPainter* p, const QPointF& p
|
||||
|
||||
if ( frameBorder == QgsComposerMapGrid::Left )
|
||||
{
|
||||
if ( mLeftGridAnnotationDisplay == QgsComposerMapGrid::HideAll ||
|
||||
( coordinateType == Longitude && mLeftGridAnnotationDisplay == QgsComposerMapGrid::LatitudeOnly ) ||
|
||||
( coordinateType == Latitude && mLeftGridAnnotationDisplay == QgsComposerMapGrid::LongitudeOnly ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
if ( !testFrameSideFlag( QgsComposerMapGrid::FrameLeft ) )
|
||||
{
|
||||
gridFrameDistance = 0;
|
||||
@ -1068,6 +1120,12 @@ void QgsComposerMapGrid::drawCoordinateAnnotation( QPainter* p, const QPointF& p
|
||||
}
|
||||
else if ( frameBorder == QgsComposerMapGrid::Right )
|
||||
{
|
||||
if ( mRightGridAnnotationDisplay == QgsComposerMapGrid::HideAll ||
|
||||
( coordinateType == Longitude && mRightGridAnnotationDisplay == QgsComposerMapGrid::LatitudeOnly ) ||
|
||||
( coordinateType == Latitude && mRightGridAnnotationDisplay == QgsComposerMapGrid::LongitudeOnly ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
if ( !testFrameSideFlag( QgsComposerMapGrid::FrameRight ) )
|
||||
{
|
||||
gridFrameDistance = 0;
|
||||
@ -1116,6 +1174,12 @@ void QgsComposerMapGrid::drawCoordinateAnnotation( QPainter* p, const QPointF& p
|
||||
}
|
||||
else if ( frameBorder == QgsComposerMapGrid::Bottom )
|
||||
{
|
||||
if ( mBottomGridAnnotationDisplay == QgsComposerMapGrid::HideAll ||
|
||||
( coordinateType == Longitude && mBottomGridAnnotationDisplay == QgsComposerMapGrid::LatitudeOnly ) ||
|
||||
( coordinateType == Latitude && mBottomGridAnnotationDisplay == QgsComposerMapGrid::LongitudeOnly ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
if ( !testFrameSideFlag( QgsComposerMapGrid::FrameBottom ) )
|
||||
{
|
||||
gridFrameDistance = 0;
|
||||
@ -1162,8 +1226,14 @@ void QgsComposerMapGrid::drawCoordinateAnnotation( QPainter* p, const QPointF& p
|
||||
return;
|
||||
}
|
||||
}
|
||||
else //Top
|
||||
else //top
|
||||
{
|
||||
if ( mTopGridAnnotationDisplay == QgsComposerMapGrid::HideAll ||
|
||||
( coordinateType == Longitude && mTopGridAnnotationDisplay == QgsComposerMapGrid::LatitudeOnly ) ||
|
||||
( coordinateType == Latitude && mTopGridAnnotationDisplay == QgsComposerMapGrid::LongitudeOnly ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
if ( !testFrameSideFlag( QgsComposerMapGrid::FrameTop ) )
|
||||
{
|
||||
gridFrameDistance = 0;
|
||||
@ -1663,25 +1733,48 @@ void QgsComposerMapGrid::sortGridLinesOnBorders( const QList< QPair< double, QLi
|
||||
for ( ; bIt != borderPositions.constEnd(); ++bIt )
|
||||
{
|
||||
QgsComposerMapGrid::BorderSide frameBorder = borderForLineCoord( bIt->itemPosition, bIt->coordinateType );
|
||||
if ( frameBorder == QgsComposerMapGrid::Left )
|
||||
if ( frameBorder == QgsComposerMapGrid::Left && shouldShowDivisionForSide( bIt->coordinateType, QgsComposerMapGrid::Left ) )
|
||||
{
|
||||
leftFrameEntries.insert( bIt->itemPosition.y(), bIt->coordinate );
|
||||
}
|
||||
else if ( frameBorder == QgsComposerMapGrid::Right )
|
||||
else if ( frameBorder == QgsComposerMapGrid::Right && shouldShowDivisionForSide( bIt->coordinateType, QgsComposerMapGrid::Right ) )
|
||||
{
|
||||
rightFrameEntries.insert( bIt->itemPosition.y(), bIt->coordinate );
|
||||
}
|
||||
else if ( frameBorder == QgsComposerMapGrid::Top )
|
||||
else if ( frameBorder == QgsComposerMapGrid::Top && shouldShowDivisionForSide( bIt->coordinateType, QgsComposerMapGrid::Top ) )
|
||||
{
|
||||
topFrameEntries.insert( bIt->itemPosition.x(), bIt->coordinate );
|
||||
}
|
||||
else //Bottom
|
||||
else if ( frameBorder == QgsComposerMapGrid::Bottom && shouldShowDivisionForSide( bIt->coordinateType, QgsComposerMapGrid::Bottom ) )
|
||||
{
|
||||
bottomFrameEntries.insert( bIt->itemPosition.x(), bIt->coordinate );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool QgsComposerMapGrid::shouldShowDivisionForSide( const QgsComposerMapGrid::AnnotationCoordinate& coordinate, const QgsComposerMapGrid::BorderSide& side ) const
|
||||
{
|
||||
switch ( side )
|
||||
{
|
||||
case QgsComposerMapGrid::Left:
|
||||
return shouldShowDivisionForDisplayMode( coordinate, mLeftFrameDivisions );
|
||||
case QgsComposerMapGrid::Right:
|
||||
return shouldShowDivisionForDisplayMode( coordinate, mRightFrameDivisions );
|
||||
case QgsComposerMapGrid::Top:
|
||||
return shouldShowDivisionForDisplayMode( coordinate, mTopFrameDivisions );
|
||||
case QgsComposerMapGrid::Bottom:
|
||||
default: //prevent warnings
|
||||
return shouldShowDivisionForDisplayMode( coordinate, mBottomFrameDivisions );
|
||||
}
|
||||
}
|
||||
|
||||
bool QgsComposerMapGrid::shouldShowDivisionForDisplayMode( const QgsComposerMapGrid::AnnotationCoordinate& coordinate, const QgsComposerMapGrid::DisplayMode& mode ) const
|
||||
{
|
||||
return mode == QgsComposerMapGrid::ShowAll
|
||||
|| ( mode == QgsComposerMapGrid::LatitudeOnly && coordinate == QgsComposerMapGrid::Latitude )
|
||||
|| ( mode == QgsComposerMapGrid::LongitudeOnly && coordinate == QgsComposerMapGrid::Longitude );
|
||||
}
|
||||
|
||||
QgsComposerMapGrid::BorderSide QgsComposerMapGrid::borderForLineCoord( const QPointF& p, const AnnotationCoordinate coordinateType ) const
|
||||
{
|
||||
if ( !mComposerMap )
|
||||
@ -1754,6 +1847,53 @@ void QgsComposerMapGrid::setMarkerSymbol( QgsMarkerSymbolV2 *symbol )
|
||||
mGridMarkerSymbol = symbol;
|
||||
}
|
||||
|
||||
void QgsComposerMapGrid::setAnnotationDisplay( const QgsComposerMapGrid::DisplayMode display, const QgsComposerMapGrid::BorderSide border )
|
||||
{
|
||||
switch ( border )
|
||||
{
|
||||
case QgsComposerMapGrid::Left:
|
||||
mLeftGridAnnotationDisplay = display;
|
||||
break;
|
||||
case QgsComposerMapGrid::Right:
|
||||
mRightGridAnnotationDisplay = display;
|
||||
break;
|
||||
case QgsComposerMapGrid::Top:
|
||||
mTopGridAnnotationDisplay = display;
|
||||
break;
|
||||
case QgsComposerMapGrid::Bottom:
|
||||
mBottomGridAnnotationDisplay = display;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
if ( mComposerMap )
|
||||
{
|
||||
mComposerMap->updateBoundingRect();
|
||||
mComposerMap->update();
|
||||
}
|
||||
}
|
||||
|
||||
QgsComposerMapGrid::DisplayMode QgsComposerMapGrid::annotationDisplay( const QgsComposerMapGrid::BorderSide border ) const
|
||||
{
|
||||
switch ( border )
|
||||
{
|
||||
case QgsComposerMapGrid::Left:
|
||||
return mLeftGridAnnotationDisplay;
|
||||
break;
|
||||
case QgsComposerMapGrid::Right:
|
||||
return mRightGridAnnotationDisplay;
|
||||
break;
|
||||
case QgsComposerMapGrid::Top:
|
||||
return mTopGridAnnotationDisplay;
|
||||
break;
|
||||
case QgsComposerMapGrid::Bottom:
|
||||
default:
|
||||
return mBottomGridAnnotationDisplay;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
double QgsComposerMapGrid::maxExtension() const
|
||||
{
|
||||
if ( !mComposerMap )
|
||||
@ -1761,8 +1901,11 @@ double QgsComposerMapGrid::maxExtension() const
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ( !mEnabled || ( mGridFrameStyle == QgsComposerMapGrid::NoFrame && ( !mShowGridAnnotation || ( mLeftGridAnnotationPosition != QgsComposerMapGrid::OutsideMapFrame && mRightGridAnnotationPosition != QgsComposerMapGrid::OutsideMapFrame
|
||||
&& mTopGridAnnotationPosition != QgsComposerMapGrid::OutsideMapFrame && mBottomGridAnnotationPosition != QgsComposerMapGrid::OutsideMapFrame ) ) ) )
|
||||
if ( !mEnabled || ( mGridFrameStyle == QgsComposerMapGrid::NoFrame && ( !mShowGridAnnotation ||
|
||||
(( mLeftGridAnnotationPosition != QgsComposerMapGrid::OutsideMapFrame || mLeftGridAnnotationDisplay == QgsComposerMapGrid::HideAll ) &&
|
||||
( mRightGridAnnotationPosition != QgsComposerMapGrid::OutsideMapFrame || mRightGridAnnotationDisplay == QgsComposerMapGrid::HideAll ) &&
|
||||
( mTopGridAnnotationPosition != QgsComposerMapGrid::OutsideMapFrame || mTopGridAnnotationDisplay == QgsComposerMapGrid::HideAll ) &&
|
||||
( mBottomGridAnnotationPosition != QgsComposerMapGrid::OutsideMapFrame || mBottomGridAnnotationDisplay == QgsComposerMapGrid::HideAll ) ) ) ) )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@ -2028,6 +2171,52 @@ QgsComposerMapGrid::AnnotationDirection QgsComposerMapGrid::annotationDirection(
|
||||
}
|
||||
}
|
||||
|
||||
void QgsComposerMapGrid::setFrameDivisions( const QgsComposerMapGrid::DisplayMode divisions, const QgsComposerMapGrid::BorderSide border )
|
||||
{
|
||||
switch ( border )
|
||||
{
|
||||
case QgsComposerMapGrid::Left:
|
||||
mLeftFrameDivisions = divisions;
|
||||
break;
|
||||
case QgsComposerMapGrid::Right:
|
||||
mRightFrameDivisions = divisions;
|
||||
break;
|
||||
case QgsComposerMapGrid::Top:
|
||||
mTopFrameDivisions = divisions;
|
||||
break;
|
||||
case QgsComposerMapGrid::Bottom:
|
||||
mBottomFrameDivisions = divisions;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
if ( mComposerMap )
|
||||
{
|
||||
mComposerMap->update();
|
||||
}
|
||||
}
|
||||
|
||||
QgsComposerMapGrid::DisplayMode QgsComposerMapGrid::frameDivisions( const QgsComposerMapGrid::BorderSide border ) const
|
||||
{
|
||||
switch ( border )
|
||||
{
|
||||
case QgsComposerMapGrid::Left:
|
||||
return mLeftFrameDivisions;
|
||||
break;
|
||||
case QgsComposerMapGrid::Right:
|
||||
return mRightFrameDivisions;
|
||||
break;
|
||||
case QgsComposerMapGrid::Top:
|
||||
return mTopFrameDivisions;
|
||||
break;
|
||||
case QgsComposerMapGrid::Bottom:
|
||||
default:
|
||||
return mBottomFrameDivisions;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int QgsComposerMapGrid::crsGridParams( QgsRectangle& crsRect, QgsCoordinateTransform& inverseTransform ) const
|
||||
{
|
||||
if ( !mComposerMap )
|
||||
|
@ -174,13 +174,24 @@ class CORE_EXPORT QgsComposerMapGrid : public QgsComposerMapItem
|
||||
FrameAnnotationsOnly /*< no grid lines over the map, only draw frame and annotations */
|
||||
};
|
||||
|
||||
/** Display settings for grid annotations and frames
|
||||
*/
|
||||
enum DisplayMode
|
||||
{
|
||||
ShowAll = 0, /*< show both latitude and longitude annotations/divisions */
|
||||
LatitudeOnly, /*< show latitude/y annotations/divisions only */
|
||||
LongitudeOnly, /*< show longitude/x annotations/divisions only */
|
||||
HideAll /*< no annotations */
|
||||
};
|
||||
|
||||
/** Position for grid annotations
|
||||
*/
|
||||
enum AnnotationPosition
|
||||
{
|
||||
InsideMapFrame = 0,
|
||||
OutsideMapFrame, /*< draw annotations outside the map frame */
|
||||
Disabled /*< disable annotation */
|
||||
Disabled /*< disable annotation
|
||||
* @deprecated in QGIS 2.7, use QgsComposerMapGrid::HideAll instead */
|
||||
};
|
||||
|
||||
/** Direction of grid annotations
|
||||
@ -544,6 +555,25 @@ class CORE_EXPORT QgsComposerMapGrid : public QgsComposerMapItem
|
||||
*/
|
||||
int annotationPrecision() const { return mGridAnnotationPrecision; }
|
||||
|
||||
/**Sets what types of grid annotations should be drawn for a specified side of the map frame,
|
||||
* or whether grid annotations should be disabled for the side.
|
||||
* @param display display mode for annotations
|
||||
* @param border side of map for annotations
|
||||
* @see annotationDisplay
|
||||
* @note added in QGIS 2.7
|
||||
*/
|
||||
void setAnnotationDisplay( const DisplayMode display, const BorderSide border );
|
||||
|
||||
/**Gets the display mode for the grid annotations on a specified side of the map
|
||||
* frame. This property also specifies whether annotations have been disabled
|
||||
* from a side of the map frame.
|
||||
* @param border side of map for annotations
|
||||
* @returns display mode for grid annotations
|
||||
* @see setAnnotationDisplay
|
||||
* @note added in QGIS 2.7
|
||||
*/
|
||||
DisplayMode annotationDisplay( const BorderSide border ) const;
|
||||
|
||||
/**Sets the position for the grid annotations on a specified side of the map
|
||||
* frame.
|
||||
* @param position position to draw grid annotations
|
||||
@ -620,6 +650,22 @@ class CORE_EXPORT QgsComposerMapGrid : public QgsComposerMapItem
|
||||
*/
|
||||
FrameStyle frameStyle() const { return mGridFrameStyle; }
|
||||
|
||||
/**Sets what type of grid divisions should be used for frames on a specified side of the map.
|
||||
* @param divisions grid divisions for frame
|
||||
* @param border side of map for frame
|
||||
* @see frameDivisions
|
||||
* @note added in QGIS 2.7
|
||||
*/
|
||||
void setFrameDivisions( const DisplayMode divisions, const BorderSide border );
|
||||
|
||||
/**Gets the type of grid divisions which are used for frames on a specified side of the map.
|
||||
* @param border side of map for frame
|
||||
* @returns grid divisions for frame
|
||||
* @see setFrameDivisions
|
||||
* @note added in QGIS 2.7
|
||||
*/
|
||||
DisplayMode frameDivisions( const BorderSide border ) const;
|
||||
|
||||
/**Sets flags for grid frame sides. Setting these flags controls which sides
|
||||
* of the map item the grid frame is drawn on.
|
||||
* @param flags flags for grid frame sides
|
||||
@ -763,13 +809,22 @@ class CORE_EXPORT QgsComposerMapGrid : public QgsComposerMapItem
|
||||
/**True if coordinate values should be drawn*/
|
||||
bool mShowGridAnnotation;
|
||||
|
||||
/**Annotation position for left map side (inside / outside / not shown)*/
|
||||
/**Annotation display mode for left map side*/
|
||||
DisplayMode mLeftGridAnnotationDisplay;
|
||||
/**Annotation display mode for right map side*/
|
||||
DisplayMode mRightGridAnnotationDisplay;
|
||||
/**Annotation display mode for top map side*/
|
||||
DisplayMode mTopGridAnnotationDisplay;
|
||||
/**Annotation display mode for bottom map side*/
|
||||
DisplayMode mBottomGridAnnotationDisplay;
|
||||
|
||||
/**Annotation position for left map side (inside / outside)*/
|
||||
AnnotationPosition mLeftGridAnnotationPosition;
|
||||
/**Annotation position for right map side (inside / outside / not shown)*/
|
||||
/**Annotation position for right map side (inside / outside)*/
|
||||
AnnotationPosition mRightGridAnnotationPosition;
|
||||
/**Annotation position for top map side (inside / outside / not shown)*/
|
||||
/**Annotation position for top map side (inside / outside)*/
|
||||
AnnotationPosition mTopGridAnnotationPosition;
|
||||
/**Annotation position for bottom map side (inside / outside / not shown)*/
|
||||
/**Annotation position for bottom map side (inside / outside)*/
|
||||
AnnotationPosition mBottomGridAnnotationPosition;
|
||||
|
||||
/**Distance between map frame and annotation*/
|
||||
@ -793,6 +848,15 @@ class CORE_EXPORT QgsComposerMapGrid : public QgsComposerMapItem
|
||||
QColor mGridFrameFillColor2;
|
||||
double mCrossLength;
|
||||
|
||||
/**Divisions for frame on left map side*/
|
||||
DisplayMode mLeftFrameDivisions;
|
||||
/**Divisions for frame on right map side*/
|
||||
DisplayMode mRightFrameDivisions;
|
||||
/**Divisions for frame on top map side*/
|
||||
DisplayMode mTopFrameDivisions;
|
||||
/**Divisions for frame on bottom map side*/
|
||||
DisplayMode mBottomFrameDivisions;
|
||||
|
||||
QgsLineSymbolV2* mGridLineSymbol;
|
||||
QgsMarkerSymbolV2* mGridMarkerSymbol;
|
||||
|
||||
@ -891,6 +955,9 @@ class CORE_EXPORT QgsComposerMapGrid : public QgsComposerMapItem
|
||||
|
||||
void calculateCRSTransformLines();
|
||||
|
||||
bool shouldShowDivisionForSide( const AnnotationCoordinate &coordinate, const QgsComposerMapGrid::BorderSide& side ) const;
|
||||
bool shouldShowDivisionForDisplayMode( const QgsComposerMapGrid::AnnotationCoordinate &coordinate, const QgsComposerMapGrid::DisplayMode &mode ) const;
|
||||
|
||||
friend class TestQgsComposerMapGrid;
|
||||
};
|
||||
|
||||
|
@ -54,9 +54,9 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>-1149</y>
|
||||
<width>444</width>
|
||||
<height>2196</height>
|
||||
<y>-517</y>
|
||||
<width>484</width>
|
||||
<height>2445</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -543,7 +543,7 @@
|
||||
<property name="collapsed" stdset="0">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_6" columnstretch="0,1">
|
||||
<layout class="QGridLayout" name="gridLayout_6" columnstretch="0,0">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="mGridTypeLabel_2">
|
||||
<property name="accessibleName">
|
||||
@ -854,7 +854,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="3">
|
||||
<item row="8" column="0" colspan="3">
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="mCheckGridLeftSide">
|
||||
@ -927,6 +927,46 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="mRightDivisionsLabel">
|
||||
<property name="text">
|
||||
<string>Right divisions</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="mLeftDivisionsLabel">
|
||||
<property name="text">
|
||||
<string>Left divisions</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="mTopDivisionsLabel">
|
||||
<property name="text">
|
||||
<string>Top divisions</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="mBottomDivisionsLabel">
|
||||
<property name="text">
|
||||
<string>Bottom divisions</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1" colspan="2">
|
||||
<widget class="QComboBox" name="mFrameDivisionsLeftComboBox"/>
|
||||
</item>
|
||||
<item row="5" column="1" colspan="2">
|
||||
<widget class="QComboBox" name="mFrameDivisionsRightComboBox"/>
|
||||
</item>
|
||||
<item row="6" column="1" colspan="2">
|
||||
<widget class="QComboBox" name="mFrameDivisionsTopComboBox"/>
|
||||
</item>
|
||||
<item row="7" column="1" colspan="2">
|
||||
<widget class="QComboBox" name="mFrameDivisionsBottomComboBox"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@ -957,15 +997,21 @@
|
||||
<property name="rightMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="mAnnotationFormatLabel">
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="mAnnotationPositionLabelRight">
|
||||
<property name="text">
|
||||
<string>Format</string>
|
||||
<string>Right</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>mAnnotationPositionRightComboBox</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="mAnnotationFormatComboBox"/>
|
||||
<item row="4" column="1">
|
||||
<widget class="QComboBox" name="mAnnotationDisplayRightComboBox"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="mAnnotationPositionLabelLeft">
|
||||
@ -980,91 +1026,62 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="mAnnotationPositionLeftComboBox"/>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="mAnnotationFormatLabel">
|
||||
<property name="text">
|
||||
<string>Format</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="mAnnotationFormatComboBox"/>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="mAnnotationDirectionComboBoxLeft"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="mAnnotationPositionLabelRight">
|
||||
<property name="text">
|
||||
<string>Right</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>mAnnotationPositionRightComboBox</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="mAnnotationPositionLeftComboBox"/>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="mAnnotationPositionRightComboBox"/>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QComboBox" name="mAnnotationDirectionComboBoxRight"/>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="mAnnotationPositionLabelTop">
|
||||
<property name="text">
|
||||
<string>Top</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>mAnnotationPositionTopComboBox</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="mAnnotationDirectionComboBoxLeft"/>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QComboBox" name="mAnnotationPositionTopComboBox"/>
|
||||
<widget class="QComboBox" name="mAnnotationPositionRightComboBox"/>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QComboBox" name="mAnnotationDirectionComboBoxTop"/>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="mAnnotationPositionLabelBottom">
|
||||
<property name="text">
|
||||
<string>Bottom</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>mAnnotationPositionRightComboBox</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QComboBox" name="mAnnotationPositionBottomComboBox"/>
|
||||
<widget class="QComboBox" name="mAnnotationDirectionComboBoxRight"/>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QComboBox" name="mAnnotationPositionTopComboBox"/>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<widget class="QComboBox" name="mAnnotationDirectionComboBoxTop"/>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<widget class="QComboBox" name="mAnnotationPositionBottomComboBox"/>
|
||||
</item>
|
||||
<item row="12" column="1">
|
||||
<widget class="QComboBox" name="mAnnotationDirectionComboBoxBottom"/>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<item row="13" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Font</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<item row="13" column="1">
|
||||
<widget class="QPushButton" name="mAnnotationFontButton">
|
||||
<property name="text">
|
||||
<string>Font...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<item row="14" column="0">
|
||||
<widget class="QLabel" name="mFontColorLabel">
|
||||
<property name="text">
|
||||
<string>Font color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<item row="14" column="1">
|
||||
<widget class="QgsColorButtonV2" name="mAnnotationFontColorButton">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
@ -1083,7 +1100,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0">
|
||||
<item row="15" column="0">
|
||||
<widget class="QLabel" name="mDistanceToFrameLabel">
|
||||
<property name="text">
|
||||
<string>Distance to map frame</string>
|
||||
@ -1096,14 +1113,14 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<item row="15" column="1">
|
||||
<widget class="QDoubleSpinBox" name="mDistanceToMapFrameSpinBox">
|
||||
<property name="suffix">
|
||||
<string> mm</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="0">
|
||||
<item row="16" column="0">
|
||||
<widget class="QLabel" name="mCoordinatePrecisionLabel">
|
||||
<property name="text">
|
||||
<string>Coordinate precision</string>
|
||||
@ -1116,9 +1133,44 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="1">
|
||||
<item row="16" column="1">
|
||||
<widget class="QSpinBox" name="mCoordinatePrecisionSpinBox"/>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="mAnnotationDisplayLeftComboBox"/>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="mAnnotationPositionLabelTop">
|
||||
<property name="text">
|
||||
<string>Top</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>mAnnotationPositionTopComboBox</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QComboBox" name="mAnnotationDisplayTopComboBox"/>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<widget class="QComboBox" name="mAnnotationDisplayBottomComboBox"/>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<widget class="QLabel" name="mAnnotationPositionLabelBottom">
|
||||
<property name="text">
|
||||
<string>Bottom</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>mAnnotationPositionRightComboBox</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@ -1300,9 +1352,9 @@
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>QgsCollapsibleGroupBoxBasic</class>
|
||||
<extends>QGroupBox</extends>
|
||||
<header location="global">qgscollapsiblegroupbox.h</header>
|
||||
<class>QgsColorButtonV2</class>
|
||||
<extends>QToolButton</extends>
|
||||
<header>qgscolorbuttonv2.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
@ -1311,9 +1363,9 @@
|
||||
<header>qgsdatadefinedbutton.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>QgsColorButtonV2</class>
|
||||
<extends>QToolButton</extends>
|
||||
<header>qgscolorbuttonv2.h</header>
|
||||
<class>QgsCollapsibleGroupBoxBasic</class>
|
||||
<extends>QGroupBox</extends>
|
||||
<header location="global">qgscollapsiblegroupbox.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
@ -1376,18 +1428,26 @@
|
||||
<tabstop>mGridFramePenColorButton</tabstop>
|
||||
<tabstop>mGridFrameFill1ColorButton</tabstop>
|
||||
<tabstop>mGridFrameFill2ColorButton</tabstop>
|
||||
<tabstop>mFrameDivisionsLeftComboBox</tabstop>
|
||||
<tabstop>mFrameDivisionsRightComboBox</tabstop>
|
||||
<tabstop>mFrameDivisionsTopComboBox</tabstop>
|
||||
<tabstop>mFrameDivisionsBottomComboBox</tabstop>
|
||||
<tabstop>mCheckGridLeftSide</tabstop>
|
||||
<tabstop>mCheckGridRightSide</tabstop>
|
||||
<tabstop>mCheckGridTopSide</tabstop>
|
||||
<tabstop>mCheckGridBottomSide</tabstop>
|
||||
<tabstop>mDrawAnnotationGroupBox</tabstop>
|
||||
<tabstop>mAnnotationFormatComboBox</tabstop>
|
||||
<tabstop>mAnnotationDisplayLeftComboBox</tabstop>
|
||||
<tabstop>mAnnotationPositionLeftComboBox</tabstop>
|
||||
<tabstop>mAnnotationDirectionComboBoxLeft</tabstop>
|
||||
<tabstop>mAnnotationDisplayRightComboBox</tabstop>
|
||||
<tabstop>mAnnotationPositionRightComboBox</tabstop>
|
||||
<tabstop>mAnnotationDirectionComboBoxRight</tabstop>
|
||||
<tabstop>mAnnotationDisplayTopComboBox</tabstop>
|
||||
<tabstop>mAnnotationPositionTopComboBox</tabstop>
|
||||
<tabstop>mAnnotationDirectionComboBoxTop</tabstop>
|
||||
<tabstop>mAnnotationDisplayBottomComboBox</tabstop>
|
||||
<tabstop>mAnnotationPositionBottomComboBox</tabstop>
|
||||
<tabstop>mAnnotationDirectionComboBoxBottom</tabstop>
|
||||
<tabstop>mAnnotationFontButton</tabstop>
|
||||
|
@ -40,6 +40,8 @@ class TestQgsComposerMapGrid: public QObject
|
||||
void frameOnly(); //test if grid "frame/annotation" mode works
|
||||
void zebraStyle(); //test zebra map border style
|
||||
void zebraStyleSides(); //test zebra border on certain sides
|
||||
void frameDivisions(); //test filtering frame divisions
|
||||
void annotationFilter(); //test filtering annotations
|
||||
void interiorTicks(); //test interior tick mode
|
||||
void interiorTicksAnnotated(); //test interior tick mode with annotations
|
||||
void exteriorTicks(); //test exterior tick mode
|
||||
@ -247,6 +249,89 @@ void TestQgsComposerMapGrid::zebraStyleSides()
|
||||
|
||||
}
|
||||
|
||||
void TestQgsComposerMapGrid::frameDivisions()
|
||||
{
|
||||
mComposerMap->setNewExtent( QgsRectangle( 781662.375, 3339523.125, 793062.375, 3345223.125 ) );
|
||||
//rotate map, so we mix latitude and longitude coordinates on every map side
|
||||
mComposerMap->setMapRotation( 45.0 );
|
||||
|
||||
//setup defaults
|
||||
mComposerMap->grid()->setGridLineColor( QColor( 0, 0, 0 ) );
|
||||
mComposerMap->grid()->setAnnotationFontColor( QColor( 0, 0, 0, 0 ) );
|
||||
mComposerMap->grid()->setBlendMode( QPainter::CompositionMode_SourceOver );
|
||||
mComposerMap->grid()->setFrameStyle( QgsComposerMapGrid::Zebra );
|
||||
mComposerMap->grid()->setFrameWidth( 10 );
|
||||
mComposerMap->grid()->setFramePenSize( 1 );
|
||||
mComposerMap->grid()->setFramePenColor( Qt::black );
|
||||
mComposerMap->grid()->setFrameFillColor1( Qt::black );
|
||||
mComposerMap->grid()->setFrameFillColor2( Qt::white );
|
||||
mComposerMap->grid()->setEnabled( true );
|
||||
mComposerMap->grid()->setFrameSideFlag( QgsComposerMapGrid::FrameLeft, true );
|
||||
mComposerMap->grid()->setFrameSideFlag( QgsComposerMapGrid::FrameRight, true );
|
||||
mComposerMap->grid()->setFrameSideFlag( QgsComposerMapGrid::FrameTop, true );
|
||||
mComposerMap->grid()->setFrameSideFlag( QgsComposerMapGrid::FrameBottom, true );
|
||||
|
||||
QgsCompositionChecker checker( "composermap_rotatedframe", mComposition );
|
||||
bool testResult = checker.testComposition( mReport, 0, 0 );
|
||||
QVERIFY( testResult );
|
||||
|
||||
mComposerMap->grid()->setFrameDivisions( QgsComposerMapGrid::LatitudeOnly, QgsComposerMapGrid::Left );
|
||||
mComposerMap->grid()->setFrameDivisions( QgsComposerMapGrid::LongitudeOnly, QgsComposerMapGrid::Right );
|
||||
mComposerMap->grid()->setFrameDivisions( QgsComposerMapGrid::LatitudeOnly, QgsComposerMapGrid::Top );
|
||||
mComposerMap->grid()->setFrameDivisions( QgsComposerMapGrid::LongitudeOnly, QgsComposerMapGrid::Bottom );
|
||||
|
||||
QgsCompositionChecker checker2( "composermap_framedivisions", mComposition );
|
||||
testResult = checker2.testComposition( mReport, 0, 0 );
|
||||
QVERIFY( testResult );
|
||||
|
||||
mComposerMap->grid()->setFrameDivisions( QgsComposerMapGrid::ShowAll, QgsComposerMapGrid::Left );
|
||||
mComposerMap->grid()->setFrameDivisions( QgsComposerMapGrid::ShowAll, QgsComposerMapGrid::Right );
|
||||
mComposerMap->grid()->setFrameDivisions( QgsComposerMapGrid::ShowAll, QgsComposerMapGrid::Top );
|
||||
mComposerMap->grid()->setFrameDivisions( QgsComposerMapGrid::ShowAll, QgsComposerMapGrid::Bottom );
|
||||
mComposerMap->grid()->setFrameStyle( QgsComposerMapGrid::NoFrame );
|
||||
mComposerMap->setMapRotation( 0.0 );
|
||||
}
|
||||
|
||||
void TestQgsComposerMapGrid::annotationFilter()
|
||||
{
|
||||
mComposerMap->setNewExtent( QgsRectangle( 781662.375, 3339523.125, 793062.375, 3345223.125 ) );
|
||||
//rotate map, so we mix latitude and longitude coordinates on every map side
|
||||
mComposerMap->setMapRotation( 45.0 );
|
||||
|
||||
//setup defaults
|
||||
mComposerMap->grid()->setGridLineColor( QColor( 0, 0, 0 ) );
|
||||
mComposerMap->grid()->setAnnotationFontColor( QColor( 0, 0, 0, 0 ) );
|
||||
mComposerMap->grid()->setBlendMode( QPainter::CompositionMode_SourceOver );
|
||||
mComposerMap->grid()->setFrameStyle( QgsComposerMapGrid::NoFrame );
|
||||
mComposerMap->grid()->setEnabled( true );
|
||||
mComposerMap->grid()->setAnnotationEnabled( true );
|
||||
mComposerMap->grid()->setAnnotationFontColor( Qt::black );
|
||||
mComposerMap->grid()->setAnnotationPosition( QgsComposerMapGrid::OutsideMapFrame, QgsComposerMapGrid::Left );
|
||||
mComposerMap->grid()->setAnnotationPosition( QgsComposerMapGrid::OutsideMapFrame, QgsComposerMapGrid::Right );
|
||||
mComposerMap->grid()->setAnnotationPosition( QgsComposerMapGrid::OutsideMapFrame, QgsComposerMapGrid::Top );
|
||||
mComposerMap->grid()->setAnnotationPosition( QgsComposerMapGrid::OutsideMapFrame, QgsComposerMapGrid::Bottom );
|
||||
|
||||
QgsCompositionChecker checker( "composermap_rotatedannotations", mComposition );
|
||||
bool testResult = checker.testComposition( mReport, 0, 0 );
|
||||
QVERIFY( testResult );
|
||||
|
||||
mComposerMap->grid()->setAnnotationDisplay( QgsComposerMapGrid::HideAll, QgsComposerMapGrid::Left );
|
||||
mComposerMap->grid()->setAnnotationDisplay( QgsComposerMapGrid::LongitudeOnly, QgsComposerMapGrid::Right );
|
||||
mComposerMap->grid()->setAnnotationDisplay( QgsComposerMapGrid::LatitudeOnly, QgsComposerMapGrid::Top );
|
||||
mComposerMap->grid()->setAnnotationDisplay( QgsComposerMapGrid::LongitudeOnly, QgsComposerMapGrid::Bottom );
|
||||
|
||||
QgsCompositionChecker checker2( "composermap_filteredannotations", mComposition );
|
||||
testResult = checker2.testComposition( mReport, 0, 0 );
|
||||
QVERIFY( testResult );
|
||||
|
||||
mComposerMap->grid()->setAnnotationEnabled( false );
|
||||
mComposerMap->grid()->setAnnotationDisplay( QgsComposerMapGrid::ShowAll, QgsComposerMapGrid::Left );
|
||||
mComposerMap->grid()->setAnnotationDisplay( QgsComposerMapGrid::ShowAll, QgsComposerMapGrid::Right );
|
||||
mComposerMap->grid()->setAnnotationDisplay( QgsComposerMapGrid::ShowAll, QgsComposerMapGrid::Top );
|
||||
mComposerMap->grid()->setAnnotationDisplay( QgsComposerMapGrid::ShowAll, QgsComposerMapGrid::Bottom );
|
||||
mComposerMap->setMapRotation( 0.0 );
|
||||
}
|
||||
|
||||
void TestQgsComposerMapGrid::interiorTicks()
|
||||
{
|
||||
mComposerMap->setNewExtent( QgsRectangle( 781662.375, 3339523.125, 793062.375, 3345223.125 ) );
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 28 KiB |
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
Binary file not shown.
After Width: | Height: | Size: 40 KiB |
Binary file not shown.
After Width: | Height: | Size: 19 KiB |
Loading…
x
Reference in New Issue
Block a user