Laba2 Hard PIbd-22 Kalyshev Y V #2

Closed
Zyzf wants to merge 6 commits from Laba2 into Laba1
16 changed files with 1109 additions and 305 deletions
Showing only changes of commit fdc7d9ab56 - Show all commits

View File

@ -0,0 +1,243 @@
package com.example.pibd22_kalyshev_y_v_motorboat_hard;
import javafx.scene.canvas.GraphicsContext;
import java.util.Random;
public abstract class AbstractMap
{
private IDrawningObject _drawningObject = null;
private GraphicsContext _graphicsContext = null;
protected int[][] _map = null;
protected int _width;
protected int _height;
protected float _size_x;
protected float _size_y;
protected final Random _random = new Random();
protected final int _freeRoad = 0;
protected final int _barrier = 1;
public void CreateMap(int width, int height, IDrawningObject drawningObject, GraphicsContext gc)
{
_width = width;
_height = height;
_drawningObject = drawningObject;
_graphicsContext = gc;
GenerateMap();
while (!SetObjectOnMap())
{
GenerateMap();
}
DrawMapWithObject();
}
public void MoveObject(Direction direction)
{
boolean roadIsClear = true;
float[] position = _drawningObject.GetCurrentPosition();
int xNumOfCells;
int yNumOfCells;
int xObjOffset;
int yObjOffset;
switch (direction)
{
case Up:
xNumOfCells = (int)Math.ceil((position[2] - position[0]) / _size_x);
yNumOfCells = (int)Math.ceil(_drawningObject.GetStep() / _size_y);
xObjOffset = (int)(position[0] / _size_x);
yObjOffset = (int)Math.floor(position[1] / _size_y);
for (int i = 0; i < yNumOfCells; i++)
{
if (!roadIsClear)
{
break;
}
for (int j = 0; j < xNumOfCells; j++)
{
if (yObjOffset - i < 0 || xObjOffset + j >= _map[0].length)
{
break;
}
if (_map[xObjOffset + j][yObjOffset - i] == _barrier)
{
roadIsClear = false;
break;
}
}
}
break;
case Down:
xNumOfCells = (int)Math.ceil((position[2] - position[0]) / _size_x);
yNumOfCells = (int)Math.ceil(_drawningObject.GetStep() / _size_y);
xObjOffset = (int)(position[0] / _size_x);
yObjOffset = (int)Math.ceil(position[3]/ _size_y);
for (int i = 0; i < yNumOfCells; i++)
{
if (!roadIsClear)
{
break;
}
for (int j = 0; j < xNumOfCells; j++)
{
if (yObjOffset + i >= _map.length || xObjOffset + j >= _map[0].length)
{
break;
}
if (_map[xObjOffset + j][yObjOffset + i] == _barrier)
{
roadIsClear = false;
break;
}
}
}
break;
case Left:
xNumOfCells = (int)Math.ceil(_drawningObject.GetStep() / _size_x);
yNumOfCells = (int)Math.ceil((position[3] - position[1]) / _size_y);
xObjOffset = (int)Math.floor(position[0] / _size_x);
yObjOffset = (int)(position[1] / _size_y);
for (int i = 0; i < yNumOfCells; i++)
{
if (!roadIsClear)
{
break;
}
for (int j = 0; j < xNumOfCells; j++)
{
if (yObjOffset + i >= _map.length || xObjOffset - j < 0)
{
break;
}
if (_map[xObjOffset - j][yObjOffset + i] == _barrier)
{
roadIsClear = false;
break;
}
}
}
break;
case Right:
xNumOfCells = (int)Math.ceil(_drawningObject.GetStep() / _size_x);
yNumOfCells = (int)Math.ceil((position[3] - position[1]) / _size_y);
xObjOffset = (int)(position[2] / _size_x);
yObjOffset = (int)Math.ceil(position[1] / _size_y);
for (int i = 0; i < yNumOfCells; i++)
{
if (!roadIsClear)
{
break;
}
for (int j = 0; j < xNumOfCells; j++)
{
if (yObjOffset + i >= _map.length || xObjOffset + j >= _map[0].length)
{
break;
}
if (_map[xObjOffset + j][yObjOffset + i] == _barrier)
{
roadIsClear = false;
break;
}
}
}
break;
}
if (roadIsClear)
{
_drawningObject.MoveObject(direction);
}
DrawMapWithObject();
}
private boolean SetObjectOnMap()
{
if (_drawningObject == null || _map == null)
{
return false;
}
int x = _random.nextInt(0, 10);
int y = _random.nextInt(0, 10);
float[] position = _drawningObject.GetCurrentPosition();
int xNumOfCells = (int)Math.ceil(position[2] / _size_x) - (int)Math.floor(position[0] / _size_x);
int yNumOfCells = (int)Math.ceil(position[3] / _size_y) - (int)Math.floor(position[1] / _size_y);
int xObjOffset = (int)(x / _size_x);
int yObjOffset = (int)(y / _size_y);
while (y < _height - (position[3] - position[1]))
{
while (x < _width - (position[2] - position[0]))
{
if (AreaIsFree(xNumOfCells, yNumOfCells, xObjOffset, yObjOffset))
{
_drawningObject.SetObject(x, y, _width, _height);
return true;
}
x += (int)_size_x;
xObjOffset = (int)(x / _size_x);
}
x = 0;
y += (int)_size_y;
yObjOffset = (int)(y / _size_y);
}
return false;
}
private boolean AreaIsFree(int xNumOfCells, int yNumOfCells, int xObjOffset, int yObjOffset)
{
for (int i = 0; i <= yNumOfCells; i++)
{
for (int j = 0; j <= xNumOfCells; j++)
{
if (yObjOffset + i >= _map.length || xObjOffset + j >= _map[0].length)
{
return false;
}
if (_map[xObjOffset + j][yObjOffset + i] == _barrier)
{
return false;
}
}
}
return true;
}
public void DrawMapWithObject()
{
if (_drawningObject == null || _map == null)
{
return;
}
for (int i = 0; i < _map.length; ++i)
{
for (int j = 0; j < _map[0].length; ++j)
{
if (_map[i][j] == _freeRoad)
{
DrawRoadPart(_graphicsContext, i, j);
}
else if (_map[i][j] == _barrier)
{
DrawBarrierPart(_graphicsContext, i, j);
}
}
}
_drawningObject.DrawningObject(_graphicsContext);
}
protected abstract void GenerateMap();
protected abstract void DrawRoadPart(GraphicsContext gc, int i, int j);
protected abstract void DrawBarrierPart(GraphicsContext gc, int i, int j);
}

View File

@ -0,0 +1,213 @@
package com.example.pibd22_kalyshev_y_v_motorboat_hard;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.canvas.Canvas;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.control.Button;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import java.util.Random;
public class ControllerBoat {
@FXML
private Pane root;
@FXML
private Canvas canvas;
@FXML
private FlowPane flowPane;
@FXML
private Label labelSpeedValue;
@FXML
private Label labelWeightValue;
@FXML
private Label labelBodyColorValue;
@FXML
private ComboBox<String> comboBoxNumOfRollers;
@FXML
private ComboBox<String> comboBoxOrnamentType;
@FXML
private Button buttonCreate;
@FXML
private Button buttonCreateModif;
@FXML
private Button buttonLeft;
@FXML
private Button buttonRight;
@FXML
private Button buttonUp;
@FXML
private Button buttonDown;
private final double rootPadding = 10.0;
private DrawningBoat _boat;
@FXML
public void initialize()
{
buttonCreate.setTranslateX(rootPadding);
root.widthProperty().addListener((obs, oldVal, newVal) ->
{
UpdateGUI();
if (_boat != null)
{
_boat.ChangeBorders((int) canvas.getWidth(), (int) canvas.getHeight());
}
Draw();
});
root.heightProperty().addListener((obs, oldVal, newVal) ->
{
UpdateGUI();
if (_boat != null)
{
_boat.ChangeBorders((int) canvas.getWidth(), (int) canvas.getHeight());
}
Draw();
});
}
@FXML
void ButtonCreate_Click()
{
Random rnd = new Random();
_boat = new DrawningBoat(rnd.nextInt(200) + 100, rnd.nextInt(1000) + 1000,
Color.rgb(rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256)));
SetData();
Draw();
}
@FXML
void ButtonCreateModif_Click()
{
Random rnd = new Random();
_boat = new DrawningSpeedboat(rnd.nextInt(200) + 100, rnd.nextInt(1000) + 1000,
Color.rgb(rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256)),
Color.rgb(rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256)),
(rnd.nextInt(2) != 0), (rnd.nextInt(2) != 0), (rnd.nextInt(2) != 0));
SetData();
Draw();
}
@FXML
void ButtonMove_Click(ActionEvent event)
{
if (_boat == null)
{
return;
}
String buttonName = ((Button) event.getSource()).getId();
switch (buttonName)
{
case "buttonUp" -> _boat.MoveTransport(Direction.Up);
case "buttonDown" -> _boat.MoveTransport(Direction.Down);
case "buttonLeft" -> _boat.MoveTransport(Direction.Left);
case "buttonRight" -> _boat.MoveTransport(Direction.Right);
}
Draw();
}
@FXML
private void ComboBoxOrnamentType_Changed()
{
if (_boat != null)
{
ChangeDrawningOars();
Draw();
}
}
@FXML
private void ComboBoxNumOfRollers_Changed()
{
if (_boat != null)
{
_boat.GetDrawningOars().SetNumberOars(Integer.parseInt(comboBoxNumOfRollers.getValue()));
Draw();
}
}
private void ChangeDrawningOars()
{
if (_boat != null)
{
IDrawningAdditionalElement newDrawningTrackRollers = switch (comboBoxOrnamentType.getValue())
{
case "None" -> new DrawningOars(_boat.GetBoat().GetBodyColor());
case "Dots" -> new DrawningDotOrnamentTrackRollers(_boat.GetBoat().GetBodyColor());
case "Circles" ->
new DrawningCircleOrnamentTrackRollers(_boat.GetBoat().GetBodyColor());
default -> null;
};
if (newDrawningTrackRollers != null)
{
_boat.SetDrawningOars(newDrawningTrackRollers);
_boat.GetDrawningOars().SetNumberOars(Integer.parseInt(comboBoxNumOfRollers.getValue()));
}
}
}
private void UpdateGUI()
{
double rootWidth = root.getWidth();
double rootHeight = root.getHeight();
double flowPaneHeight = flowPane.getHeight();
double buttonCreateHeight = buttonCreate.getHeight();
canvas.setWidth(rootWidth);
flowPane.setPrefWidth(rootWidth);
canvas.setHeight(rootHeight - flowPaneHeight);
flowPane.setTranslateY(rootHeight - flowPaneHeight);
buttonCreate.setTranslateY(rootHeight - flowPaneHeight - buttonCreateHeight - rootPadding);
buttonCreateModif.setTranslateY(rootHeight - flowPaneHeight - buttonCreateHeight - rootPadding);
int buttonMoveSize = 30;
int distanceBetweenButtons = 5;
buttonUp.setTranslateY(rootHeight - flowPaneHeight - buttonMoveSize * 2.0 - rootPadding -
distanceBetweenButtons);
buttonUp.setTranslateX(rootWidth - rootPadding - buttonMoveSize * 2.0 - distanceBetweenButtons);
buttonDown.setTranslateY(rootHeight - flowPaneHeight - buttonMoveSize - rootPadding);
buttonDown.setTranslateX(rootWidth- rootPadding - buttonMoveSize * 2.0 - distanceBetweenButtons);
buttonLeft.setTranslateY(rootHeight - flowPaneHeight - buttonMoveSize - rootPadding);
buttonLeft.setTranslateX(rootWidth - rootPadding - buttonMoveSize * 3.0 -
distanceBetweenButtons * 2.0);
buttonRight.setTranslateY(rootHeight - flowPaneHeight - buttonMoveSize - rootPadding);
buttonRight.setTranslateX(rootWidth - rootPadding - buttonMoveSize);
}
private void Draw()
{
GraphicsContext gc = canvas.getGraphicsContext2D();
gc.clearRect(0.0, 0.0, canvas.getWidth(), canvas.getHeight());
gc.setFill(Color.WHITE);
gc.fillRect(0.0, 0.0, canvas.getWidth(), canvas.getHeight());
gc.setStroke(Color.BLACK);
gc.setLineWidth(4);
gc.strokeRect(0.0, 0.0, canvas.getWidth(), canvas.getHeight());
if (_boat != null)
{
_boat.DrawTransport(gc);
}
}
private void SetData()
{
ChangeDrawningOars();
Random rnd = new Random();
_boat.SetPosition(rnd.nextInt(90) + 10, rnd.nextInt(90),
(int) canvas.getWidth(), (int) canvas.getHeight());
labelSpeedValue.setText(Integer.toString(_boat.GetBoat().GetSpeed()));
labelWeightValue.setText(Double.toString(_boat.GetBoat().GetWeight()));
labelBodyColorValue.setText(_boat.GetBoat().GetBodyColor().toString());
}
}

View File

@ -6,9 +6,9 @@ import javafx.scene.paint.Color;
public class DrawningBoat
{
private EntityBoat _boat;
private DrawningOars _drawningOars;
private float _startPosX;
private float _startPosY;
private IDrawningAdditionalElement _drawningOars;
protected float _startPosX;
protected float _startPosY;
private Integer _pictureWidth;
private Integer _pictureHeight;
private int _boatWidth = 170;
@ -18,20 +18,30 @@ public class DrawningBoat
{
return _boat;
}
public DrawningOars GetDrawningOars()
protected void SetBoat(EntityBoat boat)
{
_boat = boat;
}
public IDrawningAdditionalElement GetDrawningOars()
{
return _drawningOars;
}
public void Init(int speed, float weight, Color bodyColor)
public void SetDrawningOars(IDrawningAdditionalElement drawningOars)
{
_boat = new EntityBoat();
_boat.Init(speed, weight, bodyColor);
_drawningOars = new DrawningOars();
_drawningOars.Init(bodyColor);
_drawningOars = drawningOars;
}
public DrawningBoat(int speed, float weight, Color bodyColor)
{
_boat = new EntityBoat(speed, weight, bodyColor);
_drawningOars = new DrawningOars(bodyColor);
}
protected DrawningBoat(int speed, float weight, Color bodyColor, int boatWidth, int boatHeight)
{
this(speed, weight, bodyColor);
_boatHeight = boatHeight;
_boatWidth = boatWidth;
}
public void SetPosition(int x, int y, int width, int height)
{
if (x < 0 || y < 0) {

View File

@ -3,7 +3,7 @@ package com.example.pibd22_kalyshev_y_v_motorboat_hard;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.paint.Color;
public class DrawningOars {
public class DrawningOars implements IDrawningAdditionalElement{
private Color _OarsColor;
private NumberOars _numOars;
public void SetNumberOars(int numberOars)
@ -11,11 +11,10 @@ public class DrawningOars {
_numOars = NumberOars.FromInteger(numberOars);
}
public int deltaYdown = 0;
public void Init(Color oarsColor)
public DrawningOars(Color oarsColor)
{
_OarsColor = oarsColor;
}
public void DrawOars(GraphicsContext gc, float startPosX, float startPosY) {
if (_OarsColor == null) {
return;

View File

@ -0,0 +1,113 @@
package com.example.pibd22_kalyshev_y_v_motorboat_hard;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.paint.Color;
public class DrawningSpeedboat extends DrawningBoat
{
public DrawningSpeedboat(int speed, float weight, Color bodyColor, Color dopColor, boolean bodyKit, boolean wing, boolean sportLine)
{
super(speed, weight, bodyColor, 195, 80);
SetBoat(new EntitySpeedboat(speed, weight, bodyColor, dopColor, bodyKit, wing, sportLine));
}
@Override
public void DrawTransport(GraphicsContext gc)
{
if (!(GetBoat() instanceof EntitySpeedboat speedboat))
{
return;
}
_startPosX += 8;
_startPosY += 1;
super.DrawTransport(gc);
_startPosX -= 8;
_startPosY -= 1;
gc.setStroke(Color.BLACK);
gc.setLineWidth(2);
if (speedboat.GetBodyKit())
{
double[] turretX =
{
31.0 + _startPosX,
31.0 + _startPosX,
45.0 + _startPosX,
83.0 + _startPosX,
97.0 + _startPosX,
97.0 + _startPosX,
};
double[] turretY =
{
24.0 + _startPosY,
12.0 + _startPosY,
2.0 + _startPosY,
2.0 + _startPosY,
12.0 + _startPosY,
24.0 + _startPosY,
};
gc.setFill(speedboat.GetDopColor());
gc.fillPolygon(turretX, turretY, 6);
gc.strokePolygon(turretX, turretY, 6);
gc.strokeRect(32 + _startPosX, 22 + _startPosY, 64, 2);
double[] muzzleX =
{
94 + _startPosX,
84 + _startPosX,
120 + _startPosX,
120 + _startPosX,
};
double[] muzzleY =
{
9 + _startPosY,
3 + _startPosY,
3 + _startPosY,
9 + _startPosY,
};
gc.setFill(Color.rgb(109, 137, 165));
gc.fillPolygon(muzzleX, muzzleY, 4);
gc.strokePolygon(muzzleX, muzzleY, 4);
gc.fillRect(120 + _startPosX, 2 + _startPosY, 16, 8);
gc.strokeRect(120 + _startPosX, 2 + _startPosY, 16, 8);
}
if (speedboat.GetWing())
{
gc.moveTo(60 + _startPosX, 1 + _startPosY);
gc.lineTo(60 + _startPosX, 24 + _startPosY);
gc.closePath();
gc.setFill(speedboat.GetDopColor());
gc.fillRect(_startPosX, 2 + _startPosY, 58, 8);
gc.strokeRect(_startPosX, 2 + _startPosY, 58, 8);
gc.fillRect(_startPosX, 10 + _startPosY, 58, 8);
gc.strokeRect(_startPosX, 10 + _startPosY, 58, 8);
gc.fillRect(_startPosX, _startPosY, 6, 17);
gc.strokeRect(_startPosX, _startPosY, 6, 17);
double[] batteryMoutX =
{
24 + _startPosX,
15 + _startPosX,
58 + _startPosX,
58 + _startPosX
};
double[] batteryMoutY =
{
24 + _startPosY,
18 + _startPosY,
18 + _startPosY,
24 + _startPosY
};
gc.setFill(Color.rgb(21, 39, 71));
gc.fillPolygon(batteryMoutX, batteryMoutY, 4);
gc.strokePolygon(batteryMoutX, batteryMoutY, 4);
}
}
}

View File

@ -28,7 +28,7 @@ public class EntityBoat
return _speed * 100 / _weight;
}
public void Init(int speed, float weight, Color bodyColor)
public EntityBoat(int speed, float weight, Color bodyColor)
{
Random random = new Random();
_speed = speed <= 0 ? random.nextInt(5) + 25 : speed;

View File

@ -0,0 +1,32 @@
package com.example.pibd22_kalyshev_y_v_motorboat_hard;
import javafx.scene.paint.Color;
public class EntitySpeedboat extends EntityBoat
{
private final Color _dopColor;
private final boolean _bodyKit;
private final boolean _wing;
private final boolean _sportLine;
public Color GetDopColor() {
return _dopColor;
}
public boolean GetBodyKit() {
return _bodyKit;
}
public boolean GetWing() {
return _wing;
}
public boolean GetSportLine() {
return _sportLine;
}
public EntitySpeedboat(int speed, float weight, Color bodyColor, Color dopColor, boolean bodyKit, boolean wing, boolean sportLine)
{
super(speed, weight, bodyColor);
_dopColor = dopColor;
_bodyKit = bodyKit;
_wing = wing;
_sportLine = sportLine;
}
}

View File

@ -1,303 +1,76 @@
package com.example.pibd22_kalyshev_y_v_motorboat_hard;
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.canvas.Canvas;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.control.Button;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.HBox;
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
import java.io.IOException;
import java.util.Random;
public class FormBoat extends Application
{
private Pane _root;
private Scene _scene;
private Canvas _canvas;
private HBox _hBox;
private Button _buttonCreate;
private Button _buttonUp;
private Button _buttonDown;
private Button _buttonLeft;
private Button _buttonRight;
private Label _labelSpeedValue;
private Label _labelWeightValue;
private Label _labelBodyColorValue;
private ComboBox<String> _comboBoxNumOars;
private double _hBoxHeight;
private double _buttonCreateHeight;
private final int _buttonMoveWidth = 30;
private final int _buttonMoveHeight = 30;
private final int _distanceBetweenMoveButtons = 5;
private final double _buttonMargin = 10.0;
private DrawningBoat _boat;
@Override
public void start(Stage stage) throws IOException
{
FXMLLoader fxmlLoader = new FXMLLoader(FormBoat.class.getResource("hello-view.fxml"));
_scene = new Scene(fxmlLoader.load(), 600, 400);
_root = (Pane) _scene.lookup("#root");
_root.setStyle("-fx-background-color: #31374c;");
_canvas = new Canvas();
_root.getChildren().add(_canvas);
InitHBox();
InitButtonCreate();
InitMoveButtons();
FXMLLoader fxmlLoader = new FXMLLoader(FormBoat.class.getResource("form-boat-view.fxml"));
Scene scene = new Scene(fxmlLoader.load(), 320, 240);
stage.setTitle("Boat");
stage.setScene(_scene);
_scene.widthProperty().addListener((obs, oldVal, newVal) -> {
UpdateGUI();
if (_boat != null)
{
_boat.ChangeBorders((int) _canvas.getWidth(), (int) _canvas.getHeight());
}
Draw();
});
_scene.heightProperty().addListener((obs, oldVal, newVal) -> {
UpdateGUI();
if (_boat != null)
{
_boat.ChangeBorders((int) _canvas.getWidth(), (int) _canvas.getHeight());
}
Draw();
});
_root.applyCss();
_root.layout();
stage.setOnShowing(event -> {
_hBoxHeight = _hBox.getHeight();
_buttonCreateHeight = _buttonCreate.getHeight();
UpdateGUI();
Draw();
});
stage.setScene(scene);
FirstUpdateGUI(scene);
stage.show();
}
private void InitHBox()
private void FirstUpdateGUI(Scene scene)
{
_hBox = new HBox();
_hBox.setStyle("-fx-background-color: #31374c;");
_root.getChildren().add(_hBox);
Pane root = (Pane)scene.lookup("#root");
Canvas canvas = (Canvas)scene.lookup("#canvas");
Button buttonCreate = (Button)scene.lookup("#buttonCreate");
Button buttonCreateModif = (Button)scene.lookup("#buttonCreateModif");
Button buttonUp = (Button)scene.lookup("#buttonUp");
Button buttonLeft = (Button)scene.lookup("#buttonLeft");
Button buttonRight = (Button)scene.lookup("#buttonRight");
Button buttonDown = (Button)scene.lookup("#buttonDown");
FlowPane flowPane = (FlowPane)scene.lookup("#flowPane");
Label labelSpeed = new Label("Speed:");
labelSpeed.setStyle("-fx-text-fill: #b8becc; -fx-padding: 5 5 5 5;");
_hBox.getChildren().add(labelSpeed);
root.applyCss();
root.layout();
_labelSpeedValue = new Label("-");
_labelSpeedValue.setStyle("-fx-text-fill: #ffffff; -fx-padding: 5 5 5 0; -fx-font-weight: bold;");
_hBox.getChildren().add(_labelSpeedValue);
double flowPaneHeight = flowPane.getHeight();
double buttonCreateHeight = buttonCreate.getHeight();
double buttonCreateWidth = buttonCreate.getWidth();
double rootWidth = root.getWidth();
double rootHeight = root.getHeight();
double rootPadding = 10.0;
double distanceBetweenButtons = 5.0;
double buttonMoveSize = 30.0;
Label labelWeight = new Label("Weight:");
labelWeight.setStyle("-fx-text-fill: #b8becc; -fx-padding: 5 5 5 5;");
_hBox.getChildren().add(labelWeight);
canvas.setWidth(rootWidth);
flowPane.setPrefWidth(rootWidth);
canvas.setHeight(rootHeight - flowPaneHeight);
flowPane.setTranslateY(rootHeight - flowPaneHeight);
buttonCreateModif.setTranslateX(rootPadding + buttonCreateWidth + distanceBetweenButtons);
buttonCreate.setTranslateY(rootHeight - flowPaneHeight - buttonCreateHeight - rootPadding);
buttonCreateModif.setTranslateY(rootHeight - flowPaneHeight - buttonCreateHeight - rootPadding);
_labelWeightValue = new Label("-");
_labelWeightValue.setStyle("-fx-text-fill: #ffffff; -fx-padding: 5 5 5 0; -fx-font-weight: bold;");
_hBox.getChildren().add(_labelWeightValue);
buttonUp.setTranslateY(rootHeight - flowPaneHeight - buttonMoveSize * 2.0 - rootPadding -
distanceBetweenButtons);
buttonUp.setTranslateX(rootWidth - rootPadding - buttonMoveSize * 2.0 - distanceBetweenButtons);
Label labelHullColor = new Label("Color:");
labelHullColor.setStyle("-fx-text-fill: #b8becc; -fx-padding: 5 5 5 5;");
_hBox.getChildren().add(labelHullColor);
buttonDown.setTranslateY(rootHeight - flowPaneHeight - buttonMoveSize - rootPadding);
buttonDown.setTranslateX(rootWidth- rootPadding - buttonMoveSize * 2.0 - distanceBetweenButtons);
_labelBodyColorValue = new Label("-");
_labelBodyColorValue.setStyle("-fx-text-fill: #ffffff; -fx-padding: 5 5 5 0; -fx-font-weight: bold;");
_hBox.getChildren().add(_labelBodyColorValue);
buttonLeft.setTranslateY(rootHeight - flowPaneHeight - buttonMoveSize - rootPadding);
buttonLeft.setTranslateX(rootWidth - rootPadding - buttonMoveSize * 3.0 - distanceBetweenButtons * 2.0);
Label labelNumOars = new Label("Oars:");
labelNumOars.setStyle("-fx-text-fill: #b8becc; -fx-padding: 5 5 5 5;");
_hBox.getChildren().add(labelNumOars);
ObservableList<String> optionsForNumOars = FXCollections.observableArrayList("1", "2", "3");
_comboBoxNumOars = new ComboBox<>(optionsForNumOars);
_comboBoxNumOars.setValue("1");
_comboBoxNumOars.setOnAction(e -> {
if (_boat != null) {
_boat.GetDrawningOars().SetNumberOars(Integer.parseInt(_comboBoxNumOars.getValue()));
Draw();
}
});
_hBox.getChildren().add(_comboBoxNumOars);
buttonRight.setTranslateY(rootHeight - flowPaneHeight - buttonMoveSize - rootPadding);
buttonRight.setTranslateX(rootWidth - rootPadding - buttonMoveSize);
}
private void InitButtonCreate()
{
_buttonCreate = new Button("Create");
_buttonCreate.setTranslateX(_buttonMargin);
_root.getChildren().add(_buttonCreate);
_buttonCreate.setOnAction(e -> {
Random rnd = new Random();
_boat = new DrawningBoat();
_boat.Init(rnd.nextInt(200) + 100, rnd.nextInt(1000) + 1000,
Color.rgb(rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256)));
_boat.SetPosition(rnd.nextInt(90) + 10, rnd.nextInt(90)+50,
(int) _canvas.getWidth(), (int) _canvas.getHeight());
_boat.GetDrawningOars().SetNumberOars(Integer.parseInt(_comboBoxNumOars.getValue()));
_labelSpeedValue.setText(Integer.toString(_boat.GetBoat().GetSpeed()));
_labelWeightValue.setText(Double.toString(_boat.GetBoat().GetWeight()));
_labelBodyColorValue.setText(_boat.GetBoat().GetBodyColor().toString());
Draw();
});
}
private void InitMoveButtons()
{
Image img;
ImageView view;
// Button "Up"
_buttonUp = new Button();
img = new Image("arrowUp.png");
view = new ImageView(img);
view.setFitHeight(14);
view.setFitWidth(14);
_buttonUp.setGraphic(view);
_buttonUp.setPrefWidth(_buttonMoveWidth);
_buttonUp.setPrefHeight(_buttonMoveHeight);
_buttonUp.setOnAction(e -> {
if (_boat != null) {
_boat.MoveTransport(Direction.Up);
Draw();
}
});
_root.getChildren().add(_buttonUp);
// Button "Down"
_buttonDown = new Button();
img = new Image("arrowDown.png");
view = new ImageView(img);
view.setFitHeight(14);
view.setFitWidth(14);
_buttonDown.setGraphic(view);
_buttonDown.setPrefWidth(_buttonMoveWidth);
_buttonDown.setPrefHeight(_buttonMoveHeight);
_buttonDown.setOnAction(e -> {
if (_boat != null) {
_boat.MoveTransport(Direction.Down);
Draw();
}
});
_root.getChildren().add(_buttonDown);
// Button "Left"
_buttonLeft = new Button();
img = new Image("arrowLeft.png");
view = new ImageView(img);
view.setFitHeight(14);
view.setFitWidth(14);
_buttonLeft.setGraphic(view);
_buttonLeft.setPrefWidth(_buttonMoveWidth);
_buttonLeft.setPrefHeight(_buttonMoveHeight);
_buttonLeft.setOnAction(e -> {
if (_boat != null) {
_boat.MoveTransport(Direction.Left);
Draw();
}
});
_root.getChildren().add(_buttonLeft);
// Button "Right"
_buttonRight = new Button();
img = new Image("arrowRight.png");
view = new ImageView(img);
view.setFitHeight(14);
view.setFitWidth(14);
_buttonRight.setGraphic(view);
_buttonRight.setPrefWidth(_buttonMoveWidth);
_buttonRight.setPrefHeight(_buttonMoveHeight);
_buttonRight.setOnAction(e -> {
if (_boat != null) {
_boat.MoveTransport(Direction.Right);
Draw();
}
});
_root.getChildren().add(_buttonRight);
}
private void UpdateGUI()
{
double sceneWidth = _scene.getWidth();
double sceneHeight = _scene.getHeight();
_canvas.setWidth(sceneWidth);
_hBox.setPrefWidth(sceneWidth);
_canvas.setHeight(sceneHeight - _hBoxHeight);
_hBox.setTranslateY(sceneHeight - _hBoxHeight);
_buttonCreate.setTranslateY(sceneHeight - _hBoxHeight - _buttonCreateHeight - _buttonMargin);
_buttonUp.setTranslateY(sceneHeight - _hBoxHeight - _buttonMoveHeight * 2.0 - _buttonMargin -
_distanceBetweenMoveButtons);
_buttonUp.setTranslateX(sceneWidth - _buttonMargin - _buttonMoveWidth * 2.0 - _distanceBetweenMoveButtons);
_buttonDown.setTranslateY(sceneHeight - _hBoxHeight - _buttonMoveHeight - _buttonMargin);
_buttonDown.setTranslateX(sceneWidth- _buttonMargin - _buttonMoveWidth * 2.0 - _distanceBetweenMoveButtons);
_buttonLeft.setTranslateY(sceneHeight - _hBoxHeight - _buttonMoveHeight - _buttonMargin);
_buttonLeft.setTranslateX(sceneWidth - _buttonMargin - _buttonMoveWidth * 3.0 -
_distanceBetweenMoveButtons * 2.0);
_buttonRight.setTranslateY(sceneHeight - _hBoxHeight - _buttonMoveHeight - _buttonMargin);
_buttonRight.setTranslateX(sceneWidth - _buttonMargin - _buttonMoveWidth);
}
private void Draw()
{
GraphicsContext gc = _canvas.getGraphicsContext2D();
gc.clearRect(0.0, 0.0, _canvas.getWidth(), _canvas.getHeight());
gc.setFill(Color.WHITE);
gc.fillRect(0.0, 0.0, _canvas.getWidth(), _canvas.getHeight());
gc.setStroke(Color.BLACK);
gc.setLineWidth(4);
gc.strokeRect(0.0, 0.0, _canvas.getWidth(), _canvas.getHeight());
if (_boat != null)
{
_boat.DrawTransport(gc);
}
}
public static void main(String[] args)
{
launch();

View File

@ -0,0 +1,79 @@
package com.example.pibd22_kalyshev_y_v_motorboat_hard;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.canvas.Canvas;
import javafx.scene.control.Button;
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.Pane;
import javafx.stage.Stage;
import java.io.IOException;
public class FormMap extends Application
{
@Override
public void start(Stage stage) throws IOException
{
FXMLLoader fxmlLoader = new FXMLLoader(FormMap.class.getResource("form-map-view.fxml"));
Scene scene = new Scene(fxmlLoader.load(), 320, 240);
stage.setTitle("Map");
stage.setScene(scene);
FirstUpdateGUI(scene);
stage.show();
}
private void FirstUpdateGUI(Scene scene)
{
Pane root = (Pane)scene.lookup("#root");
Canvas canvas = (Canvas)scene.lookup("#canvas");
Button buttonCreate = (Button)scene.lookup("#buttonCreate");
Button buttonCreateModif = (Button)scene.lookup("#buttonCreateModif");
Button buttonUp = (Button)scene.lookup("#buttonUp");
Button buttonLeft = (Button)scene.lookup("#buttonLeft");
Button buttonRight = (Button)scene.lookup("#buttonRight");
Button buttonDown = (Button)scene.lookup("#buttonDown");
FlowPane flowPane = (FlowPane)scene.lookup("#flowPane");
root.applyCss();
root.layout();
double flowPaneHeight = flowPane.getHeight();
double buttonCreateHeight = buttonCreate.getHeight();
double buttonCreateWidth = buttonCreate.getWidth();
double rootWidth = root.getWidth();
double rootHeight = root.getHeight();
double rootPadding = 10.0;
double distanceBetweenButtons = 5.0;
double buttonMoveSize = 30.0;
canvas.setWidth(rootWidth);
flowPane.setPrefWidth(rootWidth);
canvas.setHeight(rootHeight - flowPaneHeight);
flowPane.setTranslateY(rootHeight - flowPaneHeight);
buttonCreateModif.setTranslateX(rootPadding + buttonCreateWidth + distanceBetweenButtons);
buttonCreate.setTranslateY(rootHeight - flowPaneHeight - buttonCreateHeight - rootPadding);
buttonCreateModif.setTranslateY(rootHeight - flowPaneHeight - buttonCreateHeight - rootPadding);
buttonUp.setTranslateY(rootHeight - flowPaneHeight - buttonMoveSize * 2.0 - rootPadding -
distanceBetweenButtons);
buttonUp.setTranslateX(rootWidth - rootPadding - buttonMoveSize * 2.0 - distanceBetweenButtons);
buttonDown.setTranslateY(rootHeight - flowPaneHeight - buttonMoveSize - rootPadding);
buttonDown.setTranslateX(rootWidth- rootPadding - buttonMoveSize * 2.0 - distanceBetweenButtons);
buttonLeft.setTranslateY(rootHeight - flowPaneHeight - buttonMoveSize - rootPadding);
buttonLeft.setTranslateX(rootWidth - rootPadding - buttonMoveSize * 3.0 - distanceBetweenButtons * 2.0);
buttonRight.setTranslateY(rootHeight - flowPaneHeight - buttonMoveSize - rootPadding);
buttonRight.setTranslateX(rootWidth - rootPadding - buttonMoveSize);
}
public static void main(String[] args)
{
launch();
}
}

View File

@ -0,0 +1,10 @@
package com.example.pibd22_kalyshev_y_v_motorboat_hard;
import javafx.scene.canvas.GraphicsContext;
public interface IDrawningAdditionalElement
{
public int deltaYdown = 0;
public void SetNumberOars(int numberOfRollers);
public void DrawOars(GraphicsContext gc, float startPosX, float startPosY);
}

View File

@ -0,0 +1,16 @@
package com.example.pibd22_kalyshev_y_v_motorboat_hard;
import javafx.scene.canvas.GraphicsContext;
public interface IDrawningObject
{
public float GetStep();
public void SetObject(int x, int y, int width, int height);
public void MoveObject(Direction direction);
public void DrawningObject(GraphicsContext gc);
public float[] GetCurrentPosition();
}

View File

@ -0,0 +1,42 @@
package com.example.pibd22_kalyshev_y_v_motorboat_hard;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.paint.Color;
public class SimpleMap extends AbstractMap
{
protected void DrawBarrierPart(GraphicsContext gc, int i, int j)
{
gc.setFill(Color.BLACK);
gc.fillRect(i * _size_x, j * _size_y, i * (_size_x + 1), j * (_size_y + 1));
}
protected void DrawRoadPart(GraphicsContext gc, int i, int j)
{
gc.setFill(Color.GRAY);
gc.fillRect(i * _size_x, j * _size_y, i * (_size_x + 1), j * (_size_y + 1));
}
protected void GenerateMap()
{
_map = new int[100][100];
_size_x = (float)_width / _map.length;
_size_y = (float)_height / _map[0].length;
int counter = 0;
for (int i = 0; i < _map.length; ++i)
{
for (int j = 0; j < _map[0].length; ++j)
{
_map[i][j] = _freeRoad;
}
}
while (counter < 50)
{
int x = _random.nextInt(0, 100);
int y = _random.nextInt(0, 100);
if (_map[x][y] == _freeRoad)
{
_map[x][y] = _barrier;
counter++;
}
}
}
}

View File

@ -0,0 +1,192 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.canvas.Canvas?>
<?import javafx.scene.layout.FlowPane?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.ComboBox?>
<?import javafx.collections.FXCollections?>
<?import java.lang.String?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.image.Image?>
<Pane xmlns:fx="http://javafx.com/fxml" fx:id="root" fx:controller="com.example.pibd22_kalyshev_y_v_motorboat_hard.ControllerBoat"
style="-fx-background-color: #31374c;">
<Canvas fx:id="canvas">
</Canvas>
<FlowPane fx:id="flowPane">
<Label style="-fx-text-fill: #b8becc; -fx-padding: 5 5 5 5;">
Speed:
</Label>
<Label fx:id="labelSpeedValue" style="-fx-text-fill: #ffffff; -fx-padding: 5 5 5 0; -fx-font-weight: bold;">
-
</Label>
<Label style="-fx-text-fill: #b8becc; -fx-padding: 5 5 5 5;">
Weight:
</Label>
<Label fx:id="labelWeightValue" style="-fx-text-fill: #ffffff; -fx-padding: 5 5 5 0; -fx-font-weight: bold;">
-
</Label>
<Label style="-fx-text-fill: #b8becc; -fx-padding: 5 5 5 5;">
Color:
</Label>
<Label fx:id="labelBodyColorValue" style="-fx-text-fill: #ffffff; -fx-padding: 5 5 5 0; -fx-font-weight: bold;">
-
</Label>
<Label style="-fx-text-fill: #b8becc; -fx-padding: 5 5 5 5;">
Rollers:
</Label>
<ComboBox fx:id="comboBoxNumOfRollers" value="5" onAction="#ComboBoxNumOfRollers_Changed">
<items>
<FXCollections fx:factory="observableArrayList">
<String fx:value="4"/>
<String fx:value="5"/>
<String fx:value="6"/>
</FXCollections>
</items>
</ComboBox>
<Label style="-fx-text-fill: #b8becc; -fx-padding: 5 5 5 5;">
Ornament:
</Label>
<ComboBox fx:id="comboBoxOrnamentType" value="None" onAction="#ComboBoxOrnamentType_Changed">
<items>
<FXCollections fx:factory="observableArrayList">
<String fx:value="None"/>
<String fx:value="Dots"/>
<String fx:value="Circles"/>
</FXCollections>
</items>
</ComboBox>
</FlowPane>
<Button fx:id="buttonCreate" onAction="#ButtonCreate_Click">
Create
</Button>
<Button fx:id="buttonCreateModif" onAction="#ButtonCreateModif_Click">
Modification
</Button>
<Button fx:id="buttonLeft" minWidth="30" minHeight="30" onAction="#ButtonMove_Click">
<graphic>
<ImageView fitHeight="14.0" fitWidth="14.0" pickOnBounds="true" preserveRatio="true">
<Image url="@/arrowLeft.png"/>
</ImageView>
</graphic>
</Button>
<Button fx:id="buttonRight" minWidth="30" minHeight="30" onAction="#ButtonMove_Click">
<graphic>
<ImageView fitHeight="14.0" fitWidth="14.0" pickOnBounds="true" preserveRatio="true">
<Image url="@/arrowRight.png"/>
</ImageView>
</graphic>
</Button>
<Button fx:id="buttonUp" minWidth="30" minHeight="30" onAction="#ButtonMove_Click">
<graphic>
<ImageView fitHeight="14.0" fitWidth="14.0" pickOnBounds="true" preserveRatio="true">
<Image url="@/arrowUp.png"/>
</ImageView>
</graphic>
</Button>
<Button fx:id="buttonDown" minWidth="30" minHeight="30" onAction="#ButtonMove_Click">
<graphic>
<ImageView fitHeight="14.0" fitWidth="14.0" pickOnBounds="true" preserveRatio="true">
<Image url="@/arrowDown.png"/>
</ImageView>
</graphic>
</Button>
</Pane>
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.canvas.Canvas?>
<?import javafx.scene.layout.FlowPane?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.ComboBox?>
<?import javafx.collections.FXCollections?>
<?import java.lang.String?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.image.Image?>
<Pane xmlns:fx="http://javafx.com/fxml" fx:id="root" fx:controller="com.example.pibd22_kalyshev_y_v_motorboat_hard.ControllerBoat"
style="-fx-background-color: #31374c;">
<Canvas fx:id="canvas">
</Canvas>
<FlowPane fx:id="flowPane">
<Label style="-fx-text-fill: #b8becc; -fx-padding: 5 5 5 5;">
Speed:
</Label>
<Label fx:id="labelSpeedValue" style="-fx-text-fill: #ffffff; -fx-padding: 5 5 5 0; -fx-font-weight: bold;">
-
</Label>
<Label style="-fx-text-fill: #b8becc; -fx-padding: 5 5 5 5;">
Weight:
</Label>
<Label fx:id="labelWeightValue" style="-fx-text-fill: #ffffff; -fx-padding: 5 5 5 0; -fx-font-weight: bold;">
-
</Label>
<Label style="-fx-text-fill: #b8becc; -fx-padding: 5 5 5 5;">
Color:
</Label>
<Label fx:id="labelBodyColorValue" style="-fx-text-fill: #ffffff; -fx-padding: 5 5 5 0; -fx-font-weight: bold;">
-
</Label>
<Label style="-fx-text-fill: #b8becc; -fx-padding: 5 5 5 5;">
Rollers:
</Label>
<ComboBox fx:id="comboBoxNumOfRollers" value="5" onAction="#ComboBoxNumOfRollers_Changed">
<items>
<FXCollections fx:factory="observableArrayList">
<String fx:value="4"/>
<String fx:value="5"/>
<String fx:value="6"/>
</FXCollections>
</items>
</ComboBox>
<Label style="-fx-text-fill: #b8becc; -fx-padding: 5 5 5 5;">
Ornament:
</Label>
<ComboBox fx:id="comboBoxOrnamentType" value="None" onAction="#ComboBoxOrnamentType_Changed">
<items>
<FXCollections fx:factory="observableArrayList">
<String fx:value="None"/>
<String fx:value="Dots"/>
<String fx:value="Circles"/>
</FXCollections>
</items>
</ComboBox>
</FlowPane>
<Button fx:id="buttonCreate" onAction="#ButtonCreate_Click">
Create
</Button>
<Button fx:id="buttonCreateModif" onAction="#ButtonCreateModif_Click">
Modification
</Button>
<Button fx:id="buttonLeft" minWidth="30" minHeight="30" onAction="#ButtonMove_Click">
<graphic>
<ImageView fitHeight="14.0" fitWidth="14.0" pickOnBounds="true" preserveRatio="true">
<Image url="@/arrowLeft.png"/>
</ImageView>
</graphic>
</Button>
<Button fx:id="buttonRight" minWidth="30" minHeight="30" onAction="#ButtonMove_Click">
<graphic>
<ImageView fitHeight="14.0" fitWidth="14.0" pickOnBounds="true" preserveRatio="true">
<Image url="@/arrowRight.png"/>
</ImageView>
</graphic>
</Button>
<Button fx:id="buttonUp" minWidth="30" minHeight="30" onAction="#ButtonMove_Click">
<graphic>
<ImageView fitHeight="14.0" fitWidth="14.0" pickOnBounds="true" preserveRatio="true">
<Image url="@/arrowUp.png"/>
</ImageView>
</graphic>
</Button>
<Button fx:id="buttonDown" minWidth="30" minHeight="30" onAction="#ButtonMove_Click">
<graphic>
<ImageView fitHeight="14.0" fitWidth="14.0" pickOnBounds="true" preserveRatio="true">
<Image url="@/arrowDown.png"/>
</ImageView>
</graphic>
</Button>
</Pane>

View File

@ -0,0 +1,104 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.canvas.Canvas?>
<?import javafx.scene.layout.FlowPane?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.ComboBox?>
<?import javafx.collections.FXCollections?>
<?import java.lang.String?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.image.Image?>
<Pane xmlns:fx="http://javafx.com/fxml" fx:id="root" fx:controller="com.example.pibd22_kalyshev_y_v_motorboat_hard.ControllerMap">
<Canvas fx:id="canvas">
</Canvas>
<FlowPane fx:id="flowPane" style="-fx-background-color: #31374c;">
<Label style="-fx-text-fill: #b8becc; -fx-padding: 5 5 5 5;">
Speed:
</Label>
<Label fx:id="labelSpeedValue" style="-fx-text-fill: #ffffff; -fx-padding: 5 5 5 0; -fx-font-weight: bold;">
-
</Label>
<Label style="-fx-text-fill: #b8becc; -fx-padding: 5 5 5 5;">
Weight:
</Label>
<Label fx:id="labelWeightValue" style="-fx-text-fill: #ffffff; -fx-padding: 5 5 5 0; -fx-font-weight: bold;">
-
</Label>
<Label style="-fx-text-fill: #b8becc; -fx-padding: 5 5 5 5;">
Color:
</Label>
<Label fx:id="labelBodyColorValue" style="-fx-text-fill: #ffffff; -fx-padding: 5 5 5 0; -fx-font-weight: bold;">
-
</Label>
<Label style="-fx-text-fill: #b8becc; -fx-padding: 5 5 5 5;">
Rollers:
</Label>
<ComboBox fx:id="comboBoxNumOfRollers" value="5">
<items>
<FXCollections fx:factory="observableArrayList">
<String fx:value="4"/>
<String fx:value="5"/>
<String fx:value="6"/>
</FXCollections>
</items>
</ComboBox>
<Label style="-fx-text-fill: #b8becc; -fx-padding: 5 5 5 5;">
Ornament:
</Label>
<ComboBox fx:id="comboBoxOrnamentType" value="None">
<items>
<FXCollections fx:factory="observableArrayList">
<String fx:value="None"/>
<String fx:value="Dots"/>
<String fx:value="Circles"/>
</FXCollections>
</items>
</ComboBox>
</FlowPane>
<ComboBox fx:id="comboBoxSelectorMap" value="Simple map" onAction="#ComboBoxSelectorMap_Changed">
<items>
<FXCollections fx:factory="observableArrayList">
<String fx:value="Simple map"/>
<String fx:value="Green map"/>
<String fx:value="Cross map"/>
</FXCollections>
</items>
</ComboBox>
<Button fx:id="buttonCreate" onAction="#ButtonCreate_Click">
Create
</Button>
<Button fx:id="buttonCreateModif" onAction="#ButtonCreateModif_Click">
Modification
</Button>
<Button fx:id="buttonLeft" minWidth="30" minHeight="30" onAction="#ButtonMove_Click">
<graphic>
<ImageView fitHeight="14.0" fitWidth="14.0" pickOnBounds="true" preserveRatio="true">
<Image url="@/arrowLeft.png"/>
</ImageView>
</graphic>
</Button>
<Button fx:id="buttonRight" minWidth="30" minHeight="30" onAction="#ButtonMove_Click">
<graphic>
<ImageView fitHeight="14.0" fitWidth="14.0" pickOnBounds="true" preserveRatio="true">
<Image url="@/arrowRight.png"/>
</ImageView>
</graphic>
</Button>
<Button fx:id="buttonUp" minWidth="30" minHeight="30" onAction="#ButtonMove_Click">
<graphic>
<ImageView fitHeight="14.0" fitWidth="14.0" pickOnBounds="true" preserveRatio="true">
<Image url="@/arrowUp.png"/>
</ImageView>
</graphic>
</Button>
<Button fx:id="buttonDown" minWidth="30" minHeight="30" onAction="#ButtonMove_Click">
<graphic>
<ImageView fitHeight="14.0" fitWidth="14.0" pickOnBounds="true" preserveRatio="true">
<Image url="@/arrowDown.png"/>
</ImageView>
</graphic>
</Button>
</Pane>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.layout.Pane?>
<Pane xmlns:fx="http://javafx.com/fxml" fx:id="root">
</Pane>

View File

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.control.Button?>
<VBox alignment="CENTER" spacing="20.0" xmlns:fx="http://javafx.com/fxml"
fx:controller="com.zyzf.pibd22_kalyshev_y_v_motorboat_hard.HelloController">
<padding>
<Insets bottom="20.0" left="20.0" right="20.0" top="20.0"/>
</padding>
<Label fx:id="welcomeText"/>
<Button text="Hello!" onAction="#onHelloButtonClick"/>
</VBox>