コード例 #1
0
void QgsComposerPictureWidget::on_mPictureExpressionButton_clicked()
{
  if ( !mPicture )
  {
    return;
  }

  QgsVectorLayer* vl = 0;
  QgsComposition* composition = mPicture->composition();

  if ( composition )
  {
    QgsAtlasComposition* atlasMap = &composition->atlasComposition();
    if ( atlasMap )
    {
      vl = atlasMap->coverageLayer();
    }
  }

  QgsExpressionBuilderDialog exprDlg( vl, mPictureExpressionLineEdit->text(), this );
  exprDlg.setWindowTitle( tr( "Expression based image path" ) );
  if ( exprDlg.exec() == QDialog::Accepted )
  {
    QString expression =  exprDlg.expressionText();
    if ( !expression.isEmpty() )
    {
      mPictureExpressionLineEdit->setText( expression );
      setPictureExpression();
    }
  }
}
コード例 #2
0
QgsAtlasComposition* QgsComposerItemBaseWidget::atlasComposition() const
{
  if ( !mComposerObject )
  {
    return 0;
  }

  QgsComposition* composition = mComposerObject->composition();

  if ( !composition )
  {
    return 0;
  }

  return &composition->atlasComposition();
}
コード例 #3
0
void QgsComposerMapWidget::updateMapForAtlas()
{
  //update map if in atlas preview mode
  QgsComposition* composition = mComposerMap->composition();
  if ( !composition )
  {
    return;
  }
  if ( composition->atlasMode() == QgsComposition::AtlasOff )
  {
    return;
  }

  //update atlas based extent for map
  QgsAtlasComposition* atlas = &composition->atlasComposition();
  atlas->prepareMap( mComposerMap );

  //redraw map
  mComposerMap->cache();
  mComposerMap->update();
}
コード例 #4
0
ファイル: qgscomposermapwidget.cpp プロジェクト: Asjad27/QGIS
void QgsComposerMapWidget::toggleAtlasScalingOptionsByLayerType()
{
  if ( !mComposerMap )
  {
    return;
  }

  //get composition
  QgsComposition* composition = mComposerMap->composition();
  if ( !composition )
  {
    return;
  }

  QgsAtlasComposition* atlas = &composition->atlasComposition();

  QgsVectorLayer* coverageLayer = atlas->coverageLayer();
  if ( !coverageLayer )
  {
    return;
  }

  switch ( atlas->coverageLayer()->wkbType() )
  {
    case QGis::WKBPoint:
    case QGis::WKBPoint25D:
    case QGis::WKBMultiPoint:
    case QGis::WKBMultiPoint25D:
      //For point layers buffer setting makes no sense, so set "fixed scale" on and disable margin control
      mAtlasFixedScaleRadio->setChecked( true );
      mAtlasMarginRadio->setEnabled( false );
      mAtlasPredefinedScaleRadio->setEnabled( false );
      break;
    default:
      //Not a point layer, so enable changes to fixed scale control
      mAtlasMarginRadio->setEnabled( true );
      mAtlasPredefinedScaleRadio->setEnabled( true );
  }
}
コード例 #5
0
QgsComposerMapWidget::QgsComposerMapWidget( QgsComposerMap* composerMap ): QWidget(), mComposerMap( composerMap )
{
  setupUi( this );

  //add widget for general composer item properties
  QgsComposerItemWidget* itemPropertiesWidget = new QgsComposerItemWidget( this, composerMap );
  mainLayout->addWidget( itemPropertiesWidget );

  mScaleLineEdit->setValidator( new QDoubleValidator( mScaleLineEdit ) );

  mXMinLineEdit->setValidator( new QDoubleValidator( mXMinLineEdit ) );
  mXMaxLineEdit->setValidator( new QDoubleValidator( mXMaxLineEdit ) );
  mYMinLineEdit->setValidator( new QDoubleValidator( mYMinLineEdit ) );
  mYMaxLineEdit->setValidator( new QDoubleValidator( mYMaxLineEdit ) );

  blockAllSignals( true );
  mPreviewModeComboBox->insertItem( 0, tr( "Cache" ) );
  mPreviewModeComboBox->insertItem( 1, tr( "Render" ) );
  mPreviewModeComboBox->insertItem( 2, tr( "Rectangle" ) );

  mGridTypeComboBox->insertItem( 0, tr( "Solid" ) );
  mGridTypeComboBox->insertItem( 1, tr( "Cross" ) );

  mAnnotationFormatComboBox->insertItem( 0, tr( "Decimal" ) );
  mAnnotationFormatComboBox->insertItem( 1, tr( "DegreeMinute" ) );
  mAnnotationFormatComboBox->insertItem( 2, tr( "DegreeMinuteSecond" ) );

  mAnnotationFontColorButton->setColorDialogTitle( tr( "Select font color" ) );
  mAnnotationFontColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );

  insertAnnotationPositionEntries( mAnnotationPositionLeftComboBox );
  insertAnnotationPositionEntries( mAnnotationPositionRightComboBox );
  insertAnnotationPositionEntries( mAnnotationPositionTopComboBox );
  insertAnnotationPositionEntries( mAnnotationPositionBottomComboBox );

  insertAnnotationDirectionEntries( mAnnotationDirectionComboBoxLeft );
  insertAnnotationDirectionEntries( mAnnotationDirectionComboBoxRight );
  insertAnnotationDirectionEntries( mAnnotationDirectionComboBoxTop );
  insertAnnotationDirectionEntries( mAnnotationDirectionComboBoxBottom );

  mFrameStyleComboBox->insertItem( 0, tr( "No frame" ) );
  mFrameStyleComboBox->insertItem( 1, tr( "Zebra" ) );

  mGridFramePenColorButton->setColorDialogTitle( tr( "Select grid frame color" ) );
  mGridFramePenColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
  mGridFrameFill1ColorButton->setColorDialogTitle( tr( "Select grid frame fill color" ) );
  mGridFrameFill1ColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
  mGridFrameFill2ColorButton->setColorDialogTitle( tr( "Select grid frame fill color" ) );
  mGridFrameFill2ColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );

  //set initial state of frame style controls
  toggleFrameControls( false );

  connect( mGridCheckBox, SIGNAL( toggled( bool ) ),
           mDrawAnnotationCheckableGroupBox, SLOT( setEnabled( bool ) ) );

  connect( mAtlasCheckBox, SIGNAL( toggled( bool ) ), this, SLOT( atlasToggled( bool ) ) );

  if ( composerMap )
  {
    connect( composerMap, SIGNAL( itemChanged() ), this, SLOT( setGuiElementValues() ) );

    //get composition
    QgsComposition* composition = mComposerMap->composition();
    if ( composition )
    {
      QgsAtlasComposition* atlas = &composition->atlasComposition();
      connect( atlas, SIGNAL( coverageLayerChanged( QgsVectorLayer* ) ),
               this, SLOT( atlasLayerChanged( QgsVectorLayer* ) ) );
      connect( atlas, SIGNAL( toggled( bool ) ), this, SLOT( compositionAtlasToggled( bool ) ) );
    }
  }

  updateOverviewSymbolMarker();
  updateLineSymbolMarker();

  updateGuiElements();
  blockAllSignals( false );
}