- in Geometry Editor - simplification method is now threaded and optimized

This commit is contained in:
Marius Stanciu
2020-11-27 02:14:59 +02:00
committed by Marius
parent e79a53012a
commit ae302244a6
2 changed files with 21 additions and 13 deletions

View File

@@ -3871,22 +3871,29 @@ class AppGeoEditor(QtCore.QObject):
tol = self.geo_tol_entry.get_value()
selected_tree_items = self.tw.selectedItems()
for sel in selected_tree_items:
for obj_shape in self.storage.get_objects():
try:
if id(obj_shape) == int(sel.text(0)):
selected_shapes.append(obj_shape)
selected_shapes_geos.append(obj_shape.geo.simplify(tolerance=tol))
except ValueError:
pass
for shape in selected_shapes:
self.delete_shape(shape=shape)
def task_job():
with self.app.proc_container.new('%s...' % _("Working")):
for sel in selected_tree_items:
for obj_shape in self.storage.get_objects():
try:
if id(obj_shape) == int(sel.text(0)):
selected_shapes.append(obj_shape)
selected_shapes_geos.append(obj_shape.geo.simplify(tolerance=tol))
except ValueError:
pass
for geo in selected_shapes_geos:
self.add_shape(DrawToolShape(geo))
for shape in selected_shapes:
self.delete_shape(shape=shape)
self.build_ui_sig.emit()
for geo in selected_shapes_geos:
self.add_shape(DrawToolShape(geo), build_ui=False)
self.plot_all()
self.build_ui_sig.emit()
self.app.worker_task.emit({'fcn': task_job, 'params': []})
def activate(self):
# adjust the status of the menu entries related to the editor