Skip to content

Commit

Permalink
Do not re-lookup already present CRSes
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Feb 24, 2017
1 parent 10f50ee commit c0a8ee5
Show file tree
Hide file tree
Showing 18 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/qgis/FieldsCalculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def processAlgorithm(self, feedback):
exp = QgsExpression(formula)

da = QgsDistanceArea()
da.setSourceCrs(layer.crs().srsid())
da.setSourceCrs(layer.crs())
da.setEllipsoidalMode(
iface.mapCanvas().mapSettings().hasCrsTransformEnabled())
da.setEllipsoid(QgsProject.instance().readEntry(
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/qgis/FieldsMapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def processAlgorithm(self, feedback):
expressions = []

da = QgsDistanceArea()
da.setSourceCrs(layer.crs().srsid())
da.setSourceCrs(layer.crs())
da.setEllipsoidalMode(
iface.mapCanvas().mapSettings().hasCrsTransformEnabled())
da.setEllipsoid(QgsProject.instance().readEntry(
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/qgis/HubDistanceLines.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def processAlgorithm(self, feedback):
index = vector.spatialindex(layerHubs)

distance = QgsDistanceArea()
distance.setSourceCrs(layerPoints.crs().srsid())
distance.setSourceCrs(layerPoints.crs())
distance.setEllipsoidalMode(True)

# Scan source points, find nearest hub, and write to output file
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/qgis/HubDistancePoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def processAlgorithm(self, feedback):
index = vector.spatialindex(layerHubs)

distance = QgsDistanceArea()
distance.setSourceCrs(layerPoints.crs().srsid())
distance.setSourceCrs(layerPoints.crs())
distance.setEllipsoidalMode(True)

# Scan source points, find nearest hub, and write to output file
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/network/qgsgraphbuilderinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class ANALYSIS_EXPORT QgsGraphBuilderInterface
, mCtfEnabled( ctfEnabled )
, mTopologyTolerance( topologyTolerance )
{
mDa.setSourceCrs( mCrs.srsid() );
mDa.setSourceCrs( mCrs );
mDa.setEllipsoid( ellipsoidID );
mDa.setEllipsoidalMode( ctfEnabled );
}
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/vector/qgstransectsample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ int QgsTransectSample::createSample( QProgressDialog* pd )

//configure distanceArea depending on minDistance units and output CRS
QgsDistanceArea distanceArea;
distanceArea.setSourceCrs( mStrataLayer->crs().srsid() );
distanceArea.setSourceCrs( mStrataLayer->crs() );
if ( mMinDistanceUnits == Meters )
{
distanceArea.setEllipsoidalMode( true );
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7506,7 +7506,7 @@ void QgisApp::selectByForm()
}
QgsDistanceArea myDa;

myDa.setSourceCrs( vlayer->crs().srsid() );
myDa.setSourceCrs( vlayer->crs() );
myDa.setEllipsoidalMode( true );
myDa.setEllipsoid( QgsProject::instance()->ellipsoid() );

Expand Down
2 changes: 1 addition & 1 deletion src/app/qgisappinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ QgsAttributeDialog* QgisAppInterface::getFeatureForm( QgsVectorLayer *l, QgsFeat
{
QgsDistanceArea myDa;

myDa.setSourceCrs( l->crs().srsid() );
myDa.setSourceCrs( l->crs() );
myDa.setEllipsoidalMode( true );
myDa.setEllipsoid( QgsProject::instance()->ellipsoid() );

Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsattributeactionpropertiesdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ void QgsAttributeActionPropertiesDialog::init( const QSet<QString>& actionScopes
}

QgsDistanceArea myDa;
myDa.setSourceCrs( mLayer->crs().srsid() );
myDa.setSourceCrs( mLayer->crs() );
myDa.setEllipsoidalMode( true );
myDa.setEllipsoid( QgsProject::instance()->ellipsoid() );

Expand Down
4 changes: 2 additions & 2 deletions src/app/qgsattributetabledialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ void QgsAttributeTableDialog::filterExpressionBuilder()
dlg.setWindowTitle( tr( "Expression based filter" ) );

QgsDistanceArea myDa;
myDa.setSourceCrs( mLayer->crs().srsid() );
myDa.setSourceCrs( mLayer->crs() );
myDa.setEllipsoidalMode( true );
myDa.setEllipsoid( QgsProject::instance()->ellipsoid() );
dlg.setGeomCalculator( myDa );
Expand Down Expand Up @@ -947,7 +947,7 @@ void QgsAttributeTableDialog::setFilterExpression( const QString& filterString,
QgsFeatureIds filteredFeatures;
QgsDistanceArea myDa;

myDa.setSourceCrs( mLayer->crs().srsid() );
myDa.setSourceCrs( mLayer->crs() );
myDa.setEllipsoidalMode( true );
myDa.setEllipsoid( QgsProject::instance()->ellipsoid() );

Expand Down
4 changes: 2 additions & 2 deletions src/app/qgsdiagramproperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ QgsDiagramProperties::QgsDiagramProperties( QgsVectorLayer* layer, QWidget* pare
// field combo and expression button
mSizeFieldExpressionWidget->setLayer( mLayer );
QgsDistanceArea myDa;
myDa.setSourceCrs( mLayer->crs().srsid() );
myDa.setSourceCrs( mLayer->crs() );
myDa.setEllipsoidalMode( true );
myDa.setEllipsoid( QgsProject::instance()->ellipsoid() );
mSizeFieldExpressionWidget->setGeomCalculator( myDa );
Expand Down Expand Up @@ -865,7 +865,7 @@ QString QgsDiagramProperties::showExpressionBuilder( const QString& initialExpre
dlg.setWindowTitle( tr( "Expression based attribute" ) );

QgsDistanceArea myDa;
myDa.setSourceCrs( mLayer->crs().srsid() );
myDa.setSourceCrs( mLayer->crs() );
myDa.setEllipsoidalMode( true );
myDa.setEllipsoid( QgsProject::instance()->ellipsoid() );
dlg.setGeomCalculator( myDa );
Expand Down
4 changes: 2 additions & 2 deletions src/app/qgsfieldcalculator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ QgsFieldCalculator::QgsFieldCalculator( QgsVectorLayer* vl, QWidget* parent )
connect( mOutputFieldWidthSpinBox, SIGNAL( editingFinished() ), this, SLOT( setPrecisionMinMax() ) );

QgsDistanceArea myDa;
myDa.setSourceCrs( vl->crs().srsid() );
myDa.setSourceCrs( vl->crs() );
myDa.setEllipsoidalMode( true );
myDa.setEllipsoid( QgsProject::instance()->ellipsoid() );
builder->setGeomCalculator( myDa );
Expand Down Expand Up @@ -155,7 +155,7 @@ void QgsFieldCalculator::accept()
// Set up QgsDistanceArea each time we (re-)calculate
QgsDistanceArea myDa;

myDa.setSourceCrs( mVectorLayer->crs().srsid() );
myDa.setSourceCrs( mVectorLayer->crs() );
myDa.setEllipsoidalMode( true );
myDa.setEllipsoid( QgsProject::instance()->ellipsoid() );

Expand Down
2 changes: 1 addition & 1 deletion src/app/qgslabelinggui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ void QgsLabelingGui::setLayer( QgsMapLayer* mapLayer )

mFieldExpressionWidget->setLayer( mLayer );
QgsDistanceArea da;
da.setSourceCrs( mLayer->crs().srsid() );
da.setSourceCrs( mLayer->crs() );
da.setEllipsoidalMode( true );
da.setEllipsoid( QgsProject::instance()->ellipsoid() );
mFieldExpressionWidget->setGeomCalculator( da );
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsmaptoolmeasureangle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ void QgsMapToolMeasureAngle::updateSettings()
void QgsMapToolMeasureAngle::configureDistanceArea()
{
QString ellipsoidId = QgsProject::instance()->ellipsoid();
mDa.setSourceCrs( mCanvas->mapSettings().destinationCrs().srsid() );
mDa.setSourceCrs( mCanvas->mapSettings().destinationCrs() );
mDa.setEllipsoid( ellipsoidId );
mDa.setEllipsoidalMode( true );
}
2 changes: 1 addition & 1 deletion src/app/qgsmeasuredialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ void QgsMeasureDialog::updateSettings()
// Configure QgsDistanceArea
mDistanceUnits = QgsProject::instance()->distanceUnits();
mAreaUnits = QgsProject::instance()->areaUnits();
mDa.setSourceCrs( mTool->canvas()->mapSettings().destinationCrs().srsid() );
mDa.setSourceCrs( mTool->canvas()->mapSettings().destinationCrs() );
mDa.setEllipsoid( QgsProject::instance()->ellipsoid() );
mDa.setEllipsoidalMode( true );

Expand Down
2 changes: 1 addition & 1 deletion src/core/composer/qgscomposerscalebar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ double QgsComposerScaleBar::mapWidth() const
{
QgsDistanceArea da;
da.setEllipsoidalMode( true );
da.setSourceCrs( mComposerMap->crs().srsid() );
da.setSourceCrs( mComposerMap->crs() );
da.setEllipsoid( mComposition->project()->ellipsoid() );

QgsUnitTypes::DistanceUnit units = QgsUnitTypes::DistanceMeters;
Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsmaptoolidentify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ QMap< QString, QString > QgsMapToolIdentify::featureDerivedAttributes( QgsFeatur
QgsDistanceArea calc;
calc.setEllipsoidalMode( true );
calc.setEllipsoid( ellipsoid );
calc.setSourceCrs( layer->crs().srsid() );
calc.setSourceCrs( layer->crs() );

QgsWkbTypes::Type wkbType = QgsWkbTypes::NoGeometry;
QgsWkbTypes::GeometryType geometryType = QgsWkbTypes::NullGeometry;
Expand Down
2 changes: 1 addition & 1 deletion src/providers/grass/qgsgrassgislib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ int GRASS_LIB_EXPORT QgsGrassGisLib::G__gisinit( const char * version, const cha
mCrs.saveAsUserCRS( myName );
}
}
mDistanceArea.setSourceCrs( mCrs.srsid() );
mDistanceArea.setSourceCrs( mCrs );

// Read region fron environment variable
// QGIS_GRASS_REGION=west,south,east,north,cols,rows
Expand Down

0 comments on commit c0a8ee5

Please sign in to comment.