Skip to content
Permalink
Browse files

Do not re-lookup already present CRSes

  • Loading branch information
m-kuhn committed Feb 24, 2017
1 parent 10f50ee commit c0a8ee51e1c3a2f03478f89dcb8c609af5daff3f
@@ -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(
@@ -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(
@@ -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
@@ -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
@@ -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 );
}
@@ -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 );
@@ -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() );

@@ -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() );

@@ -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() );

@@ -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 );
@@ -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() );

@@ -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 );
@@ -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 );
@@ -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 );
@@ -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() );

@@ -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 );
@@ -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 );
}
@@ -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 );

@@ -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;
@@ -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;
@@ -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

0 comments on commit c0a8ee5

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