mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-13 00:03:09 -04:00
[composer][needs-docs] Rename "world file map" option to "reference map"
This option will be used for more than just world file generation, and instead will indicate which map should be considered the master map for the composition from which any composer properties calculating map units will derive the scale from.
This commit is contained in:
parent
5abe66b4c7
commit
e0934d7766
@ -646,6 +646,7 @@ were removed. Use setSnapTolerance() and snapTolerance() instead.
|
||||
- sortZList() was removed. Use refreshZList() instead.
|
||||
- addComposerTable(), composerTableAdded() were removed.
|
||||
- setAllUnselected() has been renamed to setAllDeselected. <!--#spellok-->
|
||||
- worldFileMap() and setWorldFileMap() have been renamed to referenceMap() and setReferenceMap()
|
||||
|
||||
|
||||
QgsCoordinateReferenceSystem {#qgis_api_break_3_0_QgsCoordinateReferenceSystem}
|
||||
|
@ -359,20 +359,9 @@ class QgsComposition : QGraphicsScene, QgsExpressionContextGenerator
|
||||
*/
|
||||
void setGenerateWorldFile( bool enabled );
|
||||
|
||||
/** Returns the map item which will be used to generate corresponding world files when the
|
||||
* composition is exported, or nullptr if no corresponding map is set.
|
||||
* @see setWorldFileMap()
|
||||
* @see generateWorldFile()
|
||||
*/
|
||||
QgsComposerMap* worldFileMap() const;
|
||||
QgsComposerMap* referenceMap() const;
|
||||
|
||||
/** Sets the map item which will be used to generate corresponding world files when the
|
||||
* composition is exported.
|
||||
* @param map composer map item
|
||||
* @see worldFileMap()
|
||||
* @see setGenerateWorldFile()
|
||||
*/
|
||||
void setWorldFileMap( QgsComposerMap* map );
|
||||
void setReferenceMap( QgsComposerMap* map );
|
||||
|
||||
/** Returns true if a composition should use advanced effects such as blend modes */
|
||||
bool useAdvancedEffects() const;
|
||||
|
@ -2077,9 +2077,9 @@ void QgsComposer::exportCompositionAsImage( QgsComposer::OutputMode mode )
|
||||
mView->setPaintingEnabled( false );
|
||||
|
||||
int worldFilePageNo = -1;
|
||||
if ( mComposition->worldFileMap() )
|
||||
if ( mComposition->referenceMap() )
|
||||
{
|
||||
worldFilePageNo = mComposition->worldFileMap()->page() - 1;
|
||||
worldFilePageNo = mComposition->referenceMap()->page() - 1;
|
||||
}
|
||||
|
||||
for ( int i = 0; i < mComposition->numPages(); ++i )
|
||||
@ -2315,9 +2315,9 @@ void QgsComposer::exportCompositionAsImage( QgsComposer::OutputMode mode )
|
||||
QString filename = QDir( dir ).filePath( atlasMap->currentFilename() ) + fileExt;
|
||||
|
||||
int worldFilePageNo = -1;
|
||||
if ( mComposition->worldFileMap() )
|
||||
if ( mComposition->referenceMap() )
|
||||
{
|
||||
worldFilePageNo = mComposition->worldFileMap()->page() - 1;
|
||||
worldFilePageNo = mComposition->referenceMap()->page() - 1;
|
||||
}
|
||||
|
||||
for ( int i = 0; i < mComposition->numPages(); ++i )
|
||||
|
@ -82,9 +82,9 @@ QgsCompositionWidget::QgsCompositionWidget( QWidget* parent, QgsComposition* c )
|
||||
mGenerateWorldFileCheckBox->setChecked( mComposition->generateWorldFile() );
|
||||
|
||||
// populate the map list
|
||||
mWorldFileMapComboBox->setComposition( mComposition );
|
||||
mWorldFileMapComboBox->setItemType( QgsComposerItem::ComposerMap );
|
||||
mWorldFileMapComboBox->setItem( mComposition->worldFileMap() );
|
||||
mReferenceMapComboBox->setComposition( mComposition );
|
||||
mReferenceMapComboBox->setItemType( QgsComposerItem::ComposerMap );
|
||||
mReferenceMapComboBox->setItem( mComposition->referenceMap() );
|
||||
|
||||
mSnapToleranceSpinBox->setValue( mComposition->snapTolerance() );
|
||||
|
||||
@ -124,7 +124,7 @@ QgsCompositionWidget::QgsCompositionWidget( QWidget* parent, QgsComposition* c )
|
||||
connect( mPaperOrientationDDBtn, SIGNAL( dataDefinedActivated( bool ) ), this, SLOT( updateDataDefinedProperty() ) );
|
||||
connect( mPaperOrientationDDBtn, SIGNAL( dataDefinedActivated( bool ) ), mPaperOrientationComboBox, SLOT( setDisabled( bool ) ) );
|
||||
|
||||
connect( mWorldFileMapComboBox, SIGNAL( itemChanged( QgsComposerItem* ) ), this, SLOT( worldFileMapChanged( QgsComposerItem* ) ) );
|
||||
connect( mReferenceMapComboBox, &QgsComposerItemComboBox::itemChanged, this, &QgsCompositionWidget::referenceMapChanged );
|
||||
|
||||
//initialize data defined buttons
|
||||
populateDataDefinedButtons();
|
||||
@ -679,7 +679,7 @@ void QgsCompositionWidget::on_mGenerateWorldFileCheckBox_toggled( bool state )
|
||||
mComposition->setGenerateWorldFile( state );
|
||||
}
|
||||
|
||||
void QgsCompositionWidget::worldFileMapChanged( QgsComposerItem* item )
|
||||
void QgsCompositionWidget::referenceMapChanged( QgsComposerItem* item )
|
||||
{
|
||||
if ( !mComposition )
|
||||
{
|
||||
@ -687,7 +687,7 @@ void QgsCompositionWidget::worldFileMapChanged( QgsComposerItem* item )
|
||||
}
|
||||
|
||||
QgsComposerMap* map = dynamic_cast< QgsComposerMap* >( item );
|
||||
mComposition->setWorldFileMap( map );
|
||||
mComposition->setReferenceMap( map );
|
||||
}
|
||||
|
||||
void QgsCompositionWidget::on_mGridResolutionSpinBox_valueChanged( double d )
|
||||
@ -738,6 +738,6 @@ void QgsCompositionWidget::blockSignals( bool block )
|
||||
mOffsetYSpinBox->blockSignals( block );
|
||||
mSnapToleranceSpinBox->blockSignals( block );
|
||||
mGenerateWorldFileCheckBox->blockSignals( block );
|
||||
mWorldFileMapComboBox->blockSignals( block );
|
||||
mReferenceMapComboBox->blockSignals( block );
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ class QgsCompositionWidget: public QgsPanelWidget, private Ui::QgsCompositionWid
|
||||
void on_mResolutionSpinBox_valueChanged( const int value );
|
||||
void on_mPrintAsRasterCheckBox_toggled( bool state );
|
||||
void on_mGenerateWorldFileCheckBox_toggled( bool state );
|
||||
void worldFileMapChanged( QgsComposerItem* );
|
||||
void referenceMapChanged( QgsComposerItem* );
|
||||
|
||||
void on_mGridResolutionSpinBox_valueChanged( double d );
|
||||
void on_mOffsetXSpinBox_valueChanged( double d );
|
||||
|
@ -789,12 +789,12 @@ void QgsComposition::setPrintResolution( const int dpi )
|
||||
mProject->setDirty( true );
|
||||
}
|
||||
|
||||
QgsComposerMap* QgsComposition::worldFileMap() const
|
||||
QgsComposerMap* QgsComposition::referenceMap() const
|
||||
{
|
||||
return dynamic_cast< QgsComposerMap* >( const_cast< QgsComposerItem* >( getComposerItemByUuid( mWorldFileMapId ) ) );
|
||||
}
|
||||
|
||||
void QgsComposition::setWorldFileMap( QgsComposerMap* map )
|
||||
void QgsComposition::setReferenceMap( QgsComposerMap* map )
|
||||
{
|
||||
mWorldFileMapId = map ? map->uuid() : QString();
|
||||
mProject->setDirty( true );
|
||||
@ -3047,7 +3047,7 @@ void QgsComposition::renderRect( QPainter* p, const QRectF& rect )
|
||||
double* QgsComposition::computeGeoTransform( const QgsComposerMap* map, const QRectF& region , double dpi ) const
|
||||
{
|
||||
if ( !map )
|
||||
map = worldFileMap();
|
||||
map = referenceMap();
|
||||
|
||||
if ( !map )
|
||||
return nullptr;
|
||||
@ -3151,7 +3151,7 @@ QGraphicsView *QgsComposition::graphicsView() const
|
||||
|
||||
void QgsComposition::computeWorldFileParameters( double& a, double& b, double& c, double& d, double& e, double& f ) const
|
||||
{
|
||||
const QgsComposerMap* map = worldFileMap();
|
||||
const QgsComposerMap* map = referenceMap();
|
||||
if ( !map )
|
||||
{
|
||||
return;
|
||||
@ -3166,7 +3166,7 @@ void QgsComposition::computeWorldFileParameters( double& a, double& b, double& c
|
||||
void QgsComposition::computeWorldFileParameters( const QRectF& exportRegion, double& a, double& b, double& c, double& d, double& e, double& f ) const
|
||||
{
|
||||
// World file parameters : affine transformation parameters from pixel coordinates to map coordinates
|
||||
QgsComposerMap* map = worldFileMap();
|
||||
QgsComposerMap* map = referenceMap();
|
||||
if ( !map )
|
||||
{
|
||||
return;
|
||||
|
@ -411,7 +411,7 @@ class CORE_EXPORT QgsComposition : public QGraphicsScene, public QgsExpressionCo
|
||||
/** Returns true if the composition will generate corresponding world files when pages
|
||||
* are exported.
|
||||
* @see setGenerateWorldFile()
|
||||
* @see worldFileMap()
|
||||
* @see referenceMap()
|
||||
*/
|
||||
bool generateWorldFile() const { return mGenerateWorldFile; }
|
||||
|
||||
@ -419,24 +419,24 @@ class CORE_EXPORT QgsComposition : public QGraphicsScene, public QgsExpressionCo
|
||||
* are exported.
|
||||
* @param enabled set to true to generate world files
|
||||
* @see generateWorldFile()
|
||||
* @see setWorldFileMap()
|
||||
* @see setReferenceMap()
|
||||
*/
|
||||
void setGenerateWorldFile( bool enabled ) { mGenerateWorldFile = enabled; }
|
||||
|
||||
/** Returns the map item which will be used to generate corresponding world files when the
|
||||
* composition is exported, or nullptr if no corresponding map is set.
|
||||
* @see setWorldFileMap()
|
||||
* @see setReferenceMap()
|
||||
* @see generateWorldFile()
|
||||
*/
|
||||
QgsComposerMap* worldFileMap() const;
|
||||
QgsComposerMap* referenceMap() const;
|
||||
|
||||
/** Sets the map item which will be used to generate corresponding world files when the
|
||||
* composition is exported.
|
||||
* @param map composer map item
|
||||
* @see worldFileMap()
|
||||
* @see referenceMap()
|
||||
* @see setGenerateWorldFile()
|
||||
*/
|
||||
void setWorldFileMap( QgsComposerMap* map );
|
||||
void setReferenceMap( QgsComposerMap* map );
|
||||
|
||||
//! Returns true if a composition should use advanced effects such as blend modes
|
||||
bool useAdvancedEffects() const {return mUseAdvancedEffects;}
|
||||
@ -692,7 +692,7 @@ class CORE_EXPORT QgsComposition : public QGraphicsScene, public QgsExpressionCo
|
||||
/** Georeferences a file (image of PDF) exported from the composition.
|
||||
* @param file filename of exported file
|
||||
* @param referenceMap map item to use for georeferencing, or leave as nullptr to use the
|
||||
* currently defined worldFileMap().
|
||||
* currently defined referenceMap().
|
||||
* @param exportRegion set to a valid rectangle to indicate that only part of the composition was
|
||||
* exported
|
||||
* @param dpi set to DPI of exported file, or leave as -1 to use composition's DPI.
|
||||
@ -1027,7 +1027,7 @@ class CORE_EXPORT QgsComposition : public QGraphicsScene, public QgsExpressionCo
|
||||
|
||||
/** Computes a GDAL style geotransform for georeferencing a composition.
|
||||
* @param referenceMap map item to use for georeferencing, or leave as nullptr to use the
|
||||
* currently defined worldFileMap().
|
||||
* currently defined referenceMap().
|
||||
* @param exportRegion set to a valid rectangle to indicate that only part of the composition is
|
||||
* being exported
|
||||
* @param dpi allows overriding the default composition DPI, or leave as -1 to use composition's DPI.
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>345</width>
|
||||
<height>506</height>
|
||||
<height>464</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -59,12 +59,89 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>-311</y>
|
||||
<width>327</width>
|
||||
<height>1113</height>
|
||||
<y>0</y>
|
||||
<width>329</width>
|
||||
<height>1065</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QgsCollapsibleGroupBoxBasic" name="groupBox_4">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>General settings</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="mPageStyleButton">
|
||||
<property name="text">
|
||||
<string>Change...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QgsSpinBox" name="mNumPagesSpinBox">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="showClearButton" stdset="0">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QgsDataDefinedButton" name="mNumPagesDDBtn">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="mNumPagesLabel">
|
||||
<property name="text">
|
||||
<string>Number of pages</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>Page background</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="text">
|
||||
<string>Reference map</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QgsComposerItemComboBox" name="mReferenceMapComboBox">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Specifies the master map for this composition, which is used to georeference composer exports and for scale calculation for item styles.</string>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QgsCollapsibleGroupBoxBasic" name="groupBox">
|
||||
<property name="focusPolicy">
|
||||
@ -372,60 +449,6 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QgsCollapsibleGroupBoxBasic" name="groupBox_4">
|
||||
<property name="title">
|
||||
<string>Page settings</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="mNumPagesLabel">
|
||||
<property name="text">
|
||||
<string>Number of pages</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QgsSpinBox" name="mNumPagesSpinBox">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="showClearButton" stdset="0">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QgsDataDefinedButton" name="mNumPagesDDBtn">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>Page background</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="mPageStyleButton">
|
||||
<property name="text">
|
||||
<string>Change...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QgsCollapsibleGroupBoxBasic" name="groupBox_3">
|
||||
<property name="title">
|
||||
@ -484,26 +507,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="text">
|
||||
<string>Reference map</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QgsComposerItemComboBox" name="mWorldFileMapComboBox">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Specifies the map which is used to georeference composer exports</string>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@ -660,6 +663,18 @@
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>QgsCollapsibleGroupBox</class>
|
||||
<extends>QGroupBox</extends>
|
||||
<header>qgscollapsiblegroupbox.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>QgsVariableEditorWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header location="global">qgsvariableeditorwidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>QgsCollapsibleGroupBoxBasic</class>
|
||||
<extends>QGroupBox</extends>
|
||||
@ -686,21 +701,14 @@
|
||||
<extends>QToolButton</extends>
|
||||
<header>qgsdatadefinedbutton.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>QgsCollapsibleGroupBox</class>
|
||||
<extends>QGroupBox</extends>
|
||||
<header>qgscollapsiblegroupbox.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>QgsVariableEditorWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header location="global">qgsvariableeditorwidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>scrollArea</tabstop>
|
||||
<tabstop>groupBox_4</tabstop>
|
||||
<tabstop>mNumPagesSpinBox</tabstop>
|
||||
<tabstop>mNumPagesDDBtn</tabstop>
|
||||
<tabstop>mPageStyleButton</tabstop>
|
||||
<tabstop>mReferenceMapComboBox</tabstop>
|
||||
<tabstop>groupBox</tabstop>
|
||||
<tabstop>mPaperSizeComboBox</tabstop>
|
||||
<tabstop>mPaperSizeDDBtn</tabstop>
|
||||
@ -716,9 +724,6 @@
|
||||
<tabstop>mRightMarginSpinBox</tabstop>
|
||||
<tabstop>mBottomMarginSpinBox</tabstop>
|
||||
<tabstop>mResizePageButton</tabstop>
|
||||
<tabstop>mNumPagesSpinBox</tabstop>
|
||||
<tabstop>mNumPagesDDBtn</tabstop>
|
||||
<tabstop>mPageStyleButton</tabstop>
|
||||
<tabstop>mResolutionSpinBox</tabstop>
|
||||
<tabstop>mPrintAsRasterCheckBox</tabstop>
|
||||
<tabstop>mGenerateWorldFileCheckBox</tabstop>
|
||||
|
@ -176,7 +176,7 @@ void TestQgsComposerMap::worldFileGeneration()
|
||||
mComposerMap->setMapRotation( 30.0 );
|
||||
|
||||
mComposition->setGenerateWorldFile( true );
|
||||
mComposition->setWorldFileMap( mComposerMap );
|
||||
mComposition->setReferenceMap( mComposerMap );
|
||||
|
||||
double a, b, c, d, e, f;
|
||||
mComposition->computeWorldFileParameters( a, b, c, d, e, f );
|
||||
|
@ -543,7 +543,7 @@ void TestQgsComposition::georeference()
|
||||
delete[] t;
|
||||
|
||||
// don't specify map
|
||||
composition->setWorldFileMap( map );
|
||||
composition->setReferenceMap( map );
|
||||
t = composition->computeGeoTransform();
|
||||
QVERIFY( qgsDoubleNear( t[0], 1925.0, 1.0 ) );
|
||||
QVERIFY( qgsDoubleNear( t[1], 0.211719, 0.0001 ) );
|
||||
|
@ -161,7 +161,7 @@ class TestQgsComposerMap(unittest.TestCase):
|
||||
self.mComposerMap.setMapRotation(30.0)
|
||||
|
||||
self.mComposition.setGenerateWorldFile(True)
|
||||
self.mComposition.setWorldFileMap(self.mComposerMap)
|
||||
self.mComposition.setReferenceMap(self.mComposerMap)
|
||||
|
||||
p = self.mComposition.computeWorldFileParameters()
|
||||
pexpected = (4.180480199790922, 2.4133064516129026, 779443.7612381146,
|
||||
|
Loading…
x
Reference in New Issue
Block a user