Skip to content
Permalink
Browse files

rotated ticks folloup : all the others

  • Loading branch information
olivierdalang authored and nyalldawson committed Oct 7, 2020
1 parent a85b6c5 commit f8d7743625c4c2f72e039001d1966119373d601b
@@ -1877,13 +1877,13 @@ bool QgsLayoutItemMapGrid::shouldShowDivisionForSide( QgsLayoutItemMapGrid::Anno
switch ( side )
{
case QgsLayoutItemMapGrid::Left:
return testFrameSideFlag( QgsLayoutItemMapGrid::FrameLeft ) && shouldShowForDisplayMode( coordinate, mLeftFrameDivisions );
return testFrameSideFlag( QgsLayoutItemMapGrid::FrameLeft ) && shouldShowForDisplayMode( coordinate, mEvaluatedLeftFrameDivisions );
case QgsLayoutItemMapGrid::Right:
return testFrameSideFlag( QgsLayoutItemMapGrid::FrameRight ) && shouldShowForDisplayMode( coordinate, mRightFrameDivisions );
return testFrameSideFlag( QgsLayoutItemMapGrid::FrameRight ) && shouldShowForDisplayMode( coordinate, mEvaluatedRightFrameDivisions );
case QgsLayoutItemMapGrid::Top:
return testFrameSideFlag( QgsLayoutItemMapGrid::FrameTop ) && shouldShowForDisplayMode( coordinate, mTopFrameDivisions );
return testFrameSideFlag( QgsLayoutItemMapGrid::FrameTop ) && shouldShowForDisplayMode( coordinate, mEvaluatedTopFrameDivisions );
case QgsLayoutItemMapGrid::Bottom:
return testFrameSideFlag( QgsLayoutItemMapGrid::FrameBottom ) && shouldShowForDisplayMode( coordinate, mBottomFrameDivisions );
return testFrameSideFlag( QgsLayoutItemMapGrid::FrameBottom ) && shouldShowForDisplayMode( coordinate, mEvaluatedBottomFrameDivisions );
}
return false; // no warnings
}
@@ -1895,11 +1895,11 @@ bool QgsLayoutItemMapGrid::shouldShowAnnotationForSide( QgsLayoutItemMapGrid::An
case QgsLayoutItemMapGrid::Left:
return shouldShowForDisplayMode( coordinate, mEvaluatedLeftGridAnnotationDisplay );
case QgsLayoutItemMapGrid::Right:
return shouldShowForDisplayMode( coordinate, mRightGridAnnotationDisplay );
return shouldShowForDisplayMode( coordinate, mEvaluatedRightGridAnnotationDisplay );
case QgsLayoutItemMapGrid::Top:
return shouldShowForDisplayMode( coordinate, mTopGridAnnotationDisplay );
return shouldShowForDisplayMode( coordinate, mEvaluatedTopGridAnnotationDisplay );
case QgsLayoutItemMapGrid::Bottom:
return shouldShowForDisplayMode( coordinate, mBottomGridAnnotationDisplay );
return shouldShowForDisplayMode( coordinate, mEvaluatedBottomGridAnnotationDisplay );
}
return false; // no warnings
}
@@ -1911,7 +1911,7 @@ bool QgsLayoutItemMapGrid::shouldShowForDisplayMode( QgsLayoutItemMapGrid::Annot
|| ( mode == QgsLayoutItemMapGrid::LongitudeOnly && coordinate == QgsLayoutItemMapGrid::Longitude );
}

/*

QgsLayoutItemMapGrid::DisplayMode gridAnnotationDisplayModeFromDD(QString ddValue) {
if( ddValue == QStringLiteral("x_only") )
return QgsLayoutItemMapGrid::LatitudeOnly;
@@ -1922,7 +1922,7 @@ QgsLayoutItemMapGrid::DisplayMode gridAnnotationDisplayModeFromDD(QString ddValu
else // if ( ddValue == QStringLiteral("all") )
return QgsLayoutItemMapGrid::ShowAll;
}
*/


void QgsLayoutItemMapGrid::refreshDataDefinedProperties()
{
@@ -1966,16 +1966,15 @@ void QgsLayoutItemMapGrid::refreshDataDefinedProperties()
mEvaluatedAnnotationFrameDistance = mDataDefinedProperties.valueAsDouble( QgsLayoutObject::MapGridLabelDistance, context, mAnnotationFrameDistance );
mEvaluatedCrossLength = mDataDefinedProperties.valueAsDouble( QgsLayoutObject::MapGridCrossSize, context, mCrossLength );
mEvaluatedGridFrameLineThickness = mDataDefinedProperties.valueAsDouble( QgsLayoutObject::MapGridFrameLineThickness, context, mGridFramePenThickness );
QString leftGridAnnotationDisplayStr = mDataDefinedProperties.valueAsString( QgsLayoutObject::MapGridAnnotationDisplayLeft, context, QStringLiteral("all") );
QgsMessageLog::logMessage(QStringLiteral("DEBUG MAPGRID : ") + leftGridAnnotationDisplayStr, QStringLiteral("DEBUGDEBUG"));
if( leftGridAnnotationDisplayStr == QStringLiteral("x_only") )
mEvaluatedLeftGridAnnotationDisplay = LatitudeOnly;
else if ( leftGridAnnotationDisplayStr == QStringLiteral("y_only") )
mEvaluatedLeftGridAnnotationDisplay = LongitudeOnly;
else if ( leftGridAnnotationDisplayStr == QStringLiteral("disabled") )
mEvaluatedLeftGridAnnotationDisplay = HideAll;
else // if ( leftGridAnnotationDisplayStr == QStringLiteral("all") )
mEvaluatedLeftGridAnnotationDisplay = ShowAll;
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") ) );

}

double QgsLayoutItemMapGrid::mapWidth() const
@@ -1187,6 +1187,13 @@ class CORE_EXPORT QgsLayoutItemMapGrid : public QgsLayoutItemMapItem
double mEvaluatedCrossLength = 0;
double mEvaluatedGridFrameLineThickness = 0;
DisplayMode mEvaluatedLeftGridAnnotationDisplay = QgsLayoutItemMapGrid::ShowAll;
DisplayMode mEvaluatedRightGridAnnotationDisplay = QgsLayoutItemMapGrid::ShowAll;
DisplayMode mEvaluatedTopGridAnnotationDisplay = QgsLayoutItemMapGrid::ShowAll;
DisplayMode mEvaluatedBottomGridAnnotationDisplay = QgsLayoutItemMapGrid::ShowAll;
DisplayMode mEvaluatedLeftFrameDivisions = QgsLayoutItemMapGrid::ShowAll;
DisplayMode mEvaluatedRightFrameDivisions = QgsLayoutItemMapGrid::ShowAll;
DisplayMode mEvaluatedTopFrameDivisions = QgsLayoutItemMapGrid::ShowAll;
DisplayMode mEvaluatedBottomFrameDivisions = QgsLayoutItemMapGrid::ShowAll;

/**
* Updates the grid lines annotation positions
@@ -79,6 +79,13 @@ void QgsLayoutObject::initPropertyDefinitions()
{ QgsLayoutObject::MapGridFrameMargin, QgsPropertyDefinition( "dataDefinedMapGridFrameMargin", QObject::tr( "Grid frame margin" ), QgsPropertyDefinition::DoublePositive ) },
{ QgsLayoutObject::MapGridLabelDistance, QgsPropertyDefinition( "dataDefinedMapGridLabelDistance", QObject::tr( "Grid label distance" ), QgsPropertyDefinition::DoublePositive ) },
{ QgsLayoutObject::MapGridAnnotationDisplayLeft, QgsPropertyDefinition( "dataDefinedMapGridAnnotationDisplayLeft", QgsPropertyDefinition::DataTypeString, QObject::tr( "Map grid annotation display left" ), QObject::tr( "string " ) + QLatin1String( "[<b>all</b>|<b>x_only</b>|<b>y_only</b>|<b>disabled</b>]" ) ) },
{ QgsLayoutObject::MapGridAnnotationDisplayRight, QgsPropertyDefinition( "dataDefinedMapGridAnnotationDisplayRight", QgsPropertyDefinition::DataTypeString, QObject::tr( "Map grid annotation display right" ), QObject::tr( "string " ) + QLatin1String( "[<b>all</b>|<b>x_only</b>|<b>y_only</b>|<b>disabled</b>]" ) ) },
{ QgsLayoutObject::MapGridAnnotationDisplayTop, QgsPropertyDefinition( "dataDefinedMapGridAnnotationDisplayTop", QgsPropertyDefinition::DataTypeString, QObject::tr( "Map grid annotation display top" ), QObject::tr( "string " ) + QLatin1String( "[<b>all</b>|<b>x_only</b>|<b>y_only</b>|<b>disabled</b>]" ) ) },
{ QgsLayoutObject::MapGridAnnotationDisplayBottom, QgsPropertyDefinition( "dataDefinedMapGridAnnotationDisplayBottom", QgsPropertyDefinition::DataTypeString, QObject::tr( "Map grid annotation display bottom" ), QObject::tr( "string " ) + QLatin1String( "[<b>all</b>|<b>x_only</b>|<b>y_only</b>|<b>disabled</b>]" ) ) },
{ QgsLayoutObject::MapGridFrameDivisionsLeft, QgsPropertyDefinition( "dataDefinedMapGridFrameDivisionsLeft", QgsPropertyDefinition::DataTypeString, QObject::tr( "Map grid frme divisions display left" ), QObject::tr( "string " ) + QLatin1String( "[<b>all</b>|<b>x_only</b>|<b>y_only</b>|<b>disabled</b>]" ) ) },
{ QgsLayoutObject::MapGridFrameDivisionsRight, QgsPropertyDefinition( "dataDefinedMapGridFrameDivisionsRight", QgsPropertyDefinition::DataTypeString, QObject::tr( "Map grid frme divisions display right" ), QObject::tr( "string " ) + QLatin1String( "[<b>all</b>|<b>x_only</b>|<b>y_only</b>|<b>disabled</b>]" ) ) },
{ QgsLayoutObject::MapGridFrameDivisionsTop, QgsPropertyDefinition( "dataDefinedMapGridFrameDivisionsTop", QgsPropertyDefinition::DataTypeString, QObject::tr( "Map grid frme divisions display top" ), QObject::tr( "string " ) + QLatin1String( "[<b>all</b>|<b>x_only</b>|<b>y_only</b>|<b>disabled</b>]" ) ) },
{ QgsLayoutObject::MapGridFrameDivisionsBottom, QgsPropertyDefinition( "dataDefinedMapGridFrameDivisionsBottom", QgsPropertyDefinition::DataTypeString, QObject::tr( "Map grid frme divisions display bottom" ), QObject::tr( "string " ) + QLatin1String( "[<b>all</b>|<b>x_only</b>|<b>y_only</b>|<b>disabled</b>]" ) ) },
{ QgsLayoutObject::PictureSource, QgsPropertyDefinition( "dataDefinedSource", QObject::tr( "Picture source (URL)" ), QgsPropertyDefinition::String ) },
{ QgsLayoutObject::SourceUrl, QgsPropertyDefinition( "dataDefinedSourceUrl", QObject::tr( "Source URL" ), QgsPropertyDefinition::String ) },
{ QgsLayoutObject::PictureSvgBackgroundColor, QgsPropertyDefinition( "dataDefinedSvgBackgroundColor", QObject::tr( "SVG background color" ), QgsPropertyDefinition::ColorWithAlpha ) },
@@ -175,6 +175,13 @@ class CORE_EXPORT QgsLayoutObject: public QObject, public QgsExpressionContextGe
MapGridCrossSize, //!< Map grid cross size
MapGridFrameLineThickness, //!< Map grid frame line thickness
MapGridAnnotationDisplayLeft, //!< Map annotation display left
MapGridAnnotationDisplayRight, //!< Map annotation display right
MapGridAnnotationDisplayTop, //!< Map annotation display top
MapGridAnnotationDisplayBottom, //!< Map annotation display bottom
MapGridFrameDivisionsLeft, //!< Map frame division display left
MapGridFrameDivisionsRight, //!< Map frame division display right
MapGridFrameDivisionsTop, //!< Map frame division display top
MapGridFrameDivisionsBottom, //!< Map frame division display bottom
//composer picture
PictureSource, //!< Picture source url
PictureSvgBackgroundColor, //!< SVG background color
@@ -190,6 +190,13 @@ QgsLayoutMapGridWidget::QgsLayoutMapGridWidget( QgsLayoutItemMapGrid *mapGrid, Q
registerDataDefinedButton( mCrossWidthDDBtn, QgsLayoutObject::MapGridCrossSize );
registerDataDefinedButton( mFrameLineThicknessDDBtn, QgsLayoutObject::MapGridFrameLineThickness );
registerDataDefinedButton( mAnnotationDisplayLeftDDBtn, QgsLayoutObject::MapGridAnnotationDisplayLeft );
registerDataDefinedButton( mAnnotationDisplayRightDDBtn, QgsLayoutObject::MapGridAnnotationDisplayRight );
registerDataDefinedButton( mAnnotationDisplayTopDDBtn, QgsLayoutObject::MapGridAnnotationDisplayTop );
registerDataDefinedButton( mAnnotationDisplayBottomDDBtn, QgsLayoutObject::MapGridAnnotationDisplayBottom );
registerDataDefinedButton( mFrameDivisionsLeftDDBtn, QgsLayoutObject::MapGridFrameDivisionsLeft );
registerDataDefinedButton( mFrameDivisionsRightDDBtn, QgsLayoutObject::MapGridFrameDivisionsRight );
registerDataDefinedButton( mFrameDivisionsTopDDBtn, QgsLayoutObject::MapGridFrameDivisionsTop );
registerDataDefinedButton( mFrameDivisionsBottomDDBtn, QgsLayoutObject::MapGridFrameDivisionsBottom );

updateGuiElements();

@@ -225,6 +232,13 @@ void QgsLayoutMapGridWidget::populateDataDefinedButtons()
updateDataDefinedButton( mCrossWidthDDBtn );
updateDataDefinedButton( mFrameLineThicknessDDBtn );
updateDataDefinedButton( mAnnotationDisplayLeftDDBtn );
updateDataDefinedButton( mAnnotationDisplayRightDDBtn );
updateDataDefinedButton( mAnnotationDisplayTopDDBtn );
updateDataDefinedButton( mAnnotationDisplayBottomDDBtn );
updateDataDefinedButton( mFrameDivisionsLeftDDBtn );
updateDataDefinedButton( mFrameDivisionsRightDDBtn );
updateDataDefinedButton( mFrameDivisionsTopDDBtn );
updateDataDefinedButton( mFrameDivisionsBottomDDBtn );
}

void QgsLayoutMapGridWidget::setGuiElementValues()

0 comments on commit f8d7743

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