Skip to content

Commit

Permalink
Added DA to qgsattribute... Not sure if it works OK...
Browse files Browse the repository at this point in the history
  • Loading branch information
homann committed Sep 4, 2012
1 parent 6b26c4a commit 79a138c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/app/qgsattributedialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include "qgsattributedialog.h"
#include "qgsfield.h"
#include "qgslogger.h"

#include "qgsmapcanvas.h"
#include "qgsvectorlayer.h"
#include "qgsvectordataprovider.h"
#include "qgsuniquevaluerenderer.h"
Expand Down Expand Up @@ -177,6 +177,14 @@ QgsAttributeDialog::QgsAttributeDialog( QgsVectorLayer *vl, QgsFeature *thepFeat
}
else
{

QgsDistanceArea myDa;
QSettings settings;

myDa.setSourceCrs( vl->crs().srsid() );
myDa.setEllipsoidalMode(QgisApp::instance()->mapCanvas()->mapRenderer()->hasCrsTransformEnabled() );
myDa.setEllipsoid( settings.value( "/qgis/measure/ellipsoid", GEO_NONE ).toString() );

for ( QgsFieldMap::const_iterator it = theFieldMap.begin(); it != theFieldMap.end(); ++it )
{
QWidget *myWidget = mDialog->findChild<QWidget*>( it->name() );
Expand Down Expand Up @@ -217,6 +225,8 @@ QgsAttributeDialog::QgsAttributeDialog( QgsVectorLayer *vl, QgsFeature *thepFeat
}
}

exp.setGeomCalculator( myDa );

QVariant value = exp.evaluate( mFeature, vl->pendingFields() );

if ( !exp.hasEvalError() )
Expand Down
9 changes: 9 additions & 0 deletions src/app/qgsattributetabledialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,14 @@ void QgsAttributeTableDialog::updateSelectionFromLayer()

void QgsAttributeTableDialog::doSearch( QString searchString )
{

QgsDistanceArea myDa;
QSettings settings;

myDa.setSourceCrs( mLayer->crs().srsid() );
myDa.setEllipsoidalMode(QgisApp::instance()->mapCanvas()->mapRenderer()->hasCrsTransformEnabled() );
myDa.setEllipsoid( settings.value( "/qgis/measure/ellipsoid", GEO_NONE ).toString() );

// parse search string and build parsed tree
QgsExpression search( searchString );
if ( search.hasParserError() )
Expand All @@ -556,6 +564,7 @@ void QgsAttributeTableDialog::doSearch( QString searchString )
QApplication::setOverrideCursor( Qt::WaitCursor );
mSelectedFeatures.clear();

search.setGeomCalculator( myDa );
if ( cbxSearchSelectedOnly->isChecked() )
{
QgsFeatureList selectedFeatures = mLayer->selectedFeatures();
Expand Down

0 comments on commit 79a138c

Please sign in to comment.