Skip to content
Permalink
Browse files

Started on ExpBuiWid

  • Loading branch information
homann committed Sep 4, 2012
1 parent 79a138c commit e83dce5e57a0facd74c92a0e8fcee6f908c57327
@@ -182,7 +182,7 @@ QgsAttributeDialog::QgsAttributeDialog( QgsVectorLayer *vl, QgsFeature *thepFeat
QSettings settings;

myDa.setSourceCrs( vl->crs().srsid() );
myDa.setEllipsoidalMode(QgisApp::instance()->mapCanvas()->mapRenderer()->hasCrsTransformEnabled() );
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 )
@@ -541,7 +541,7 @@ void QgsAttributeTableDialog::doSearch( QString searchString )
QSettings settings;

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

// parse search string and build parsed tree
@@ -231,6 +231,12 @@ bool QgsExpressionBuilderWidget::isExpressionValid()
return mExpressionValid;
}

void QgsExpressionBuilderWidget::setGeomCalculator( const QgsDistanceArea & da )
{
Q_UNUSED( da );
// TODO! FIXME!!!
}

QString QgsExpressionBuilderWidget::expressionText()
{
return txtExpressionString->toPlainText();
@@ -257,12 +263,25 @@ void QgsExpressionBuilderWidget::on_txtExpressionString_textChanged()
return;
}



QgsExpression exp( text );

// TODO We could do this without a layer.
// Maybe just calling exp.evaluate()?
if ( mLayer )
{
// Only set ellipsoid if we have layer...
QgsDistanceArea myDa;
QSettings settings;

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

exp.setGeomCalculator( myDa );

if ( !mFeature.isValid() )
{
mLayer->select( mLayer->pendingAllAttributesList(), QgsRectangle(), mLayer->geometryType() != QGis::NoGeometry && exp.needsGeometry() );
@@ -20,6 +20,7 @@
#include "ui_qgsexpressionbuilder.h"
#include "qgsvectorlayer.h"
#include "qgsexpressionhighlighter.h"
#include "qgsdistancearea.h"

#include "QStandardItemModel"
#include "QStandardItem"
@@ -122,6 +123,10 @@ class GUI_EXPORT QgsExpressionBuilderWidget : public QWidget, private Ui::QgsExp

void loadFieldNames( QgsFieldMap fields );

/** Sets geometry calculator in order to get the measurements correct.
*/
void setGeomCalculator( const QgsDistanceArea & da );

/** Gets the expression string that has been set in the expression area.
* @returns The expression as a string. */
QString expressionText();

0 comments on commit e83dce5

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