- in Gerber editor, for selection now the intersection of the click point and the geometry is determined for chunks of the original geometry, each chunk gets done in a separate process
This commit is contained in:
parent
f1107fbd3b
commit
01806d77a3
|
@ -10,6 +10,7 @@ CHANGELOG for FlatCAM beta
|
|||
6.11.2020
|
||||
|
||||
- in Gerber Editor made the selection multithreaded in a bid to get more performance but until Shapely will start working on vectorized geometry this don't yield too much improvement
|
||||
- in Gerber Editor, for selection now the intersection of the click point and the geometry is determined for chunks of the original geometry, each chunk gets done in a separate process
|
||||
|
||||
5.11.2020
|
||||
|
||||
|
|
|
@ -2488,10 +2488,23 @@ class SelectEditorGrb(QtCore.QObject, DrawTool):
|
|||
def job_thread(editor_obj):
|
||||
self.results = []
|
||||
with editor_obj.app.proc_container.new('%s' % _("Working ...")):
|
||||
|
||||
def divide_chunks(l, n):
|
||||
# looping till length l
|
||||
for i in range(0, len(l), n):
|
||||
yield l[i:i + n]
|
||||
|
||||
# divide in chunks of 77 elements
|
||||
n = 77
|
||||
|
||||
for ap_key, storage_val in editor_obj.storage_dict.items():
|
||||
self.results.append(
|
||||
editor_obj.pool.apply_async(self.check_intersection, args=(ap_key, storage_val, point))
|
||||
)
|
||||
# divide in chunks of 77 elements
|
||||
geo_list = list(divide_chunks(storage_val['geometry'], n))
|
||||
for chunk, list30 in enumerate(geo_list):
|
||||
self.results.append(
|
||||
editor_obj.pool.apply_async(
|
||||
self.check_intersection, args=(ap_key, chunk, list30, point))
|
||||
)
|
||||
|
||||
output = []
|
||||
for p in self.results:
|
||||
|
@ -2500,7 +2513,8 @@ class SelectEditorGrb(QtCore.QObject, DrawTool):
|
|||
for ret_val in output:
|
||||
if ret_val:
|
||||
k = ret_val[0]
|
||||
idx = ret_val[1]
|
||||
part = ret_val[1]
|
||||
idx = ret_val[2] + (part * n)
|
||||
shape_stored = editor_obj.storage_dict[k]['geometry'][idx]
|
||||
|
||||
if shape_stored in editor_obj.selected:
|
||||
|
@ -2514,12 +2528,12 @@ class SelectEditorGrb(QtCore.QObject, DrawTool):
|
|||
self.draw_app.app.worker_task.emit({'fcn': job_thread, 'params': [self.draw_app]})
|
||||
|
||||
@staticmethod
|
||||
def check_intersection(ap_key, ap_storage, point):
|
||||
for idx, shape_stored in enumerate(ap_storage['geometry']):
|
||||
def check_intersection(ap_key, chunk, geo_storage, point):
|
||||
for idx, shape_stored in enumerate(geo_storage):
|
||||
if 'solid' in shape_stored.geo:
|
||||
geometric_data = shape_stored.geo['solid']
|
||||
if Point(point).intersects(geometric_data):
|
||||
return ap_key, idx
|
||||
return ap_key, chunk, idx
|
||||
|
||||
def after_selection(self):
|
||||
# ######################################################################################################
|
||||
|
|
Loading…
Reference in New Issue