package gui.simulator; public class AccessPoint extends DrawEngine { private static String imageLocation = "/simulator/ingang.png"; private static String facilityName = "Ingang"; private Terrain terrain; public AccessPoint(Terrain terrain, int x, int y) { super(imageLocation, x, y, 1, 0); this.terrain = terrain; } public AccessPoint(Terrain terrain, int x, int y, double scale, double distance) { super(imageLocation, x, y, scale, distance); this.terrain = terrain; } public String getFacilityName(){ return facilityName; } @Override public void setX(double x){ double oldPosX = this.getX(); double oldPosY = this.getY(); if(x<0){ this.setRotation(90); this.setX(0); } else if(x>9*terrain.getWidth()/10){ this.setX(9*terrain.getWidth()/10); this.setRotation(90); } else if(x>0 && x<9*terrain.getWidth()/10 && this.getY() > 50 && this.getY() < terrain.getFestivalHeight()-150){ this.setX(oldPosX); this.setY(oldPosY); } else { this.setX(x); } } @Override public void setY(double y){ double oldPosY = this.getY(); if(y<50){ this.setRotation(0); this.setY(50); } else if(y>11*terrain.getFestivalHeight()/12){ this.setRotation(0); this.setY(11*terrain.getFestivalHeight()/12); } else if(this.getX()>terrain.getWidth()/10 && this.getX() <9*terrain.getWidth()/10 && this.getY()> 50 && this.getY() < terrain.getFestivalHeight()-150){ this.setY(oldPosY); } else { this.setY(y); } } }