Skip to content
Permalink
Browse files
Fix merge conflicts resulting from composer multi grid merge
  • Loading branch information
nyalldawson committed Jul 11, 2014
1 parent 4e5c286 commit 644d6fc538c3907d0def57188e31228e71c6c1d7
@@ -66,6 +66,9 @@ QgsComposerMapWidget::QgsComposerMapWidget( QgsComposerMap* composerMap ): QgsCo
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 );
@@ -76,6 +79,16 @@ QgsComposerMapWidget::QgsComposerMapWidget( QgsComposerMap* composerMap ): QgsCo
insertAnnotationDirectionEntries( mAnnotationDirectionComboBoxTop );
insertAnnotationDirectionEntries( mAnnotationDirectionComboBoxBottom );

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 );

if ( composerMap )
{
connect( composerMap, SIGNAL( itemChanged() ), this, SLOT( setGuiElementValues() ) );
@@ -689,8 +702,6 @@ void QgsComposerMapWidget::blockAllSignals( bool b )
mYMinLineEdit->blockSignals( b );
mYMaxLineEdit->blockSignals( b );
mDrawCanvasItemsCheckBox->blockSignals( b );
mFrameStyleComboBox->blockSignals( b );
mFrameWidthSpinBox->blockSignals( b );
mOverviewFrameMapComboBox->blockSignals( b );
mOverviewFrameStyleButton->blockSignals( b );
mOverviewBlendModeComboBox->blockSignals( b );
@@ -700,27 +711,20 @@ void QgsComposerMapWidget::blockAllSignals( bool b )
mAtlasMarginSpinBox->blockSignals( b );
mAtlasFixedScaleRadio->blockSignals( b );
mAtlasMarginRadio->blockSignals( b );
mGridTypeComboBox->blockSignals( b );
mIntervalXSpinBox->blockSignals( b );
mIntervalYSpinBox->blockSignals( b );
mOffsetXSpinBox->blockSignals( b );
mOffsetYSpinBox->blockSignals( b );
mCrossWidthSpinBox->blockSignals( b );
mFrameStyleComboBox->blockSignals( b );
mFrameWidthSpinBox->blockSignals( b );
mMapGridUnitComboBox->blockSignals( b );
mAnnotationFormatComboBox->blockSignals( b );
mAnnotationPositionLeftComboBox->blockSignals( b );
mAnnotationDirectionComboBoxLeft->blockSignals( b );
mAnnotationPositionRightComboBox->blockSignals( b );
mAnnotationDirectionComboBoxRight->blockSignals( b );
mAnnotationPositionTopComboBox->blockSignals( b );
mAnnotationDirectionComboBoxTop->blockSignals( b );
mAnnotationPositionBottomComboBox->blockSignals( b );
mAnnotationDirectionComboBoxBottom->blockSignals( b );
mDistanceToMapFrameSpinBox->blockSignals( b );
mCoordinatePrecisionSpinBox->blockSignals( b );
mGridBlendComboBox->blockSignals( b );
blockGridItemsSignals( b );
}

void QgsComposerMapWidget::toggleFrameControls( bool frameEnabled )
{
//set status of frame controls
mFrameWidthSpinBox->setEnabled( frameEnabled );
mGridFramePenSizeSpinBox->setEnabled( frameEnabled );
mGridFramePenColorButton->setEnabled( frameEnabled );
mGridFrameFill1ColorButton->setEnabled( frameEnabled );
mGridFrameFill2ColorButton->setEnabled( frameEnabled );
mFrameWidthLabel->setEnabled( frameEnabled );
mFramePenLabel->setEnabled( frameEnabled );
mFrameFillLabel->setEnabled( frameEnabled );
}

void QgsComposerMapWidget::on_mUpdatePreviewButton_clicked()
@@ -1229,12 +1233,12 @@ void QgsComposerMapWidget::blockGridItemsSignals( bool block )
mFrameStyleComboBox->blockSignals( block );
mFrameWidthSpinBox->blockSignals( block );
mGridLineStyleButton->blockSignals( block );
mGridTypeComboBox->blockSignals( block );
mMapGridUnitComboBox->blockSignals( block );
mGridFramePenSizeSpinBox->blockSignals( block );
mGridFramePenColorButton->blockSignals( block );
mGridFrameFill1ColorButton->blockSignals( block );
mGridFrameFill2ColorButton->blockSignals( block );
mGridBlendComboBox->blockSignals( block );

//grid annotation
mDrawAnnotationGroupBox->blockSignals( block );
@@ -1249,6 +1253,8 @@ void QgsComposerMapWidget::blockGridItemsSignals( bool block )
mAnnotationDirectionComboBoxBottom->blockSignals( block );
mDistanceToMapFrameSpinBox->blockSignals( block );
mCoordinatePrecisionSpinBox->blockSignals( block );
mAnnotationFontColorButton->blockSignals( block );
mAnnotationFontButton->blockSignals( block );
}

void QgsComposerMapWidget::setGridItems( const QgsComposerMapGrid* grid )
@@ -1287,10 +1293,12 @@ void QgsComposerMapWidget::setGridItems( const QgsComposerMapGrid* grid )
if ( gridFrameStyle == QgsComposerMap::Zebra )
{
mFrameStyleComboBox->setCurrentIndex( 1 );
toggleFrameControls( true );
}
else //NoGridFrame
{
mFrameStyleComboBox->setCurrentIndex( 0 );
toggleFrameControls( false );
}

//line style
@@ -1353,13 +1361,26 @@ void QgsComposerMapWidget::updateLineSymbolMarker( const QgsComposerMapGrid* gri
void QgsComposerMapWidget::on_mGridLineStyleButton_clicked()
{
QgsComposerMapGrid* grid = currentGrid();
QgsSymbolV2SelectorDialog d( grid->gridLineSymbol(), QgsStyleV2::defaultStyle(), 0 );
if ( d.exec() == QDialog::Accepted )
if ( !grid )
{
updateLineSymbolMarker( grid );
return;
}

mComposerMap->update();
QgsLineSymbolV2* newSymbol = dynamic_cast<QgsLineSymbolV2*>( grid->gridLineSymbol()->clone() );
QgsSymbolV2SelectorDialog d( newSymbol, QgsStyleV2::defaultStyle(), 0 );

if ( d.exec() == QDialog::Accepted )
{
mComposerMap->beginCommand( tr( "Grid line style changed" ) );
grid->setGridLineSymbol( newSymbol );
updateLineSymbolMarker();
mComposerMap->endCommand();
mComposerMap->update();
}
else
{
delete newSymbol;
}
}

void QgsComposerMapWidget::on_mIntervalXSpinBox_editingFinished()
@@ -1519,10 +1540,12 @@ void QgsComposerMapWidget::on_mFrameStyleComboBox_currentIndexChanged( const QSt
if ( text == tr( "Zebra" ) )
{
grid->setGridFrameStyle( QgsComposerMap::Zebra );
toggleFrameControls( true );
}
else //no frame
{
grid->setGridFrameStyle( QgsComposerMap::NoGridFrame );
toggleFrameControls( false );
}
mComposerMap->updateBoundingRect();
mComposerMap->update();
@@ -161,6 +161,9 @@ class QgsComposerMapWidget: public QgsComposerItemBaseWidget, private Ui::QgsCom
/**Updates the map combo box with the current composer map ids*/
void refreshMapComboBox();

/**Enables/disables grid frame related controls*/
void toggleFrameControls( bool frameEnabled );

/**Enables or disables the atlas margin and predefined scales radio depending on the atlas coverage layer type*/
void toggleAtlasScalingOptionsByLayerType();

@@ -427,7 +427,11 @@ void QgsComposerMap::paint( QPainter* painter, const QStyleOptionGraphicsItem* i
{
drawOverviewMapExtent( painter );
}
drawGrids( painter );
if ( shouldDrawPart( Grid ) &&
( mComposition->plotStyle() != QgsComposition::Preview || mPreviewMode != Rectangle ) )
{
drawGrids( painter );
}
if ( shouldDrawPart( Frame ) )
{
drawFrame( painter );
@@ -445,7 +449,7 @@ int QgsComposerMap::numberExportLayers() const
return
( hasBackground() ? 1 : 0 )
+ layersToRender().length()
+ mGrids.size()
+ 1 // for grids, if they exist
+ ( mOverviewFrameMapId != -1 ? 1 : 0 )
+ ( hasFrame() ? 1 : 0 )
+ ( isSelected() ? 1 : 0 )
@@ -486,14 +490,11 @@ bool QgsComposerMap::shouldDrawPart( PartType part ) const
return mCurrentExportLayer == idx;
}
}
/*if ( mGridEnabled )
--idx;
if ( Grid == part )
{
--idx;
if ( Grid == part )
{
return mCurrentExportLayer == idx;
}
}*/
return mCurrentExportLayer == idx;
}
if ( hasBackground() )
{
if ( Background == part )
@@ -1334,6 +1335,11 @@ bool QgsComposerMap::readXML( const QDomElement& itemElem, const QDomDocument& d
mapGrid->setCrossLength( gridElem.attribute( "crossLength", "3" ).toDouble() );
mapGrid->setGridFrameStyle(( QgsComposerMap::GridFrameStyle )gridElem.attribute( "gridFrameStyle", "0" ).toInt() );
mapGrid->setGridFrameWidth( gridElem.attribute( "gridFrameWidth", "2.0" ).toDouble() );
mapGrid->setGridFramePenSize( gridElem.attribute( "gridFramePenThickness", "0.5" ).toDouble() );
mapGrid->setGridFramePenColor( QgsSymbolLayerV2Utils::decodeColor( gridElem.attribute( "framePenColor", "0,0,0" ) ) );
mapGrid->setGridFrameFillColor1( QgsSymbolLayerV2Utils::decodeColor( gridElem.attribute( "frameFillColor1", "255,255,255,255" ) ) );
mapGrid->setGridFrameFillColor2( QgsSymbolLayerV2Utils::decodeColor( gridElem.attribute( "frameFillColor2", "0,0,0,255" ) ) );
mapGrid->setBlendMode( QgsMapRenderer::getCompositionMode(( QgsMapRenderer::BlendMode ) itemElem.attribute( "gridBlendMode", "0" ).toUInt() ) );
QDomElement gridSymbolElem = gridElem.firstChildElement( "symbol" );
QgsLineSymbolV2* lineSymbol = 0;
if ( gridSymbolElem.isNull( ) )
@@ -1370,6 +1376,8 @@ bool QgsComposerMap::readXML( const QDomElement& itemElem, const QDomDocument& d
QFont annotationFont;
annotationFont.fromString( annotationElem.attribute( "font", "" ) );
mapGrid->setGridAnnotationFont( annotationFont );
mapGrid->setGridAnnotationFontColor( QgsSymbolLayerV2Utils::decodeColor( itemElem.attribute( "fontColor", "0,0,0,255" ) ) );

mapGrid->setGridAnnotationPrecision( annotationElem.attribute( "precision", "3" ).toInt() );
}
mGrids.append( mapGrid );
@@ -1804,22 +1812,20 @@ QRectF QgsComposerMap::boundingRect() const
void QgsComposerMap::updateBoundingRect()
{
QRectF rectangle = rect();
double extension = 0;
double frameExtension = mFrame ? pen().widthF() / 2.0 : 0.0;
double maxGridExtension = 0;

QList< QgsComposerMapGrid* >::const_iterator it = mGrids.constBegin();
for ( ; it != mGrids.constEnd(); ++it )
{
double currentExtension = ( *it )->maxExtension();
if ( currentExtension > extension )
{
extension = currentExtension;
}
maxGridExtension = qMax( maxGridExtension, ( *it )->maxExtension() );
}
double maxExtension = qMax( frameExtension, maxGridExtension );

rectangle.setLeft( rectangle.left() - extension );
rectangle.setRight( rectangle.right() + extension );
rectangle.setTop( rectangle.top() - extension );
rectangle.setBottom( rectangle.bottom() + extension );
rectangle.setLeft( rectangle.left() - maxExtension );
rectangle.setRight( rectangle.right() + maxExtension );
rectangle.setTop( rectangle.top() - maxExtension );
rectangle.setBottom( rectangle.bottom() + maxExtension );
if ( rectangle != mCurrentRectangle )
{
prepareGeometryChange();

0 comments on commit 644d6fc

Please sign in to comment.