|
@@ -40,6 +40,7 @@ public class Terrain extends JPanel {
|
|
|
private SimulatorPane.Terrains terrain;
|
|
private SimulatorPane.Terrains terrain;
|
|
|
Point2D cameraPoint = new Point2D.Double(festivalwidth/2,festivalheight/2);
|
|
Point2D cameraPoint = new Point2D.Double(festivalwidth/2,festivalheight/2);
|
|
|
float cameraScale = 1;
|
|
float cameraScale = 1;
|
|
|
|
|
+ private boolean grid;
|
|
|
|
|
|
|
|
Point2D lastClickPosition;
|
|
Point2D lastClickPosition;
|
|
|
Point lastMousePosition;
|
|
Point lastMousePosition;
|
|
@@ -48,6 +49,7 @@ public class Terrain extends JPanel {
|
|
|
//get values
|
|
//get values
|
|
|
setFestivalHeight(length);
|
|
setFestivalHeight(length);
|
|
|
setFestivalWidth(width);
|
|
setFestivalWidth(width);
|
|
|
|
|
+ grid = true;
|
|
|
this.terrain = terrain;
|
|
this.terrain = terrain;
|
|
|
//initialize sidebar
|
|
//initialize sidebar
|
|
|
sidebar = new Sidebar(200, getFestivalHeight(), this);
|
|
sidebar = new Sidebar(200, getFestivalHeight(), this);
|
|
@@ -199,27 +201,7 @@ public class Terrain extends JPanel {
|
|
|
Graphics2D g2 = (Graphics2D) g;
|
|
Graphics2D g2 = (Graphics2D) g;
|
|
|
sidebar.draw(g2);
|
|
sidebar.draw(g2);
|
|
|
|
|
|
|
|
- //draw sidebar
|
|
|
|
|
-// g2.setClip(new Rectangle2D.Double(0,0, sideBarWidth, getHeight()));
|
|
|
|
|
-// g2.setColor(Color.GRAY);
|
|
|
|
|
-// g2.fill3DRect(0, 0, 200, 50, true);
|
|
|
|
|
-// g2.setColor(Color.WHITE);
|
|
|
|
|
-// g2.setFont(new Font("Serif", Font.BOLD, 20));
|
|
|
|
|
-// g2.drawString("Drag and drop", 30, 25);
|
|
|
|
|
-// g2.setColor(Color.BLACK);
|
|
|
|
|
-// g2.setStroke(new BasicStroke(5));
|
|
|
|
|
-// g2.drawLine(199, 0, 199, getHeight());
|
|
|
|
|
-// //draw objects
|
|
|
|
|
-// Draw object1 = new Stage(0,50);
|
|
|
|
|
-// object1.draw(g2);
|
|
|
|
|
-// g2.drawString("stage", 80, 275);
|
|
|
|
|
-// Draw object2 = new RestRoom(0,300, 0.5, 10);
|
|
|
|
|
-// object2.draw(g2);
|
|
|
|
|
-// g2.drawString("toilettage", 70, 525);
|
|
|
|
|
-// Draw object3 = new AccessPoint(this, 0,550, 0.5, 10);
|
|
|
|
|
-// object3.draw(g2);
|
|
|
|
|
-// g2.drawString("ingang", 70, 675);
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
//draw simulation field
|
|
//draw simulation field
|
|
|
g2.setClip(new Rectangle2D.Double(200, 0, getWidth()-200, getHeight()));
|
|
g2.setClip(new Rectangle2D.Double(200, 0, getWidth()-200, getHeight()));
|
|
|
AffineTransform oldTransform = g2.getTransform();
|
|
AffineTransform oldTransform = g2.getTransform();
|
|
@@ -228,10 +210,17 @@ public class Terrain extends JPanel {
|
|
|
TexturePaint p = new TexturePaint(background, new Rectangle2D.Double(0, 0, 200, 200));
|
|
TexturePaint p = new TexturePaint(background, new Rectangle2D.Double(0, 0, 200, 200));
|
|
|
g2.setPaint(p);
|
|
g2.setPaint(p);
|
|
|
g2.fill(new Rectangle2D.Double(0,0,festivalwidth,festivalheight));
|
|
g2.fill(new Rectangle2D.Double(0,0,festivalwidth,festivalheight));
|
|
|
- for(int i = 0; i < (festivalwidth/100); i++){
|
|
|
|
|
-
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
|
|
+ if(grid){
|
|
|
|
|
+ g2.setColor(new Color(160,160,160,120));
|
|
|
|
|
+ g2.setStroke(new BasicStroke(1));
|
|
|
|
|
+ for(int i = 0; i < (getFestivalWidth()/10)+1; i++){
|
|
|
|
|
+ g2.drawLine(i*10, 0, i*10, getFestivalHeight());
|
|
|
|
|
+ };
|
|
|
|
|
+ for(int i = 0; i < (getFestivalHeight()/10)+1; i++){
|
|
|
|
|
+ g2.drawLine(0, i*10, getFestivalWidth(), i*10);
|
|
|
|
|
+ };
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
for(Draw drawObject: entities){
|
|
for(Draw drawObject: entities){
|
|
|
drawObject.draw(g2);
|
|
drawObject.draw(g2);
|
|
|
}
|
|
}
|