Skip to content

Commit

Permalink
[processing] Fix invalid geometries made by densify when input geom i…
Browse files Browse the repository at this point in the history
…s null
  • Loading branch information
nyalldawson committed Nov 6, 2016
1 parent e426dbc commit eefa711
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
12 changes: 5 additions & 7 deletions python/plugins/processing/algs/qgis/DensifyGeometries.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,11 @@ def processAlgorithm(self, progress):
features = vector.features(layer)
total = 100.0 / len(features)
for current, f in enumerate(features):
featGeometry = f.geometry()
attrs = f.attributes()
newGeometry = self.densifyGeometry(featGeometry, int(vertices),
isPolygon)
feature = QgsFeature()
feature.setGeometry(newGeometry)
feature.setAttributes(attrs)
feature = f
if feature.hasGeometry():
new_geometry = self.densifyGeometry(feature.geometry(), int(vertices),
isPolygon)
feature.setGeometry(new_geometry)
writer.addFeature(feature)
progress.setPercentage(int(current * total))

Expand Down
12 changes: 5 additions & 7 deletions python/plugins/processing/algs/qgis/DensifyGeometriesInterval.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,11 @@ def processAlgorithm(self, progress):
features = vector.features(layer)
total = 100.0 / len(features)
for current, f in enumerate(features):
featGeometry = f.geometry()
attrs = f.attributes()
newGeometry = self.densifyGeometry(featGeometry, interval,
isPolygon)
feature = QgsFeature()
feature.setGeometry(newGeometry)
feature.setAttributes(attrs)
feature = f
if feature.hasGeometry():
new_geometry = self.densifyGeometry(feature.geometry(), interval,
isPolygon)
feature.setGeometry(new_geometry)
writer.addFeature(feature)

progress.setPercentage(int(current * total))
Expand Down

0 comments on commit eefa711

Please sign in to comment.