void QgsAtlasCompositionWidget::on_mApplyConfigButton_clicked() { QgsAtlasComposition* atlasMap = &mComposition->atlasComposition(); if ( !atlasMap ) { return; } QgsVectorLayer* vl = dynamic_cast<QgsVectorLayer*>( mAtlasCoverageLayerComboBox->currentLayer() ); if ( !vl ) { atlasMap->setCoverageLayer( 0 ); } else { atlasMap->setCoverageLayer( vl ); } atlasMap->setSortFeatures( mAtlasSortFeatureCheckBox->isChecked() ); atlasMap->setSortKeyAttributeName( mAtlasSortFeatureKeyComboBox->currentField() ); Qt::ArrowType at = mAtlasSortFeatureDirectionButton->arrowType(); at = ( at == Qt::UpArrow ) ? Qt::DownArrow : Qt::UpArrow; atlasMap->setSortAscending( at == Qt::UpArrow ); atlasMap->setFilterFeatures( mAtlasFeatureFilterCheckBox->isChecked() ); atlasMap->setFeatureFilter( mAtlasFeatureFilterEdit->text() ); atlasMap->setPageNameExpression( mPageNameWidget->currentField() ); atlasMap->setHideCoverage( mAtlasHideCoverageCheckBox->isChecked() ); updateAtlasFeatures(); }
void QgsAtlasCompositionWidget::on_mAtlasFeatureFilterButton_clicked() { QgsAtlasComposition* atlasMap = &mComposition->atlasComposition(); QgsVectorLayer* vl = dynamic_cast<QgsVectorLayer*>( mAtlasCoverageLayerComboBox->currentLayer() ); if ( !atlasMap || !vl ) { return; } QScopedPointer<QgsExpressionContext> context( mComposition->createExpressionContext() ); QgsExpressionBuilderDialog exprDlg( vl, mAtlasFeatureFilterEdit->text(), this, "generic", *context ); exprDlg.setWindowTitle( tr( "Expression based filter" ) ); if ( exprDlg.exec() == QDialog::Accepted ) { QString expression = exprDlg.expressionText(); if ( !expression.isEmpty() ) { mAtlasFeatureFilterEdit->setText( expression ); atlasMap->setFeatureFilter( mAtlasFeatureFilterEdit->text() ); updateAtlasFeatures(); } } }
void QgsLayoutAtlasWidget::mAtlasFeatureFilterButton_clicked() { QgsVectorLayer *vl = dynamic_cast<QgsVectorLayer *>( mAtlasCoverageLayerComboBox->currentLayer() ); if ( !vl ) { return; } QgsExpressionContext context = mLayout->createExpressionContext(); QgsExpressionBuilderDialog exprDlg( vl, mAtlasFeatureFilterEdit->text(), this, QStringLiteral( "generic" ), context ); exprDlg.setWindowTitle( tr( "Expression Based Filter" ) ); if ( exprDlg.exec() == QDialog::Accepted ) { QString expression = exprDlg.expressionText(); if ( !expression.isEmpty() ) { mAtlasFeatureFilterEdit->setText( expression ); QString error; mLayout->undoStack()->beginCommand( mAtlas, tr( "Change Atlas Filter" ) ); if ( !mAtlas->setFilterExpression( mAtlasFeatureFilterEdit->text(), error ) ) { //expression could not be set mMessageBar->pushWarning( tr( "Atlas" ), tr( "Could not set filter expression to '%1'.\nParser error:\n%2" ) .arg( mAtlasFeatureFilterEdit->text(), error ) ); } mLayout->undoStack()->endCommand(); updateAtlasFeatures(); } } }
void QgsLayoutAtlasWidget::changesSortFeatureExpression( const QString &expression, bool ) { mLayout->undoStack()->beginCommand( mAtlas, tr( "Change Atlas Sort" ) ); mAtlas->setSortExpression( expression ); mLayout->undoStack()->endCommand(); updateAtlasFeatures(); }
void QgsAtlasCompositionWidget::changesSortFeatureField( QString fieldName ) { QgsAtlasComposition* atlasMap = &mComposition->atlasComposition(); if ( !atlasMap ) { return; } atlasMap->setSortKeyAttributeName( fieldName ); updateAtlasFeatures(); }
void QgsAtlasCompositionWidget::on_mAtlasFeatureFilterEdit_editingFinished() { QgsAtlasComposition* atlasMap = &mComposition->atlasComposition(); if ( !atlasMap ) { return; } atlasMap->setFeatureFilter( mAtlasFeatureFilterEdit->text() ); updateAtlasFeatures(); }
void QgsLayoutAtlasWidget::mAtlasSortFeatureDirectionButton_clicked() { Qt::ArrowType at = mAtlasSortFeatureDirectionButton->arrowType(); at = ( at == Qt::UpArrow ) ? Qt::DownArrow : Qt::UpArrow; mAtlasSortFeatureDirectionButton->setArrowType( at ); mLayout->undoStack()->beginCommand( mAtlas, tr( "Change Atlas Sort" ) ); mAtlas->setSortAscending( at == Qt::UpArrow ); mLayout->undoStack()->endCommand(); updateAtlasFeatures(); }
void QgsAtlasCompositionWidget::on_mAtlasSortFeatureDirectionButton_clicked() { Qt::ArrowType at = mAtlasSortFeatureDirectionButton->arrowType(); at = ( at == Qt::UpArrow ) ? Qt::DownArrow : Qt::UpArrow; mAtlasSortFeatureDirectionButton->setArrowType( at ); QgsAtlasComposition* atlasMap = &mComposition->atlasComposition(); if ( !atlasMap ) { return; } atlasMap->setSortAscending( at == Qt::UpArrow ); updateAtlasFeatures(); }
void QgsLayoutAtlasWidget::mAtlasFeatureFilterEdit_editingFinished() { QString error; mLayout->undoStack()->beginCommand( mAtlas, tr( "Change Atlas Filter" ) ); if ( !mAtlas->setFilterExpression( mAtlasFeatureFilterEdit->text(), error ) ) { //expression could not be set mMessageBar->pushWarning( tr( "Atlas" ), tr( "Could not set filter expression to '%1'.\nParser error:\n%2" ) .arg( mAtlasFeatureFilterEdit->text(), error ) ); } mLayout->undoStack()->endCommand(); updateAtlasFeatures(); }
void QgsLayoutAtlasWidget::changeCoverageLayer( QgsMapLayer *layer ) { QgsVectorLayer *vl = dynamic_cast<QgsVectorLayer *>( layer ); mLayout->undoStack()->beginCommand( mAtlas, tr( "Change Atlas Layer" ) ); mLayout->reportContext().setLayer( vl ); if ( !vl ) { mAtlas->setCoverageLayer( nullptr ); } else { mAtlas->setCoverageLayer( vl ); updateAtlasFeatures(); } mLayout->undoStack()->endCommand(); }
void QgsLayoutAtlasWidget::mAtlasFeatureFilterCheckBox_stateChanged( int state ) { if ( state == Qt::Checked ) { mAtlasFeatureFilterEdit->setEnabled( true ); mAtlasFeatureFilterButton->setEnabled( true ); } else { mAtlasFeatureFilterEdit->setEnabled( false ); mAtlasFeatureFilterButton->setEnabled( false ); } mLayout->undoStack()->beginCommand( mAtlas, tr( "Change Atlas Filter" ) ); mAtlas->setFilterFeatures( state == Qt::Checked ); mLayout->undoStack()->endCommand(); updateAtlasFeatures(); }
void QgsLayoutAtlasWidget::mAtlasSortFeatureCheckBox_stateChanged( int state ) { if ( state == Qt::Checked ) { mAtlasSortFeatureDirectionButton->setEnabled( true ); mAtlasSortExpressionWidget->setEnabled( true ); } else { mAtlasSortFeatureDirectionButton->setEnabled( false ); mAtlasSortExpressionWidget->setEnabled( false ); } mLayout->undoStack()->beginCommand( mAtlas, tr( "Toggle Atlas Sorting" ) ); mAtlas->setSortFeatures( state == Qt::Checked ); mLayout->undoStack()->endCommand(); updateAtlasFeatures(); }
void QgsAtlasCompositionWidget::changeCoverageLayer( QgsMapLayer *layer ) { QgsAtlasComposition* atlasMap = &mComposition->atlasComposition(); if ( !atlasMap ) { return; } QgsVectorLayer* vl = dynamic_cast<QgsVectorLayer*>( layer ); if ( !vl ) { atlasMap->setCoverageLayer( 0 ); } else { atlasMap->setCoverageLayer( vl ); updateAtlasFeatures(); } }
void QgsAtlasCompositionWidget::on_mAtlasFeatureFilterButton_clicked() { QgsAtlasComposition* atlasMap = &mComposition->atlasComposition(); if ( !atlasMap || !atlasMap->coverageLayer() ) { return; } QgsExpressionBuilderDialog exprDlg( atlasMap->coverageLayer(), mAtlasFeatureFilterEdit->text(), this ); exprDlg.setWindowTitle( tr( "Expression based filter" ) ); if ( exprDlg.exec() == QDialog::Accepted ) { QString expression = exprDlg.expressionText(); if ( !expression.isEmpty() ) { mAtlasFeatureFilterEdit->setText( expression ); atlasMap->setFeatureFilter( mAtlasFeatureFilterEdit->text() ); updateAtlasFeatures(); } } }
void QgsAtlasCompositionWidget::on_mAtlasFeatureFilterCheckBox_stateChanged( int state ) { QgsAtlasComposition* atlasMap = &mComposition->atlasComposition(); if ( !atlasMap ) { return; } if ( state == Qt::Checked ) { mAtlasFeatureFilterEdit->setEnabled( true ); mAtlasFeatureFilterButton->setEnabled( true ); } else { mAtlasFeatureFilterEdit->setEnabled( false ); mAtlasFeatureFilterButton->setEnabled( false ); } atlasMap->setFilterFeatures( state == Qt::Checked ); updateAtlasFeatures(); }
void QgsAtlasCompositionWidget::on_mAtlasSortFeatureCheckBox_stateChanged( int state ) { QgsAtlasComposition* atlasMap = &mComposition->atlasComposition(); if ( !atlasMap ) { return; } if ( state == Qt::Checked ) { mAtlasSortFeatureDirectionButton->setEnabled( true ); mAtlasSortFeatureKeyComboBox->setEnabled( true ); } else { mAtlasSortFeatureDirectionButton->setEnabled( false ); mAtlasSortFeatureKeyComboBox->setEnabled( false ); } atlasMap->setSortFeatures( state == Qt::Checked ); updateAtlasFeatures(); }