コード例 #1
0
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();
}
コード例 #2
0
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();
  }
}