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;
|
private int people;
|
||||||
JLabel timeLabel;
|
JLabel timeLabel;
|
||||||
JLabel peopleLabel;
|
JLabel peopleLabel;
|
||||||
|
JLabel runningLabel;
|
||||||
|
|
||||||
public ControlPanel()
|
public ControlPanel()
|
||||||
{
|
{
|
||||||
@@ -36,8 +37,8 @@ public class ControlPanel extends JPanel
|
|||||||
setFocusable(false);
|
setFocusable(false);
|
||||||
|
|
||||||
JPanel simulatorPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
JPanel simulatorPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||||
simulatorPanel.setPreferredSize(new Dimension(350,50));
|
simulatorPanel.setPreferredSize(new Dimension(290,50));
|
||||||
simulatorPanel.setMaximumSize(new Dimension(350,50));
|
simulatorPanel.setMaximumSize(new Dimension(290,50));
|
||||||
add(simulatorPanel);
|
add(simulatorPanel);
|
||||||
{
|
{
|
||||||
JLabel simulatorLabel = new JLabel("Simulator: ");
|
JLabel simulatorLabel = new JLabel("Simulator: ");
|
||||||
@@ -51,21 +52,11 @@ public class ControlPanel extends JPanel
|
|||||||
public void actionPerformed(ActionEvent e)
|
public void actionPerformed(ActionEvent e)
|
||||||
{
|
{
|
||||||
p.getT().start();
|
p.getT().start();
|
||||||
|
runningLabel.setText("Simulation Started");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
simulatorPanel.add(playButton);
|
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");
|
JButton stopButton = new JButton("Stop");
|
||||||
stopButton.setFocusable(false);
|
stopButton.setFocusable(false);
|
||||||
stopButton.setFont(new Font("Segoe UI", Font.PLAIN, 20));
|
stopButton.setFont(new Font("Segoe UI", Font.PLAIN, 20));
|
||||||
@@ -73,6 +64,7 @@ public class ControlPanel extends JPanel
|
|||||||
public void actionPerformed(ActionEvent e)
|
public void actionPerformed(ActionEvent e)
|
||||||
{
|
{
|
||||||
p.getT().stop();
|
p.getT().stop();
|
||||||
|
runningLabel.setText("Simulation Stopped");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
simulatorPanel.add(stopButton);
|
simulatorPanel.add(stopButton);
|
||||||
@@ -131,7 +123,7 @@ public class ControlPanel extends JPanel
|
|||||||
runningPanel.setMaximumSize(new Dimension(195,50));
|
runningPanel.setMaximumSize(new Dimension(195,50));
|
||||||
add(runningPanel);
|
add(runningPanel);
|
||||||
{
|
{
|
||||||
JLabel runningLabel = new JLabel("Simulation stopped");
|
runningLabel = new JLabel("Simulation stopped");
|
||||||
runningLabel.setFont(new Font("Segoe UI", Font.PLAIN, 20));
|
runningLabel.setFont(new Font("Segoe UI", Font.PLAIN, 20));
|
||||||
runningPanel.add(runningLabel);
|
runningPanel.add(runningLabel);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -389,6 +389,9 @@ public class Panel extends JPanel implements ActionListener
|
|||||||
public void clearObjects()
|
public void clearObjects()
|
||||||
{
|
{
|
||||||
objects.clear();
|
objects.clear();
|
||||||
|
visitors.clear();
|
||||||
|
waypoints.clear();
|
||||||
|
paths.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Point getLastMousePosition()
|
public Point getLastMousePosition()
|
||||||
|
|||||||
@@ -8,12 +8,14 @@ import java.io.IOException;
|
|||||||
import java.io.ObjectInputStream;
|
import java.io.ObjectInputStream;
|
||||||
import java.io.ObjectOutputStream;
|
import java.io.ObjectOutputStream;
|
||||||
|
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
import javax.swing.JFileChooser;
|
import javax.swing.JFileChooser;
|
||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
import javax.swing.filechooser.FileFilter;
|
import javax.swing.filechooser.FileFilter;
|
||||||
|
|
||||||
import Agenda.Agenda;
|
import Agenda.Agenda;
|
||||||
import Objects.DrawObject;
|
import Objects.DrawObject;
|
||||||
|
import Objects.Path;
|
||||||
|
|
||||||
public class SaveLoad
|
public class SaveLoad
|
||||||
{
|
{
|
||||||
@@ -83,8 +85,13 @@ public class SaveLoad
|
|||||||
oos.writeObject(panel.getAgenda());
|
oos.writeObject(panel.getAgenda());
|
||||||
for (DrawObject object : panel.objects)
|
for (DrawObject object : panel.objects)
|
||||||
{
|
{
|
||||||
|
object.setSelected(false);
|
||||||
oos.writeObject(object);
|
oos.writeObject(object);
|
||||||
}
|
}
|
||||||
|
for(Path p : panel.paths)
|
||||||
|
{
|
||||||
|
oos.writeObject(p);
|
||||||
|
}
|
||||||
oos.close();
|
oos.close();
|
||||||
JOptionPane.showMessageDialog(null, "Saved succesfully");
|
JOptionPane.showMessageDialog(null, "Saved succesfully");
|
||||||
}
|
}
|
||||||
@@ -167,6 +174,12 @@ public class SaveLoad
|
|||||||
panel.addWaypoint((Waypoint) object);
|
panel.addWaypoint((Waypoint) object);
|
||||||
panel.objects.add((DrawObject) object);
|
panel.objects.add((DrawObject) object);
|
||||||
}
|
}
|
||||||
|
if (object instanceof Path)
|
||||||
|
{
|
||||||
|
Path p = (Path) object;
|
||||||
|
p.updateImage();
|
||||||
|
panel.paths.add((Path) object);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
panel.objects.add((DrawObject) object);
|
panel.objects.add((DrawObject) object);
|
||||||
|
|||||||
+17
-2
@@ -10,6 +10,7 @@ import java.awt.geom.Rectangle2D;
|
|||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
@@ -23,13 +24,15 @@ import Applicatie.Waypoint;
|
|||||||
* @author Wesley de Hek
|
* @author Wesley de Hek
|
||||||
* @version 1.2
|
* @version 1.2
|
||||||
*/
|
*/
|
||||||
public class Path
|
public class Path implements Serializable
|
||||||
{
|
{
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 5345485798486018597L;
|
||||||
|
|
||||||
private ArrayList<Point2D> points;
|
private ArrayList<Point2D> points;
|
||||||
private ArrayList<Shape> lines;
|
private ArrayList<Shape> lines;
|
||||||
private Point2D tempPoint;
|
private Point2D tempPoint;
|
||||||
private BufferedImage pathBackground;
|
public transient BufferedImage pathBackground = null;;
|
||||||
private ArrayList<Waypoint> waypoints;
|
private ArrayList<Waypoint> waypoints;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -49,6 +52,18 @@ public class Path
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateImage()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
pathBackground = ImageIO.read(new File("images/newPath.png"));
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draws the path.
|
* Draws the path.
|
||||||
|
|||||||
Reference in New Issue
Block a user