Skip to content
Permalink
Browse files
fix #7172
  • Loading branch information
jef-n committed Feb 17, 2013
1 parent 7275525 commit 8f25bcfd20bb6deae846010883f37114e133f8f1
Showing with 21 additions and 15 deletions.
  1. +15 −9 python/plugins/fTools/tools/doGeoprocessing.py
  2. +6 −6 python/plugins/fTools/tools/ftools_utils.py
@@ -891,7 +891,6 @@ def intersect( self ):
crs_match = None
else:
crs_match = crsA == crsB

fields = ftools_utils.combineVectorFields( self.vlayerA, self.vlayerB )
longNames = ftools_utils.checkFieldNameLength( fields )
if not longNames.isEmpty():
@@ -945,7 +944,8 @@ def intersect( self ):
gList = ftools_utils.getGeomType( geom.wkbType() )
if int_geom.wkbType() in gList:
outFeat.setGeometry( int_geom )
outFeat.setAttributes( atMapA.extend( atMapB ) )
atMapA.extend( atMapB )
outFeat.setAttributes( atMapA )
writer.addFeature( outFeat )
except:
FEATURE_EXCEPT = False
@@ -976,7 +976,8 @@ def intersect( self ):
gList = ftools_utils.getGeomType( geom.wkbType() )
if int_geom.wkbType() in gList:
outFeat.setGeometry( int_geom )
outFeat.setAttributes( atMapA.extend( atMapB ) )
atMapA.extend( atMapB )
outFeat.setAttributes( atMapA )
writer.addFeature( outFeat )
except:
EATURE_EXCEPT = False
@@ -1015,7 +1016,8 @@ def intersect( self ):
gList = ftools_utils.getGeomType( geom.wkbType() )
if int_geom.wkbType() in gList:
outFeat.setGeometry( int_geom )
outFeat.setAttributes( atMapA.extend( atMapB ) )
atMapA.extend( atMapB )
outFeat.setAttributes( atMapA )
writer.addFeature( outFeat )
except:
FEATURE_EXCEPT = False
@@ -1025,8 +1027,8 @@ def intersect( self ):
break
# we have no selection in overlay layer
else:
fitA = vproviderA.getFeatures()
while fita.nextFeature( inFeatA ):
fitA = vproviderA.getFeatures()
while fitA.nextFeature( inFeatA ):
nElement += 1
self.emit( SIGNAL( "runStatus(PyQt_PyObject)" ), nElement )
geom = QgsGeometry( inFeatA.geometry() )
@@ -1043,11 +1045,13 @@ def intersect( self ):
int_com = geom.combine( tmpGeom )
int_sym = geom.symDifference( tmpGeom )
int_geom = QgsGeometry( int_com.difference( int_sym ) )

try:
gList = ftools_utils.getGeomType( geom.wkbType() )
if int_geom.wkbType() in gList:
outFeat.setGeometry( int_geom )
outFeat.setAttributes( atMapA.extend( atMapB ) )
atMapA.extend( atMapB )
outFeat.setAttributes( atMapA )
writer.addFeature( outFeat )
except:
FEATURE_EXCEPT = False
@@ -1148,7 +1152,8 @@ def union( self ):
int_geom = QgsGeometry( i )
try:
outFeat.setGeometry( int_geom )
outFeat.setAttributes( atMapA.extend( atMapB ) )
atMapA.extend( atMapB )
outFeat.setAttributes( atMapA )
writer.addFeature( outFeat )
except Exception, err:
FEATURE_EXCEPT = False
@@ -1161,7 +1166,8 @@ def union( self ):
if int_geom.wkbType() in gList:
try:
outFeat.setGeometry( int_geom )
outFeat.setAttributes( atMapA.extend( atMapB ) )
atMapA.extend( atMapB )
outFeat.setAttributes( atMapA )
writer.addFeature( outFeat )
except Exception, err:
FEATURE_EXCEPT = False
@@ -76,7 +76,8 @@ def combineVectorFields( layerA, layerB ):
fieldsA = layerA.dataProvider().fields()
fieldsB = layerB.dataProvider().fields()
fieldsB = testForUniqueness( fieldsA, fieldsB )
fieldsA.extend( fieldsB )
for f in fieldsB:
fieldsA.append( f )
return fieldsA

# Check if two input CRSs are identical
@@ -155,10 +156,10 @@ def testForUniqueness( fieldList1, fieldList2 ):
changed = True
while changed:
changed = False
for i in fieldList1:
for j in fieldList2:
if j.name() == i.name():
j = createUniqueFieldName( j )
for i in range(0,len(fieldList1)):
for j in range(0,len(fieldList2)):
if fieldList1[i].name() == fieldList2[j].name():
fieldList2[j] = createUniqueFieldName( fieldList2[j] )
changed = True
return fieldList2

@@ -265,7 +266,6 @@ def addShapeToCanvas( shapefile_path ):
else:
return False
vlayer_new = QgsVectorLayer( shapefile_path, layer_name, "ogr" )
print layer_name
if vlayer_new.isValid():
QgsMapLayerRegistry.instance().addMapLayers( [vlayer_new] )
return True

0 comments on commit 8f25bcf

Please sign in to comment.