Skip to content

Commit

Permalink
Port possibility to have several grids / crs in composer map from QGI…
Browse files Browse the repository at this point in the history
…S Enterprise to master
  • Loading branch information
mhugent committed Jul 8, 2014
1 parent e1385c1 commit a09fbc0
Show file tree
Hide file tree
Showing 10 changed files with 2,533 additions and 801 deletions.
1,065 changes: 613 additions & 452 deletions src/app/composer/qgscomposermapwidget.cpp

Large diffs are not rendered by default.

63 changes: 35 additions & 28 deletions src/app/composer/qgscomposermapwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,21 +56,39 @@ class QgsComposerMapWidget: public QgsComposerItemBaseWidget, private Ui::QgsCom
void on_mYMinLineEdit_editingFinished();
void on_mYMaxLineEdit_editingFinished();

void on_mAtlasMarginRadio_toggled( bool checked );

void on_mAtlasCheckBox_toggled( bool checked );
void on_mAtlasMarginSpinBox_valueChanged( int value );
void on_mAtlasFixedScaleRadio_toggled( bool checked );
void on_mAtlasPredefinedScaleRadio_toggled( bool checked );

void on_mAddGridPushButton_clicked();
void on_mRemoveGridPushButton_clicked();
void on_mGridUpButton_clicked();
void on_mGridDownButton_clicked();

QgsComposerMapGrid* currentGrid();
void on_mGridCheckBox_toggled( bool state );
void on_mGridListWidget_currentItemChanged( QListWidgetItem* current, QListWidgetItem* previous );
void on_mGridListWidget_itemChanged( QListWidgetItem* item );
void setGridItemsEnabled( bool enabled );
void setGridItems( const QgsComposerMapGrid* grid );
void blockGridItemsSignals( bool block );
void updateLineSymbolMarker( const QgsComposerMapGrid* grid );
void on_mGridLineStyleButton_clicked();
void on_mIntervalXSpinBox_editingFinished();
void on_mIntervalYSpinBox_editingFinished();
void on_mOffsetXSpinBox_editingFinished();
void on_mOffsetYSpinBox_editingFinished();
void on_mGridLineStyleButton_clicked();
void on_mOffsetXSpinBox_valueChanged( double value );
void on_mOffsetYSpinBox_valueChanged( double value );
void on_mCrossWidthSpinBox_valueChanged( double val );
void on_mFrameWidthSpinBox_valueChanged( double val );
void on_mFrameStyleComboBox_currentIndexChanged( const QString& text );
void on_mGridTypeComboBox_currentIndexChanged( const QString& text );
void on_mCrossWidthSpinBox_valueChanged( double d );
void on_mGridBlendComboBox_currentIndexChanged( int index );
void on_mAnnotationFontButton_clicked();
void on_mAnnotationFontColorButton_colorChanged( const QColor& newFontColor );
void on_mDistanceToMapFrameSpinBox_valueChanged( double d );

void on_mAnnotationFormatComboBox_currentIndexChanged( int index );
void on_mMapGridCRSButton_clicked();
void on_mMapGridUnitComboBox_currentIndexChanged( const QString& text );

void on_mDrawAnnotationGroupBox_toggled( bool state );
//annotation position
void on_mAnnotationPositionLeftComboBox_currentIndexChanged( const QString& text );
void on_mAnnotationPositionRightComboBox_currentIndexChanged( const QString& text );
Expand All @@ -83,22 +101,11 @@ class QgsComposerMapWidget: public QgsComposerItemBaseWidget, private Ui::QgsCom
void on_mAnnotationDirectionComboBoxTop_currentIndexChanged( const QString& text );
void on_mAnnotationDirectionComboBoxBottom_currentIndexChanged( const QString& text );

void on_mDrawAnnotationCheckableGroupBox_toggled( bool state );
void on_mAnnotationFormatComboBox_currentIndexChanged( int index );
void on_mCoordinatePrecisionSpinBox_valueChanged( int value );

void on_mFrameStyleComboBox_currentIndexChanged( const QString& text );
void on_mFrameWidthSpinBox_valueChanged( double d );
void on_mGridFramePenSizeSpinBox_valueChanged( double d );
void on_mGridFramePenColorButton_colorChanged( const QColor& newColor );
void on_mGridFrameFill1ColorButton_colorChanged( const QColor& newColor );
void on_mGridFrameFill2ColorButton_colorChanged( const QColor& newColor );

void on_mAtlasMarginRadio_toggled( bool checked );

void on_mAtlasCheckBox_toggled( bool checked );
void on_mAtlasMarginSpinBox_valueChanged( int value );
void on_mAtlasFixedScaleRadio_toggled( bool checked );
void on_mAtlasPredefinedScaleRadio_toggled( bool checked );
void on_mDistanceToMapFrameSpinBox_valueChanged( double d );
void on_mAnnotationFontButton_clicked();
void on_mAnnotationFontColorButton_clicked();

protected:
void showEvent( QShowEvent * event );
Expand Down Expand Up @@ -149,9 +156,6 @@ 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();

Expand All @@ -161,6 +165,9 @@ class QgsComposerMapWidget: public QgsComposerItemBaseWidget, private Ui::QgsCom
/**Is there some predefined scales, globally or as project's options ?*/
bool hasPredefinedScales() const;

QListWidgetItem* addGridListItem( const QString& id, const QString& name );

void loadGridEntries();
};

#endif
1 change: 1 addition & 0 deletions src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ SET(QGIS_CORE_SRCS
composer/qgscomposerlegenditem.cpp
composer/qgscomposerpicture.cpp
composer/qgscomposermap.cpp
composer/qgscomposermapgrid.cpp
composer/qgscomposertable.cpp
composer/qgscomposertablecolumn.cpp
composer/qgscomposerattributetable.cpp
Expand Down
3 changes: 2 additions & 1 deletion src/core/composer/qgscomposeritem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -863,12 +863,13 @@ void QgsComposerItem::setEffectsEnabled( bool effectsEnabled )
mEffect->setEnabled( effectsEnabled );
}

void QgsComposerItem::drawText( QPainter* p, double x, double y, const QString& text, const QFont& font ) const
void QgsComposerItem::drawText( QPainter* p, double x, double y, const QString& text, const QFont& font, const QColor& c ) const
{
QFont textFont = scaledFontPixelSize( font );

p->save();
p->setFont( textFont );
p->setPen( c );
double scaleFactor = 1.0 / FONT_WORKAROUND_SCALE;
p->scale( scaleFactor, scaleFactor );
p->drawText( QPointF( x * FONT_WORKAROUND_SCALE, y * FONT_WORKAROUND_SCALE ), text );
Expand Down
2 changes: 1 addition & 1 deletion src/core/composer/qgscomposeritem.h
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ class CORE_EXPORT QgsComposerItem: public QObject, public QGraphicsRectItem

/**Draws Text. Takes care about all the composer specific issues (calculation to pixel, scaling of font and painter
to work around the Qt font bug)*/
void drawText( QPainter* p, double x, double y, const QString& text, const QFont& font ) const;
void drawText( QPainter* p, double x, double y, const QString& text, const QFont& font, const QColor& c = QColor( 0, 0, 0 ) ) const;

/**Like the above, but with a rectangle for multiline text
* @param p painter to use
Expand Down
Loading

0 comments on commit a09fbc0

Please sign in to comment.