[SCM] qgis branch, master, updated. a2ee769957385f4e084c5e8b6ba178a8c877d1db

Alexander Bruy alexander.bruy at gmail.com
Tue Mar 20 13:42:29 UTC 2012


The following commit has been merged in the master branch:
commit 3c7354e3d897bd9136a4312455bccd5b3b88ffc3
Author: Alexander Bruy <alexander.bruy at gmail.com>
Date:   Thu Mar 1 13:02:00 2012 +0200

    fix geometry column export when used calculation on ellipsoid

diff --git a/python/plugins/fTools/tools/doGeometry.py b/python/plugins/fTools/tools/doGeometry.py
index 560e6bf..978d786 100644
--- a/python/plugins/fTools/tools/doGeometry.py
+++ b/python/plugins/fTools/tools/doGeometry.py
@@ -508,37 +508,40 @@ class geometryThread( QThread ):
     return True
 
   def export_geometry_info( self ):
+    ellips = None
+    crs = None
+    coordTransform = None
+
+    # calculate with:
+    # 0 - layer CRS
+    # 1 - project CRS
+    # 2 - ellipsoidal
+    if self.myCalcType == 2:
+      settings = QSettings()
+      ellips = settings.value( "/qgis/measure/ellipsoid", "WGS84" ).toString()
+      crs = self.vlayer.crs().srsid()
+    elif self.myCalcType == 1:
+      mapCRS = self.parent.iface.mapCanvas().mapRenderer().destinationCrs()
+      layCRS = self.vlayer.crs()
+      coordTransform = QgsCoordinateTransform( layCRS, mapCRS )
+
+    inFeat = QgsFeature()
+    outFeat = QgsFeature()
+    inGeom = QgsGeometry()
+    nElement = 0
+
+    vprovider = self.vlayer.dataProvider()
+
+    self.emit( SIGNAL( "runStatus( PyQt_PyObject )" ), 0)
+    self.emit( SIGNAL( "runRange( PyQt_PyObject )" ), ( 0, vprovider.featureCount() ) )
+
     if self.writeShape:
-      vprovider = self.vlayer.dataProvider()
       allAttrs = vprovider.attributeIndexes()
       vprovider.select( allAttrs )
       ( fields, index1, index2 ) = self.checkGeometryFields( self.vlayer )
       writer = QgsVectorFileWriter( self.myName, self.myEncoding, fields,
                                     vprovider.geometryType(), vprovider.crs() )
-      inFeat = QgsFeature()
-      outFeat = QgsFeature()
-      inGeom = QgsGeometry()
-      nFeat = vprovider.featureCount()
-      nElement = 0
-
-      # calculate with:
-      # 0 - layer CRS
-      # 1 - project CRS
-      # 2 - ellipsoidal
-      ellips = None
-      crs = None
-      coordTransform = None
-      if self.myCalcType == 2:
-        settings = QSettings()
-        ellips = settings.value( "/qgis/measure/ellipsoid", "WGS84" ).toString()
-        crs = self.parent.iface.mapCanvas().mapRenderer().destinationCrs().srsid()
-      elif self.myCalcType == 1:
-        mapCRS = self.parent.iface.mapCanvas().mapRenderer().destinationCrs()
-        layCRS = self.vlayer.crs()
-        coordTransform = QgsCoordinateTransform( layCRS, mapCRS )
-
-      self.emit( SIGNAL( "runStatus( PyQt_PyObject )" ), 0)
-      self.emit( SIGNAL( "runRange( PyQt_PyObject )" ), ( 0, nFeat ) )
+
       while vprovider.nextFeature(inFeat):
         self.emit( SIGNAL( "runStatus( PyQt_PyObject )" ),  nElement )
         nElement += 1
@@ -546,6 +549,7 @@ class geometryThread( QThread ):
 
         if self.myCalcType == 1:
           inGeom.transform( coordTransform )
+
         ( attr1, attr2 ) = self.simpleMeasure( inGeom, self.myCalcType, ellips, crs )
 
         outFeat.setGeometry( inGeom )
@@ -558,34 +562,9 @@ class geometryThread( QThread ):
       return True
     else: # update existing file
       newFields = []
-      vprovider = self.vlayer.dataProvider()
       geomType = self.vlayer.geometryType()
       ( index1, index2 ) = self.findOrCreateFields()
 
-      inFeat = QgsFeature()
-      inGeom = QgsGeometry()
-      nFeat = vprovider.featureCount()
-      nElement = 0
-
-      # calculate with:
-      # 0 - layer CRS
-      # 1 - project CRS
-      # 2 - ellipsoidal
-      ellips = None
-      crs = None
-      coordTransform = None
-      if self.myCalcType == 2:
-        settings = QSettings()
-        ellips = settings.value( "/qgis/measure/ellipsoid", "WGS84" ).toString()
-        crs = self.parent.iface.mapCanvas().mapRenderer().destinationCrs().srsid()
-      elif self.myCalcType == 1:
-        mapCRS = self.parent.iface.mapCanvas().mapRenderer().destinationCrs()
-        layCRS = self.vlayer.crs()
-        coordTransform = QgsCoordinateTransform( layCRS, mapCRS )
-
-      self.emit( SIGNAL( "runStatus( PyQt_PyObject )" ), 0)
-      self.emit( SIGNAL( "runRange( PyQt_PyObject )" ), ( 0, nFeat ) )
-
       while vprovider.nextFeature(inFeat):
         self.emit( SIGNAL( "runStatus( PyQt_PyObject )" ),  nElement )
         nElement += 1

-- 
The Quantum GIS in Debian project



More information about the Pkg-grass-devel mailing list