- fixed some bugs in Geometry Editor in regards of Buffer Tool

- fixed some issues in the Cutout Plugin by adding more checks
- fixed issues when loading files by dragging in the UI (caused by recent code refactoring)
This commit is contained in:
Marius Stanciu
2022-08-01 12:27:14 +03:00
committed by Marius
parent 4c22e52b08
commit 419330ee93
9 changed files with 72 additions and 194 deletions

View File

@@ -2847,7 +2847,7 @@ class FCBuffer(FCShapeTool):
# the cb index start from 0 but the join styles for the buffer start from 1 therefore the adjustment
# I populated the combobox such that the index coincide with the join styles value (whcih is really an INT)
join_style = self.buff_tool.ui.buffer_corner_cb.currentIndex() + 1
ret_val = self.draw_app.buffer(buffer_distance, join_style)
ret_val = self.buff_tool.buffer(buffer_distance, join_style)
self.deactivate()
if ret_val == 'fail':
@@ -2873,7 +2873,7 @@ class FCBuffer(FCShapeTool):
# the cb index start from 0 but the join styles for the buffer start from 1 therefore the adjustment
# I populated the combobox such that the index coincide with the join styles value (whcih is really an INT)
join_style = self.buff_tool.ui.buffer_corner_cb.currentIndex() + 1
ret_val = self.draw_app.buffer_int(buffer_distance, join_style)
ret_val = self.buff_tool.buffer_int(buffer_distance, join_style)
self.deactivate()
if ret_val == 'fail':
@@ -2899,7 +2899,7 @@ class FCBuffer(FCShapeTool):
# the cb index start from 0 but the join styles for the buffer start from 1 therefore the adjustment
# I populated the combobox such that the index coincide with the join styles value (whcih is really an INT)
join_style = self.buff_tool.ui.buffer_corner_cb.currentIndex() + 1
ret_val = self.draw_app.buffer_ext(buffer_distance, join_style)
ret_val = self.buff_tool.buffer_ext(buffer_distance, join_style)
# self.app.ui.notebook.setTabText(2, _("Tools"))
# self.draw_app.app.ui.splitter.setSizes([0, 1])

View File

@@ -200,7 +200,7 @@ class BufferSelectionTool(AppToolEditor):
geo_editor.build_ui_sig.emit()
geo_editor.app.inform.emit('[success] %s' % _("Done."))
self.app.worker_task.emit({'fcn': work_task, 'params': [self]})
self.app.worker_task.emit({'fcn': work_task, 'params': [self.draw_app]})
def buffer_int(self, buf_distance, join_style):
def work_task(geo_editor):
@@ -238,6 +238,8 @@ class BufferSelectionTool(AppToolEditor):
for line in t.geo:
if line.is_ring:
b_geo = Polygon(line)
else:
b_geo = line
results.append(b_geo.buffer(
-buf_distance + 1e-10,
resolution=int(int(geo_editor.app.options["geometry_circle_steps"]) / 4),
@@ -246,6 +248,8 @@ class BufferSelectionTool(AppToolEditor):
elif t.geo.geom_type in ['LineString', 'LinearRing']:
if t.geo.is_ring:
b_geo = Polygon(t.geo)
else:
b_geo = t.geo
results.append(b_geo.buffer(
-buf_distance + 1e-10,
resolution=int(int(geo_editor.app.options["geometry_circle_steps"]) / 4),
@@ -266,7 +270,7 @@ class BufferSelectionTool(AppToolEditor):
geo_editor.build_ui_sig.emit()
geo_editor.app.inform.emit('[success] %s' % _("Done."))
self.app.worker_task.emit({'fcn': work_task, 'params': [self]})
self.app.worker_task.emit({'fcn': work_task, 'params': [self.draw_app]})
def buffer_ext(self, buf_distance, join_style):
def work_task(geo_editor):
@@ -306,6 +310,8 @@ class BufferSelectionTool(AppToolEditor):
for line in t.geo:
if line.is_ring:
b_geo = Polygon(line)
else:
b_geo = line
results.append(b_geo.buffer(
buf_distance - 1e-10,
resolution=int(int(geo_editor.app.options["geometry_circle_steps"]) / 4),
@@ -314,6 +320,8 @@ class BufferSelectionTool(AppToolEditor):
elif t.geo.geom_type in ['LineString', 'LinearRing']:
if t.geo.is_ring:
b_geo = Polygon(t.geo)
else:
b_geo = t.geo
results.append(b_geo.buffer(
buf_distance - 1e-10,
resolution=int(int(geo_editor.app.options["geometry_circle_steps"]) / 4),
@@ -334,7 +342,7 @@ class BufferSelectionTool(AppToolEditor):
geo_editor.build_ui_sig.emit()
geo_editor.app.inform.emit('[success] %s' % _("Done."))
self.app.worker_task.emit({'fcn': work_task, 'params': [self]})
self.app.worker_task.emit({'fcn': work_task, 'params': [self.draw_app]})
def hide_tool(self):
self.ui.buffer_tool_frame.hide()