Перенос из 3 бд

This commit is contained in:
Mark Zaharchenko 2022-10-17 17:23:34 +04:00
parent 177e168498
commit 9ba224ac0d
11 changed files with 392 additions and 240 deletions

View File

@ -5,23 +5,31 @@ import javafx.collections.FXCollections;
import javafx.collections.ObservableList; import javafx.collections.ObservableList;
import javafx.event.ActionEvent; import javafx.event.ActionEvent;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.canvas.Canvas; import javafx.scene.canvas.Canvas;
import javafx.scene.canvas.GraphicsContext; import javafx.scene.canvas.GraphicsContext;
import javafx.scene.control.Button; import javafx.scene.control.*;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.Label;
import javafx.scene.layout.AnchorPane; import javafx.scene.layout.AnchorPane;
import javafx.scene.paint.Color; import javafx.scene.paint.Color;
import java.io.IOException;
import java.util.Optional;
import java.util.Random; import java.util.Random;
import static com.example.doubledeckerbus.ControllerMapWithSetBus._mapBusesCollectionGeneric;
public class ControllerBus { public class ControllerBus {
protected DrawingBus _bus; protected DrawingBus _bus;
public DrawingBus SelectedBus;
protected ObservableList<Integer> countOfDoors = FXCollections.observableArrayList(3, 4, 5); protected ObservableList<Integer> countOfDoors = FXCollections.observableArrayList(3, 4, 5);
@FXML @FXML
protected Button buttonCreate; protected Button buttonCreate;
@FXML
protected Button buttonSelectBus;
@FXML @FXML
protected Button buttonDown; protected Button buttonDown;
@ -89,13 +97,15 @@ public class ControllerBus {
public void initialize() { public void initialize() {
choiceDoors.setItems(countOfDoors); choiceDoors.setItems(countOfDoors);
choiceDoors.setValue(3); choiceDoors.setValue(3);
}
}
InvalidationListener listener = o -> BorderChanged(); InvalidationListener listener = o -> BorderChanged();
private void Draw() private void Draw()
{ {
GraphicsContext gc = canvasBus.getGraphicsContext2D(); GraphicsContext gc = canvasBus.getGraphicsContext2D();
gc.setFill(Color.WHITE);
gc.fillRect(0, 0, pictureBoxBus.getWidth(), pictureBoxBus.getHeight());
_bus.DrawTransport(gc); _bus.DrawTransport(gc);
} }
@ -111,6 +121,8 @@ public class ControllerBus {
pictureBoxBus.widthProperty().addListener(listener); pictureBoxBus.widthProperty().addListener(listener);
pictureBoxBus.heightProperty().addListener(listener); pictureBoxBus.heightProperty().addListener(listener);
Random rnd = new Random(); Random rnd = new Random();
ColorPicker colorPicker = new ColorPicker();
ObservableList<Color> a = colorPicker.getCustomColors();
_bus = new DrawingDDB(rnd.nextInt(300), rnd.nextInt(2000), _bus = new DrawingDDB(rnd.nextInt(300), rnd.nextInt(2000),
Color.rgb(rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256)), Color.rgb(rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256)),
choiceDoors.getValue(), choiceDoors.getValue(),
@ -119,4 +131,38 @@ public class ControllerBus {
SetData(); SetData();
BorderChanged(); BorderChanged();
} }
@FXML
private void ButtonSelectBus_Click(ActionEvent event) throws IOException {
SelectedBus = _bus;
if (SelectedBus == null) {
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("SelectBus");
alert.setContentText("Вы не создали объект");
Optional<ButtonType> option = alert.showAndWait();
}
else {
DrawingObjectBus bus = new DrawingObjectBus(SelectedBus);
if (_mapBusesCollectionGeneric.add(bus) != -1) {
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("SelectBus");
alert.setContentText("Вы создали объект");
Optional<ButtonType> option = alert.showAndWait();
} else {
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("SelectBus");
alert.setContentText("Не удалось добавить объект");
Optional<ButtonType> option = alert.showAndWait();
}
}
FXMLLoader fxmlLoader = new FXMLLoader(Form.class.getResource("FormMapWithSetBus.fxml"));
Scene scene = new Scene(fxmlLoader.load());
Form.myStage.setTitle("DoubleDeckerBus");
Form.myStage.setScene(scene);
Form.myStage.show();
}
} }

View File

@ -1,124 +0,0 @@
package com.example.doubledeckerbus;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
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.ChoiceBox;
import javafx.scene.control.Label;
import javafx.scene.layout.AnchorPane;
import javafx.scene.paint.Color;
import java.util.Random;
public class ControllerMap{
private AbstractMap _abstractMap;
protected ObservableList<Integer> countOfDoors = FXCollections.observableArrayList(3, 4, 5);
protected ObservableList<String> countOfMap = FXCollections.observableArrayList("Простая карта", "Водная карта");
@FXML
private ChoiceBox<String> choiceMap;
@FXML
protected Button buttonCreate;
@FXML
protected Button buttonDown;
@FXML
protected Button buttonLeft;
@FXML
protected Button buttonRight;
@FXML
protected Button buttonUp;
@FXML
protected Canvas canvasBus;
@FXML
protected AnchorPane pictureBoxBus;
@FXML
protected Label statusColor;
@FXML
protected Label statusSpeed;
@FXML
protected Label statusWeight;
@FXML
protected ChoiceBox<Integer> choiceDoors;
@FXML
void ButtonCreate_Click(ActionEvent event) {
BorderChanged();
Random rnd = new Random();
var bus = new DrawingBus(rnd.nextInt(100, 300), rnd.nextFloat(1000, 2000),
Color.rgb(rnd.nextInt(256), rnd.nextInt(0, 256), rnd.nextInt(0, 256)),
choiceDoors.getValue());
SetData(bus);
}
@FXML
public void initialize() {
choiceDoors.setItems(countOfDoors);
choiceDoors.setValue(countOfDoors.get(0));
choiceMap.setItems(countOfMap);
choiceMap.setValue(countOfMap.get(0));
_abstractMap = new SimpleMap();
}
@FXML
void ButtonCreateExtra_Click() {
canvasBus.setWidth(pictureBoxBus.getWidth());
canvasBus.setHeight(pictureBoxBus.getHeight());
Random rnd = new Random();
var bus = new DrawingDDB(rnd.nextInt(300), rnd.nextInt(2000),
Color.rgb(rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256)),
choiceDoors.getValue(),
Color.rgb(rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256)),
rnd.nextBoolean(), rnd.nextBoolean());
SetData(bus);
}
@FXML
void ButtonMove_Click(ActionEvent event) {
String name = ((Button) event.getSource()).getId();
Direction dir = Direction.None;
switch (name) {
case "buttonUp" -> dir = Direction.Up;
case "buttonDown" -> dir = Direction.Down;
case "buttonLeft" -> dir = Direction.Left;
case "buttonRight" -> dir = Direction.Right;
}
_abstractMap.MoveObject(dir);
}
private void BorderChanged() {
canvasBus.setWidth(pictureBoxBus.getWidth());
canvasBus.setHeight(pictureBoxBus.getHeight());
}
private void SetData(DrawingBus bus)
{
statusSpeed.setText("Скорость: %s".formatted(bus.Bus.Speed));
statusWeight.setText("Вес: %s".formatted(bus.Bus.Weight));
statusColor.setText("Цвет: %s".formatted(bus.Bus.BodyColor));
GraphicsContext gc = canvasBus.getGraphicsContext2D();
switch (choiceMap.getValue()) {
case "Простая карта" -> _abstractMap = new SimpleMap();
case "Водная карта" -> _abstractMap = new WaterMap();
}
_abstractMap.CreateMap((int) pictureBoxBus.getWidth(), (int) pictureBoxBus.getHeight(),
new DrawingObjectBus(bus), gc);
}
}

View File

@ -0,0 +1,179 @@
package com.example.doubledeckerbus;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.canvas.Canvas;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.control.*;
import javafx.scene.layout.AnchorPane;
import javafx.scene.paint.Color;
import java.io.IOException;
import java.util.Objects;
import java.util.Optional;
public class ControllerMapWithSetBus {
static MapWithSetBusesGeneric<DrawingObjectBus, AbstractMap> _mapBusesCollectionGeneric;
AbstractMap map = new SimpleMap();
static String map_name = "Простая карта";
protected ObservableList<String> countOfMap = FXCollections.observableArrayList("Простая карта", "Водная карта");
@FXML
private Button buttonAddBus;
@FXML
private Button buttonDown;
@FXML
private Button buttonLeft;
@FXML
private Button buttonRemoveCar;
@FXML
private Button buttonRight;
@FXML
private Button buttonShowMap;
@FXML
private Button buttonShowStorage;
@FXML
private Button buttonUp;
@FXML
private Canvas canvasBus;
@FXML
private ChoiceBox<String> comboBoxSelectorMap;
@FXML
private AnchorPane pictureBoxBus;
@FXML
private TextField textBoxPosition;
@FXML
private void initialize(){
comboBoxSelectorMap.setItems(countOfMap);
comboBoxSelectorMap.setValue(map_name);
}
GraphicsContext gc;
private void FirstIncome() {
if (_mapBusesCollectionGeneric == null) {
_mapBusesCollectionGeneric = new MapWithSetBusesGeneric<DrawingObjectBus, AbstractMap>(
(int) pictureBoxBus.getWidth(), (int) pictureBoxBus.getHeight(), map);
}
gc = canvasBus.getGraphicsContext2D();
if (comboBoxSelectorMap.getValue() != map_name) {
map_name = comboBoxSelectorMap.getValue();
switch (map_name) {
case "Простая карта" -> map = new SimpleMap();
case "Водная карта" -> map = new WaterMap();
}
_mapBusesCollectionGeneric.changeMap(map);
}
}
@FXML
private void ButtonAddBus_Click(ActionEvent event) throws IOException {
FXMLLoader fxmlLoader = new FXMLLoader(Form.class.getResource("FormBus.fxml"));
Scene scene = new Scene(fxmlLoader.load());
Form.myStage.setTitle("DoubleDeckerBus");
Form.myStage.setScene(scene);
Form.myStage.show();
FirstIncome();
}
@FXML
private void ButtonRemoveBus_Click(ActionEvent event)
{
FirstIncome();
if (Objects.equals(textBoxPosition.getText(), ""))
{
return;
}
Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
alert.setTitle("RemoveBus");
alert.setHeaderText("Вы действительно хотите удалить объект?");
Optional<ButtonType> option = alert.showAndWait();
if (option.get() == ButtonType.CANCEL) {
return;
}
int pos;
try {
pos = Integer.parseInt(textBoxPosition.getText());
}
catch (Exception e) {
return;
}
if (_mapBusesCollectionGeneric.remove(pos) != null)
{
alert = new Alert(Alert.AlertType.WARNING);
alert.setTitle("RemoveBus");
alert.setContentText("Вы удалили объект");
option = alert.showAndWait();
}
else
{
alert = new Alert(Alert.AlertType.WARNING);
alert.setTitle("RemoveBus");
alert.setContentText("Не удалось удалить объект");
option = alert.showAndWait();
}
}
@FXML
private void ButtonShowStorage_Click(ActionEvent event)
{
FirstIncome();
if (_mapBusesCollectionGeneric == null)
{
return;
}
gc.setFill(Color.WHITE);
gc.fillRect(0, 0, pictureBoxBus.getWidth(), pictureBoxBus.getHeight());
_mapBusesCollectionGeneric.ShowSet(gc);
}
@FXML
private void ButtonShowOnMap_Click(ActionEvent event) {
FirstIncome();
if (_mapBusesCollectionGeneric == null) {
return;
}
gc.setFill(Color.WHITE);
gc.fillRect(0, 0, pictureBoxBus.getWidth(), pictureBoxBus.getHeight());
_mapBusesCollectionGeneric.ShowOnMap(gc);
}
@FXML
private void ButtonMove_Click(ActionEvent event)
{
if (_mapBusesCollectionGeneric == null)
{
return;
}
String name = ((Button) event.getSource()).getId();
Direction dir = Direction.None;
switch (name) {
case "buttonUp" -> dir = Direction.Up;
case "buttonDown" -> dir = Direction.Down;
case "buttonLeft" -> dir = Direction.Left;
case "buttonRight" -> dir = Direction.Right;
}
_mapBusesCollectionGeneric.MoveObject(dir);
}
}

View File

@ -88,6 +88,7 @@ public class DrawingBus {
return; return;
} }
gc.setFill(Bus.BodyColor); gc.setFill(Bus.BodyColor);
gc.fillRect(_startPosX, _startPosY + 10, 100, 30); gc.fillRect(_startPosX, _startPosY + 10, 100, 30);

View File

@ -8,13 +8,16 @@ import javafx.stage.Stage;
import java.io.IOException; import java.io.IOException;
public class Form extends Application { public class Form extends Application {
static Stage myStage;
@Override @Override
public void start(Stage stage) throws IOException { public void start(Stage stage) throws IOException {
FXMLLoader fxmlLoader = new FXMLLoader(Form.class.getResource("FormMap.fxml")); FXMLLoader fxmlLoader = new FXMLLoader(Form.class.getResource("FormMapWithSetBus.fxml"));
Scene scene = new Scene(fxmlLoader.load()); Scene scene = new Scene(fxmlLoader.load());
stage.setTitle("DoubleDeckerBus"); myStage = stage;
stage.setScene(scene); myStage.setTitle("DoubleDeckerBus");
stage.show(); myStage.setScene(scene);
myStage.show();
} }
public static void main(String[] args) { public static void main(String[] args) {

View File

@ -11,7 +11,7 @@ public class MapWithSetBusesGeneric<T extends IDrawingObject, U extends Abstract
private final int _placeSizeWidth = 210; private final int _placeSizeWidth = 210;
private final int _placeSizeHeight = 90; private final int _placeSizeHeight = 90;
private final SetBusesGeneric<T> _setBuses; private final SetBusesGeneric<T> _setBuses;
private final U _map; private U _map;
public MapWithSetBusesGeneric(int picWidth, int picHeight, U map) public MapWithSetBusesGeneric(int picWidth, int picHeight, U map)
{ {
@ -23,14 +23,18 @@ public class MapWithSetBusesGeneric<T extends IDrawingObject, U extends Abstract
_map = map; _map = map;
} }
public boolean add(MapWithSetBusesGeneric<T, U> map, T bus) public void changeMap(U map) {
{ _map = map;
return map._setBuses.Insert(bus);
} }
public boolean remove(MapWithSetBusesGeneric<T, U> map, int position) public int add(T bus)
{ {
return map._setBuses.Remove(position); return _setBuses.Insert(bus);
}
public T remove(int position)
{
return _setBuses.Remove(position);
} }
public void ShowSet(GraphicsContext gc) public void ShowSet(GraphicsContext gc)
@ -100,12 +104,30 @@ public class MapWithSetBusesGeneric<T extends IDrawingObject, U extends Abstract
} }
} }
private void DrawBuses(GraphicsContext gc) private void DrawBuses(GraphicsContext gc) {
{ int width = _pictureWidth / _placeSizeWidth;
for (int i = 0; i < _setBuses.Count(); i++) int height = _pictureHeight / _placeSizeHeight;
{
// TODO установка позиции int currentWidth = width - 1;
int currentHeight = 0;
for (int i = 0; i < _setBuses.Count(); i++) {
if (_setBuses.Get(i) == null){
continue;
}
_setBuses.Get(i).SetObject(currentWidth * _placeSizeWidth,
currentHeight * _placeSizeHeight,
_pictureWidth, _pictureHeight);
_setBuses.Get(i).DrawingObject(gc); _setBuses.Get(i).DrawingObject(gc);
if (currentWidth > 0)
currentWidth--;
else {
currentWidth = width - 1;
currentHeight++;
}
if (currentHeight > height) return;
} }
} }
} }

View File

@ -6,39 +6,46 @@ import java.util.Objects;
class SetBusesGeneric<T> { class SetBusesGeneric<T> {
private Object[] _places; private Object[] _places;
private int BusyPlaces = 0;
public SetBusesGeneric(int count) { public SetBusesGeneric(int count) {
_places = new Object[count]; _places = new Object[count];
} }
public boolean Insert(T car) public int Insert(T bus)
{ {
// TODO вставка в начало набора return Insert(bus, 0);
return true;
} }
public boolean Insert(T bus, int position) public int Insert(T bus, int position)
{ {
// TODO проверка позиции if (position < 0 || position >= _places.length|| BusyPlaces == _places.length) return -1;
// TODO проверка, что элемент массива по этой позиции пустой, если нет, то
// проверка, что после вставляемого элемента в массиве есть пустой элемент BusyPlaces++;
// сдвиг всех объектов, находящихся справа от позиции до первого пустого элемента while (_places[position] != null) {
// TODO вставка по позиции for (int i = _places.length - 1; i > 0; --i) {
if (_places[i] == null && _places[i - 1] != null) {
_places[i] = _places[i - 1];
_places[i - 1] = null;
}
}
}
_places[position] = bus; _places[position] = bus;
return true; return position;
} }
public boolean Remove(int position) public T Remove(int position)
{ {
// TODO проверка позиции if (position < 0 || position >= _places.length) return null;
// TODO удаление объекта из массива, присовив элементу массива значение null T savedBus = (T)_places[position];
return true; _places[position] = null;
return savedBus;
} }
public T Get(int position) public T Get(int position)
{ {
// TODO проверка позиции if (position < 0 || position >= _places.length) return null;
return (T) _places[position]; return (T)_places[position];
} }
public int Count() { public int Count() {

View File

@ -18,7 +18,7 @@ public class SimpleMap extends AbstractMap{
} }
int counter = 0; int counter = 0;
while (counter < 50) while (counter < 20)
{ {
int x = _random.nextInt(0, 100); int x = _random.nextInt(0, 100);
int y = _random.nextInt(0, 100); int y = _random.nextInt(0, 100);

View File

@ -66,8 +66,9 @@
</image> </image>
</ImageView> </ImageView>
</graphic></Button> </graphic></Button>
<Button fx:id="buttonCreate" layoutY="455.0" mnemonicParsing="false" onAction="#ButtonCreate_Click" text="Создать" AnchorPane.bottomAnchor="14.0" AnchorPane.leftAnchor="0.0" /> <Button fx:id="buttonCreate" layoutX="6.0" layoutY="565.0" mnemonicParsing="false" onAction="#ButtonCreate_Click" text="Создать" AnchorPane.bottomAnchor="14.0" AnchorPane.leftAnchor="6.0" />
<Button fx:id="buttonCreateExtra" layoutX="82.0" layoutY="565.0" mnemonicParsing="false" onAction="#ButtonCreateExtra_Click" text="Продвинутый объект" /> <Button fx:id="buttonCreateExtra" layoutX="90.0" layoutY="565.0" mnemonicParsing="false" onAction="#ButtonCreateExtra_Click" text="Продвинутый объект" AnchorPane.bottomAnchor="14.0" AnchorPane.leftAnchor="90.0" />
<Button fx:id="buttonSelectBus" layoutX="840.0" layoutY="565.0" mnemonicParsing="false" onAction="#ButtonSelectBus_Click" text="Выбрать" AnchorPane.bottomAnchor="14.0" AnchorPane.rightAnchor="104.0" />
</children> </children>
</AnchorPane> </AnchorPane>
</children> </children>

View File

@ -1,78 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.canvas.Canvas?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ChoiceBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.RowConstraints?>
<GridPane alignment="CENTER" prefHeight="758.0" prefWidth="1166.0" xmlns="http://javafx.com/javafx/18" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.example.doubledeckerbus.ControllerMap">
<columnConstraints>
<ColumnConstraints hgrow="ALWAYS" minWidth="10.0" percentWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints fillHeight="false" maxHeight="1.7976931348623157E308" percentHeight="90.0" vgrow="ALWAYS" />
<RowConstraints fillHeight="false" maxHeight="-Infinity" minHeight="-Infinity" percentHeight="10.0" prefHeight="31.0" vgrow="NEVER" />
</rowConstraints>
<children>
<HBox alignment="CENTER_LEFT" prefHeight="57.0" prefWidth="777.0" spacing="20.0" GridPane.rowIndex="1">
<children>
<Label fx:id="statusSpeed" text="Скорость:" />
<Label fx:id="statusWeight" text="Вес:" />
<Label fx:id="statusColor" text="Цвет:" />
<Label text="Колл-во дверей:" />
<ChoiceBox fx:id="choiceDoors" prefHeight="24.0" prefWidth="58.0" />
</children>
</HBox>
<AnchorPane fx:id="pictureBoxBus" maxHeight="2000000.0" maxWidth="2000000.0" minHeight="0.0" minWidth="0.0" prefHeight="2000000.0" prefWidth="2000000.0">
<children>
<Canvas fx:id="canvasBus" layoutY="38.0" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="0.0" />
<Button fx:id="buttonLeft" layoutX="975.0" layoutY="427.0" mnemonicParsing="false" onAction="#ButtonMove_Click" prefHeight="0.0" prefWidth="0.0" AnchorPane.bottomAnchor="40.0" AnchorPane.rightAnchor="60.0">
<graphic>
<ImageView fitHeight="27.0" fitWidth="10.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@images/LeftArrow.png" />
</image>
</ImageView>
</graphic></Button>
<Button fx:id="buttonDown" layoutX="1005.0" layoutY="457.0" mnemonicParsing="false" onAction="#ButtonMove_Click" prefHeight="0.0" prefWidth="0.0" AnchorPane.bottomAnchor="10.0" AnchorPane.rightAnchor="30.0">
<graphic>
<ImageView fitHeight="27.0" fitWidth="10.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@images/DownArrow.png" />
</image>
</ImageView>
</graphic></Button>
<Button fx:id="buttonRight" layoutX="1035.0" layoutY="427.0" mnemonicParsing="false" onAction="#ButtonMove_Click" prefHeight="0.0" prefWidth="0.0" AnchorPane.bottomAnchor="40.0" AnchorPane.rightAnchor="0.0">
<graphic>
<ImageView fitHeight="27.0" fitWidth="10.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@images/RightArrow.png" />
</image>
</ImageView>
</graphic></Button>
<Button fx:id="buttonUp" layoutX="1005.0" layoutY="397.0" mnemonicParsing="false" onAction="#ButtonMove_Click" prefHeight="0.0" prefWidth="0.0" AnchorPane.bottomAnchor="70.0" AnchorPane.rightAnchor="30.0">
<graphic>
<ImageView fitHeight="27.0" fitWidth="10.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@images/UpArrow.png" />
</image>
</ImageView>
</graphic></Button>
<Button fx:id="buttonCreate" layoutY="455.0" mnemonicParsing="false" onAction="#ButtonCreate_Click" text="Создать" AnchorPane.bottomAnchor="14.0" AnchorPane.leftAnchor="0.0" />
<ChoiceBox fx:id="choiceMap" layoutY="2.0" prefWidth="150.0" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="2.0" />
<Button layoutX="82.0" layoutY="565.0" mnemonicParsing="false" onAction="#ButtonCreateExtra_Click" text="Продвинутый объект" AnchorPane.bottomAnchor="14.0" AnchorPane.leftAnchor="82.0" />
</children>
</AnchorPane>
</children>
<padding>
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
</padding>
</GridPane>

View File

@ -0,0 +1,95 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.Group?>
<?import javafx.scene.canvas.Canvas?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ChoiceBox?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.RowConstraints?>
<GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="463.0" prefWidth="779.0" xmlns="http://javafx.com/javafx/18" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.example.doubledeckerbus.ControllerMapWithSetBus">
<columnConstraints>
<ColumnConstraints hgrow="ALWAYS" maxWidth="463.0" minWidth="10.0" percentWidth="70.0" prefWidth="423.0" />
<ColumnConstraints hgrow="NEVER" maxWidth="294.0" minWidth="10.0" percentWidth="30.0" prefWidth="177.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<AnchorPane fx:id="pictureBoxBus" prefHeight="9.9999999E7" prefWidth="9.9999999E7">
<children>
<Canvas fx:id="canvasBus" height="463.0" width="537.0" />
</children>
</AnchorPane>
<Group GridPane.columnIndex="1" />
<GridPane GridPane.columnIndex="1">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" percentWidth="100.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="120.0" minHeight="0.0" prefHeight="34.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="200.0" minHeight="10.0" prefHeight="24.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="200.0" minHeight="8.0" prefHeight="27.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="269.0" minHeight="10.0" prefHeight="65.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="250.0" minHeight="0.0" prefHeight="44.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="272.0" minHeight="10.0" prefHeight="34.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="272.0" minHeight="0.0" prefHeight="46.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="272.0" minHeight="0.0" prefHeight="46.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="272.0" minHeight="10.0" prefHeight="134.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<ChoiceBox fx:id="comboBoxSelectorMap" prefHeight="50.0" prefWidth="9.9999999E7" />
<Button fx:id="buttonAddBus" mnemonicParsing="false" onAction="#ButtonAddBus_Click" prefHeight="50.0" prefWidth="9.999999999E9" text="Добавить автобус" GridPane.rowIndex="2" />
<TextField fx:id="textBoxPosition" GridPane.rowIndex="3" />
<Button fx:id="buttonRemoveCar" mnemonicParsing="false" onAction="#ButtonRemoveBus_Click" prefHeight="63.0" prefWidth="9.999999999E9" text="Удалить автобус" GridPane.rowIndex="4" />
<Button fx:id="buttonShowMap" mnemonicParsing="false" onAction="#ButtonShowOnMap_Click" prefHeight="63.0" prefWidth="9.99999999999E11" text="Посмотреть карту" GridPane.rowIndex="7" />
<AnchorPane prefHeight="157.0" prefWidth="332.0" GridPane.rowIndex="8">
<children>
<Button fx:id="buttonLeft" layoutX="38.0" layoutY="52.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" mnemonicParsing="false" onAction="#ButtonMove_Click" prefHeight="30.0" prefWidth="30.0" AnchorPane.bottomAnchor="52.0" AnchorPane.rightAnchor="111.0">
<graphic>
<ImageView fitHeight="27.0" fitWidth="10.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@images/LeftArrow.png" />
</image>
</ImageView>
</graphic>
</Button>
<Button fx:id="buttonDown" layoutX="68.0" layoutY="82.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" mnemonicParsing="false" onAction="#ButtonMove_Click" prefHeight="30.0" prefWidth="30.0" AnchorPane.bottomAnchor="22.0" AnchorPane.rightAnchor="81.0">
<graphic>
<ImageView fitHeight="27.0" fitWidth="10.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@images/DownArrow.png" />
</image>
</ImageView>
</graphic>
</Button>
<Button fx:id="buttonRight" layoutX="98.0" layoutY="52.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" mnemonicParsing="false" onAction="#ButtonMove_Click" prefHeight="30.0" prefWidth="30.0" AnchorPane.bottomAnchor="52.0" AnchorPane.rightAnchor="51.0">
<graphic>
<ImageView fitHeight="27.0" fitWidth="10.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@images/RightArrow.png" />
</image>
</ImageView>
</graphic>
</Button>
<Button fx:id="buttonUp" layoutX="68.0" layoutY="22.0" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" mnemonicParsing="false" onAction="#ButtonMove_Click" prefHeight="30.0" prefWidth="30.0" AnchorPane.bottomAnchor="82.0" AnchorPane.rightAnchor="81.0">
<graphic>
<ImageView fitHeight="27.0" fitWidth="10.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@images/UpArrow.png" />
</image>
</ImageView>
</graphic>
</Button>
</children>
</AnchorPane>
<Button fx:id="buttonShowStorage" mnemonicParsing="false" onAction="#ButtonShowStorage_Click" prefHeight="50.0" prefWidth="1.0E16" text="Посмотреть хранилище" GridPane.rowIndex="6" />
</children>
</GridPane>
</children>
</GridPane>