Skip to content
Snippets Groups Projects
Commit 45dadf62 authored by Harlan Hile's avatar Harlan Hile
Browse files

Add saveJob() implementations.

parent 65258100
No related branches found
No related tags found
No related merge requests found
......@@ -999,4 +999,10 @@ abstract class EpilogCutter extends LaserCutter
return Math.sqrt(Math.pow(p.x - x, 2) + Math.pow(p.y - y, 2));
}
@Override
public void saveJob(PrintStream fileOutputStream, LaserJob job) throws UnsupportedOperationException, IllegalJobException, Exception {
job.applyStartPoint();
byte[] pjlData = generatePjlData(job);
fileOutputStream.write(pjlData);
}
}
......@@ -446,8 +446,12 @@ public class GoldCutHPGL extends LaserCutter {
out = new BufferedOutputStream(port.getOutputStream());
pl.taskChanged(this, "sending");
}
writeJob(out, job, pl, port);
}
private void writeJob(BufferedOutputStream out, LaserJob job, ProgressListener pl, SerialPort port) throws IllegalJobException, Exception {
out.write(this.generateInitializationCode());
pl.progressChanged(this, 20);
if (pl != null) pl.progressChanged(this, 20);
int i = 0;
int max = job.getParts().size();
for (JobPart p : job.getParts())
......@@ -465,7 +469,7 @@ public class GoldCutHPGL extends LaserCutter {
out.write(this.generateVectorGCode((VectorPart) p, p.getDPI()));
}
i++;
pl.progressChanged(this, 20 + (int) (i*(double) 60/max));
if (pl != null) pl.progressChanged(this, 20 + (int) (i*(double) 60/max));
}
out.write(this.generateShutdownCode());
out.close();
......@@ -473,8 +477,11 @@ public class GoldCutHPGL extends LaserCutter {
{
port.close();
}
pl.taskChanged(this, "sent.");
pl.progressChanged(this, 100);
if (pl != null)
{
pl.taskChanged(this, "sent.");
pl.progressChanged(this, 100);
}
}
private List<Double> resolutions;
......@@ -606,4 +613,9 @@ public class GoldCutHPGL extends LaserCutter {
clone.addSpacePerRasterLine = addSpacePerRasterLine;
return clone;
}
@Override
public void saveJob(PrintStream fileOutputStream, LaserJob job) throws UnsupportedOperationException, IllegalJobException, Exception {
writeJob(new BufferedOutputStream(fileOutputStream), job, null, null);
}
}
......@@ -388,8 +388,12 @@ public class Lasersaur extends LaserCutter {
port.setSerialPortParams(9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
out = new BufferedOutputStream(port.getOutputStream());
pl.taskChanged(this, "sending");
writeJob(out, job, pl, port);
}
private void writeJob(BufferedOutputStream out, LaserJob job, ProgressListener pl, SerialPort port) throws IllegalJobException, Exception {
out.write(this.generateInitializationCode());
pl.progressChanged(this, 20);
if (pl != null) pl.progressChanged(this, 20);
int i = 0;
int max = job.getParts().size();
for (JobPart p : job.getParts())
......@@ -407,13 +411,16 @@ public class Lasersaur extends LaserCutter {
out.write(this.generateVectorGCode((VectorPart) p, p.getDPI()));
}
i++;
pl.progressChanged(this, 20 + (int) (i*(double) 60/max));
if (pl!= null) pl.progressChanged(this, 20 + (int) (i*(double) 60/max));
}
out.write(this.generateShutdownCode());
out.close();
port.close();
pl.taskChanged(this, "sent.");
pl.progressChanged(this, 100);
if (port != null) port.close();
if (pl != null)
{
pl.taskChanged(this, "sent.");
pl.progressChanged(this, 100);
}
}
private List<Double> resolutions;
......@@ -532,4 +539,9 @@ public class Lasersaur extends LaserCutter {
clone.addSpacePerRasterLine = addSpacePerRasterLine;
return clone;
}
@Override
public void saveJob(PrintStream fileOutputStream, LaserJob job) throws UnsupportedOperationException, IllegalJobException, Exception {
writeJob(new BufferedOutputStream(fileOutputStream), job, null, null);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment