- Geo Editor -> Simplification Sub-tool: fixed an issue when calculating vertexes number
This commit is contained in:
@@ -7,6 +7,10 @@ CHANGELOG for FlatCAM Evo beta
|
|||||||
|
|
||||||
=================================================
|
=================================================
|
||||||
|
|
||||||
|
3.01.2024
|
||||||
|
|
||||||
|
- Geo Editor -> Simplification Sub-tool: fixed an issue when calculating vertexes number
|
||||||
|
|
||||||
16.12.2023
|
16.12.2023
|
||||||
|
|
||||||
- when tabs are set as not detachable, double_clicking the Plot_Area tab will toggle the notebook area visibility
|
- when tabs are set as not detachable, double_clicking the Plot_Area tab will toggle the notebook area visibility
|
||||||
|
|||||||
@@ -3094,7 +3094,7 @@ class FCSimplification(FCShapeTool):
|
|||||||
self.draw_app.plot_all()
|
self.draw_app.plot_all()
|
||||||
|
|
||||||
last_sel_geo = self.draw_app.selected[-1].geo
|
last_sel_geo = self.draw_app.selected[-1].geo
|
||||||
self.simp_tool.calculate_coords_vertex(last_sel_geo)
|
self.simp_tool.calculate_coordinates_vertex(last_sel_geo)
|
||||||
|
|
||||||
def clean_up(self):
|
def clean_up(self):
|
||||||
self.draw_app.selected = []
|
self.draw_app.selected = []
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ class SimplificationTool(AppToolEditor):
|
|||||||
pass
|
pass
|
||||||
if selected_shapes_geos:
|
if selected_shapes_geos:
|
||||||
# those are displayed by triggering the signal self.update_ui
|
# those are displayed by triggering the signal self.update_ui
|
||||||
self.calculate_coords_vertex(selected_shapes_geos)
|
self.calculate_coordinates_vertex(selected_shapes_geos)
|
||||||
|
|
||||||
def on_tab_close(self):
|
def on_tab_close(self):
|
||||||
self.geo_editor.select_tool("select")
|
self.geo_editor.select_tool("select")
|
||||||
@@ -139,7 +139,7 @@ class SimplificationTool(AppToolEditor):
|
|||||||
# # geo_editor.ui.tw.blockSignals(False)
|
# # geo_editor.ui.tw.blockSignals(False)
|
||||||
# # -----------------------------------------------------
|
# # -----------------------------------------------------
|
||||||
|
|
||||||
self.calculate_coords_vertex(selected_shapes_geos)
|
self.calculate_coordinates_vertex(selected_shapes_geos)
|
||||||
geo_editor.plot_all()
|
geo_editor.plot_all()
|
||||||
|
|
||||||
geo_editor.interdict_selection = False
|
geo_editor.interdict_selection = False
|
||||||
@@ -148,68 +148,70 @@ class SimplificationTool(AppToolEditor):
|
|||||||
|
|
||||||
self.app.worker_task.emit({'fcn': task_job, 'params': [self.geo_editor]})
|
self.app.worker_task.emit({'fcn': task_job, 'params': [self.geo_editor]})
|
||||||
|
|
||||||
def calculate_coords_vertex(self, selected_geos):
|
def calculate_coordinates_vertex(self, selected_geos):
|
||||||
vertex_nr = 0
|
vertex_nr = 0
|
||||||
coords = ''
|
coordinates = ''
|
||||||
|
|
||||||
|
if not isinstance(selected_geos, list):
|
||||||
|
selected_geos = [selected_geos]
|
||||||
for c_geo in selected_geos:
|
for c_geo in selected_geos:
|
||||||
if c_geo.geom_type == 'MultiLineString':
|
if c_geo.geom_type == 'MultiLineString':
|
||||||
for idx, line in enumerate(c_geo.geoms):
|
for idx, line in enumerate(c_geo.geoms):
|
||||||
line_coords = list(line.coords)
|
line_coords = list(line.coords)
|
||||||
vertex_nr += len(line_coords)
|
vertex_nr += len(line_coords)
|
||||||
coords += 'Line %s\n' % str(idx)
|
coordinates += 'Line %s\n' % str(idx)
|
||||||
coords += str(line_coords) + '\n'
|
coordinates += str(line_coords) + '\n'
|
||||||
elif c_geo.geom_type == 'MultiPolygon':
|
elif c_geo.geom_type == 'MultiPolygon':
|
||||||
for idx, poly in enumerate(c_geo.geoms):
|
for idx, poly in enumerate(c_geo.geoms):
|
||||||
poly_coords = list(poly.exterior.coords) + [list(i.coords) for i in poly.interiors]
|
poly_coords = list(poly.exterior.coords) + [list(i.coords) for i in poly.interiors]
|
||||||
vertex_nr += len(poly_coords)
|
vertex_nr += len(poly_coords)
|
||||||
|
|
||||||
coords += 'Polygon %s\n' % str(idx)
|
coordinates += 'Polygon %s\n' % str(idx)
|
||||||
coords += str(poly_coords) + '\n'
|
coordinates += str(poly_coords) + '\n'
|
||||||
elif c_geo.geom_type in ['LinearRing', 'LineString']:
|
elif c_geo.geom_type in ['LinearRing', 'LineString']:
|
||||||
line_coords = list(c_geo.coords)
|
line_coords = list(c_geo.coords)
|
||||||
coords += 'Line \n'
|
coordinates += 'Line \n'
|
||||||
coords += str(line_coords) + '\n'
|
coordinates += str(line_coords) + '\n'
|
||||||
|
|
||||||
vertex_nr += len(line_coords)
|
vertex_nr += len(line_coords)
|
||||||
elif c_geo.geom_type == 'Polygon':
|
elif c_geo.geom_type == 'Polygon':
|
||||||
line_coords = list(c_geo.exterior.coords)
|
line_coords = list(c_geo.exterior.coords)
|
||||||
coords += 'Line \n'
|
coordinates += 'Line \n'
|
||||||
coords += str(line_coords) + '\n'
|
coordinates += str(line_coords) + '\n'
|
||||||
|
|
||||||
vertex_nr += len(line_coords)
|
vertex_nr += len(line_coords)
|
||||||
else:
|
else:
|
||||||
coords += 'None\n'
|
coordinates += 'None\n'
|
||||||
|
|
||||||
# if last_sel_geo:
|
# if last_sel_geo:
|
||||||
# if last_sel_geo.geom_type == 'MultiLineString':
|
# if last_sel_geo.geom_type == 'MultiLineString':
|
||||||
# coords = ''
|
# coordinates = ''
|
||||||
# vertex_nr = 0
|
# vertex_nr = 0
|
||||||
# for idx, line in enumerate(last_sel_geo.geoms):
|
# for idx, line in enumerate(last_sel_geo.geoms):
|
||||||
# line_coords = list(line.coords)
|
# line_coords = list(line.coordinates)
|
||||||
# vertex_nr += len(line_coords)
|
# vertex_nr += len(line_coords)
|
||||||
# coords += 'Line %s\n' % str(idx)
|
# coordinates += 'Line %s\n' % str(idx)
|
||||||
# coords += str(line_coords) + '\n'
|
# coordinates += str(line_coords) + '\n'
|
||||||
# elif last_sel_geo.geom_type == 'MultiPolygon':
|
# elif last_sel_geo.geom_type == 'MultiPolygon':
|
||||||
# coords = ''
|
# coordinates = ''
|
||||||
# vertex_nr = 0
|
# vertex_nr = 0
|
||||||
# for idx, poly in enumerate(last_sel_geo.geoms):
|
# for idx, poly in enumerate(last_sel_geo.geoms):
|
||||||
# poly_coords = list(poly.exterior.coords) + [list(i.coords) for i in poly.interiors]
|
# poly_coords = list(poly.exterior.coordinates) + [list(i.coordinates) for i in poly.interiors]
|
||||||
# vertex_nr += len(poly_coords)
|
# vertex_nr += len(poly_coords)
|
||||||
#
|
#
|
||||||
# coords += 'Polygon %s\n' % str(idx)
|
# coordinates += 'Polygon %s\n' % str(idx)
|
||||||
# coords += str(poly_coords) + '\n'
|
# coordinates += str(poly_coords) + '\n'
|
||||||
# elif last_sel_geo.geom_type in ['LinearRing', 'LineString']:
|
# elif last_sel_geo.geom_type in ['LinearRing', 'LineString']:
|
||||||
# coords = list(last_sel_geo.coords)
|
# coordinates = list(last_sel_geo.coordinates)
|
||||||
# vertex_nr = len(coords)
|
# vertex_nr = len(coordinates)
|
||||||
# elif last_sel_geo.geom_type == 'Polygon':
|
# elif last_sel_geo.geom_type == 'Polygon':
|
||||||
# coords = list(last_sel_geo.exterior.coords)
|
# coordinates = list(last_sel_geo.exterior.coordinates)
|
||||||
# vertex_nr = len(coords)
|
# vertex_nr = len(coordinates)
|
||||||
# else:
|
# else:
|
||||||
# coords = 'None'
|
# coordinates = 'None'
|
||||||
# vertex_nr = 0
|
# vertex_nr = 0
|
||||||
|
|
||||||
self.update_ui.emit(coords, vertex_nr)
|
self.update_ui.emit(coordinates, vertex_nr)
|
||||||
|
|
||||||
def on_update_ui(self, coords, vertex_nr):
|
def on_update_ui(self, coords, vertex_nr):
|
||||||
self.ui.geo_coords_entry.set_value(str(coords))
|
self.ui.geo_coords_entry.set_value(str(coords))
|
||||||
|
|||||||
Reference in New Issue
Block a user