Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
[ftools] S'part to M'part with non-string columns and NULL values
- Loading branch information
Showing
with
11 additions
and
1 deletion.
-
+11
−1
python/plugins/fTools/tools/doGeometry.py
|
@@ -374,16 +374,26 @@ def single_to_multi( self ): |
|
|
merge_all = self.myField == "--- " + self.tr( "Merge all" ) + " ---" |
|
|
if not len( unique ) == self.vlayer.featureCount() or merge_all: |
|
|
for i in unique: |
|
|
# Strip spaces for strings, so " A " and "A" will be grouped |
|
|
# TODO: Make this optional (opt-out to keep it easy for beginners) |
|
|
if isinstance( i, basestring ): |
|
|
iMod = i.strip() |
|
|
else: |
|
|
iMod = i |
|
|
multi_feature= [] |
|
|
first = True |
|
|
fit = vprovider.getFeatures() |
|
|
while fit.nextFeature( inFeat ): |
|
|
atMap = inFeat.attributes() |
|
|
if not merge_all: |
|
|
idVar = atMap[ index ] |
|
|
if isinstance( idVar, basestring ): |
|
|
idVarMod = idVar.strip() |
|
|
else: |
|
|
idVarMod = idVar |
|
|
else: |
|
|
idVar = "" |
|
|
if idVar.strip() == i.strip() or merge_all: |
|
|
if idVarMod == iMod or merge_all: |
|
|
if first: |
|
|
atts = atMap |
|
|
first = False |
|
|