Allow layer switch directly from MultiPlotter
This commit is contained in:
parent
b35952c8bd
commit
ccee6134bb
51
lib/plot.py
51
lib/plot.py
|
@ -120,29 +120,6 @@ A4_PORTRAIT = Paper(210, 297, 20)
|
|||
A6_PORTRAIT = Paper(105, 148, 8)
|
||||
|
||||
|
||||
class MultiPlotter:
|
||||
def __init__(self):
|
||||
self.plotters = []
|
||||
|
||||
def move_to(self, point):
|
||||
for plotter in self.plotters:
|
||||
plotter.move_to(point)
|
||||
|
||||
def line_to(self, point):
|
||||
for plotter in self.plotters:
|
||||
plotter.line_to(point)
|
||||
|
||||
def add_layer(self, *args, **kwargs):
|
||||
for plotter in self.plotters:
|
||||
plotter.add_layer(*args, **kwargs)
|
||||
|
||||
def finalise(self):
|
||||
for plotter in self.plotters:
|
||||
plotter.finalise()
|
||||
|
||||
def register_plotter(self, plotter):
|
||||
self.plotters.append(plotter)
|
||||
|
||||
|
||||
class Plotter:
|
||||
|
||||
|
@ -286,3 +263,31 @@ class HPGLPlotter(Plotter):
|
|||
for i in range(len(self.layers)):
|
||||
with open(self._layer_file_name(i), 'at') as file:
|
||||
file.write(';PU0,0;IN')
|
||||
|
||||
|
||||
class MultiPlotter(Plotter):
|
||||
def __init__(self):
|
||||
self.plotters = []
|
||||
|
||||
def move_to(self, point):
|
||||
for plotter in self.plotters:
|
||||
plotter.move_to(point)
|
||||
|
||||
def line_to(self, point):
|
||||
for plotter in self.plotters:
|
||||
plotter.line_to(point)
|
||||
|
||||
def add_layer(self, *args, **kwargs):
|
||||
for plotter in self.plotters:
|
||||
plotter.add_layer(*args, **kwargs)
|
||||
|
||||
def switch_layers(self, *args, **kwargs):
|
||||
for plotter in self.plotters:
|
||||
plotter.switch_layers(*args, **kwargs)
|
||||
|
||||
def finalise(self):
|
||||
for plotter in self.plotters:
|
||||
plotter.finalise()
|
||||
|
||||
def register_plotter(self, plotter):
|
||||
self.plotters.append(plotter)
|
Loading…
Reference in a new issue