this.notifyObservers(SimulatorObserverCommandState.STOPPED_SIMULATION);
}
private void calculateOutOfWindowAreaPosition(RoboterController roboterController, RoboterMove rm) {
Point2d newPosition = null;
// Fall 1: Unten
Point2d roboter1 = rm.getNewRoboterPoint();
if (roboter1.getY() > height) {
newPosition = getIntersectionPointForSides(rm, roboter1, SideStraigtLine.LINE_LEFT, SideStraigtLine.LINE_RIGHT,
SideStraigtLine.LINE_UP);
roboterController.getRoboter().setX(newPosition.getX());
roboterController.getRoboter().setY(newPosition.getY());
// Fall 2: Oben
} else if (roboter1.getY() < 0) {
newPosition = getIntersectionPointForSides(rm, roboter1, SideStraigtLine.LINE_LEFT, SideStraigtLine.LINE_RIGHT,
SideStraigtLine.LINE_DOWN);
roboterController.getRoboter().setX(newPosition.getX());
roboterController.getRoboter().setY(newPosition.getY());
// Fall 3: Rechts
} else if (roboter1.getX() > width) {
newPosition = getIntersectionPointForSides(rm, roboter1, SideStraigtLine.LINE_LEFT, SideStraigtLine.LINE_DOWN,
SideStraigtLine.LINE_UP);
roboterController.getRoboter().setX(newPosition.getX());
roboterController.getRoboter().setY(newPosition.getY());
// Fall 4: Links
} else if (roboter1.getX() < 0) {
newPosition = getIntersectionPointForSides(rm, roboter1, SideStraigtLine.LINE_RIGHT, SideStraigtLine.LINE_DOWN,
SideStraigtLine.LINE_UP);
roboterController.getRoboter().setX(newPosition.getX());
roboterController.getRoboter().setY(newPosition.getY());