- fixed Gerber object color set for Legacy(2D) graphic engine; glitch on the OpenGL(3D) graphic engine

This commit is contained in:
Marius Stanciu
2019-12-22 16:24:04 +02:00
committed by Marius
parent 988b9d7dac
commit 9fe3dfbfa9
4 changed files with 31 additions and 13 deletions

View File

@@ -1033,7 +1033,7 @@ class ShapeCollectionLegacy:
if update is True:
self.redraw()
def redraw(self):
def redraw(self, update_colors=None):
"""
This draw the shapes in the shapes collection, on canvas
@@ -1087,7 +1087,6 @@ class ShapeCollectionLegacy:
self.axes.plot(x, y, local_shapes[element]['color'],
linestyle='-',
linewidth=local_shapes[element]['linewidth'])
elif obj_type == 'gerber':
if self.obj.options["multicolored"]:
linespec = '-'
@@ -1095,16 +1094,25 @@ class ShapeCollectionLegacy:
linespec = 'k-'
if self.obj.options["solid"]:
if update_colors:
gerber_fill_color = update_colors[0]
gerber_outline_color = update_colors[1]
else:
gerber_fill_color = local_shapes[element]['face_color']
gerber_outline_color = local_shapes[element]['color']
try:
patch = PolygonPatch(local_shapes[element]['shape'],
facecolor=local_shapes[element]['face_color'],
edgecolor=local_shapes[element]['color'],
facecolor=gerber_fill_color,
edgecolor=gerber_outline_color,
alpha=local_shapes[element]['alpha'],
zorder=2)
self.axes.add_patch(patch)
except AssertionError:
FlatCAMApp.App.log.warning("A geometry component was not a polygon:")
FlatCAMApp.App.log.warning(str(element))
except Exception as e:
FlatCAMApp.App.log.debug("PlotCanvasLegacy.ShepeCollectionLegacy.redraw() --> %s" % str(e))
else:
x, y = local_shapes[element]['shape'].exterior.xy
self.axes.plot(x, y, linespec)