Skip to content
Permalink
Browse files

rotated ticks followup : fix data defined not correctly updating

  • Loading branch information
olivierdalang authored and nyalldawson committed Oct 7, 2020
1 parent ce249b5 commit 6409bce0b819cf94943bfddbc7dae693b3b87daf
Showing with 16 additions and 10 deletions.
  1. +16 −10 src/core/layout/qgslayoutitemmapgrid.cpp
@@ -1912,16 +1912,18 @@ bool QgsLayoutItemMapGrid::shouldShowForDisplayMode( QgsLayoutItemMapGrid::Annot
}


QgsLayoutItemMapGrid::DisplayMode gridAnnotationDisplayModeFromDD( QString ddValue )
QgsLayoutItemMapGrid::DisplayMode gridAnnotationDisplayModeFromDD( QString ddValue, QgsLayoutItemMapGrid::DisplayMode defValue )
{
if ( ddValue == QStringLiteral( "x_only" ) )
return QgsLayoutItemMapGrid::LatitudeOnly;
else if ( ddValue == QStringLiteral( "y_only" ) )
return QgsLayoutItemMapGrid::LongitudeOnly;
else if ( ddValue == QStringLiteral( "disabled" ) )
return QgsLayoutItemMapGrid::HideAll;
else // if ( ddValue == QStringLiteral("all") )
else if ( ddValue == QStringLiteral( "all" ) )
return QgsLayoutItemMapGrid::ShowAll;
else
return defValue;
}


@@ -1967,14 +1969,14 @@ void QgsLayoutItemMapGrid::refreshDataDefinedProperties()
mEvaluatedAnnotationFrameDistance = mDataDefinedProperties.valueAsDouble( QgsLayoutObject::MapGridLabelDistance, context, mAnnotationFrameDistance );
mEvaluatedCrossLength = mDataDefinedProperties.valueAsDouble( QgsLayoutObject::MapGridCrossSize, context, mCrossLength );
mEvaluatedGridFrameLineThickness = mDataDefinedProperties.valueAsDouble( QgsLayoutObject::MapGridFrameLineThickness, context, mGridFramePenThickness );
mEvaluatedLeftGridAnnotationDisplay = gridAnnotationDisplayModeFromDD( mDataDefinedProperties.valueAsString( QgsLayoutObject::MapGridAnnotationDisplayLeft, context, QStringLiteral( "all" ) ) );
mEvaluatedRightGridAnnotationDisplay = gridAnnotationDisplayModeFromDD( mDataDefinedProperties.valueAsString( QgsLayoutObject::MapGridAnnotationDisplayRight, context, QStringLiteral( "all" ) ) );
mEvaluatedTopGridAnnotationDisplay = gridAnnotationDisplayModeFromDD( mDataDefinedProperties.valueAsString( QgsLayoutObject::MapGridAnnotationDisplayTop, context, QStringLiteral( "all" ) ) );
mEvaluatedBottomGridAnnotationDisplay = gridAnnotationDisplayModeFromDD( mDataDefinedProperties.valueAsString( QgsLayoutObject::MapGridAnnotationDisplayBottom, context, QStringLiteral( "all" ) ) );
mEvaluatedLeftFrameDivisions = gridAnnotationDisplayModeFromDD( mDataDefinedProperties.valueAsString( QgsLayoutObject::MapGridFrameDivisionsLeft, context, QStringLiteral( "all" ) ) );
mEvaluatedRightFrameDivisions = gridAnnotationDisplayModeFromDD( mDataDefinedProperties.valueAsString( QgsLayoutObject::MapGridFrameDivisionsRight, context, QStringLiteral( "all" ) ) );
mEvaluatedTopFrameDivisions = gridAnnotationDisplayModeFromDD( mDataDefinedProperties.valueAsString( QgsLayoutObject::MapGridFrameDivisionsTop, context, QStringLiteral( "all" ) ) );
mEvaluatedBottomFrameDivisions = gridAnnotationDisplayModeFromDD( mDataDefinedProperties.valueAsString( QgsLayoutObject::MapGridFrameDivisionsBottom, context, QStringLiteral( "all" ) ) );
mEvaluatedLeftGridAnnotationDisplay = gridAnnotationDisplayModeFromDD( mDataDefinedProperties.valueAsString( QgsLayoutObject::MapGridAnnotationDisplayLeft, context ), mLeftGridAnnotationDisplay );
mEvaluatedRightGridAnnotationDisplay = gridAnnotationDisplayModeFromDD( mDataDefinedProperties.valueAsString( QgsLayoutObject::MapGridAnnotationDisplayRight, context ), mRightGridAnnotationDisplay );
mEvaluatedTopGridAnnotationDisplay = gridAnnotationDisplayModeFromDD( mDataDefinedProperties.valueAsString( QgsLayoutObject::MapGridAnnotationDisplayTop, context ), mTopGridAnnotationDisplay );
mEvaluatedBottomGridAnnotationDisplay = gridAnnotationDisplayModeFromDD( mDataDefinedProperties.valueAsString( QgsLayoutObject::MapGridAnnotationDisplayBottom, context ), mBottomGridAnnotationDisplay );
mEvaluatedLeftFrameDivisions = gridAnnotationDisplayModeFromDD( mDataDefinedProperties.valueAsString( QgsLayoutObject::MapGridFrameDivisionsLeft, context ), mLeftFrameDivisions );
mEvaluatedRightFrameDivisions = gridAnnotationDisplayModeFromDD( mDataDefinedProperties.valueAsString( QgsLayoutObject::MapGridFrameDivisionsRight, context ), mRightFrameDivisions );
mEvaluatedTopFrameDivisions = gridAnnotationDisplayModeFromDD( mDataDefinedProperties.valueAsString( QgsLayoutObject::MapGridFrameDivisionsTop, context ), mTopFrameDivisions );
mEvaluatedBottomFrameDivisions = gridAnnotationDisplayModeFromDD( mDataDefinedProperties.valueAsString( QgsLayoutObject::MapGridFrameDivisionsBottom, context ), mBottomFrameDivisions );

}

@@ -2141,6 +2143,8 @@ void QgsLayoutItemMapGrid::setAnnotationDisplay( const QgsLayoutItemMapGrid::Dis
break;
}

refreshDataDefinedProperties();

if ( mMap )
{
mMap->updateBoundingRect();
@@ -2525,6 +2529,8 @@ void QgsLayoutItemMapGrid::setFrameDivisions( const QgsLayoutItemMapGrid::Displa
break;
}

refreshDataDefinedProperties();

if ( mMap )
{
mMap->update();

0 comments on commit 6409bce

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