Skip to content
Permalink
Browse files
Pass distance area into field calc bar
  • Loading branch information
NathanW2 committed May 26, 2014
1 parent c5bde9b commit dcbf893e68727d469b41c9adebc781e083b64609
Showing with 7 additions and 5 deletions.
  1. +6 −5 src/app/qgsattributetabledialog.cpp
  2. +1 −0 src/app/qgsattributetabledialog.h
@@ -78,13 +78,13 @@ QgsAttributeTableDialog::QgsAttributeTableDialog( QgsVectorLayer *theLayer, QWid

QgsAttributeEditorContext context;

QgsDistanceArea myDa;
myDa = new QgsDistanceArea();

myDa.setSourceCrs( mLayer->crs() );
myDa.setEllipsoidalMode( QgisApp::instance()->mapCanvas()->mapSettings().hasCrsTransformEnabled() );
myDa.setEllipsoid( QgsProject::instance()->readEntry( "Measure", "/Ellipsoid", GEO_NONE ) );
myDa->setSourceCrs( mLayer->crs() );
myDa->setEllipsoidalMode( QgisApp::instance()->mapCanvas()->mapSettings().hasCrsTransformEnabled() );
myDa->setEllipsoid( QgsProject::instance()->readEntry( "Measure", "/Ellipsoid", GEO_NONE ) );

context.setDistanceArea( myDa );
context.setDistanceArea( *myDa );
context.setVectorLayerTools( QgisApp::instance()->vectorLayerTools() );

// Initialize dual view
@@ -303,6 +303,7 @@ void QgsAttributeTableDialog::updateFieldFromExpression()
QString error;

QgsExpression exp( mUpdateExpressionText->text() );
exp.setGeomCalculator( *myDa );
bool useGeometry = exp.needsGeometry();

QgsFeatureRequest request;
@@ -194,6 +194,7 @@ class APP_EXPORT QgsAttributeTableDialog : public QDialog, private Ui::QgsAttrib
QAction* mActionToggleEditing;

QDockWidget* mDock;
QgsDistanceArea* myDa;

QMenu* mFilterColumnsMenu;
QSignalMapper* mFilterActionMapper;

1 comment on commit dcbf893

@m-kuhn

This comment has been minimized.

Copy link
Member

@m-kuhn m-kuhn commented on dcbf893 Jun 6, 2014

Doesn't this leak memory?
Is there a reason to create it with new? If creating with new I think there should be an appropriate delete as well.

Please sign in to comment.