Added Stages to save file.
Remove selection from save.
This commit is contained in:
@@ -389,6 +389,9 @@ public class Panel extends JPanel implements ActionListener
|
||||
public void clearObjects()
|
||||
{
|
||||
objects.clear();
|
||||
visitors.clear();
|
||||
waypoints.clear();
|
||||
paths.clear();
|
||||
}
|
||||
|
||||
public Point getLastMousePosition()
|
||||
|
||||
@@ -8,12 +8,14 @@ import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.filechooser.FileFilter;
|
||||
|
||||
import Agenda.Agenda;
|
||||
import Objects.DrawObject;
|
||||
import Objects.Path;
|
||||
|
||||
public class SaveLoad
|
||||
{
|
||||
@@ -83,8 +85,13 @@ public class SaveLoad
|
||||
oos.writeObject(panel.getAgenda());
|
||||
for (DrawObject object : panel.objects)
|
||||
{
|
||||
object.setSelected(false);
|
||||
oos.writeObject(object);
|
||||
}
|
||||
for(Path p : panel.paths)
|
||||
{
|
||||
oos.writeObject(p);
|
||||
}
|
||||
oos.close();
|
||||
JOptionPane.showMessageDialog(null, "Saved succesfully");
|
||||
}
|
||||
@@ -167,6 +174,12 @@ public class SaveLoad
|
||||
panel.addWaypoint((Waypoint) object);
|
||||
panel.objects.add((DrawObject) object);
|
||||
}
|
||||
if (object instanceof Path)
|
||||
{
|
||||
Path p = (Path) object;
|
||||
p.updateImage();
|
||||
panel.paths.add((Path) object);
|
||||
}
|
||||
else
|
||||
{
|
||||
panel.objects.add((DrawObject) object);
|
||||
|
||||
+17
-2
@@ -10,6 +10,7 @@ import java.awt.geom.Rectangle2D;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
@@ -23,13 +24,15 @@ import Applicatie.Waypoint;
|
||||
* @author Wesley de Hek
|
||||
* @version 1.2
|
||||
*/
|
||||
public class Path
|
||||
public class Path implements Serializable
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = 5345485798486018597L;
|
||||
|
||||
private ArrayList<Point2D> points;
|
||||
private ArrayList<Shape> lines;
|
||||
private Point2D tempPoint;
|
||||
private BufferedImage pathBackground;
|
||||
public transient BufferedImage pathBackground = null;;
|
||||
private ArrayList<Waypoint> waypoints;
|
||||
|
||||
/**
|
||||
@@ -49,6 +52,18 @@ public class Path
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void updateImage()
|
||||
{
|
||||
try
|
||||
{
|
||||
pathBackground = ImageIO.read(new File("images/newPath.png"));
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws the path.
|
||||
|
||||
Reference in New Issue
Block a user