Skip to content
Permalink
Browse files

Added DA to qgsattribute... Not sure if it works OK...

  • Loading branch information
homann committed Sep 4, 2012
1 parent 6b26c4a commit 79a138cba25d5a9c27762c0b54d4bd5e68f694c7
Showing with 20 additions and 1 deletion.
  1. +11 −1 src/app/qgsattributedialog.cpp
  2. +9 −0 src/app/qgsattributetabledialog.cpp
@@ -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"
@@ -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() );
@@ -217,6 +225,8 @@ QgsAttributeDialog::QgsAttributeDialog( QgsVectorLayer *vl, QgsFeature *thepFeat
}
}

exp.setGeomCalculator( myDa );

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

if ( !exp.hasEvalError() )
@@ -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() )
@@ -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();

0 comments on commit 79a138c

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