Skip to content
Permalink
Browse files

missing const ref, remove extra argument

  • Loading branch information
3nids authored and nyalldawson committed Dec 1, 2017
1 parent d404a32 commit 6188b167fc00b84beb07efa8bf035dd98ee77097
@@ -137,13 +137,13 @@ class QgsCoordinateTransformContext
:rtype: QgsCoordinateTransform.TransformPair
%End

void readXml( const QDomElement &element, const QDomDocument &document, const QgsReadWriteContext &context );
void readXml( const QDomElement &element, const QgsReadWriteContext &context );
%Docstring
Reads the context's state from a DOM ``element``.
.. seealso:: writeXml()
%End

void writeXml( QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context ) const;
void writeXml( QDomElement &element, const QgsReadWriteContext &context ) const;
%Docstring
Writes the context's state to a DOM ``element``.
.. seealso:: readXml()
@@ -3184,7 +3184,7 @@ void QgisApp::setupConnections()
this, &QgisApp::mapCanvas_keyPressed );

// project crs connections
connect( QgsProject::instance(), &QgsProject::crsChanged, this, &QgisApp::onProjectCrsChanged );
connect( QgsProject::instance(), &QgsProject::crsChanged, this, &QgisApp::projectCrsChanged );

connect( QgsProject::instance(), &QgsProject::labelingEngineSettingsChanged,
this, [ = ]
@@ -9119,7 +9119,7 @@ void QgisApp::onFocusChanged( QWidget *oldWidget, QWidget *newWidget )
}
}

void QgisApp::onProjectCrsChanged()
void QgisApp::projectCrsChanged()
{
updateCrsStatusBar();
QgsDebugMsgLevel( QString( "QgisApp::setupConnections -1- : QgsProject::instance()->crs().description[%1]ellipsoid[%2]" ).arg( QgsProject::instance()->crs().description() ).arg( QgsProject::instance()->crs().ellipsoidAcronym() ), 3 );
@@ -9140,8 +9140,8 @@ void QgisApp::onProjectCrsChanged()
}
if ( transformsToAskFor.count() == 1 )
{
askForDatumTransform( transformsToAskFor.at( 0 ),
QgsProject::instance()->crs() );
askUserForDatumTransform( transformsToAskFor.at( 0 ),
QgsProject::instance()->crs() );
}
else if ( transformsToAskFor.count() > 1 )
{
@@ -9457,7 +9457,7 @@ void QgisApp::setLayerCrs()
{
if ( child->layer() )
{
askForDatumTransform( crs, QgsProject::instance()->crs() );
askUserForDatumTransform( crs, QgsProject::instance()->crs() );
child->layer()->setCrs( crs );
child->layer()->triggerRepaint();
}
@@ -9468,7 +9468,7 @@ void QgisApp::setLayerCrs()
QgsLayerTreeLayer *nodeLayer = QgsLayerTree::toLayer( node );
if ( nodeLayer->layer() )
{
askForDatumTransform( crs, QgsProject::instance()->crs() );
askUserForDatumTransform( crs, QgsProject::instance()->crs() );
nodeLayer->layer()->setCrs( crs );
nodeLayer->layer()->triggerRepaint();
}
@@ -12563,8 +12563,10 @@ void QgisApp::writeDockWidgetSettings( QDockWidget *dockWidget, QDomElement &ele
elem.setAttribute( QStringLiteral( "area" ), dockWidgetArea( dockWidget ) );
}

bool QgisApp::askForDatumTransform( QgsCoordinateReferenceSystem sourceCrs, QgsCoordinateReferenceSystem destinationCrs )
bool QgisApp::askUserForDatumTransform( const QgsCoordinateReferenceSystem &sourceCrs, const QgsCoordinateReferenceSystem &destinationCrs )
{
Q_ASSERT( qApp->thread() == QThread::currentThread() );

bool ok = false;

QgsCoordinateTransformContext context = QgsProject::instance()->transformContext();
@@ -697,7 +697,7 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
* \returns true if a datum transform has been specifically chosen by user or only one is available.
* \since 3.0
*/
bool askForDatumTransform( QgsCoordinateReferenceSystem sourceCrs, QgsCoordinateReferenceSystem destinationCrs );
bool askUserForDatumTransform( const QgsCoordinateReferenceSystem &sourceCrs, const QgsCoordinateReferenceSystem &destinationCrs );

public slots:
//! save current vector layer
@@ -1616,7 +1616,7 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
void onFocusChanged( QWidget *oldWidget, QWidget *newWidget );

//! handle project crs changes
void onProjectCrsChanged();
void projectCrsChanged();

signals:

@@ -827,5 +827,5 @@ void QgisAppInterface::deregisterLocatorFilter( QgsLocatorFilter *filter )

bool QgisAppInterface::askForDatumTransform( QgsCoordinateReferenceSystem sourceCrs, QgsCoordinateReferenceSystem destinationCrs )
{
return qgis->askForDatumTransform( sourceCrs, destinationCrs );
return qgis->askUserForDatumTransform( sourceCrs, destinationCrs );
}
@@ -270,7 +270,7 @@ QgsFeatureList QgsClipboard::transformedCopyOf( const QgsCoordinateReferenceSyst
{
QgsFeatureList featureList = copyOf( fields );

QgisApp::instance()->askForDatumTransform( crs(), destCRS );
QgisApp::instance()->askUserForDatumTransform( crs(), destCRS );
QgsCoordinateTransform ct = QgsCoordinateTransform( crs(), destCRS, QgsProject::instance() );

QgsDebugMsg( "transforming clipboard." );
@@ -1221,7 +1221,7 @@ void QgsRasterLayerProperties::pbnAddValuesManually_clicked()

void QgsRasterLayerProperties::mCrsSelector_crsChanged( const QgsCoordinateReferenceSystem &crs )
{
QgisApp::instance()->askForDatumTransform( crs, QgsProject::instance()->crs() );
QgisApp::instance()->askUserForDatumTransform( crs, QgsProject::instance()->crs() );
mRasterLayer->setCrs( crs );
}

@@ -831,7 +831,7 @@ void QgsVectorLayerProperties::mLayerOrigNameLineEdit_textEdited( const QString

void QgsVectorLayerProperties::mCrsSelector_crsChanged( const QgsCoordinateReferenceSystem &crs )
{
QgisApp::instance()->askForDatumTransform( crs, QgsProject::instance()->crs() );
QgisApp::instance()->askUserForDatumTransform( crs, QgsProject::instance()->crs() );
mLayer->setCrs( crs );
mMetadataFilled = false;
}
@@ -161,7 +161,7 @@ QgsCoordinateTransform::TransformPair QgsCoordinateTransformContext::calculateDa
#endif
}

void QgsCoordinateTransformContext::readXml( const QDomElement &element, const QDomDocument &, const QgsReadWriteContext & )
void QgsCoordinateTransformContext::readXml( const QDomElement &element, const QgsReadWriteContext & )
{
d.detach();
d->mLock.lockForWrite();
@@ -231,16 +231,16 @@ void QgsCoordinateTransformContext::readXml( const QDomElement &element, const Q
d->mLock.unlock();
}

void QgsCoordinateTransformContext::writeXml( QDomElement &element, QDomDocument &document, const QgsReadWriteContext & ) const
void QgsCoordinateTransformContext::writeXml( QDomElement &element, const QgsReadWriteContext & ) const
{
d->mLock.lockForRead();

QDomElement contextElem = document.createElement( QStringLiteral( "transformContext" ) );
QDomElement contextElem = element.ownerDocument().createElement( QStringLiteral( "transformContext" ) );

//src/dest transforms
for ( auto it = d->mSourceDestDatumTransforms.constBegin(); it != d->mSourceDestDatumTransforms.constEnd(); ++ it )
{
QDomElement transformElem = document.createElement( QStringLiteral( "srcDest" ) );
QDomElement transformElem = element.ownerDocument().createElement( QStringLiteral( "srcDest" ) );
transformElem.setAttribute( QStringLiteral( "source" ), it.key().first );
transformElem.setAttribute( QStringLiteral( "dest" ), it.key().second );
transformElem.setAttribute( QStringLiteral( "sourceTransform" ), it.value().sourceTransformId );
@@ -252,7 +252,7 @@ void QgsCoordinateTransformContext::writeXml( QDomElement &element, QDomDocument
// src transforms
for ( auto it = d->mSourceDatumTransforms.constBegin(); it != d->mSourceDatumTransforms.constEnd(); ++ it )
{
QDomElement transformElem = document.createElement( QStringLiteral( "source" ) );
QDomElement transformElem = element.ownerDocument().createElement( QStringLiteral( "source" ) );
transformElem.setAttribute( QStringLiteral( "crs" ), it.key() );
transformElem.setAttribute( QStringLiteral( "transform" ), it.value() );
contextElem.appendChild( transformElem );
@@ -261,7 +261,7 @@ void QgsCoordinateTransformContext::writeXml( QDomElement &element, QDomDocument
// dest transforms
for ( auto it = d->mDestDatumTransforms.constBegin(); it != d->mDestDatumTransforms.constEnd(); ++ it )
{
QDomElement transformElem = document.createElement( QStringLiteral( "dest" ) );
QDomElement transformElem = element.ownerDocument().createElement( QStringLiteral( "dest" ) );
transformElem.setAttribute( QStringLiteral( "crs" ), it.key() );
transformElem.setAttribute( QStringLiteral( "transform" ), it.value() );
contextElem.appendChild( transformElem );
@@ -235,13 +235,13 @@ class CORE_EXPORT QgsCoordinateTransformContext
* Reads the context's state from a DOM \a element.
* \see writeXml()
*/
void readXml( const QDomElement &element, const QDomDocument &document, const QgsReadWriteContext &context );
void readXml( const QDomElement &element, const QgsReadWriteContext &context );

/**
* Writes the context's state to a DOM \a element.
* \see readXml()
*/
void writeXml( QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context ) const;
void writeXml( QDomElement &element, const QgsReadWriteContext &context ) const;


/**
@@ -925,7 +925,7 @@ bool QgsProject::readProjectFile( const QString &filename )
}
mCrs = projectCrs;

mTransformContext.readXml( doc->documentElement(), *doc, context );
mTransformContext.readXml( doc->documentElement(), context );
emit transformContextChanged();

QDomNodeList nl = doc->elementsByTagName( QStringLiteral( "autotransaction" ) );
@@ -1464,7 +1464,7 @@ bool QgsProject::writeProjectFile( const QString &filename )

mLabelingEngineSettings->writeSettingsToProject( this );

mTransformContext.writeXml( qgisNode, *doc, context );
mTransformContext.writeXml( qgisNode, context );

QDomElement annotationsElem = mAnnotationManager->writeXml( *doc, context );
qgisNode.appendChild( annotationsElem );

0 comments on commit 6188b16

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