Skip to content
Permalink
Browse files

[FEATURE][composer] Add button to view current map item extent in mai…

…n map canvas
  • Loading branch information
nyalldawson committed Apr 21, 2014
1 parent d0f40b9 commit f5a60a499a5e9741156070891a20a3e13d27a515
@@ -15,6 +15,8 @@
* *
***************************************************************************/

#include "qgisapp.h"
#include "qgsmapcanvas.h"
#include "qgscomposermapwidget.h"
#include "qgscomposeritemwidget.h"
#include "qgscomposition.h"
@@ -333,6 +335,22 @@ void QgsComposerMapWidget::on_mSetToMapCanvasExtentButton_clicked()
}
}

void QgsComposerMapWidget::on_mViewExtentInCanvasButton_clicked()
{
if ( !mComposerMap )
{
return;
}

QgsRectangle currentMapExtent = *( mComposerMap->currentMapExtent() );

if ( !currentMapExtent.isEmpty() )
{
QgisApp::instance()->mapCanvas()->setExtent( currentMapExtent );
QgisApp::instance()->mapCanvas()->refresh();
}
}

void QgsComposerMapWidget::on_mXMinLineEdit_editingFinished()
{
updateComposerExtentFromGui();
@@ -39,6 +39,7 @@ class QgsComposerMapWidget: public QWidget, private Ui::QgsComposerMapWidgetBase
void on_mScaleLineEdit_editingFinished();
void on_mMapRotationSpinBox_valueChanged( double value );
void on_mSetToMapCanvasExtentButton_clicked();
void on_mViewExtentInCanvasButton_clicked();
void on_mUpdatePreviewButton_clicked();
void on_mKeepLayerListCheckBox_stateChanged( int state );
void on_mDrawCanvasItemsCheckBox_stateChanged( int state );
@@ -56,7 +56,7 @@
<x>0</x>
<y>0</y>
<width>439</width>
<height>1638</height>
<height>1671</height>
</rect>
</property>
<property name="sizePolicy">
@@ -174,25 +174,25 @@
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="3" column="1">
<widget class="QLineEdit" name="mYMaxLineEdit"/>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="mXMaxLineEdit"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="mXMaxLabel">
<item row="0" column="0">
<widget class="QLabel" name="mXMinLabel">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>X max</string>
<string>X min</string>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
<property name="buddy">
<cstring>mXMaxLineEdit</cstring>
<cstring>mXMinLineEdit</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="mXMinLineEdit"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="mYMinLabel">
<property name="text">
@@ -206,6 +206,25 @@
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="mYMinLineEdit"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="mXMaxLabel">
<property name="text">
<string>X max</string>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
<property name="buddy">
<cstring>mXMaxLineEdit</cstring>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="mXMaxLineEdit"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="mYMaxLabel">
<property name="text">
@@ -219,32 +238,20 @@
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="mXMinLineEdit"/>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="mYMinLineEdit"/>
<item row="3" column="1">
<widget class="QLineEdit" name="mYMaxLineEdit"/>
</item>
<item row="4" column="0" colspan="4">
<item row="4" column="0" colspan="2">
<widget class="QPushButton" name="mSetToMapCanvasExtentButton">
<property name="text">
<string>Set to map canvas extent</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="mXMinLabel">
<property name="enabled">
<bool>true</bool>
</property>
<item row="5" column="0" colspan="2">
<widget class="QPushButton" name="mViewExtentInCanvasButton">
<property name="text">
<string>X min</string>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
<property name="buddy">
<cstring>mXMinLineEdit</cstring>
<string>View extent in map canvas</string>
</property>
</widget>
</item>

0 comments on commit f5a60a4

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