Skip to content
Permalink
Browse files

Add GUI elements to change composer map grid annotation format

  • Loading branch information
mhugent committed Aug 9, 2012
1 parent 5821e2b commit fa5784098438bcb035d05a52bffd11a6e208a168
@@ -51,6 +51,10 @@ QgsComposerMapWidget::QgsComposerMapWidget( QgsComposerMap* composerMap ): QWidg
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" ) );

insertAnnotationPositionEntries( mAnnotationPositionLeftComboBox );
insertAnnotationPositionEntries( mAnnotationPositionRightComboBox );
insertAnnotationPositionEntries( mAnnotationPositionTopComboBox );
@@ -372,6 +376,10 @@ void QgsComposerMapWidget::updateGuiElements()
mFrameStyleComboBox->setCurrentIndex( mFrameStyleComboBox->findText( tr( "No frame" ) ) );
}

//grid annotation format
QgsComposerMap::GridAnnotationFormat gf = mComposerMap->gridAnnotationFormat();
mAnnotationFormatComboBox->setCurrentIndex(( int )gf );

//grid annotation position
initAnnotationPositionBox( mAnnotationPositionLeftComboBox, mComposerMap->gridAnnotationPosition( QgsComposerMap::Left ) );
initAnnotationPositionBox( mAnnotationPositionRightComboBox, mComposerMap->gridAnnotationPosition( QgsComposerMap::Right ) );
@@ -457,6 +465,7 @@ void QgsComposerMapWidget::blockAllSignals( bool b )
mLineColorButton->blockSignals( b );
mDrawAnnotationCheckBox->blockSignals( b );
mAnnotationFontButton->blockSignals( b );
mAnnotationFormatComboBox->blockSignals( b );
mAnnotationPositionLeftComboBox->blockSignals( b );
mAnnotationPositionRightComboBox->blockSignals( b );
mAnnotationPositionTopComboBox->blockSignals( b );
@@ -767,6 +776,20 @@ void QgsComposerMapWidget::on_mDistanceToMapFrameSpinBox_valueChanged( double d
mComposerMap->endCommand();
}

void QgsComposerMapWidget::on_mAnnotationFormatComboBox_currentIndexChanged( int index )
{
if ( !mComposerMap )
{
return;
}

mComposerMap->beginCommand( tr( "Annotation format changed" ) );
mComposerMap->setGridAnnotationFormat(( QgsComposerMap::GridAnnotationFormat )index );
mComposerMap->updateBoundingRect();
mComposerMap->update();
mComposerMap->endCommand();
}

void QgsComposerMapWidget::on_mAnnotationPositionLeftComboBox_currentIndexChanged( const QString& text )
{
handleChangedAnnotationPosition( QgsComposerMap::Left, text );
@@ -63,6 +63,8 @@ class QgsComposerMapWidget: public QWidget, private Ui::QgsComposerMapWidgetBase
void on_mAnnotationFontButton_clicked();
void on_mDistanceToMapFrameSpinBox_valueChanged( double d );

void on_mAnnotationFormatComboBox_currentIndexChanged( int index );

//annotation position
void on_mAnnotationPositionLeftComboBox_currentIndexChanged( const QString& text );
void on_mAnnotationPositionRightComboBox_currentIndexChanged( const QString& text );
@@ -262,6 +262,9 @@ class CORE_EXPORT QgsComposerMap : public QgsComposerItem
void setGridAnnotationDirection( GridAnnotationDirection d, QgsComposerMap::Border border );
GridAnnotationDirection gridAnnotationDirection( QgsComposerMap::Border border ) const;

void setGridAnnotationFormat( GridAnnotationFormat f ) { mGridAnnotationFormat = f; }
GridAnnotationFormat gridAnnotationFormat() const { return mGridAnnotationFormat; }

/**Set grid frame style (NoGridFrame or Zebra)
@note: this function was added in version 1.9*/
void setGridFrameStyle( GridFrameStyle style ) { mGridFrameStyle = style; }
@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>240</width>
<width>265</width>
<height>483</height>
</rect>
</property>
@@ -33,8 +33,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>230</width>
<height>395</height>
<width>255</width>
<height>392</height>
</rect>
</property>
<attribute name="label">
@@ -251,8 +251,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>230</width>
<height>395</height>
<width>255</width>
<height>392</height>
</rect>
</property>
<attribute name="label">
@@ -359,8 +359,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>218</width>
<height>716</height>
<width>238</width>
<height>770</height>
</rect>
</property>
<attribute name="label">
@@ -591,9 +591,9 @@
</property>
</widget>
</item>
<item row="4" column="0" colspan="4">
<item row="5" column="0" colspan="4">
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<item row="1" column="0">
<widget class="QLabel" name="mAnnotationPositionLabelLeft">
<property name="text">
<string>Annotation position left side</string>
@@ -606,10 +606,10 @@
</property>
</widget>
</item>
<item row="0" column="1">
<item row="1" column="1">
<widget class="QComboBox" name="mAnnotationPositionLeftComboBox"/>
</item>
<item row="1" column="0">
<item row="2" column="0">
<widget class="QLabel" name="mAnnotationPositionLabelRight">
<property name="text">
<string>Annotation position right side</string>
@@ -622,10 +622,10 @@
</property>
</widget>
</item>
<item row="1" column="1">
<item row="2" column="1">
<widget class="QComboBox" name="mAnnotationPositionRightComboBox"/>
</item>
<item row="2" column="0">
<item row="3" column="0">
<widget class="QLabel" name="mAnnotationPositionLabelTop">
<property name="text">
<string>Annotation position top side</string>
@@ -638,10 +638,10 @@
</property>
</widget>
</item>
<item row="2" column="1">
<item row="3" column="1">
<widget class="QComboBox" name="mAnnotationPositionTopComboBox"/>
</item>
<item row="3" column="0">
<item row="4" column="0">
<widget class="QLabel" name="mAnnotationPositionLabelBottom">
<property name="text">
<string>Annotation position bottom side</string>
@@ -654,10 +654,10 @@
</property>
</widget>
</item>
<item row="3" column="1">
<item row="4" column="1">
<widget class="QComboBox" name="mAnnotationPositionBottomComboBox"/>
</item>
<item row="4" column="0">
<item row="5" column="0">
<widget class="QLabel" name="mAnnotationDirectionLabelLeft">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
@@ -673,10 +673,10 @@
</property>
</widget>
</item>
<item row="4" column="1">
<item row="5" column="1">
<widget class="QComboBox" name="mAnnotationDirectionComboBoxLeft"/>
</item>
<item row="5" column="0">
<item row="6" column="0">
<widget class="QLabel" name="mAnnotationDirectionLabelRight">
<property name="text">
<string>Annotation direction right side</string>
@@ -689,10 +689,10 @@
</property>
</widget>
</item>
<item row="5" column="1">
<item row="6" column="1">
<widget class="QComboBox" name="mAnnotationDirectionComboBoxRight"/>
</item>
<item row="6" column="0">
<item row="7" column="0">
<widget class="QLabel" name="mAnnotationDirectionLabelTop">
<property name="text">
<string>Annotation direction top side</string>
@@ -702,10 +702,10 @@
</property>
</widget>
</item>
<item row="6" column="1">
<item row="7" column="1">
<widget class="QComboBox" name="mAnnotationDirectionComboBoxTop"/>
</item>
<item row="7" column="0">
<item row="8" column="0">
<widget class="QLabel" name="mAnnotationDirectionLabeBottom">
<property name="text">
<string>Annotation direction bottom side</string>
@@ -715,19 +715,29 @@
</property>
</widget>
</item>
<item row="7" column="1">
<item row="8" column="1">
<widget class="QComboBox" name="mAnnotationDirectionComboBoxBottom"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="mAnnotationFormatLabel">
<property name="text">
<string>Annotation format</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="mAnnotationFormatComboBox"/>
</item>
</layout>
</item>
<item row="5" column="0">
<item row="6" column="0">
<widget class="QPushButton" name="mAnnotationFontButton">
<property name="text">
<string>Font...</string>
</property>
</widget>
</item>
<item row="6" column="0" colspan="2">
<item row="7" column="0" colspan="2">
<widget class="QLabel" name="mDistanceToFrameLabel">
<property name="text">
<string>Distance to map frame</string>
@@ -740,10 +750,10 @@
</property>
</widget>
</item>
<item row="6" column="2" colspan="2">
<item row="7" column="2" colspan="2">
<widget class="QDoubleSpinBox" name="mDistanceToMapFrameSpinBox"/>
</item>
<item row="7" column="0" colspan="2">
<item row="8" column="0" colspan="2">
<widget class="QLabel" name="mCoordinatePrecisionLabel">
<property name="text">
<string>Coordinate precision</string>
@@ -756,10 +766,10 @@
</property>
</widget>
</item>
<item row="7" column="2" colspan="2">
<item row="8" column="2" colspan="2">
<widget class="QSpinBox" name="mCoordinatePrecisionSpinBox"/>
</item>
<item row="8" column="0">
<item row="9" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>

0 comments on commit fa57840

Please sign in to comment.
You can’t perform that action at this time.