Merge remote-tracking branch 'origin/kenneth' into develop
This commit is contained in:
@@ -22,6 +22,7 @@ public class ControlPanel extends JPanel
|
||||
private int people;
|
||||
JLabel timeLabel;
|
||||
JLabel peopleLabel;
|
||||
JLabel runningLabel;
|
||||
|
||||
public ControlPanel()
|
||||
{
|
||||
@@ -36,8 +37,8 @@ public class ControlPanel extends JPanel
|
||||
setFocusable(false);
|
||||
|
||||
JPanel simulatorPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||
simulatorPanel.setPreferredSize(new Dimension(350,50));
|
||||
simulatorPanel.setMaximumSize(new Dimension(350,50));
|
||||
simulatorPanel.setPreferredSize(new Dimension(290,50));
|
||||
simulatorPanel.setMaximumSize(new Dimension(290,50));
|
||||
add(simulatorPanel);
|
||||
{
|
||||
JLabel simulatorLabel = new JLabel("Simulator: ");
|
||||
@@ -51,21 +52,11 @@ public class ControlPanel extends JPanel
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
p.getT().start();
|
||||
runningLabel.setText("Simulation Started");
|
||||
}
|
||||
});
|
||||
simulatorPanel.add(playButton);
|
||||
|
||||
JButton pauseButton = new JButton("Pause");
|
||||
pauseButton.setFocusable(false);
|
||||
pauseButton.setFont(new Font("Segoe UI", Font.PLAIN, 20));
|
||||
pauseButton.addActionListener(new ActionListener(){
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
p.getT().stop();
|
||||
}
|
||||
});
|
||||
simulatorPanel.add(pauseButton);
|
||||
|
||||
JButton stopButton = new JButton("Stop");
|
||||
stopButton.setFocusable(false);
|
||||
stopButton.setFont(new Font("Segoe UI", Font.PLAIN, 20));
|
||||
@@ -73,6 +64,7 @@ public class ControlPanel extends JPanel
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
p.getT().stop();
|
||||
runningLabel.setText("Simulation Stopped");
|
||||
}
|
||||
});
|
||||
simulatorPanel.add(stopButton);
|
||||
@@ -131,7 +123,7 @@ public class ControlPanel extends JPanel
|
||||
runningPanel.setMaximumSize(new Dimension(195,50));
|
||||
add(runningPanel);
|
||||
{
|
||||
JLabel runningLabel = new JLabel("Simulation stopped");
|
||||
runningLabel = new JLabel("Simulation stopped");
|
||||
runningLabel.setFont(new Font("Segoe UI", Font.PLAIN, 20));
|
||||
runningPanel.add(runningLabel);
|
||||
}
|
||||
|
||||
@@ -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