150 Commits
Author SHA1 Message Date
Yorick 5d0ae9ca98 final commit 2015-04-09 09:29:13 +02:00
Yorick 719d58aae9 done 2015-04-09 01:55:12 +02:00
Yorick 4897a9440b ohgodwhy 2015-04-09 01:30:38 +02:00
Yorick 2e947589be merge 2015-04-09 00:56:42 +02:00
Remco a6f32b5739 Editing disabled while running simulator 2015-04-09 00:51:18 +02:00
Yorick 6178311c4b Merge remote-tracking branch 'origin/kenneth' into develop 2015-04-09 00:35:30 +02:00
Yorick 920fd8117e KUT 2015-04-09 00:33:18 +02:00
kennyboy55 8a92a7a571 Added Stages to save file.
Remove selection from save.
2015-04-08 22:42:40 +02:00
kennyboy55 1563368bf8 removed pause button 2015-04-08 22:06:50 +02:00
kennyboy55 eab4aedc1d Added text to button actions 2015-04-08 21:53:18 +02:00
Yorick be53c1f138 kaas kenneth 2015-04-08 21:47:12 +02:00
Yorick a7d811f956 Merge remote-tracking branch 'origin/kenneth' into develop 2015-04-08 21:46:42 +02:00
Yorick f2f0b36d0e Load waypoints from filez 2015-04-08 21:45:27 +02:00
kennyboy55 04fa453e49 Added agenda stuff 2015-04-08 21:45:03 +02:00
Remco 9d88f92a98 Deleted useless exclamation points 2015-04-08 21:38:04 +02:00
Yorick d3e9b578eb Merge banan dev 2015-04-08 21:37:48 +02:00
Yorick 8ba874bec6 visitors kinda working? 2015-04-08 21:29:17 +02:00
guusvdongen 911714f9b5 Update Visitor.java 2015-04-08 21:15:45 +02:00
Yorick 19f48ad3e9 Merge remote-tracking branch 'origin/kenneth' into develop 2015-04-08 21:03:46 +02:00
Yorick 26265b5a3e Waypoint move 2015-04-08 21:03:29 +02:00
kennyboy55 457da54a5c Fixed agenda module sync 2015-04-08 21:01:13 +02:00
kennyboy55 c3973cc4e4 Fixed stuff 2015-04-08 20:57:06 +02:00
kennyboy55 d0baf5673f Merge branch 'kenneth' of https://github.com/ProjectgroepA4/FestivalPlanner into kenneth
Conflicts:
	Applicatie/Panel.java
	Applicatie/Visitor.java
	Applicatie/WaypointPopup.java
	Listeners/Mouse.java
2015-04-08 20:55:44 +02:00
Yorick 8167fec369 WOOOOOOOOOOOOOOOOOOOO 2015-04-08 20:31:18 +02:00
unknown 254167ba15 print out line op 2015-04-08 17:40:22 +02:00
Yorick bdcc40f00f Merge branch 'develop' of https://github.com/ProjectgroepA4/FestivalPlanner into develop 2015-04-08 17:32:28 +02:00
Yorick d0c0b16585 kaas 2015-04-08 17:32:10 +02:00
Remco 6f265063b4 Edited Waypointpopup 2015-04-08 17:31:06 +02:00
unknown b8a7d9c02d change 2015-04-08 17:24:29 +02:00
Yorick 89036d27af Actions is nul wtf 2015-04-08 17:17:53 +02:00
Yorick b5cf44b44c woo 2015-04-08 16:46:02 +02:00
kennyboy55 7a6bca5ed3 Merge branch 'kenneth' of https://github.com/ProjectgroepA4/FestivalPlanner into kenneth 2015-04-08 16:39:23 +02:00
kennyboy55 9d853babdc Combined Agenda 2015-04-08 16:38:55 +02:00
Yorick 547ebfbf6a Merge branch 'develop' of https://github.com/ProjectgroepA4/FestivalPlanner into develop 2015-04-08 16:13:48 +02:00
Yorick d75016f9a9 FOLLOW WAYPOINT WOO 2015-04-08 16:13:28 +02:00
Remco 13ab1900d2 Added Cancel button 2015-04-08 15:57:55 +02:00
unknown 69c05da3fd laatste versie 2015-04-08 15:56:46 +02:00
Remco 7ffc00110f Added PathPopup 2015-04-08 15:46:19 +02:00
Yorick fc16b4c019 kut remco 2015-04-08 15:37:11 +02:00
Yorick ab91a7f1aa Merge branch 'develop' of https://github.com/ProjectgroepA4/FestivalPlanner into develop 2015-04-08 15:12:49 +02:00
Yorick 07b083453c Follow waypoints added 2015-04-08 15:12:33 +02:00
Remco 867486f6ad bugfix WayPoint 2015-04-08 14:47:49 +02:00
Yorick a82809c959 Merge branch 'develop' of https://github.com/ProjectgroepA4/FestivalPlanner into develop 2015-04-08 14:46:11 +02:00
Yorick f571189849 kaas 2015-04-08 14:46:08 +02:00
Remco 7c66edad14 WayPoint popup edited 2015-04-08 14:35:46 +02:00
Yorick a6eb4578da Merge banaan dev 2015-04-08 14:27:19 +02:00
Yorick 420e596590 Waypoint kaas 2015-04-08 14:22:01 +02:00
kennyboy55 b50c4d2c33 Objects can no longer move outside field 2015-04-08 13:51:01 +02:00
Yorick a03463442c Merge guus dev 2015-04-08 13:24:41 +02:00
kennyboy55 a360286c48 Stuff 2015-04-08 13:16:12 +02:00
Yorick 9066d0212f icons 2015-04-08 13:14:52 +02:00
Yorick 1e5d95733f Merge kenneth dev 2015-04-08 13:11:22 +02:00
unknown c2cb07cf3e ok 2015-04-08 13:11:16 +02:00
Yorick e1f88aba2d Waypointpopup 2015-04-08 12:59:49 +02:00
kennyboy55 4e277e7d5f Added new keyboard controls 2015-04-08 12:55:51 +02:00
kennyboy55 9cce659329 Added new textures 2015-04-08 12:55:38 +02:00
kennyboy55 3d0324e80b Fixed focus 2015-04-08 12:55:07 +02:00
Yorick 2dcdc954ae Merge remote-tracking branch 'origin/kenneth' into develop 2015-04-08 12:43:11 +02:00
Yorick ad62094ee7 Working 2015-04-08 12:42:12 +02:00
unknown 90ca17e28a ok 2015-04-08 12:13:39 +02:00
kennyboy55 0c9d41585c Attempt to fix focus problem. Fixed path selection 2015-04-08 11:48:29 +02:00
Yorick 701f2aed4b merge kenneth dev 2015-04-08 11:22:01 +02:00
Yorick e31b44d43f Merge branch 'develop' of https://github.com/ProjectgroepA4/FestivalPlanner into develop 2015-04-08 11:18:41 +02:00
Yorick 82a94ba456 Started with waypoints 2015-04-08 11:18:30 +02:00
kennyboy55 2a8ff8e29a Entrance now snaps to side. 2015-04-08 11:18:25 +02:00
kennyboy55 33bb880018 Fixed scale 2015-04-08 10:55:23 +02:00
kennyboy55 a164f7b781 Improved Agenda module 2015-04-08 10:55:16 +02:00
Remco 8ed04d356a Added new Waypoint sprite
Als ie niet goed is moet je het zeggen
2015-04-08 10:29:42 +02:00
Yorick 1f6811332e Visitors following paths..sort of.. 2015-04-07 22:01:07 +02:00
Yorick f2c1544d71 merge banaan dev 2015-04-07 19:35:38 +02:00
Yorick 32de28204c halverwege 2015-04-07 19:32:10 +02:00
kennyboy55 0c59eb5dd3 Stuff 2015-04-07 16:11:20 +02:00
Yorick d6b511bab5 Merge guus dev 2015-04-07 15:30:17 +02:00
Yorick d60924a05b Merge banaan dev 2015-04-07 15:22:28 +02:00
Yorick ad4eacc20c kaas 2015-04-07 15:06:20 +02:00
unknown c29ccec789 ok 2015-04-07 14:58:47 +02:00
Yorick 284823c28b hi 2015-04-07 14:49:00 +02:00
Yorick 41b4c5db8f Added several thingz 2015-04-07 14:31:44 +02:00
unknown 0535d98427 ok 2015-04-07 14:29:24 +02:00
Yorick cba61d4dc5 Merge guus dev 2015-04-07 13:59:34 +02:00
kennyboy55 050493a70b Try to fix camera zoom motion. Needs attention 2015-04-07 13:58:29 +02:00
Yorick 5a0def924a Merge branch 'develop' of https://github.com/ProjectgroepA4/FestivalPlanner into develop 2015-04-07 13:13:00 +02:00
Yorick ea7ecfcd56 Saven werkt van guus 2015-04-07 13:12:02 +02:00
kennyboy55 2d56ac1b89 Added Control Panel and improved Properties Panel. 2015-04-07 13:05:13 +02:00
unknown a2110d3e58 ok 2015-04-07 12:36:14 +02:00
xrgman 1684976a47 fixed nullpointer 2015-04-07 12:13:40 +02:00
Yorick 5a9c3f259a oops 2015-04-07 12:12:42 +02:00
Yorick 3920354ae2 Kaas 2015-04-07 12:00:04 +02:00
Remco bcbc9b1027 kaas 2015-04-07 11:58:32 +02:00
Yorick 6f58084554 Merge kenneth en develop 2015-04-07 11:55:55 +02:00
Yorick c8c1d85eba Merge banaan en develop 2015-04-07 11:35:05 +02:00
kennyboy55 a138807c2a Fixed collision and updated to WCS (Wesley Code Standard) 2015-04-06 16:44:21 +02:00
kennyboy55 fe5a8a5c2d Improved code structure. 2015-04-06 16:28:14 +02:00
kennyboy55 24790d8d19 Added area in Objects and made new panel for changing them. 2015-04-06 16:27:49 +02:00
kennyboy55 7e5c09da58 Starting with area 2015-04-06 15:31:21 +02:00
Remco 30192ec4aa Added Sprite Visitor 2015-04-06 11:39:10 +02:00
kennyboy55 65cd07af6f Removing useless stuff 2015-04-04 11:02:05 +02:00
unknown d8efbc8616 laatste update 2015-03-26 12:05:33 +01:00
unknown b9d42cd4eb new 2015-03-24 13:47:45 +01:00
Yorick df8fdd803b Merged banaan and develop 2015-03-24 09:58:21 +01:00
Yorick 8131464be7 SCrolling limited woo 2015-03-17 14:12:39 +01:00
Yorick d0c92db9f7 STAGE 4 2015-03-17 13:41:01 +01:00
Yorick f289bec571 KAas 2015-03-17 13:39:16 +01:00
Yorick 6dec40e70a Woo 2015-03-17 13:28:01 +01:00
kennyboy55 c21af8db1a Fixed actionlisteners 2015-03-17 13:27:21 +01:00
Yorick a0a0e604a9 kaas 2015-03-17 13:21:43 +01:00
unknown ca90d98d9a fix 2015-03-17 12:58:20 +01:00
xrgman 297026bf11 fixed dots
🍡
2015-03-17 12:55:09 +01:00
aareschluchtje 140d5803ef added Food, edited the icons and changed the sprites 2015-03-17 12:42:36 +01:00
unknown a3479fc37a fix 2015-03-17 12:35:57 +01:00
unknown 2f53d1353f added stuff 2015-03-17 12:23:43 +01:00
kennyboy55 8bf08d4e1d Fixed KeyListeners 2015-03-17 11:51:16 +01:00
kennyboy55 ddf5e4e908 Merge branch 'kenneth' into develop 2015-03-17 11:45:47 +01:00
kennyboy55 fd6e334649 Updated images 2015-03-17 11:45:31 +01:00
kennyboy55 47345f70c4 Merge branch 'kenneth' into develop 2015-03-17 11:43:01 +01:00
Yorick 583e447b81 KAAASS 2015-03-17 11:42:48 +00:00
Yorick 1eb4f8df41 Remove podium 2015-03-17 11:33:01 +00:00
kennyboy55 ecdb50320a Kenny Images added 2015-03-17 11:41:53 +01:00
kennyboy55 b551f91b90 Merged 2015-03-17 11:27:50 +01:00
Yorick fe8fb76759 Merge branch 'develop' of https://github.com/ProjectgroepA4/FestivalPlanner into develop 2015-03-17 10:55:54 +00:00
Yorick ea487bd24f Dragging now works properly 2015-03-17 10:55:34 +00:00
kennyboy55 47f04ee68f Added actions 2015-03-17 11:24:51 +01:00
kennyboy55 fa146df5a6 Added super cool properties stuffz 2015-03-17 11:07:57 +01:00
aareschluchtje c00a542ffc Edited StageIcon 2015-03-17 10:49:06 +01:00
aareschluchtje 01b538b3b4 Added Alpha 2015-03-17 10:39:07 +01:00
Remco b9eb9965dc Changed to new Podium (Stage) 2015-03-17 10:30:10 +01:00
Yorick f6bb5a8f44 Rectangle rotating 2015-03-16 23:00:10 +01:00
Yorick dfee405657 succesfully merged Banaan 2015-03-16 22:21:52 +01:00
Yorick d08e226650 Merge branch 'develop' of https://github.com/ProjectgroepA4/FestivalPlanner into develop 2015-03-16 21:29:47 +01:00
Yorick 99e52ebc1a Merge branch 'master' of https://github.com/ProjectgroepA4/FestivalPlanner into develop 2015-03-16 21:29:33 +01:00
aareschluchtje 87fb690de7 Also added a resize to the new Stage sprite 2015-03-16 17:49:11 +01:00
aareschluchtje ceaabb37c7 New resized sprites 2015-03-16 17:43:22 +01:00
Yorick 836f058c85 Fixed nullpointerexceptions 2015-03-16 13:46:20 +00:00
Yorick d31272622c Merge branch 'master' of https://github.com/ProjectgroepA4/FestivalPlanner into develop 2015-03-16 13:43:30 +00:00
Yorick 388021d93d Succesful merge but with nullpointerexceptions 2015-03-13 08:53:46 +00:00
Yorick 23020d03b6 Added some icons and implemented them 2015-03-12 23:42:06 +00:00
Yorick 7e51fe541a Scrolling works, had boundaries, only draws an object when image is drawn, woo 2015-03-12 23:00:44 +00:00
aareschluchtje fefffeef19 added food sprite and resized wc 2015-03-12 23:52:53 +01:00
Yorick fa726f062e Scrolling added 2015-03-12 22:44:02 +00:00
aareschluchtje d0f9601737 smaller path 2015-03-12 23:20:21 +01:00
aareschluchtje 33f0105337 new horrible sprites 2015-03-12 23:16:43 +01:00
Yorick be6aba1e38 Added images to Panel 2015-03-12 21:56:42 +00:00
kennyboy55 08c411070d Added properties panel 2015-03-12 20:51:25 +01:00
guusvdongen 87bf6d9295 festivaldemo methodes
Tekenobject & podium moeten Serializable worden.
In tekenobject moet de image variablen een String filepath worden.
Dan kun je moet je voor elke methode in tekenobject waar je die image voor nodig had (Image image = new ImageIcon(filepath).getImage();) doen. Dit komt, omdat een image niet serializable is :(
2015-03-12 18:18:03 +01:00
guusvdongen a89feaaaab Delete selection.png 2015-03-12 18:14:00 +01:00
guusvdongen df02d793eb Delete grass.jpg 2015-03-12 18:13:42 +01:00
guusvdongen a00ccbe085 Delete commons-lang3-3.3.2.jar 2015-03-12 18:13:27 +01:00
guusvdongen 835d126d80 Delete README.md 2015-03-12 18:13:22 +01:00
guusvdongen dd7893375e Agenda load/save fix 2015-03-12 18:12:25 +01:00
Yorick be342a5976 added dragbar 2015-03-11 21:50:15 +00:00
49 changed files with 326 additions and 461 deletions
+17 -1
View File
@@ -51,7 +51,20 @@ public class Agenda implements Serializable {
{ {
return stages; return stages;
} }
public ArrayList<Event> eventsForStage(AgendaStage st)
{
ArrayList<Event> stageEvents = new ArrayList<Event>();
for(Event e: events)
{
if(e.getStage() == st)
{
stageEvents.add(e);
}
}
return stageEvents;
}
/*
public void saveAgenda() public void saveAgenda()
{ {
JFileChooser fileChooser = new JFileChooser(); JFileChooser fileChooser = new JFileChooser();
@@ -179,7 +192,7 @@ public class Agenda implements Serializable {
{ {
boolean exists = false; boolean exists = false;
String name = e.getStage().getName(); String name = e.getStage().getName();
for (AgendaStage s : stages) for (Stage s : stages)
{ {
if ( s.getName().equals(name) ) { if ( s.getName().equals(name) ) {
exists = true; exists = true;
@@ -203,6 +216,7 @@ public class Agenda implements Serializable {
e.printStackTrace(); e.printStackTrace();
} }
} }
*/
public void clearAgenda() public void clearAgenda()
{ {
@@ -211,10 +225,12 @@ public class Agenda implements Serializable {
artists.clear(); artists.clear();
} }
/*
public void fillAllLists() public void fillAllLists()
{ {
loadAgenda(); loadAgenda();
fillStages(); fillStages();
fillArtists(); fillArtists();
} }
*/
} }
+1 -1
View File
@@ -19,7 +19,7 @@ public class EditArtistPanel extends JFrame {
public EditArtistPanel(Agenda agenda, Artist art, TabbedPane tab) public EditArtistPanel(Agenda agenda, Artist art, TabbedPane tab)
{ {
super("Artist editscreen!"); super("Artist editscreen");
setDefaultCloseOperation(HIDE_ON_CLOSE); setDefaultCloseOperation(HIDE_ON_CLOSE);
JPanel content = new JPanel(new BorderLayout()); JPanel content = new JPanel(new BorderLayout());
JPanel south = new JPanel(new FlowLayout()); JPanel south = new JPanel(new FlowLayout());
+1 -1
View File
@@ -24,7 +24,7 @@ public class EditEventPanel extends JFrame{
public EditEventPanel(Agenda agenda, Event e, TabbedPane tab) public EditEventPanel(Agenda agenda, Event e, TabbedPane tab)
{ {
super("Event editscreen!"); super("Event editscreen");
setDefaultCloseOperation(HIDE_ON_CLOSE); setDefaultCloseOperation(HIDE_ON_CLOSE);
JPanel content = new JPanel(new BorderLayout()); JPanel content = new JPanel(new BorderLayout());
JPanel south = new JPanel(new FlowLayout()); JPanel south = new JPanel(new FlowLayout());
+1 -1
View File
@@ -20,7 +20,7 @@ public class EditStagePanel extends JFrame{
public EditStagePanel(Agenda agenda, AgendaStage sta) public EditStagePanel(Agenda agenda, AgendaStage sta)
{ {
super("Stage editscreen!"); super("Stage editscreen");
setDefaultCloseOperation(HIDE_ON_CLOSE); setDefaultCloseOperation(HIDE_ON_CLOSE);
JPanel content = new JPanel(new BorderLayout()); JPanel content = new JPanel(new BorderLayout());
JPanel south = new JPanel(new FlowLayout()); JPanel south = new JPanel(new FlowLayout());
+3 -2
View File
@@ -63,7 +63,8 @@ public class MenuBar extends JMenuBar {
open.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, ActionEvent.CTRL_MASK)); open.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, ActionEvent.CTRL_MASK));
open.addActionListener(new ActionListener() { open.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
w.getAgenda().loadAgenda(); Applicatie.SaveLoad.load(w.getPanel());
w.setAgenda(w.getPanel().getAgenda());
Window.updatePanel(); Window.updatePanel();
} }
}); });
@@ -72,7 +73,7 @@ public class MenuBar extends JMenuBar {
save.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.CTRL_MASK)); save.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.CTRL_MASK));
save.addActionListener(new ActionListener() { save.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
w.getAgenda().saveAgenda(); Applicatie.SaveLoad.save(w.getPanel());
Window.updatePanel(); Window.updatePanel();
} }
}); });
-41
View File
@@ -1,41 +0,0 @@
package Agenda;
import java.io.Serializable;
public class Stage implements Serializable {
private static final long serialVersionUID = 1;
private String name;
private String description;
public Stage(String name, String description)
{
this.name = name;
this.description = description;
}
public String getName()
{
return this.name;
}
public String getDescription()
{
return this.description;
}
public void setDescription(String description)
{
this.description = description;
}
public void setName(String name)
{
this.name = name;
}
public String toString()
{
return name;
}
}
+10 -3
View File
@@ -1,6 +1,5 @@
package Agenda; package Agenda;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Dimension; import java.awt.Dimension;
@@ -36,14 +35,16 @@ public class Window extends JFrame {
private static GregorianCalendar date; private static GregorianCalendar date;
private static Agenda agenda; private static Agenda agenda;
private static String currentPanel = "table"; private static String currentPanel = "table";
private Applicatie.Panel ap;
public Window() public Window(Applicatie.Panel ap)
{ {
/* /*
* Initialize window * Initialize window
*/ */
super("Agenda"); super("Agenda");
agenda = new Agenda(); this.ap = ap;
agenda = ap.getAgenda();
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
addWindowListener(new WindowAdapter() { addWindowListener(new WindowAdapter() {
@@ -231,6 +232,12 @@ public class Window extends JFrame {
public void setAgenda(Agenda a) public void setAgenda(Agenda a)
{ {
agenda = a; agenda = a;
ap.setAgenda(a);
}
public Applicatie.Panel getPanel()
{
return ap;
} }
+8 -14
View File
@@ -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,12 @@ public class ControlPanel extends JPanel
public void actionPerformed(ActionEvent e) public void actionPerformed(ActionEvent e)
{ {
p.getT().start(); p.getT().start();
p.setPlay(true);
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 +65,8 @@ public class ControlPanel extends JPanel
public void actionPerformed(ActionEvent e) public void actionPerformed(ActionEvent e)
{ {
p.getT().stop(); p.getT().stop();
p.setPlay(false);
runningLabel.setText("Simulation Stopped");
} }
}); });
simulatorPanel.add(stopButton); simulatorPanel.add(stopButton);
@@ -131,7 +125,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);
} }
-268
View File
@@ -1,268 +0,0 @@
package Applicatie;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Shape;
import java.awt.geom.AffineTransform;
import java.awt.geom.Ellipse2D;
import java.awt.geom.NoninvertibleTransformException;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
import javax.swing.ImageIcon;
public abstract class DrawObject
{
Point2D position;
double rotation;
double scale;
private Image image;
protected boolean selected;
private Rectangle2D rektAngle;
private Rectangle2D upperLeftCorner;
private Rectangle2D upperRightCorner;
private Rectangle2D bottomLeftCorner;
private Rectangle2D bottomRightCorner;
private Ellipse2D rotateDot;
static final int UPPERLEFT = 0;
static final int UPPERRIGHT = 1;
static final int BOTTOMLEFT = 2;
static final int BOTTOMRIGHT = 3;
private Color rectangleColor;
public DrawObject(String filename, Point2D position)
{
image = new ImageIcon(filename).getImage();
scale = 1;
rotation = 0;
this.position = position;
rectangleColor = Color.BLACK;
}
public abstract String getName();
public void draw(Graphics2D g)
{
AffineTransform tx = getTransform();
g.drawImage(image, tx, null);
if (selected)
{
// g.rotate(Math.toRadians(rotation), image.getWidth(null)/2,
// image.getHeight(null)/2);
AffineTransform rotate = AffineTransform.getRotateInstance(Math.toRadians(rotation), position.getX() + image.getWidth(null) / 2, position.getY() + image.getHeight(null) / 2);
//g.transform(rotate);
g.setColor(rectangleColor);
g.setStroke(new BasicStroke(7));
rektAngle = new Rectangle2D.Double((int) position.getX(), (int) position.getY(), image.getWidth(null), image.getHeight(null));
tx = getTransformRectangle();
rektAngle.setFrame(tx.createTransformedShape(rektAngle).getBounds());
g.draw(rektAngle);
g.setColor(Color.YELLOW);
upperLeftCorner = new Rectangle2D.Double(rektAngle.getX() - 7, rektAngle.getY() - 7, 15, 15);
upperRightCorner = new Rectangle2D.Double(rektAngle.getX() + rektAngle.getWidth() - 8, rektAngle.getY() - 7, 15, 15);
bottomLeftCorner = new Rectangle2D.Double(rektAngle.getX() - 7, rektAngle.getY() + rektAngle.getHeight() - 8, 15, 15);
bottomRightCorner = new Rectangle2D.Double(rektAngle.getX() + rektAngle.getWidth() - 8, rektAngle.getY() + rektAngle.getHeight() - 8, 15, 15);
g.fill(upperLeftCorner); // upperleft
g.fill(upperRightCorner); // upperright
g.fill(bottomLeftCorner); // bottomleft
g.fill(bottomRightCorner); // bottomright
g.setColor(Color.RED);
rotateDot = new Ellipse2D.Double((rektAngle.getX() + (rektAngle.getWidth() / 2)) - 8, rektAngle.getY() - 8, 15, 15);
g.fill(rotateDot);
}
}
protected AffineTransform getTransform()
{
AffineTransform tx = new AffineTransform();
tx.scale(scale, scale);
tx.translate(position.getX(), position.getY());
tx.rotate(Math.toRadians(rotation), image.getWidth(null) / 2, image.getHeight(null) / 2);
return tx;
}
protected AffineTransform getTransformSelection()
{
AffineTransform tx = new AffineTransform();
tx.scale(scale, scale);
tx.translate(position.getX(), position.getY());
return tx;
}
/**
* Special transformation for the selection rectangle, because the
* translation of the image one places the rectangle translated from the
* image.
*
* @return affineTransform
*/
private AffineTransform getTransformRectangle()
{
AffineTransform tx = new AffineTransform();
tx.scale(scale, scale);
return tx;
}
public boolean contains(Point2D clickPoint)
{
Shape shape;
if (rektAngle == null)
{
shape = new Rectangle2D.Double(0, 0, image.getWidth(null), image.getHeight(null));
return getTransform().createTransformedShape(shape).contains(clickPoint);
}
else
{
shape = new Rectangle2D.Double(-9, -9, image.getWidth(null) + 13, image.getHeight(null) + 13);
return getTransformSelection().createTransformedShape(shape).contains(clickPoint);
}
}
public Point2D getObjectPoint(Point2D point)
{
try
{
return getTransform().inverseTransform(point, null);
}
catch (NoninvertibleTransformException e)
{
e.printStackTrace();
}
return null;
}
/**
* Checking collision.
* @param object. the drawObject to check collision with.
* @return if there is a collision.
*/
public boolean collision(DrawObject object)
{
Shape ownShape = getRectangle();
Rectangle2D otherRectangle = object.getTransform().createTransformedShape(object.getImageRectangle()).getBounds2D();
if(ownShape.intersects(otherRectangle))
return true;
else
return false;
}
/**
* This method checks if the place thats clicked is inside one of the
* corners.
*
* @param point
* @param corner
* @return if the clicked point is inside one of the corners
*/
public boolean containsCorner(Point2D point, int corner)
{
Rectangle2D chosenCorner = null;
switch (corner)
{
case 0:
chosenCorner = upperLeftCorner;
break;
case 1:
chosenCorner = upperRightCorner;
break;
case 2:
chosenCorner = bottomLeftCorner;
break;
case 3:
chosenCorner = bottomRightCorner;
break;
case 4:
if (point.getX() > rotateDot.getX() && point.getX() < rotateDot.getX() + rotateDot.getWidth() && point.getY() > rotateDot.getY() && point.getY() < rotateDot.getY() + rotateDot.getHeight())
return true;
else
return false;
}
if (point.getX() > chosenCorner.getX() && point.getX() < chosenCorner.getX() + chosenCorner.getWidth() && point.getY() > chosenCorner.getY() && point.getY() < chosenCorner.getY() + chosenCorner.getHeight())
return true;
else
return false;
}
public void setSelected(boolean b)
{
selected = b;
}
public Point2D getPosition()
{
return position;
}
public void setPosition(Point2D position)
{
this.position = position;
}
public double getRotation()
{
return rotation;
}
public void setRotation(double rotation)
{
this.rotation = rotation;
}
public double getScale()
{
return scale;
}
public void setScale(double scale)
{
this.scale = scale;
}
public Image getImage()
{
return image;
}
public void setImage(Image image)
{
this.image = image;
}
public boolean isSelected()
{
return selected;
}
public Rectangle2D getRectangle()
{
return rektAngle;
}
public void setRectangle(Rectangle2D rectangle)
{
rektAngle = rectangle;
}
public Color getRectangleColor()
{
return rectangleColor;
}
public void setRectangleColor(Color rectangleColor)
{
this.rectangleColor = rectangleColor;
}
public Rectangle2D getImageRectangle() {
return new Rectangle2D.Double(0,0, image.getWidth(null), image.getHeight(null));
}
}
+5 -14
View File
@@ -33,11 +33,13 @@ public class MenuBar extends JMenuBar
{ {
public void actionPerformed(ActionEvent e) public void actionPerformed(ActionEvent e)
{ {
new Agenda.Window(); new Agenda.Window(w.getPanel());
} }
}); });
file.add(agenda); file.add(agenda);
file.addSeparator();
item = new JMenuItem("Open"); item = new JMenuItem("Open");
item.addActionListener(new ActionListener() { item.addActionListener(new ActionListener() {
@@ -60,22 +62,12 @@ public class MenuBar extends JMenuBar
file.addSeparator(); file.addSeparator();
item = new JMenuItem("Load agenda");
item.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
w.getPanel().agenda.loadAgenda();
}
});
file.add(item);
item = new JMenuItem("Agenda"); item = new JMenuItem("Agenda");
item.addActionListener(new ActionListener() item.addActionListener(new ActionListener()
{ {
public void actionPerformed(ActionEvent e) public void actionPerformed(ActionEvent e)
{ {
new Agenda.Window(); new Agenda.Window(w.getPanel());
} }
}); });
file.add(item); file.add(item);
@@ -87,8 +79,7 @@ public class MenuBar extends JMenuBar
{ {
public void actionPerformed(ActionEvent e) public void actionPerformed(ActionEvent e)
{ {
w.setVisible(false); System.exit(0);
w.dispose();
} }
}); });
+15 -2
View File
@@ -63,6 +63,7 @@ public class Panel extends JPanel implements ActionListener
private Path currentPath; private Path currentPath;
private static int width = 1920; private static int width = 1920;
private static int height = 1080; private static int height = 1080;
private boolean play = false;
Point2D cameraPoint = new Point2D.Double(getWidth() / 2, getHeight() / 2); Point2D cameraPoint = new Point2D.Double(getWidth() / 2, getHeight() / 2);
float cameraScale = 1; float cameraScale = 1;
@@ -148,7 +149,7 @@ public class Panel extends JPanel implements ActionListener
addMouseWheelListener(new MouseWheel(this)); addMouseWheelListener(new MouseWheel(this));
addFocusListener(new WindowFocusListener(this)); addFocusListener(new WindowFocusListener(this));
t = new Timer(1000 / 10, this); t = new Timer(1000/60, this);
} }
public int getPanelInfoLength() public int getPanelInfoLength()
@@ -389,6 +390,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()
@@ -639,7 +643,6 @@ public class Panel extends JPanel implements ActionListener
currentTime++; currentTime++;
date.setTimeInMillis(date.getTimeInMillis() + 1000); date.setTimeInMillis(date.getTimeInMillis() + 1000);
cp.setTime(formatter.format(date.getTime())); cp.setTime(formatter.format(date.getTime()));
System.out.println(currentTime);
} }
for (Visitor v : visitors) for (Visitor v : visitors)
@@ -665,6 +668,16 @@ public class Panel extends JPanel implements ActionListener
this.t = t; this.t = t;
} }
public void setPlay(boolean play)
{
this.play = play;
}
public boolean getPlay()
{
return play;
}
public void newWorld(int width, int height, int terrainIndex) public void newWorld(int width, int height, int terrainIndex)
{ {
this.width = width; this.width = width;
+40 -6
View File
@@ -11,6 +11,8 @@ import java.awt.event.ActionListener;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.awt.event.KeyListener; import java.awt.event.KeyListener;
import java.awt.geom.Point2D; import java.awt.geom.Point2D;
import java.util.ArrayList;
import java.util.Iterator;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.Box; import javax.swing.Box;
@@ -20,8 +22,11 @@ import javax.swing.JLabel;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JTextField; import javax.swing.JTextField;
import Agenda.AgendaStage;
import Agenda.Event;
import Objects.DrawObject; import Objects.DrawObject;
import Objects.Path; import Objects.Path;
import Objects.Stage;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class PropertiesPanel extends JPanel public class PropertiesPanel extends JPanel
@@ -36,6 +41,7 @@ public class PropertiesPanel extends JPanel
JLabel nameLabel; JLabel nameLabel;
JPanel areaPanel; JPanel areaPanel;
JPanel agendaPanel;
Component rigidArea; Component rigidArea;
JTextField locationXField; JTextField locationXField;
@@ -500,12 +506,9 @@ public class PropertiesPanel extends JPanel
add(Box.createRigidArea(spacerDimension)); add(Box.createRigidArea(spacerDimension));
// AGENDA // AGENDA
JPanel agendaPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); agendaPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
JLabel agendaLabel = new JLabel("Agenda"); agendaPanel.setVisible(false);
agendaLabel.setFont(new Font("Segoe UI", Font.ITALIC, 20));
agendaPanel.setPreferredSize(new Dimension(200, 100));
agendaPanel.setMaximumSize(new Dimension(200, 100));
agendaPanel.add(agendaLabel);
add(agendaPanel); add(agendaPanel);
enableComponents(this, false); enableComponents(this, false);
@@ -566,6 +569,9 @@ public class PropertiesPanel extends JPanel
nameLabel.setText("No Selection"); nameLabel.setText("No Selection");
areaPanel.setVisible(false); areaPanel.setVisible(false);
rigidArea.setVisible(false); rigidArea.setVisible(false);
agendaPanel.setVisible(false);
agendaPanel.removeAll();
agendaPanel.validate();
} }
private void fillFields() private void fillFields()
@@ -573,6 +579,10 @@ public class PropertiesPanel extends JPanel
nameLabel.setText(selectedObject.getName()); nameLabel.setText(selectedObject.getName());
agendaPanel.removeAll();
agendaPanel.validate();
agendaPanel.setVisible(false);
locationXField.setText(Math.round(selectedObject.getPosition().getX()) + ""); locationXField.setText(Math.round(selectedObject.getPosition().getX()) + "");
locationYField.setText(Math.round(selectedObject.getPosition().getY()) + ""); locationYField.setText(Math.round(selectedObject.getPosition().getY()) + "");
scaleField.setText((double) Math.round(selectedObject.getScale() * 10) / 10 + ""); scaleField.setText((double) Math.round(selectedObject.getScale() * 10) / 10 + "");
@@ -583,6 +593,30 @@ public class PropertiesPanel extends JPanel
areaLeftField.setText(selectedObject.getAreaLeft() + ""); areaLeftField.setText(selectedObject.getAreaLeft() + "");
areaRightField.setText(selectedObject.getAreaRight() + ""); areaRightField.setText(selectedObject.getAreaRight() + "");
if(selectedObject instanceof Stage)
{
agendaPanel.setVisible(true);
JLabel agendaLabel = new JLabel("Agenda");
agendaLabel.setFont(new Font("Segoe UI", Font.ITALIC, 20));
agendaPanel.add(agendaLabel);
AgendaStage st = ((Stage) selectedObject).getStage();
nameLabel.setText("Stage: " + st.getName());
ArrayList<Event> events = p.getAgenda().eventsForStage(st);
agendaPanel.setPreferredSize(new Dimension(200, ((30*events.size())+50) ));
agendaPanel.setMaximumSize(new Dimension(200, ((30*events.size())+50) ));
for(Event e : events)
{
JPanel eventPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
JLabel eventLabel = new JLabel(e.getEventName() + " - " + e.getArtist().getName());
eventLabel.setFont(new Font("Segoe UI", Font.PLAIN, 15));
eventPanel.setPreferredSize(new Dimension(200, 30));
eventPanel.setMaximumSize(new Dimension(200, 30));
eventPanel.add(eventLabel);
agendaPanel.add(eventPanel);
}
}
} }
public void setPanel(Panel p) public void setPanel(Panel p)
+89 -32
View File
@@ -1,4 +1,5 @@
package Applicatie; package Applicatie;
import java.io.EOFException; import java.io.EOFException;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
@@ -7,30 +8,44 @@ 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 Objects.DrawObject; import Objects.DrawObject;
import Objects.Path;
public class SaveLoad { public class SaveLoad
{
public static void save(Panel panel) public static void save(Panel panel)
{ {
JFileChooser fileChooser = new JFileChooser(); JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileFilter(new FileFilter() { fileChooser.setFileFilter(new FileFilter()
{
@Override @Override
public boolean accept(File pathname) { public boolean accept(File pathname)
if(pathname.isFile() && pathname.getName().endsWith(".agn")) {
if (pathname.isFile() && pathname.getName().endsWith(".agn"))
{ {
return true; return true;
}else if(pathname.isDirectory()){return true;}else{return false;} }
else if (pathname.isDirectory())
{
return true;
}
else
{
return false;
}
} }
@Override @Override
public String getDescription() { public String getDescription()
{
return ".agn"; return ".agn";
} }
@@ -38,17 +53,17 @@ public class SaveLoad {
fileChooser.setDialogTitle("Choose save location"); fileChooser.setDialogTitle("Choose save location");
int userSelection = fileChooser.showSaveDialog(null); int userSelection = fileChooser.showSaveDialog(null);
if(userSelection == JFileChooser.APPROVE_OPTION) if (userSelection == JFileChooser.APPROVE_OPTION)
{ {
File file = fileChooser.getSelectedFile(); File file = fileChooser.getSelectedFile();
if(!file.getName().endsWith(".agn")) if (!file.getName().endsWith(".agn"))
{ {
file = new File(file.getAbsolutePath() + ".agn"); file = new File(file.getAbsolutePath() + ".agn");
} }
if(file.exists()) if (file.exists())
{ {
if(JOptionPane.showConfirmDialog(null, "Are you sure you want to overwrite: " + file.getName(), "Overwrite", JOptionPane.YES_NO_OPTION) == JOptionPane.OK_OPTION) if (JOptionPane.showConfirmDialog(null, "Are you sure you want to overwrite: " + file.getName(), "Overwrite", JOptionPane.YES_NO_OPTION) == JOptionPane.OK_OPTION)
{ {
saveTerrain(file, panel); saveTerrain(file, panel);
} }
@@ -60,18 +75,28 @@ public class SaveLoad {
} }
} }
public static void saveTerrain(File file, Panel panel)
{
public static void saveTerrain(File file, Panel panel) { try
{
try {
FileOutputStream fos = new FileOutputStream(file); FileOutputStream fos = new FileOutputStream(file);
ObjectOutputStream oos = new ObjectOutputStream(fos); ObjectOutputStream oos = new ObjectOutputStream(fos);
for (DrawObject object : panel.objects) { oos.writeObject(panel.getAgenda());
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");
} catch (IOException e) { }
catch (IOException e)
{
e.printStackTrace(); e.printStackTrace();
} }
} }
@@ -79,17 +104,28 @@ public class SaveLoad {
public static void load(Panel panel) public static void load(Panel panel)
{ {
JFileChooser fileChooser = new JFileChooser(); JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileFilter(new FileFilter() { fileChooser.setFileFilter(new FileFilter()
{
@Override @Override
public boolean accept(File pathname) { public boolean accept(File pathname)
if(pathname.isFile() && pathname.getName().endsWith(".agn")) {
if (pathname.isFile() && pathname.getName().endsWith(".agn"))
{ {
return true; return true;
}else if(pathname.isDirectory()){return true;}else{return false;} }
else if (pathname.isDirectory())
{
return true;
}
else
{
return false;
}
} }
@Override @Override
public String getDescription() { public String getDescription()
{
return ".agn"; return ".agn";
} }
@@ -98,10 +134,10 @@ public class SaveLoad {
fileChooser.setDialogTitle("Choose file"); fileChooser.setDialogTitle("Choose file");
int userSelection = fileChooser.showOpenDialog(null); int userSelection = fileChooser.showOpenDialog(null);
if(userSelection == JFileChooser.APPROVE_OPTION) if (userSelection == JFileChooser.APPROVE_OPTION)
{ {
File file = fileChooser.getSelectedFile(); File file = fileChooser.getSelectedFile();
if(!file.exists()) if (!file.exists())
{ {
JOptionPane.showMessageDialog(null, "This file does not exist: " + file.getName()); JOptionPane.showMessageDialog(null, "This file does not exist: " + file.getName());
} }
@@ -113,32 +149,53 @@ public class SaveLoad {
} }
} }
public static void fillTerrain(File file, Panel panel)
public static void fillTerrain(File file, Panel panel) { {
FileInputStream fis = null; FileInputStream fis = null;
ObjectInputStream ois = null; ObjectInputStream ois = null;
try { try
{
fis = new FileInputStream(file); fis = new FileInputStream(file);
ois = new ObjectInputStream(fis); ois = new ObjectInputStream(fis);
Object object; Object object;
Agenda a = (Agenda) ois.readObject();
panel.setAgenda(a);
try
{
object = ois.readObject(); object = ois.readObject();
try {
panel.clearObjects(); panel.clearObjects();
while (object != null) { while (object != null)
{
if (object instanceof Waypoint)
{
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
{
panel.objects.add((DrawObject) object);
}
object = ois.readObject(); object = ois.readObject();
} }
} catch (EOFException e) {
} }
} catch (Exception e) { catch (EOFException e)
{
}
}
catch (Exception e)
{
e.printStackTrace(); e.printStackTrace();
} }
panel.update(); panel.update();
} }
} }
+47 -20
View File
@@ -11,6 +11,7 @@ import java.util.ArrayList;
import java.util.GregorianCalendar; import java.util.GregorianCalendar;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Random;
import Agenda.Agenda; import Agenda.Agenda;
import Agenda.Event; import Agenda.Event;
@@ -86,16 +87,16 @@ public class Visitor
public void update(ArrayList<DrawObject> objects, int currentTime, ArrayList<Visitor> visitors, ArrayList<Path> paths, Panel panel) public void update(ArrayList<DrawObject> objects, int currentTime, ArrayList<Visitor> visitors, ArrayList<Path> paths, Panel panel)
{ {
DrawObject target = getEntrance(); DrawObject target = getEntrance();
for (Action a : actions) for (Action a : actions)
{ {
if (currentTime >= a.getStartTime() && currentTime < a.getStoptime()) if (currentTime >= a.getStartTime() && currentTime < a.getStoptime())
{ {
this.finalTarget = a.getWaypoint().getSelf(); this.finalTarget = a.getWaypoint().getSelf();
} }
} }
System.out.println(actions.size());
// moveToTarget(target, objects, visitors, paths); // moveToTarget(target, objects, visitors, paths);
move(target, panel); move(target, panel);
} }
@@ -118,7 +119,6 @@ public class Visitor
{ {
rotation += 0.15; rotation += 0.15;
} }
Point2D oldPosition = position; Point2D oldPosition = position;
// face direction // face direction
@@ -140,6 +140,7 @@ public class Visitor
if (hasCollisionDO(object)) if (hasCollisionDO(object))
{ {
possible = false; possible = false;
} }
} }
@@ -148,20 +149,25 @@ public class Visitor
position = oldPosition; position = oldPosition;
rotation += 0.2; rotation += 0.2;
} }
if (checkIfOnWaypoint(panel)) if (checkIfOnWaypoint(panel))
{ {
HashMap<Integer, int[]> options = new HashMap<Integer, int[]>(); HashMap<Integer, int[]> options = new HashMap<Integer, int[]>();
for (Waypoint w : panel.getWaypoints()) for (Waypoint w : panel.getWaypoints())
{ {
options.put(w.getSelf(), w.getOptions()); options.put(w.getSelf(), w.getOptions());
} }
for (Map.Entry<Integer, int[]> e : options.entrySet())
{
for (int i : e.getValue())
{
if (finalTarget != target) if (finalTarget != target)
{ {
for (Map.Entry<Integer, int[]> e : options.entrySet())
{
// System.out.println("KEY: " + e.getKey());
for (int i : e.getValue())
{
// System.out.println("VAL: " + i);
if (finalTarget == i && e.getKey() == target) if (finalTarget == i && e.getKey() == target)
{ {
target = finalTarget; target = finalTarget;
@@ -173,11 +179,11 @@ public class Visitor
break; break;
} }
} }
}
}
}
} }
}
}
}
public boolean checkIfOnWaypoint(Panel panel) public boolean checkIfOnWaypoint(Panel panel)
{ {
@@ -247,6 +253,7 @@ public class Visitor
if (hasCollision(object) && object != this) if (hasCollision(object) && object != this)
{ {
possible = false; possible = false;
} }
} }
@@ -370,7 +377,7 @@ public class Visitor
while (startTime < stopTime) while (startTime < stopTime)
{ {
int random = (int) Math.floor(Math.random() * 51); int random = (int) Math.floor(Math.random() * 51);
if (random < 40) if (random < 30)
{ {
Point2D position = null; Point2D position = null;
DrawObject targetStage = null; DrawObject targetStage = null;
@@ -382,11 +389,23 @@ public class Visitor
posEvents.add(e); posEvents.add(e);
} }
} }
int totalPopularity = 0;
for (Event ev : posEvents)
{
totalPopularity += ev.getExpectedPopularity();
}
if (posEvents.size() != 0) Random rand = new Random();
int n = rand.nextInt(totalPopularity + 1);
int currentPop = 0;
if (posEvents != null)
{
for (Event evs : posEvents)
{
int before = currentPop;
currentPop = currentPop + evs.getExpectedPopularity();
if (before < n && currentPop >= n)
{ {
int r = (int) Math.floor(Math.random() * posEvents.size());
Event evs = posEvents.get(r);
for (DrawObject d : objects) for (DrawObject d : objects)
{ {
if (d.getFileName().equals("stage")) if (d.getFileName().equals("stage"))
@@ -398,19 +417,22 @@ public class Visitor
targetStage = d; targetStage = d;
} }
} }
}
}
} }
} }
int randomtime = (int) (40 + (Math.random() * (60 - 40))); int randomtime = (int) (40 + (Math.random() * (60 - 40)));
if (position != null) if (position != null)
{ {
Waypoint w = getClosestWaypoint(position); Waypoint w = getClosedWaypoint(position);
actions.add(new Action(position, startTime, randomtime, targetStage, w)); actions.add(new Action(position, startTime, randomtime, targetStage, w));
} }
startTime = startTime + randomtime; startTime = startTime + randomtime;
} }
else if (random >= 40 && random < 45) else if (random >= 30 && random < 40)
{ {
Point2D position = null; Point2D position = null;
DrawObject targetStage = null; DrawObject targetStage = null;
@@ -428,15 +450,16 @@ public class Visitor
int r = (int) Math.floor(Math.random() * foodPlaces.size()); int r = (int) Math.floor(Math.random() * foodPlaces.size());
position = foodPlaces.get(r).getPosition(); position = foodPlaces.get(r).getPosition();
targetStage = foodPlaces.get(r); targetStage = foodPlaces.get(r);
Waypoint w = getClosestWaypoint(position); Waypoint w = getClosedWaypoint(position);
actions.add(new Action(position, startTime, 35, targetStage, w)); actions.add(new Action(position, startTime, 35, targetStage, w));
startTime = startTime + 20; startTime = startTime + 20;
} }
startTime = startTime + 35; startTime = startTime + 35;
} }
else if (random > 45) else if (random >= 40)
{ {
Point2D position = null; Point2D position = null;
DrawObject targetStage = null; DrawObject targetStage = null;
ArrayList<DrawObject> toilets = new ArrayList<DrawObject>(); ArrayList<DrawObject> toilets = new ArrayList<DrawObject>();
@@ -447,13 +470,15 @@ public class Visitor
toilets.add(d); toilets.add(d);
} }
} }
if (toilets.size() != 0) if (toilets.size() != 0)
{ {
int r = (int) Math.floor(Math.random() * toilets.size()); int r = (int) Math.floor(Math.random() * toilets.size());
position = toilets.get(r).getPosition(); position = toilets.get(r).getPosition();
targetStage = toilets.get(r); targetStage = toilets.get(r);
Waypoint w = getClosestWaypoint(position); Waypoint w = getClosedWaypoint(position);
actions.add(new Action(position, startTime, 35, targetStage, w)); actions.add(new Action(position, startTime, 35, targetStage, w));
startTime = startTime + 20; startTime = startTime + 20;
} }
startTime = startTime + 35; startTime = startTime + 35;
@@ -462,7 +487,7 @@ public class Visitor
} }
} }
public Waypoint getClosestWaypoint(Point2D point) public Waypoint getClosedWaypoint(Point2D point)
{ {
Waypoint waypoint = null; Waypoint waypoint = null;
int distance = 10000; int distance = 10000;
@@ -470,6 +495,7 @@ public class Visitor
{ {
if (w.getPosition().distance(point) < distance) if (w.getPosition().distance(point) < distance)
{ {
waypoint = w; waypoint = w;
distance = (int) w.getPosition().distance(point); distance = (int) w.getPosition().distance(point);
} }
@@ -479,6 +505,7 @@ public class Visitor
public boolean hasCollisionDO(DrawObject object) public boolean hasCollisionDO(DrawObject object)
{ {
Image image = Images.getImage(filename); Image image = Images.getImage(filename);
Image image2 = Images.getImage(object.getFileName()); Image image2 = Images.getImage(object.getFileName());
Rectangle recta = new Rectangle((int) position.getX(), (int) position.getY(), image.getWidth(null), image.getHeight(null)); Rectangle recta = new Rectangle((int) position.getX(), (int) position.getY(), image.getWidth(null), image.getHeight(null));
+5 -1
View File
@@ -13,6 +13,11 @@ public class Waypoint extends DrawObject
super("waypoint", position); super("waypoint", position);
} }
public Point2D getAccuratePoint()
{
return new Point2D.Double(super.getPosition().getX() + (super.getImageRectangle().getWidth()/2), super.getPosition().getY() + super.getImageRectangle().getHeight());
}
@Override @Override
public String getName() public String getName()
{ {
@@ -36,7 +41,6 @@ public class Waypoint extends DrawObject
public void setSelf(int self) public void setSelf(int self)
{ {
System.out.println(self);
this.self = self; this.self = self;
} }
+13 -1
View File
@@ -9,6 +9,8 @@ import java.awt.image.BufferedImage;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import Applicatie.Panel; import Applicatie.Panel;
import Applicatie.PathPopup;
import Applicatie.Waypoint; import Applicatie.Waypoint;
import Applicatie.WaypointPopup; import Applicatie.WaypointPopup;
import Objects.DrawObject; import Objects.DrawObject;
@@ -32,6 +34,8 @@ public class Mouse extends MouseAdapter
panel.setLastClickPosition(clickPoint); panel.setLastClickPosition(clickPoint);
panel.setLastMousePosition(e.getPoint()); panel.setLastMousePosition(e.getPoint());
if(!panel.getPlay())
{
if (!panel.getClickedOption().equals("Path")) if (!panel.getClickedOption().equals("Path"))
{ {
if (e.getY() < 150) if (e.getY() < 150)
@@ -148,13 +152,14 @@ public class Mouse extends MouseAdapter
panel.getCurrentPath().addPoint(new Point2D.Double(clickPoint.getX(), clickPoint.getY())); panel.getCurrentPath().addPoint(new Point2D.Double(clickPoint.getX(), clickPoint.getY()));
}
} }
panel.repaint(); panel.repaint();
} }
public void mouseReleased(MouseEvent e) public void mouseReleased(MouseEvent e)
{ {
if (panel.getDragObject() != null) if (panel.getDragObject() != null && !panel.getPlay())
{ {
if (panel.getDragObject().getRectangleColor() != Color.RED) if (panel.getDragObject().getRectangleColor() != Color.RED)
{ {
@@ -164,10 +169,17 @@ public class Mouse extends MouseAdapter
panel.setClickedOption("drag"); panel.setClickedOption("drag");
} }
else else
{
if (panel.getDragObject() instanceof Waypoint == false)
{ {
panel.getDragObject().setPosition(panel.getSelectionPosition()); panel.getDragObject().setPosition(panel.getSelectionPosition());
panel.getDragObject().setRectangleColor(Color.BLACK); panel.getDragObject().setRectangleColor(Color.BLACK);
} }
else
{
panel.getDragObject().setRectangleColor(Color.BLACK);
}
}
panel.setSelectionPosition(panel.getSelectedObject().getPosition()); panel.setSelectionPosition(panel.getSelectedObject().getPosition());
} }
panel.repaint(); panel.repaint();
+19 -1
View File
@@ -15,6 +15,7 @@ import java.io.Serializable;
import javax.swing.ImageIcon; import javax.swing.ImageIcon;
import Applicatie.Images; import Applicatie.Images;
import Applicatie.Panel;
public abstract class DrawObject implements Serializable public abstract class DrawObject implements Serializable
{ {
@@ -232,13 +233,30 @@ public abstract class DrawObject implements Serializable
public void setPosition(Point2D position) public void setPosition(Point2D position)
{ {
if(position.getX() < -Panel.getFieldWidth()/2)
{
position.setLocation(-Panel.getFieldWidth()/2, position.getY());
}
if(position.getY() < -Panel.getFieldHeight()/2)
{
position.setLocation(position.getX(), -Panel.getFieldHeight()/2);
}
if(position.getX() > Panel.getFieldWidth()/2 - width)
{
position.setLocation(Panel.getFieldWidth()/2-width, position.getY());
}
if(position.getY() > Panel.getFieldHeight()/2 - height)
{
position.setLocation(position.getX(), Panel.getFieldHeight()/2-height);
}
this.position = position; this.position = position;
} }
public void setPosition(Point2D position, boolean b) public void setPosition(Point2D position, boolean b)
{ {
this.position = position; setPosition(position);
} }
public double getRotation() public double getRotation()
{ {
return rotation; return rotation;
+17 -2
View File
@@ -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;
/** /**
@@ -50,6 +53,18 @@ public class Path
} }
} }
public void updateImage()
{
try
{
pathBackground = ImageIO.read(new File("images/newPath.png"));
}
catch (IOException e)
{
e.printStackTrace();
}
}
/** /**
* Draws the path. * Draws the path.
* *
-13
View File
@@ -1,13 +0,0 @@
package Objects;
import java.awt.geom.Point2D;
import Applicatie.DrawObject;
public class Podium extends DrawObject {
public Podium(Point2D position) {
super("images/stage3.png", position);
}
}
-2
View File
@@ -1,2 +0,0 @@
# FestivalPlanner
Festival Planner
Binary file not shown.

After

Width:  |  Height:  |  Size: 897 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 494 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 180 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 202 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 911 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 155 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 B