diff --git a/src/app/layout/qgslayoutmapwidget.cpp b/src/app/layout/qgslayoutmapwidget.cpp index 355e0e8ff91..7d50d0bd35a 100644 --- a/src/app/layout/qgslayoutmapwidget.cpp +++ b/src/app/layout/qgslayoutmapwidget.cpp @@ -829,51 +829,6 @@ void QgsLayoutMapWidget::blockAllSignals( bool b ) blockOverviewItemsSignals( b ); } -void QgsLayoutMapWidget::handleChangedFrameDisplay( QgsLayoutItemMapGrid::BorderSide border, const QgsLayoutItemMapGrid::DisplayMode mode ) -{ - QgsLayoutItemMapGrid *grid = currentGrid(); - if ( !grid ) - { - return; - } - - mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr( "Change Frame Divisions" ) ); - grid->setFrameDivisions( mode, border ); - mMapItem->layout()->undoStack()->endCommand(); - mMapItem->updateBoundingRect(); -} - -void QgsLayoutMapWidget::handleChangedAnnotationDisplay( QgsLayoutItemMapGrid::BorderSide border, const QString &text ) -{ - QgsLayoutItemMapGrid *grid = currentGrid(); - if ( !grid ) - { - return; - } - - mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr( "Change Annotation Display" ) ); - if ( text == tr( "Show all" ) ) - { - grid->setAnnotationDisplay( QgsLayoutItemMapGrid::ShowAll, border ); - } - else if ( text == tr( "Show latitude only" ) ) - { - grid->setAnnotationDisplay( QgsLayoutItemMapGrid::LatitudeOnly, border ); - } - else if ( text == tr( "Show longitude only" ) ) - { - grid->setAnnotationDisplay( QgsLayoutItemMapGrid::LongitudeOnly, border ); - } - else //disabled - { - grid->setAnnotationDisplay( QgsLayoutItemMapGrid::HideAll, border ); - } - - mMapItem->updateBoundingRect(); - mMapItem->update(); - mMapItem->layout()->undoStack()->endCommand(); -} - void QgsLayoutMapWidget::updatePreview() { if ( !mMapItem ) @@ -974,133 +929,6 @@ void QgsLayoutMapWidget::mDrawCanvasItemsCheckBox_stateChanged( int state ) mMapItem->layout()->undoStack()->endCommand(); } -void QgsLayoutMapWidget::insertAnnotationPositionEntries( QComboBox *c ) -{ - c->insertItem( 0, tr( "Inside frame" ) ); - c->insertItem( 1, tr( "Outside frame" ) ); -} - -void QgsLayoutMapWidget::insertAnnotationDirectionEntries( QComboBox *c ) -{ - c->addItem( tr( "Horizontal" ), QgsLayoutItemMapGrid::Horizontal ); - c->addItem( tr( "Vertical ascending" ), QgsLayoutItemMapGrid::Vertical ); - c->addItem( tr( "Vertical descending" ), QgsLayoutItemMapGrid::VerticalDescending ); -} - -void QgsLayoutMapWidget::initFrameDisplayBox( QComboBox *c, QgsLayoutItemMapGrid::DisplayMode display ) -{ - if ( !c ) - { - return; - } - c->setCurrentIndex( c->findData( display ) ); -} - -void QgsLayoutMapWidget::initAnnotationDisplayBox( QComboBox *c, QgsLayoutItemMapGrid::DisplayMode display ) -{ - if ( !c ) - { - return; - } - - if ( display == QgsLayoutItemMapGrid::ShowAll ) - { - c->setCurrentIndex( c->findText( tr( "Show all" ) ) ); - } - else if ( display == QgsLayoutItemMapGrid::LatitudeOnly ) - { - c->setCurrentIndex( c->findText( tr( "Show latitude only" ) ) ); - } - else if ( display == QgsLayoutItemMapGrid::LongitudeOnly ) - { - c->setCurrentIndex( c->findText( tr( "Show longitude only" ) ) ); - } - else - { - c->setCurrentIndex( c->findText( tr( "Disabled" ) ) ); - } -} - -void QgsLayoutMapWidget::handleChangedAnnotationPosition( QgsLayoutItemMapGrid::BorderSide border, const QString &text ) -{ - QgsLayoutItemMapGrid *grid = currentGrid(); - if ( !grid ) - { - return; - } - - mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr( "Change Annotation Position" ) ); - if ( text == tr( "Inside frame" ) ) - { - grid->setAnnotationPosition( QgsLayoutItemMapGrid::InsideMapFrame, border ); - } - else //Outside frame - { - grid->setAnnotationPosition( QgsLayoutItemMapGrid::OutsideMapFrame, border ); - } - - mMapItem->updateBoundingRect(); - mMapItem->update(); - mMapItem->layout()->undoStack()->endCommand(); -} - -void QgsLayoutMapWidget::handleChangedAnnotationDirection( QgsLayoutItemMapGrid::BorderSide border, QgsLayoutItemMapGrid::AnnotationDirection direction ) -{ - QgsLayoutItemMapGrid *grid = currentGrid(); - if ( !grid ) - { - return; - } - - mMapItem->layout()->undoStack()->beginCommand( mMapItem, tr( "Change Annotation Direction" ) ); - grid->setAnnotationDirection( direction, border ); - mMapItem->updateBoundingRect(); - mMapItem->update(); - mMapItem->layout()->undoStack()->endCommand(); -} - -void QgsLayoutMapWidget::insertFrameDisplayEntries( QComboBox *c ) -{ - c->addItem( tr( "All" ), QgsLayoutItemMapGrid::ShowAll ); - c->addItem( tr( "Latitude/Y only" ), QgsLayoutItemMapGrid::LatitudeOnly ); - c->addItem( tr( "Longitude/X only" ), QgsLayoutItemMapGrid::LongitudeOnly ); -} - -void QgsLayoutMapWidget::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 QgsLayoutMapWidget::initAnnotationPositionBox( QComboBox *c, QgsLayoutItemMapGrid::AnnotationPosition pos ) -{ - if ( !c ) - { - return; - } - - if ( pos == QgsLayoutItemMapGrid::InsideMapFrame ) - { - c->setCurrentIndex( c->findText( tr( "Inside frame" ) ) ); - } - else - { - c->setCurrentIndex( c->findText( tr( "Outside frame" ) ) ); - } -} - -void QgsLayoutMapWidget::initAnnotationDirectionBox( QComboBox *c, QgsLayoutItemMapGrid::AnnotationDirection dir ) -{ - if ( !c ) - { - return; - } - c->setCurrentIndex( c->findData( dir ) ); -} - - void QgsLayoutMapWidget::atlasLayerChanged( QgsVectorLayer *layer ) { if ( !layer || layer->wkbType() == QgsWkbTypes::NoGeometry ) diff --git a/src/app/layout/qgslayoutmapwidget.h b/src/app/layout/qgslayoutmapwidget.h index 3dad542ac0f..768b13b9f3d 100644 --- a/src/app/layout/qgslayoutmapwidget.h +++ b/src/app/layout/qgslayoutmapwidget.h @@ -138,21 +138,6 @@ class QgsLayoutMapWidget: public QgsLayoutItemBaseWidget, private Ui::QgsLayoutM void rotationChanged( double value ); - void handleChangedFrameDisplay( QgsLayoutItemMapGrid::BorderSide border, QgsLayoutItemMapGrid::DisplayMode mode ); - void handleChangedAnnotationDisplay( QgsLayoutItemMapGrid::BorderSide border, const QString &text ); - void handleChangedAnnotationPosition( QgsLayoutItemMapGrid::BorderSide border, const QString &text ); - void handleChangedAnnotationDirection( QgsLayoutItemMapGrid::BorderSide border, QgsLayoutItemMapGrid::AnnotationDirection direction ); - - void insertFrameDisplayEntries( QComboBox *c ); - void insertAnnotationDisplayEntries( QComboBox *c ); - void insertAnnotationPositionEntries( QComboBox *c ); - void insertAnnotationDirectionEntries( QComboBox *c ); - - void initFrameDisplayBox( QComboBox *c, QgsLayoutItemMapGrid::DisplayMode display ); - void initAnnotationDisplayBox( QComboBox *c, QgsLayoutItemMapGrid::DisplayMode display ); - void initAnnotationPositionBox( QComboBox *c, QgsLayoutItemMapGrid::AnnotationPosition pos ); - void initAnnotationDirectionBox( QComboBox *c, QgsLayoutItemMapGrid::AnnotationDirection dir ); - //! Enables or disables the atlas margin and predefined scales radio depending on the atlas coverage layer type void toggleAtlasScalingOptionsByLayerType();