Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #44740 from nirvn/atlas_fixes
A couple of atlas layout fixes
  • Loading branch information
nirvn committed Aug 19, 2021
2 parents 64b5ce1 + 2c5c9b6 commit 1706e7b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/core/layout/qgslayoutitemmap.cpp
Expand Up @@ -2642,7 +2642,7 @@ void QgsLayoutItemMap::updateAtlasFeature()
else
scales = mLayout->renderContext().predefinedScales();
Q_NOWARN_DEPRECATED_POP
if ( mAtlasScalingMode == Fixed || isPointLayer || scales.isEmpty() )
if ( mAtlasScalingMode == Fixed || scales.isEmpty() || ( isPointLayer && mAtlasScalingMode != Predefined ) )
{
// only translate, keep the original scale (i.e. width x height)
double xMin = geomCenterX - originalExtent.width() / 2.0;
Expand Down
8 changes: 8 additions & 0 deletions src/core/layout/qgslayoutitemmapgrid.cpp
Expand Up @@ -1948,6 +1948,13 @@ void QgsLayoutItemMapGrid::refreshDataDefinedProperties()
{
const QgsExpressionContext context = createExpressionContext();

// if we are changing the grid interval or offset, then we also have to mark the transform as dirty
mTransformDirty = mTransformDirty
|| mDataDefinedProperties.isActive( QgsLayoutObject::MapGridIntervalX )
|| mDataDefinedProperties.isActive( QgsLayoutObject::MapGridIntervalY )
|| mDataDefinedProperties.isActive( QgsLayoutObject::MapGridOffsetX )
|| mDataDefinedProperties.isActive( QgsLayoutObject::MapGridOffsetY );

mEvaluatedEnabled = mDataDefinedProperties.valueAsBool( QgsLayoutObject::MapGridEnabled, context, enabled() );
switch ( mGridUnit )
{
Expand Down Expand Up @@ -1975,6 +1982,7 @@ void QgsLayoutItemMapGrid::refreshDataDefinedProperties()
const double interval = QgsLayoutUtils::calculatePrettySize( minUnitsPerSeg, maxUnitsPerSeg );
mEvaluatedIntervalX = interval;
mEvaluatedIntervalY = interval;
mTransformDirty = true;
}
break;
}
Expand Down
5 changes: 2 additions & 3 deletions src/gui/layout/qgslayoutmapwidget.cpp
Expand Up @@ -947,15 +947,14 @@ void QgsLayoutMapWidget::toggleAtlasScalingOptionsByLayerType()
if ( QgsWkbTypes::geometryType( layer->wkbType() ) == QgsWkbTypes::PointGeometry )
{
//For point layers buffer setting makes no sense, so set "fixed scale" on and disable margin control
mAtlasFixedScaleRadio->setChecked( true );
if ( mMapItem->atlasScalingMode() == QgsLayoutItemMap::Auto )
mAtlasFixedScaleRadio->setChecked( true );
mAtlasMarginRadio->setEnabled( false );
mAtlasPredefinedScaleRadio->setEnabled( false );
}
else
{
//Not a point layer, so enable changes to fixed scale control
mAtlasMarginRadio->setEnabled( true );
mAtlasPredefinedScaleRadio->setEnabled( true );
}
}

Expand Down

0 comments on commit 1706e7b

Please sign in to comment.