Skip to content

Commit

Permalink
fix #3661
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@15610 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Mar 26, 2011
1 parent 00a6dba commit d499018
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion python/plugins/fTools/tools/doGeometry.py
Expand Up @@ -354,8 +354,9 @@ def multi_to_single( self ):
allAttrs = vprovider.attributeIndexes()
vprovider.select( allAttrs )
fields = vprovider.fields()
geomType = self.multiToSingleGeom(vprovider.geometryType())
writer = QgsVectorFileWriter( self.myName, self.myEncoding,
fields, vprovider.geometryType()-3, vprovider.crs() )
fields, geomType, vprovider.crs() )
inFeat = QgsFeature()
outFeat = QgsFeature()
inGeom = QgsGeometry()
Expand Down Expand Up @@ -901,6 +902,22 @@ def singleToMultiGeom(self, wkbType):
except Exception, err:
print str(err)

def multiToSingleGeom(self, wkbType):
try:
if wkbType in (QGis.WKBPoint, QGis.WKBMultiPoint,
QGis.WKBPoint25D, QGis.WKBMultiPoint25D):
return QGis.WKBPoint
elif wkbType in (QGis.WKBLineString, QGis.WKBMultiLineString,
QGis.WKBMultiLineString25D, QGis.WKBLineString25D):
return QGis.WKBLineString
elif wkbType in (QGis.WKBPolygon, QGis.WKBMultiPolygon,
QGis.WKBMultiPolygon25D, QGis.WKBPolygon25D):
return QGis.WKBPolygon
else:
return QGis.WKBUnknown
except Exception, err:
print str(err)

def extractAsSingle( self, geom ):
multi_geom = QgsGeometry()
temp_geom = []
Expand Down

0 comments on commit d499018

Please sign in to comment.