Compare commits
19 Commits
Author | SHA1 | Date | |
---|---|---|---|
8c1949ab34 | |||
6010e121cb | |||
4c17abdcf4 | |||
038c844c37 | |||
95d9690ca5 | |||
98fd4654f0 | |||
2596f35e5c | |||
1da5f03ecc | |||
651a9bec7a | |||
d393b5044b | |||
d50c303c9f | |||
f32a1dc88d | |||
ae0d45540d | |||
7268c2a28a | |||
1124261a4e | |||
dc94998fd9 | |||
b819188097 | |||
1dc3aac6cd | |||
312c88cd71 |
13
ProjectAirFighter/.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
13
ProjectAirFighter/.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
@ -0,0 +1,13 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="EnhancedSwitchMigration" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="myMaxNumberStatementsForBranch" value="1" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="SpellCheckingInspection" enabled="true" level="TYPO" enabled_by_default="true" editorAttributes="TYPO">
|
||||
<option name="processCode" value="true" />
|
||||
<option name="processLiterals" value="true" />
|
||||
<option name="processComments" value="false" />
|
||||
</inspection_tool>
|
||||
</profile>
|
||||
</component>
|
1
ProjectAirFighter/.idea/misc.xml
generated
1
ProjectAirFighter/.idea/misc.xml
generated
@ -1,4 +1,3 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="MavenProjectsManager">
|
||||
|
124
ProjectAirFighter/.idea/uiDesigner.xml
generated
Normal file
124
ProjectAirFighter/.idea/uiDesigner.xml
generated
Normal file
@ -0,0 +1,124 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||
<preferred-size width="-1" height="20" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
</project>
|
@ -4,7 +4,7 @@
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.example</groupId>
|
||||
<groupId>com.example.projectairfighter</groupId>
|
||||
<artifactId>ProjectAirFighter</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>ProjectAirFighter</name>
|
||||
|
@ -1,14 +0,0 @@
|
||||
package com.example.projectairfighter;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.Label;
|
||||
|
||||
public class HelloController {
|
||||
@FXML
|
||||
private Label welcomeText;
|
||||
|
||||
@FXML
|
||||
protected void onHelloButtonClick() {
|
||||
welcomeText.setText("Welcome to JavaFX Application!");
|
||||
}
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
package com.example.projectairfighter;
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class Main extends Application {
|
||||
@Override
|
||||
public void start(Stage stage) throws IOException {
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(Main.class.getResource("hello-view.fxml"));
|
||||
Scene scene = new Scene(fxmlLoader.load(), 320, 240);
|
||||
stage.setTitle("Hello!");
|
||||
stage.setScene(scene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
launch(args);
|
||||
}
|
||||
}
|
@ -0,0 +1,128 @@
|
||||
package com.projectairfighter;
|
||||
|
||||
import com.projectairfighter.drawnings.DirectionType;
|
||||
import com.projectairfighter.drawnings.DrawningWarPlane;
|
||||
import com.projectairfighter.movementstrategy.*;
|
||||
import javafx.application.Application;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Parent;
|
||||
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.input.KeyEvent;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
public class FormAirFighter extends Application implements Initializable {
|
||||
private AbstractStrategy strategy;
|
||||
private DrawningWarPlane drawningWarPlane;
|
||||
|
||||
// Окно отрисовки
|
||||
@FXML
|
||||
private Canvas canvasAirFighter;
|
||||
|
||||
@FXML
|
||||
private ComboBox<String> comboBoxStrategy;
|
||||
|
||||
@FXML
|
||||
private void buttonStrategy(){
|
||||
if (drawningWarPlane == null)
|
||||
return;
|
||||
if (!comboBoxStrategy.isDisabled()) {
|
||||
int selectedIndex = comboBoxStrategy.getSelectionModel().getSelectedIndex();
|
||||
switch (selectedIndex) {
|
||||
case 0:
|
||||
strategy = new MoveToCenter();
|
||||
break;
|
||||
case 1:
|
||||
strategy = new MoveToBorder();
|
||||
break;
|
||||
default:
|
||||
strategy = null;
|
||||
break;
|
||||
}
|
||||
if (strategy == null)
|
||||
return;
|
||||
strategy.setData(new MoveablePlane(drawningWarPlane), (int) canvasAirFighter.getWidth(), (int) canvasAirFighter.getHeight());
|
||||
}
|
||||
if (strategy == null)
|
||||
return;
|
||||
comboBoxStrategy.setDisable(true);
|
||||
strategy.makeStep();
|
||||
draw();
|
||||
if (strategy.getStatus() == StrategyStatus.Finish){
|
||||
comboBoxStrategy.setDisable(false);
|
||||
strategy = null;
|
||||
}
|
||||
}
|
||||
|
||||
// Нажатие кнопок двжиения мышкой
|
||||
@FXML
|
||||
private void moveAirFighterByMouse(ActionEvent event) {
|
||||
if (drawningWarPlane == null) return;
|
||||
Button btn = (Button) event.getSource();
|
||||
DirectionType direction = DirectionType.valueOf(btn.getId().toUpperCase());
|
||||
boolean result = drawningWarPlane.moveTransport(direction);
|
||||
if (result) draw();
|
||||
}
|
||||
|
||||
// Нажатие кнопок двжиения клавиатурой
|
||||
@FXML
|
||||
private void moveAirFighterByKey(KeyEvent event){
|
||||
if (drawningWarPlane == null) return;
|
||||
Button btn = (Button) event.getSource();
|
||||
DirectionType direction = DirectionType.valueOf(btn.getId().toUpperCase());
|
||||
boolean result = drawningWarPlane.moveTransport(direction);
|
||||
if (result) draw();
|
||||
}
|
||||
|
||||
// Функция отрисовки объекта
|
||||
private void draw() {
|
||||
if (drawningWarPlane == null) return;
|
||||
GraphicsContext gc = canvasAirFighter.getGraphicsContext2D();
|
||||
gc.clearRect(0, 0, canvasAirFighter.getWidth(), canvasAirFighter.getHeight());
|
||||
drawningWarPlane.drawTransport(gc);
|
||||
}
|
||||
|
||||
public void setWarPlane(DrawningWarPlane warPlane) {
|
||||
this.drawningWarPlane = warPlane;
|
||||
this.drawningWarPlane.setPictureSize((int) canvasAirFighter.getWidth(), (int) canvasAirFighter.getHeight());
|
||||
comboBoxStrategy.setDisable(false);
|
||||
strategy = null;
|
||||
draw();
|
||||
}
|
||||
|
||||
@FXML
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void start(Stage primaryStage) throws IOException {
|
||||
FXMLLoader loader = new FXMLLoader();
|
||||
loader.setLocation(FormAirFighter.class.getResource("FormAirFighter.fxml"));
|
||||
Parent root = loader.load();
|
||||
canvasAirFighter = (Canvas) loader.getNamespace().get("canvasAirFighter");
|
||||
comboBoxStrategy = (ComboBox<String>) loader.getNamespace().get("comboBoxStrategy");
|
||||
strategy = null;
|
||||
|
||||
Scene scene = new Scene(root, 800, 400);
|
||||
primaryStage.setTitle("Истребитель");
|
||||
primaryStage.setScene(scene);
|
||||
primaryStage.show();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle resourceBundle) {
|
||||
comboBoxStrategy.getItems().addAll("К центру", "К краю");
|
||||
}
|
||||
}
|
@ -0,0 +1,128 @@
|
||||
package com.projectairfighter;
|
||||
|
||||
import com.projectairfighter.collectiongenericobjects.Constructor;
|
||||
import com.projectairfighter.drawnings.*;
|
||||
import com.projectairfighter.entities.EntityAirFighter;
|
||||
import com.projectairfighter.entities.EntityWarPlane;
|
||||
import javafx.application.Application;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.canvas.Canvas;
|
||||
import javafx.scene.canvas.GraphicsContext;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Random;
|
||||
|
||||
public class FormConstructor extends Application {
|
||||
@FXML
|
||||
private Canvas canvas;
|
||||
|
||||
@FXML
|
||||
private Label labelInfoObject;
|
||||
|
||||
@FXML
|
||||
Label labelInfoEngines;
|
||||
|
||||
private DrawningWarPlane drawningWarPlane = null;
|
||||
|
||||
private Constructor<EntityWarPlane, IDrawableExtras> constructor;
|
||||
|
||||
@FXML
|
||||
private void generatePlane(ActionEvent event) {
|
||||
if (constructor == null) {
|
||||
constructor = createAirFighterDrawable();
|
||||
}
|
||||
|
||||
if (constructor == null) return;
|
||||
|
||||
labelInfoObject.setText(constructor.getPlaneInfo());
|
||||
labelInfoEngines.setText(constructor.getDrawingExtraInfo());
|
||||
|
||||
GraphicsContext gc = canvas.getGraphicsContext2D();
|
||||
gc.setFill(Color.rgb(244, 244, 244));
|
||||
gc.fillRect(0, 0, canvas.getWidth(), canvas.getHeight());
|
||||
|
||||
drawningWarPlane = constructor.createDrawing();
|
||||
drawningWarPlane.setPictureSize((int) canvas.getWidth(), (int) canvas.getHeight());
|
||||
drawningWarPlane.setPosition(70, 110);
|
||||
drawningWarPlane.drawTransport(canvas.getGraphicsContext2D());
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void buttonGoToForm(ActionEvent event) {
|
||||
FormWarPlaneCollection formWarPlaneCollection = FormWarPlaneCollection.getFormWarPlaneCollection();
|
||||
if (drawningWarPlane != null && formWarPlaneCollection != null) {
|
||||
formWarPlaneCollection.createObject(drawningWarPlane);
|
||||
}
|
||||
}
|
||||
|
||||
@FXML
|
||||
@Override
|
||||
public void start(Stage primaryStage) throws IOException {
|
||||
FXMLLoader loader = new FXMLLoader();
|
||||
loader.setLocation(FormAirFighter.class.getResource("FormConstructor.fxml"));
|
||||
Parent root = loader.load();
|
||||
canvas = (Canvas) loader.getNamespace().get("canvas");
|
||||
Scene scene = new Scene(root, 900, 500);
|
||||
primaryStage.setTitle("Информация о самолете");
|
||||
primaryStage.setScene(scene);
|
||||
primaryStage.show();
|
||||
}
|
||||
|
||||
private Constructor<EntityWarPlane, IDrawableExtras> createAirFighterDrawable() {
|
||||
Constructor<EntityWarPlane, IDrawableExtras> drawable = new Constructor<>();
|
||||
IDrawableExtras[] engineDrawings = {
|
||||
new EllipticalEngineDrawing(),
|
||||
new TriangleEngineDrawing(),
|
||||
new RectangleEngineDrawing()
|
||||
};
|
||||
|
||||
Random random = new Random();
|
||||
for (int i = 0; i < 3; i++) {
|
||||
EntityWarPlane plane = createRandomPlane();
|
||||
if (plane == null) return null;
|
||||
drawable.addAirFighter(plane);
|
||||
IDrawableExtras engineDrawing = engineDrawings[random.nextInt(engineDrawings.length)];
|
||||
engineDrawing.setCountEngines(random.nextInt(7));
|
||||
drawable.addDrawingEngines(engineDrawing);
|
||||
}
|
||||
|
||||
return drawable;
|
||||
}
|
||||
|
||||
|
||||
private EntityWarPlane createRandomPlane() {
|
||||
Random random = new Random();
|
||||
int randomPlane = random.nextInt(1, 3);
|
||||
|
||||
return switch (randomPlane) {
|
||||
case 1 -> new EntityWarPlane(random.nextInt(200) + 100,
|
||||
random.nextInt(2000) + 1000,
|
||||
getColor());
|
||||
case 2 -> new EntityAirFighter(
|
||||
random.nextInt(200) + 100,
|
||||
random.nextInt(2000) + 1000,
|
||||
getColor(),
|
||||
getColor(),
|
||||
random.nextBoolean(),
|
||||
random.nextBoolean());
|
||||
default -> null;
|
||||
};
|
||||
}
|
||||
|
||||
private Color getColor() {
|
||||
return Color.rgb((int) (Math.random() * 256),
|
||||
(int) (Math.random() * 256),
|
||||
(int) (Math.random() * 256));
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
launch(args);
|
||||
}
|
||||
}
|
@ -0,0 +1,260 @@
|
||||
package com.projectairfighter;
|
||||
|
||||
import com.projectairfighter.drawnings.*;
|
||||
import com.projectairfighter.entities.EntityAirFighter;
|
||||
import javafx.application.Application;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.canvas.Canvas;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.input.*;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
public class FormPlaneConfig extends Application implements Initializable {
|
||||
@FXML private Spinner<Integer> speed;
|
||||
@FXML private Spinner<Double> weight;
|
||||
@FXML private Spinner<Integer> countEngine;
|
||||
@FXML private CheckBox checkBoxRockets;
|
||||
@FXML private CheckBox checkBoxWings;
|
||||
@FXML private Canvas canvas;
|
||||
@FXML private Button buttonCancel;
|
||||
|
||||
private DrawningWarPlane plane;
|
||||
private IDrawableExtras engine = null;
|
||||
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle resourceBundle) {
|
||||
speed.setValueFactory(new SpinnerValueFactory.IntegerSpinnerValueFactory(50, 150, 0, 10));
|
||||
weight.setValueFactory(new SpinnerValueFactory.DoubleSpinnerValueFactory(50, 150, 0, 10));
|
||||
countEngine.setValueFactory(new SpinnerValueFactory.IntegerSpinnerValueFactory(2, 6, 0, 2));
|
||||
|
||||
speed.valueProperty().addListener((obs, oldVal, newVal) -> {
|
||||
if (plane != null) {
|
||||
plane.entityWarPlane.setSpeed(newVal);
|
||||
drawObject();
|
||||
}
|
||||
});
|
||||
|
||||
weight.valueProperty().addListener((obs, oldVal, newVal) -> {
|
||||
if (plane != null) {
|
||||
plane.entityWarPlane.setWeight(newVal);
|
||||
drawObject();
|
||||
}
|
||||
});
|
||||
|
||||
countEngine.valueProperty().addListener((obs, oldVal, newVal) -> {
|
||||
if (plane != null && plane.getEngineDrawing() != null) {
|
||||
canvas.getGraphicsContext2D().clearRect(0, 0, canvas.getWidth(), canvas.getHeight());
|
||||
plane.getEngineDrawing().setCountEngines(newVal);
|
||||
drawObject();
|
||||
}
|
||||
});
|
||||
|
||||
checkBoxRockets.selectedProperty().addListener((obs, wasSelected, isSelected) -> {
|
||||
if (plane instanceof DrawningAirFighter) {
|
||||
EntityAirFighter fighter = (EntityAirFighter) plane.entityWarPlane;
|
||||
fighter.setBodyRockets(isSelected);
|
||||
drawObject();
|
||||
}
|
||||
});
|
||||
|
||||
checkBoxWings.selectedProperty().addListener((obs, wasSelected, isSelected) -> {
|
||||
if (plane instanceof DrawningAirFighter) {
|
||||
EntityAirFighter fighter = (EntityAirFighter) plane.entityWarPlane;
|
||||
fighter.setAdditionalWings(isSelected);
|
||||
drawObject();
|
||||
}
|
||||
});
|
||||
|
||||
buttonCancel.setOnAction(event -> ((Stage) buttonCancel.getScene().getWindow()).close());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage stage) throws Exception {
|
||||
FXMLLoader loader = new FXMLLoader();
|
||||
loader.setLocation(FormAirFighter.class.getResource("FormPlaneConfig.fxml"));
|
||||
Parent root = loader.load();
|
||||
canvas = (Canvas) loader.getNamespace().get("canvas");
|
||||
Scene scene = new Scene(root, 799, 251);
|
||||
stage.setTitle("Создание объекта");
|
||||
stage.setScene(scene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void onDragOver(DragEvent event) {
|
||||
if (event.getGestureSource() != event.getSource() && event.getDragboard().hasContent(DataFormat.PLAIN_TEXT)) {
|
||||
event.acceptTransferModes(TransferMode.COPY);
|
||||
}
|
||||
event.consume();
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void onPanelDragDetected(MouseEvent event) {
|
||||
Label sourceLabel = (Label) event.getSource();
|
||||
Dragboard db = sourceLabel.startDragAndDrop(TransferMode.MOVE);
|
||||
|
||||
ClipboardContent content = new ClipboardContent();
|
||||
content.putString(sourceLabel.getText());
|
||||
db.setContent(content);
|
||||
event.consume();
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void onRegionDragDetected(MouseEvent event) {
|
||||
Label sourceLabel = (Label) event.getSource();
|
||||
Dragboard db = sourceLabel.startDragAndDrop(TransferMode.MOVE);
|
||||
|
||||
ClipboardContent content = new ClipboardContent();
|
||||
content.putString(sourceLabel.getText());
|
||||
db.setContent(content);
|
||||
event.consume();
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void onColorDragDetected(MouseEvent event) {
|
||||
Label source = (Label) event.getSource();
|
||||
Dragboard db = source.startDragAndDrop(TransferMode.COPY);
|
||||
|
||||
ClipboardContent content = new ClipboardContent();
|
||||
content.putString(source.getId());
|
||||
|
||||
db.setContent(content);
|
||||
event.consume();
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void onColorLabelDragDropped(DragEvent event) {
|
||||
if (plane == null) return;
|
||||
|
||||
Label target = (Label) event.getSource();
|
||||
Dragboard db = event.getDragboard();
|
||||
boolean success = false;
|
||||
|
||||
if (db.hasString()) {
|
||||
String colorId = db.getString();
|
||||
Color color = getColorFromId(colorId);
|
||||
|
||||
switch (target.getId()) {
|
||||
case "labelBodyColor":
|
||||
plane.entityWarPlane.setBodyColor(color);
|
||||
break;
|
||||
case "labelAdditionalColor":
|
||||
if (plane instanceof DrawningAirFighter) {
|
||||
EntityAirFighter fighter = (EntityAirFighter) plane.entityWarPlane;
|
||||
fighter.setAdditionalColor(color);
|
||||
drawObject();
|
||||
}
|
||||
}
|
||||
|
||||
drawObject();
|
||||
success = true;
|
||||
}
|
||||
|
||||
event.setDropCompleted(success);
|
||||
event.consume();
|
||||
}
|
||||
|
||||
private Color getColorFromId(String colorId) {
|
||||
return switch (colorId) {
|
||||
case "red" -> Color.RED;
|
||||
case "green" -> Color.GREEN;
|
||||
case "blue" -> Color.BLUE;
|
||||
case "yellow" -> Color.YELLOW;
|
||||
case "grey" -> Color.GREY;
|
||||
case "black" -> Color.BLACK;
|
||||
case "purple" -> Color.PURPLE;
|
||||
default -> Color.WHITE;
|
||||
};
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void onCanvasDragOver(DragEvent event) {
|
||||
if (event.getGestureSource() != event.getSource() &&
|
||||
event.getDragboard().hasString()) {
|
||||
event.acceptTransferModes(TransferMode.MOVE);
|
||||
}
|
||||
event.consume();
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void onCanvasPlaneDragDropped(DragEvent event) {
|
||||
Dragboard db = event.getDragboard();
|
||||
boolean success = false;
|
||||
|
||||
if (db.hasString()) {
|
||||
String droppedText = db.getString();
|
||||
switch (droppedText) {
|
||||
case "Простой":
|
||||
plane = new DrawningWarPlane(speed.getValue(), weight.getValue(), Color.WHITE);
|
||||
plane.getEngineDrawing().setCountEngines(countEngine.getValue());
|
||||
success = true;
|
||||
break;
|
||||
case "Продвинутый":
|
||||
plane = new DrawningAirFighter(speed.getValue(), weight.getValue(), Color.WHITE, Color.BLACK, checkBoxRockets.isSelected(), checkBoxWings.isSelected());
|
||||
plane.getEngineDrawing().setCountEngines(countEngine.getValue());
|
||||
success = true;
|
||||
break;
|
||||
case "Прямоугольная":
|
||||
engine = new RectangleEngineDrawing();
|
||||
engine.setCountEngines(countEngine.getValue());
|
||||
plane.setEngineDrawing(engine);
|
||||
engine.drawEngine(canvas.getGraphicsContext2D(), plane.entityWarPlane.getBodyColor(), 0, 0);
|
||||
success = true;
|
||||
break;
|
||||
case "Треугольная":
|
||||
engine = new TriangleEngineDrawing();
|
||||
engine.setCountEngines(countEngine.getValue());
|
||||
plane.setEngineDrawing(engine);
|
||||
engine.drawEngine(canvas.getGraphicsContext2D(), plane.entityWarPlane.getBodyColor(), 0, 0);
|
||||
success = true;
|
||||
break;
|
||||
case "Овальная":
|
||||
engine = new EllipticalEngineDrawing();
|
||||
engine.setCountEngines(countEngine.getValue());
|
||||
plane.setEngineDrawing(engine);
|
||||
engine.drawEngine(canvas.getGraphicsContext2D(), plane.entityWarPlane.getBodyColor(), 0, 0);
|
||||
success = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
drawObject();
|
||||
event.setDropCompleted(success);
|
||||
event.consume();
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void buttonAdd(ActionEvent event) {
|
||||
FormWarPlaneCollection formWarPlaneCollection = FormWarPlaneCollection.getFormWarPlaneCollection();
|
||||
if (plane != null && formWarPlaneCollection != null) {
|
||||
formWarPlaneCollection.createObject(plane);
|
||||
}
|
||||
|
||||
Node source = (Node) event.getSource();
|
||||
Stage stage = (Stage) source.getScene().getWindow();
|
||||
stage.close();
|
||||
}
|
||||
|
||||
private void drawObject() {
|
||||
canvas.getGraphicsContext2D().clearRect(0, 0, canvas.getWidth(), canvas.getHeight());
|
||||
plane.setPictureSize((int) canvas.getWidth(), (int) canvas.getHeight());
|
||||
plane.setPosition(0, 10);
|
||||
plane.drawTransport(canvas.getGraphicsContext2D());
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
launch(args);
|
||||
}
|
||||
}
|
@ -0,0 +1,304 @@
|
||||
package com.projectairfighter;
|
||||
|
||||
import com.projectairfighter.collectiongenericobjects.*;
|
||||
import com.projectairfighter.drawnings.DrawningWarPlane;
|
||||
import javafx.application.Application;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.canvas.Canvas;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.Random;
|
||||
import java.util.ResourceBundle;
|
||||
import java.util.Stack;
|
||||
|
||||
public class FormWarPlaneCollection extends Application implements Initializable {
|
||||
private StorageCollection<DrawningWarPlane> storageCollection;
|
||||
|
||||
private Stack<DrawningWarPlane> removedPlanesStack;
|
||||
|
||||
private AbstractCompany company;
|
||||
|
||||
// Окно отрисовки
|
||||
@FXML
|
||||
private Canvas canvasWarPlane;
|
||||
|
||||
@FXML
|
||||
private ComboBox<String> comboBox;
|
||||
|
||||
@FXML
|
||||
private TextField textBox;
|
||||
|
||||
@FXML
|
||||
private SplitPane splitPane;
|
||||
|
||||
@FXML
|
||||
private TextField textFieldCollectionName;
|
||||
|
||||
@FXML
|
||||
private RadioButton radioButtonMassive;
|
||||
|
||||
@FXML
|
||||
private RadioButton radioButtonList;
|
||||
|
||||
@FXML
|
||||
private ListView<String> listViewCollection;
|
||||
|
||||
private static FormWarPlaneCollection formWarPlaneCollection;
|
||||
|
||||
public static void setFormWarPlaneCollection(FormWarPlaneCollection controller) {
|
||||
formWarPlaneCollection = controller;
|
||||
}
|
||||
|
||||
public static FormWarPlaneCollection getFormWarPlaneCollection() {
|
||||
return formWarPlaneCollection;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize(URL location, ResourceBundle resources) {
|
||||
storageCollection = new StorageCollection<>();
|
||||
removedPlanesStack = new Stack<>();
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void comboBoxSelectorCompany(ActionEvent event) {
|
||||
splitPane.getItems().get(1).setDisable(true);
|
||||
}
|
||||
|
||||
public void createObject(DrawningWarPlane drawningAirFighter) {
|
||||
if (company == null) return;
|
||||
|
||||
int result = company.addPlane(drawningAirFighter);
|
||||
if (result != -1) {
|
||||
showAlert("Объект добавлен");
|
||||
company.show(canvasWarPlane);
|
||||
} else {
|
||||
showAlert("Не удалось создать");
|
||||
}
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void buttonRemovePlaneClicked(ActionEvent event) {
|
||||
String text = textBox.getText();
|
||||
if (text == null || text.isEmpty() || company == null) return;
|
||||
|
||||
Alert confirmationDialog = new Alert(Alert.AlertType.CONFIRMATION);
|
||||
confirmationDialog.setTitle("Удаление");
|
||||
confirmationDialog.setHeaderText("Удалить объект?");
|
||||
confirmationDialog.setContentText("Вы уверены, что хотите удалить объект?");
|
||||
|
||||
confirmationDialog.showAndWait().ifPresent(response -> {
|
||||
if (response == ButtonType.OK) {
|
||||
int pos = Integer.parseInt(text);
|
||||
DrawningWarPlane removedPlane = company.removePlane(pos);
|
||||
if (removedPlane != null) {
|
||||
removedPlanesStack.push(removedPlane);
|
||||
showAlert("Объект удален");
|
||||
company.show(canvasWarPlane);
|
||||
} else {
|
||||
showAlert("Не удалось удалить объект");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void buttonRefresh(ActionEvent event) {
|
||||
if (company == null) return;
|
||||
|
||||
company.show(canvasWarPlane);
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void buttonGoToCheck(ActionEvent event) {
|
||||
if (company == null) return;
|
||||
|
||||
DrawningWarPlane warPlane = null;
|
||||
int counter = 100;
|
||||
while (warPlane == null) {
|
||||
warPlane = company.getRandomPlane();
|
||||
counter--;
|
||||
if (counter <= 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (warPlane == null) return;
|
||||
|
||||
goToFormAirFighter(warPlane);
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void buttonGoFormConstructor(ActionEvent event) {
|
||||
if (company == null) return;
|
||||
|
||||
try {
|
||||
FXMLLoader loader = new FXMLLoader(getClass().getResource("FormConstructor.fxml"));
|
||||
Parent root = loader.load();
|
||||
FormConstructor controller = loader.getController();
|
||||
Stage stage = new Stage();
|
||||
stage.setScene(new Scene(root));
|
||||
controller.start(stage);
|
||||
FormWarPlaneCollection.setFormWarPlaneCollection(this);
|
||||
stage.show();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void buttonGoToFormWithDeleteObject(ActionEvent event){
|
||||
if (!removedPlanesStack.isEmpty()) {
|
||||
goToFormAirFighter(removedPlanesStack.pop());
|
||||
} else {
|
||||
showAlert("Стек удаленных объектов пуст.");
|
||||
}
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void buttonGoToFormCreate(ActionEvent event) {
|
||||
try {
|
||||
FXMLLoader loader = new FXMLLoader(getClass().getResource("FormPlaneConfig.fxml"));
|
||||
Parent root = loader.load();
|
||||
Stage stage = new Stage();
|
||||
stage.setScene(new Scene(root));
|
||||
FormWarPlaneCollection.setFormWarPlaneCollection(this);
|
||||
stage.showAndWait();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void goToFormAirFighter(DrawningWarPlane plane){
|
||||
try {
|
||||
FXMLLoader loader = new FXMLLoader(getClass().getResource("FormAirFighter.fxml"));
|
||||
Parent root = loader.load();
|
||||
FormAirFighter controller = loader.getController();
|
||||
controller.setWarPlane(plane);
|
||||
Stage stage = new Stage();
|
||||
stage.setScene(new Scene(root));
|
||||
stage.showAndWait();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@FXML
|
||||
void buttonCollectionAdd(ActionEvent event) {
|
||||
if (textFieldCollectionName.getText().isEmpty() || (!radioButtonList.isSelected() && !radioButtonMassive.isSelected())) {
|
||||
showError("Не все данные заполнены");
|
||||
return;
|
||||
}
|
||||
|
||||
CollectionType collectionType = CollectionType.None;
|
||||
if (radioButtonMassive.isSelected()) {
|
||||
collectionType = CollectionType.Massive;
|
||||
} else if (radioButtonList.isSelected()) {
|
||||
collectionType = CollectionType.List;
|
||||
}
|
||||
|
||||
storageCollection.addCollection(textFieldCollectionName.getText(), collectionType);
|
||||
refreshListBoxItems();
|
||||
}
|
||||
|
||||
@FXML
|
||||
void buttonCollectionDel(ActionEvent event) {
|
||||
if (listViewCollection.getSelectionModel().getSelectedIndex() < 0 || listViewCollection.getSelectionModel().getSelectedItem() == null) {
|
||||
showError("Коллекция не выбрана");
|
||||
return;
|
||||
}
|
||||
|
||||
Alert confirmDialog = new Alert(Alert.AlertType.CONFIRMATION);
|
||||
confirmDialog.setTitle("Удаление");
|
||||
confirmDialog.setHeaderText(null);
|
||||
confirmDialog.setContentText("Удалить коллекцию?");
|
||||
if (confirmDialog.showAndWait().orElse(ButtonType.CANCEL) != ButtonType.OK) {
|
||||
return;
|
||||
}
|
||||
|
||||
storageCollection.delCollection(listViewCollection.getSelectionModel().getSelectedItem());
|
||||
refreshListBoxItems();
|
||||
}
|
||||
|
||||
private void refreshListBoxItems() {
|
||||
listViewCollection.getItems().clear();
|
||||
for (String colName : storageCollection.Keys()) {
|
||||
if (colName != null && !colName.isEmpty()) {
|
||||
listViewCollection.getItems().add(colName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@FXML
|
||||
void buttonCreateCompany(ActionEvent event) {
|
||||
if (listViewCollection.getSelectionModel().getSelectedIndex() < 0 || listViewCollection.getSelectionModel().getSelectedItem() == null) {
|
||||
showAlert("Коллекция не выбрана");
|
||||
return;
|
||||
}
|
||||
|
||||
ICollectionGenericObjects<DrawningWarPlane> collection = storageCollection.get(listViewCollection.getSelectionModel().getSelectedItem());
|
||||
if (collection == null) {
|
||||
showAlert("Коллекция не проинициализирована");
|
||||
return;
|
||||
}
|
||||
|
||||
String selectedCompany = comboBox.getValue();
|
||||
|
||||
if (comboBox.getValue() == null) {
|
||||
showError("Не выбрано хранилище");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (selectedCompany) {
|
||||
case "Хранилище":
|
||||
company = new Hangar((int) canvasWarPlane.getWidth(), (int) canvasWarPlane.getHeight(), collection);
|
||||
break;
|
||||
}
|
||||
|
||||
splitPane.getItems().get(1).setDisable(false);
|
||||
refreshListBoxItems();
|
||||
}
|
||||
|
||||
private void showAlert(String message) {
|
||||
Alert alert = new Alert(Alert.AlertType.INFORMATION);
|
||||
alert.setTitle("Сообщение");
|
||||
alert.setHeaderText(null);
|
||||
alert.setContentText(message);
|
||||
alert.showAndWait();
|
||||
}
|
||||
|
||||
private void showError(String message) {
|
||||
Alert alert = new Alert(Alert.AlertType.INFORMATION);
|
||||
alert.setTitle("Ошибка");
|
||||
alert.setHeaderText(null);
|
||||
alert.setContentText(message);
|
||||
alert.showAndWait();
|
||||
}
|
||||
|
||||
@FXML
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void start(Stage primaryStage) throws IOException {
|
||||
FXMLLoader loader = new FXMLLoader();
|
||||
loader.setLocation(FormAirFighter.class.getResource("FormWarPlaneCollection.fxml"));
|
||||
Parent root = loader.load();
|
||||
canvasWarPlane = (Canvas) loader.getNamespace().get("canvasWarPlane");
|
||||
comboBox = (ComboBox<String>) loader.getNamespace().get("comboBox");
|
||||
comboBox.getItems().addAll("Хранилище");
|
||||
Scene scene = new Scene(root, 1292, 765);
|
||||
primaryStage.setTitle("Коллекция истребителей");
|
||||
primaryStage.setScene(scene);
|
||||
primaryStage.show();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
launch(args);
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
package com.projectairfighter.collectiongenericobjects;
|
||||
|
||||
import com.projectairfighter.drawnings.DrawningWarPlane;
|
||||
import javafx.scene.canvas.Canvas;
|
||||
import javafx.scene.canvas.GraphicsContext;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public abstract class AbstractCompany {
|
||||
protected final int placeSizeWidth = 210;
|
||||
protected final int placeSizeHeight = 150;
|
||||
|
||||
protected final int pictureWidth;
|
||||
protected final int pictureHeight;
|
||||
|
||||
protected ICollectionGenericObjects<DrawningWarPlane> collection = null;
|
||||
|
||||
private int getMaxCount() {
|
||||
return pictureWidth * pictureHeight / (placeSizeWidth * placeSizeHeight);
|
||||
}
|
||||
|
||||
public AbstractCompany(int picWidth, int picHeight, ICollectionGenericObjects<DrawningWarPlane> collection) {
|
||||
pictureWidth = picWidth;
|
||||
pictureHeight = picHeight;
|
||||
this.collection = collection;
|
||||
this.collection.setMaxCount(getMaxCount());
|
||||
}
|
||||
|
||||
public int addPlane(DrawningWarPlane plane) {
|
||||
if (collection == null) {
|
||||
return -1;
|
||||
}
|
||||
return collection.insert(plane);
|
||||
}
|
||||
|
||||
public DrawningWarPlane removePlane(int position) {
|
||||
return collection != null ? collection.remove(position) : null;
|
||||
}
|
||||
|
||||
public DrawningWarPlane getRandomPlane() {
|
||||
Random rnd = new Random();
|
||||
return collection != null ? collection.get(rnd.nextInt(getMaxCount())) : null;
|
||||
}
|
||||
|
||||
public void show(Canvas canvas) {
|
||||
GraphicsContext graphicsContext = canvas.getGraphicsContext2D();
|
||||
graphicsContext.clearRect(0, 0, canvas.getWidth(), canvas.getHeight());
|
||||
drawBackground(graphicsContext);
|
||||
|
||||
setObjectsPosition();
|
||||
for (int i = 0; i < (collection != null ? collection.getCount() : 0); i++) {
|
||||
DrawningWarPlane obj = collection.get(i);
|
||||
if (obj != null) obj.drawTransport(graphicsContext);
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void drawBackground(GraphicsContext gc);
|
||||
|
||||
protected abstract void setObjectsPosition();
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.projectairfighter.collectiongenericobjects;
|
||||
|
||||
public enum CollectionType {
|
||||
|
||||
/**
|
||||
Неопределно
|
||||
*/
|
||||
None,
|
||||
|
||||
/**
|
||||
Массив
|
||||
*/
|
||||
Massive,
|
||||
|
||||
/**
|
||||
Список
|
||||
*/
|
||||
List
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
package com.projectairfighter.collectiongenericobjects;
|
||||
|
||||
import com.projectairfighter.drawnings.DrawningAirFighter;
|
||||
import com.projectairfighter.drawnings.DrawningWarPlane;
|
||||
import com.projectairfighter.drawnings.IDrawableExtras;
|
||||
import com.projectairfighter.entities.EntityAirFighter;
|
||||
import com.projectairfighter.entities.EntityWarPlane;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class Constructor<T extends EntityWarPlane, U extends IDrawableExtras> {
|
||||
private final List<T> planes;
|
||||
private final List<U> drawingEngines;
|
||||
|
||||
public Constructor() {
|
||||
planes = new ArrayList<>();
|
||||
drawingEngines = new ArrayList<>();
|
||||
}
|
||||
|
||||
public void addAirFighter(T fighter) {
|
||||
planes.add(fighter);
|
||||
}
|
||||
|
||||
public void addDrawingEngines(U engine) {
|
||||
drawingEngines.add(engine);
|
||||
}
|
||||
|
||||
public DrawningWarPlane createDrawing() {
|
||||
Random rnd = new Random();
|
||||
int entityIndex = rnd.nextInt(0, 3);
|
||||
int engineCount = rnd.nextInt(0, 3);
|
||||
|
||||
T selectedPlane = planes.get(entityIndex);
|
||||
U selectedEngineCount = drawingEngines.get(engineCount);
|
||||
|
||||
return (selectedPlane instanceof EntityAirFighter) ?
|
||||
new DrawningAirFighter((EntityAirFighter) selectedPlane, selectedEngineCount) :
|
||||
new DrawningWarPlane(selectedPlane, selectedEngineCount);
|
||||
}
|
||||
|
||||
public String getPlaneInfo() {
|
||||
StringBuilder infoOfPlane = new StringBuilder();
|
||||
|
||||
for (T plane : planes) {
|
||||
if (plane instanceof EntityAirFighter entityAirFighter) {
|
||||
infoOfPlane.append("Истребитель:").append("\n");
|
||||
infoOfPlane.append("Скорость: ").append(plane.getStep()).append(",\n");
|
||||
infoOfPlane.append("Основной цвет: ").append(plane.getBodyColor()).append(",\n");
|
||||
infoOfPlane.append("Дополнительный цвет: ").append(entityAirFighter.getAdditionalColor()).append(",\n");
|
||||
infoOfPlane.append("Признак наличия ракет: ").append(entityAirFighter.hasBodyRockets()).append(",\n");
|
||||
infoOfPlane.append("Признак наличия дополнительных крыльев: ").append(entityAirFighter.hasAdditionalWings()).append("\n\n");
|
||||
} else {
|
||||
infoOfPlane.append("Военный самолет:").append("\n");
|
||||
infoOfPlane.append("Скорость: ").append(plane.getStep()).append(",\n");
|
||||
infoOfPlane.append("Основной цвет: ").append(plane.getBodyColor()).append(",\n\n");
|
||||
}
|
||||
}
|
||||
|
||||
return infoOfPlane.toString();
|
||||
}
|
||||
|
||||
public String getDrawingExtraInfo() {
|
||||
StringBuilder infoOfAdditionalElem = new StringBuilder();
|
||||
|
||||
infoOfAdditionalElem.append("Доп элементы:\n");
|
||||
for (U drawableExtra : drawingEngines) {
|
||||
infoOfAdditionalElem.append(drawableExtra.toString()).append("\n\n");
|
||||
}
|
||||
|
||||
return infoOfAdditionalElem.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package com.projectairfighter.collectiongenericobjects;
|
||||
|
||||
import com.projectairfighter.drawnings.DrawningWarPlane;
|
||||
import javafx.scene.canvas.GraphicsContext;
|
||||
import javafx.scene.paint.Color;
|
||||
|
||||
public class Hangar extends AbstractCompany {
|
||||
public Hangar(int picWidth, int picHeight, ICollectionGenericObjects<DrawningWarPlane> collection) {
|
||||
super(picWidth, picHeight, collection);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawBackground(GraphicsContext gc) {
|
||||
gc.setStroke(Color.BLACK);
|
||||
gc.setLineWidth(3);
|
||||
|
||||
int posX = 0;
|
||||
for (int i = 0; i < pictureWidth / placeSizeWidth; i++) {
|
||||
int posY = 0;
|
||||
gc.strokeLine(posX, posY, posX, posY + placeSizeHeight * (pictureHeight / placeSizeHeight));
|
||||
for (int j = 0; j <= pictureHeight / placeSizeHeight; j++) {
|
||||
gc.strokeLine(posX, posY, posX + placeSizeWidth - 30, posY);
|
||||
posY += placeSizeHeight;
|
||||
}
|
||||
posX += placeSizeWidth;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setObjectsPosition() {
|
||||
int counter = 0;
|
||||
int valPlaceY = pictureHeight / placeSizeHeight;
|
||||
int valPlaceX = pictureWidth / placeSizeWidth;
|
||||
for (int y = ((valPlaceY - 1) * placeSizeHeight) + 8; y >= 0; y -= placeSizeHeight) {
|
||||
for (int x = ((valPlaceX - 1) * placeSizeWidth) + 10; x >= 0; x -= placeSizeWidth) {
|
||||
DrawningWarPlane plane = collection != null ? collection.get(counter) : null;
|
||||
if (plane != null) {
|
||||
plane.setPictureSize(pictureWidth, pictureHeight);
|
||||
plane.setPosition(x, y);
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,47 @@
|
||||
package com.projectairfighter.collectiongenericobjects;
|
||||
|
||||
public interface ICollectionGenericObjects<T> {
|
||||
/**
|
||||
* Количество объектов в коллекции
|
||||
*/
|
||||
int getCount();
|
||||
|
||||
/**
|
||||
* Установка максимального количества элементов
|
||||
*/
|
||||
void setMaxCount(int maxCount);
|
||||
|
||||
/**
|
||||
* Добавление объекта в коллекцию
|
||||
*
|
||||
* @param obj Добавляемый объект
|
||||
* @return 1 - вставка прошла удачно, 0 - вставка не удалась
|
||||
*/
|
||||
int insert(T obj);
|
||||
|
||||
/**
|
||||
* Добавление объекта в коллекцию на конкретную позицию
|
||||
*
|
||||
* @param obj Добавляемый объект
|
||||
* @param position Позиция
|
||||
* @return 1 - вставка прошла удачно, 0 - вставка не удалась
|
||||
*/
|
||||
int insert(T obj, int position);
|
||||
|
||||
/**
|
||||
* Удаление объекта из коллекции с конкретной позиции
|
||||
*
|
||||
* @param position Позиция
|
||||
* @return Удаленный объект или null, если удаление не удалось
|
||||
*/
|
||||
T remove(int position);
|
||||
|
||||
/**
|
||||
* Получение объекта по позиции
|
||||
*
|
||||
* @param position Позиция
|
||||
* @return Объект или null, если объекта с такой позицией нет
|
||||
*/
|
||||
T get(int position);
|
||||
}
|
||||
|
@ -0,0 +1,63 @@
|
||||
package com.projectairfighter.collectiongenericobjects;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ListGenericObjects<T> implements ICollectionGenericObjects<T> {
|
||||
private final List<T> collection;
|
||||
private int maxCount;
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return collection.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMaxCount(int value) {
|
||||
if (value > 0) {
|
||||
maxCount = value;
|
||||
}
|
||||
}
|
||||
|
||||
public ListGenericObjects() {
|
||||
collection = new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public T get(int position) {
|
||||
if (position >= 0 && position < getCount()) {
|
||||
return collection.get(position);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insert(T obj) {
|
||||
if (getCount() == maxCount) {
|
||||
return -1;
|
||||
}
|
||||
collection.add(obj);
|
||||
return getCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insert(T obj, int position) {
|
||||
if (position < 0 || position >= getCount() || getCount() == maxCount) {
|
||||
return -1;
|
||||
}
|
||||
collection.add(position, obj);
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T remove(int position) {
|
||||
if (position >= getCount() || position < 0) {
|
||||
return null;
|
||||
}
|
||||
T obj = collection.get(position);
|
||||
collection.remove(position);
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,78 @@
|
||||
package com.projectairfighter.collectiongenericobjects;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class MassiveGenericObjects<T> implements ICollectionGenericObjects<T> {
|
||||
private T[] collection;
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return collection.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void setMaxCount(int value) {
|
||||
if (value > 0) {
|
||||
if (collection.length > 0) {
|
||||
collection = Arrays.copyOf(collection, value);
|
||||
} else {
|
||||
collection = (T[]) new Object[value];
|
||||
}
|
||||
}
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
public MassiveGenericObjects() {
|
||||
collection = (T[]) new Object[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public T get(int position) {
|
||||
if (position >= 0 && position < getCount()) {
|
||||
return collection[position];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insert(T obj) {
|
||||
return insert(obj, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insert(T obj, int position) {
|
||||
if (position < 0 || position >= getCount()) {
|
||||
return -1;
|
||||
}
|
||||
if (collection[position] == null) {
|
||||
collection[position] = obj;
|
||||
return position;
|
||||
}
|
||||
|
||||
for (int i = position + 1; i < getCount(); i++) {
|
||||
if (collection[i] == null) {
|
||||
collection[i] = obj;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
for (int i = position - 1; i >= 0; i--) {
|
||||
if (collection[i] == null) {
|
||||
collection[i] = obj;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T remove(int position) {
|
||||
if (position < 0 || position >= getCount()) {
|
||||
return null;
|
||||
}
|
||||
T obj = collection[position];
|
||||
collection[position] = null;
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,89 @@
|
||||
package com.projectairfighter.collectiongenericobjects;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Класс-хранилище коллекций.
|
||||
*
|
||||
* @param <T> Тип элементов коллекций.
|
||||
*/
|
||||
public class StorageCollection<T> {
|
||||
/**
|
||||
* Словарь (хранилище) с коллекциями.
|
||||
*/
|
||||
private final Map<String, ICollectionGenericObjects<T>> storages;
|
||||
|
||||
/**
|
||||
* Возвращение списка названий коллекций.
|
||||
*
|
||||
* @return Список названий коллекций.
|
||||
*/
|
||||
public List<String> Keys() {
|
||||
return new ArrayList<>(storages.keySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Конструктор.
|
||||
*/
|
||||
public StorageCollection() {
|
||||
storages = new HashMap<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Добавление коллекции в хранилище.
|
||||
*
|
||||
* @param name Название коллекции.
|
||||
* @param collectionType Тип коллекции.
|
||||
*/
|
||||
public void addCollection(String name, CollectionType collectionType) {
|
||||
if (name == null || storages.containsKey(name)) {
|
||||
return;
|
||||
}
|
||||
switch (collectionType) {
|
||||
case None:
|
||||
return;
|
||||
case Massive:
|
||||
storages.put(name, new MassiveGenericObjects<>());
|
||||
return;
|
||||
case List:
|
||||
storages.put(name, new ListGenericObjects<>());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Удаление коллекции из хранилища.
|
||||
*
|
||||
* @param name Название коллекции.
|
||||
*/
|
||||
public void delCollection(String name) {
|
||||
if (name == null || !storages.containsKey(name)) {
|
||||
return;
|
||||
}
|
||||
storages.remove(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Доступ к коллекции по её названию.
|
||||
*
|
||||
* @param name Название коллекции.
|
||||
* @return Коллекция или null, если коллекция с данным названием отсутствует.
|
||||
*/
|
||||
public ICollectionGenericObjects<T> get(String name) {
|
||||
if (name == null || !storages.containsKey(name)) {
|
||||
return null;
|
||||
}
|
||||
return storages.get(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Доступ к элементу коллекции по названию коллекции и индексу элемента.
|
||||
*
|
||||
* @param name Название коллекции.
|
||||
* @param index Индекс элемента в коллекции.
|
||||
* @return Элемент коллекции или null, если коллекция с данным названием отсутствует или индекс некорректен.
|
||||
*/
|
||||
public T getElement(String name, int index) {
|
||||
return this.get(name).get(index);
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package com.projectairfighter.drawnings;
|
||||
|
||||
public enum DirectionType {
|
||||
UNKNOWN,
|
||||
// Вверх
|
||||
UP,
|
||||
// Вниз
|
||||
DOWN,
|
||||
// Влево
|
||||
LEFT,
|
||||
// Вправо
|
||||
RIGHT
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package com.projectairfighter.drawnings;
|
||||
|
||||
import com.projectairfighter.entities.EntityAirFighter;
|
||||
import javafx.scene.canvas.GraphicsContext;
|
||||
import javafx.scene.paint.Color;
|
||||
|
||||
public class DrawningAirFighter extends DrawningWarPlane {
|
||||
public DrawningAirFighter(int speed, double weight, Color bodyColor, Color
|
||||
additionalColor, boolean bodyRockets, boolean additionalWings) {
|
||||
super(speed, weight, bodyColor);
|
||||
entityWarPlane = new EntityAirFighter(speed, weight, bodyColor, additionalColor, bodyRockets, additionalWings);
|
||||
}
|
||||
|
||||
public DrawningAirFighter(EntityAirFighter entityAirFighter, IDrawableExtras engineDrawing){
|
||||
super(entityAirFighter, engineDrawing);
|
||||
}
|
||||
|
||||
// Прорисовка объекта
|
||||
@Override
|
||||
public void drawTransport(GraphicsContext gc) {
|
||||
if (entityWarPlane == null || !(entityWarPlane instanceof EntityAirFighter entityAirFighter) || getPosX() == null || getPosY() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
gc.setStroke(entityAirFighter.getAdditionalColor());
|
||||
|
||||
if (entityAirFighter.hasBodyRockets()) {
|
||||
gc.setFill(entityAirFighter.getAdditionalColor());
|
||||
gc.setStroke(entityAirFighter.getAdditionalColor());
|
||||
|
||||
double rocketWidth = 6;
|
||||
double rocketLength = 15;
|
||||
|
||||
double[] rocketsX = {getPosX() + 100, getPosX() + 100};
|
||||
|
||||
for (double rocketPos : rocketsX) {
|
||||
gc.fillRect(rocketPos, getPosY() + 13 - (rocketWidth / 2), rocketLength, rocketWidth);
|
||||
gc.fillRect(rocketPos, getPosY() + 120 - (rocketWidth / 2), rocketLength, rocketWidth);
|
||||
}
|
||||
}
|
||||
|
||||
if (entityAirFighter.hasAdditionalWings()) {
|
||||
gc.setStroke(entityAirFighter.getAdditionalColor());
|
||||
double[] additionalWingTopX = {getPosX() + 40, getPosX() + 50, getPosX() + 60};
|
||||
double[] additionalWingTopY = {getPosY() + 53, getPosY() + 38, getPosY() + 53};
|
||||
double[] additionalWingBottomX = {getPosX() + 40, getPosX() + 50, getPosX() + 60};
|
||||
double[] additionalWingBottomY = {getPosY() + 80, getPosY() + 95, getPosY() + 80};
|
||||
|
||||
gc.strokePolygon(additionalWingTopX, additionalWingTopY, 3);
|
||||
gc.strokePolygon(additionalWingBottomX, additionalWingBottomY, 3);
|
||||
}
|
||||
super.drawTransport(gc);
|
||||
}
|
||||
}
|
@ -0,0 +1,169 @@
|
||||
package com.projectairfighter.drawnings;
|
||||
|
||||
import com.projectairfighter.entities.EntityWarPlane;
|
||||
import javafx.scene.canvas.GraphicsContext;
|
||||
import javafx.scene.paint.Color;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class DrawningWarPlane {
|
||||
// Сущность
|
||||
public EntityWarPlane entityWarPlane;
|
||||
|
||||
// Ширина и высота окна
|
||||
private Integer pictureWidth = 0;
|
||||
private Integer pictureHeight = 0;
|
||||
|
||||
// Начальные координаты прорисовки истребителя
|
||||
private Integer startPosX = null;
|
||||
private Integer startPosY = null;
|
||||
|
||||
private final int drawningAirFighterWidth = 157;
|
||||
private final int drawningAirFighterHeight = 140;
|
||||
|
||||
private IDrawableExtras engineDrawing;
|
||||
public Integer getPosX(){
|
||||
return startPosX;
|
||||
}
|
||||
public Integer getPosY(){
|
||||
return startPosY;
|
||||
}
|
||||
|
||||
public IDrawableExtras getEngineDrawing() {
|
||||
return engineDrawing;
|
||||
}
|
||||
|
||||
public int getWidth(){
|
||||
return drawningAirFighterWidth;
|
||||
}
|
||||
public int getHeight(){
|
||||
return drawningAirFighterHeight;
|
||||
}
|
||||
public void setEngineDrawing(IDrawableExtras engineDrawing) {
|
||||
this.engineDrawing = engineDrawing;
|
||||
}
|
||||
|
||||
protected DrawningWarPlane() {
|
||||
pictureWidth = 0;
|
||||
pictureHeight = 0;
|
||||
startPosX = null;
|
||||
startPosY = null;
|
||||
}
|
||||
|
||||
public DrawningWarPlane(int speed, double weight, Color bodyColor) {
|
||||
entityWarPlane = new EntityWarPlane(speed, weight, bodyColor);
|
||||
IDrawableExtras[] engineDrawings = {
|
||||
new EllipticalEngineDrawing(),
|
||||
new TriangleEngineDrawing(),
|
||||
new RectangleEngineDrawing()
|
||||
};
|
||||
|
||||
Random random = new Random();
|
||||
engineDrawing = engineDrawings[random.nextInt(engineDrawings.length)];
|
||||
engineDrawing.setCountEngines(random.nextInt(7));
|
||||
}
|
||||
|
||||
public DrawningWarPlane(EntityWarPlane entityWarPlane, IDrawableExtras engineDrawing){
|
||||
this.entityWarPlane = entityWarPlane;
|
||||
this.engineDrawing = engineDrawing;
|
||||
}
|
||||
|
||||
public boolean setPictureSize(int width, int height) {
|
||||
if (width <= drawningAirFighterWidth || height <= drawningAirFighterHeight) return false;
|
||||
pictureWidth = width;
|
||||
pictureHeight = height;
|
||||
if (startPosX != null && startPosY != null) {
|
||||
if (startPosX + drawningAirFighterWidth > pictureWidth) {
|
||||
startPosX = pictureWidth - drawningAirFighterWidth;
|
||||
}
|
||||
if (startPosY + drawningAirFighterHeight > pictureHeight) {
|
||||
startPosY = pictureHeight - drawningAirFighterHeight;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setPosition(int x, int y) {
|
||||
if (pictureHeight == null || pictureWidth == null) return;
|
||||
|
||||
startPosX = x;
|
||||
startPosY = y;
|
||||
|
||||
if (drawningAirFighterHeight + y > pictureHeight || y < 0) {
|
||||
startPosY = 0;
|
||||
}
|
||||
if (drawningAirFighterWidth + x > pictureWidth || x < 0) {
|
||||
startPosX = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean moveTransport(DirectionType direction) {
|
||||
if (entityWarPlane == null || startPosX == null || startPosY == null) return false;
|
||||
|
||||
return switch (direction) {
|
||||
case LEFT -> {
|
||||
if (startPosX - entityWarPlane.getStep() > 0) {
|
||||
startPosX -= (int) entityWarPlane.getStep();
|
||||
}
|
||||
yield true;
|
||||
}
|
||||
case UP -> {
|
||||
if (startPosY - entityWarPlane.getStep() > 0) {
|
||||
startPosY -= (int) entityWarPlane.getStep();
|
||||
}
|
||||
yield true;
|
||||
}
|
||||
case RIGHT -> {
|
||||
if (startPosX + drawningAirFighterWidth + entityWarPlane.getStep() < pictureWidth) {
|
||||
startPosX += (int) entityWarPlane.getStep();
|
||||
}
|
||||
yield true;
|
||||
}
|
||||
case DOWN -> {
|
||||
if (startPosY + drawningAirFighterHeight + entityWarPlane.getStep() < pictureHeight) {
|
||||
startPosY += (int) entityWarPlane.getStep();
|
||||
}
|
||||
yield true;
|
||||
}
|
||||
default -> false;
|
||||
};
|
||||
}
|
||||
|
||||
public void drawTransport(GraphicsContext gc) {
|
||||
if (entityWarPlane == null || startPosX == null || startPosY == null) return;
|
||||
|
||||
if (pictureWidth == 0 || pictureHeight == 0) return;
|
||||
|
||||
engineDrawing.drawEngine(gc, entityWarPlane.getBodyColor(), getPosX(), getPosY());
|
||||
|
||||
gc.setFill(entityWarPlane.getBodyColor());
|
||||
gc.setStroke(entityWarPlane.getBodyColor());
|
||||
|
||||
// Прорисовка тела истребителя
|
||||
gc.strokeRect(startPosX + 10, startPosY + 53, 130, 26);
|
||||
|
||||
// Прорисовка носа
|
||||
gc.fillPolygon(
|
||||
new double[]{startPosX + 140, startPosX + 165, startPosX + 140},
|
||||
new double[]{startPosY + 53, startPosY + 66, startPosY + 79},
|
||||
3
|
||||
);
|
||||
|
||||
// Прорисовка верхней части хвоста
|
||||
gc.strokePolygon(new double[]{startPosX + 10, startPosX + 10, startPosX + 30, startPosX + 30},
|
||||
new double[]{startPosY + 23, startPosY + 53, startPosY + 53, startPosY + 38}, 4);
|
||||
|
||||
// Прорисовка нижней части хвоста
|
||||
gc.strokePolygon(new double[]{startPosX + 10, startPosX + 10, startPosX + 30, startPosX + 30},
|
||||
new double[]{startPosY + 79, startPosY + 109, startPosY + 94, startPosY + 79}, 4);
|
||||
|
||||
// Прорисовка верхнего крыла
|
||||
gc.strokePolygon(new double[]{startPosX + 100, startPosX + 100, startPosX + 70, startPosX + 85},
|
||||
new double[]{startPosY, startPosY + 53, startPosY + 53, startPosY}, 4);
|
||||
|
||||
// Прорисовка нижнего крыла
|
||||
gc.strokePolygon(new double[]{startPosX + 100, startPosX + 100, startPosX + 85, startPosX + 70},
|
||||
new double[]{startPosY + 79, startPosY + 133, startPosY + 133, startPosY + 79}, 4);
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
package com.projectairfighter.drawnings;
|
||||
|
||||
import javafx.scene.canvas.GraphicsContext;
|
||||
import javafx.scene.paint.Color;
|
||||
|
||||
public class EllipticalEngineDrawing implements IDrawableExtras {
|
||||
private EngineCount engineCount;
|
||||
|
||||
@Override
|
||||
public void setCountEngines(int countEngines) {
|
||||
switch (countEngines) {
|
||||
case 4:
|
||||
engineCount = EngineCount.FOUR;
|
||||
break;
|
||||
case 6:
|
||||
engineCount = EngineCount.SIX;
|
||||
break;
|
||||
default:
|
||||
engineCount = EngineCount.TWO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawEngine(GraphicsContext gc, Color color, int startPosX, int startPosY) {
|
||||
double engineWidth = 6;
|
||||
double engineHeight = 10;
|
||||
double[] engineByTail;
|
||||
double[] engineByWings;
|
||||
gc.setFill(color);
|
||||
|
||||
// Прорисовка двигателей в зависимости от их количества
|
||||
switch (engineCount.getValue()) {
|
||||
case 2:
|
||||
engineByTail = new double[]{startPosX, startPosX};
|
||||
for (double rocketPos : engineByTail) {
|
||||
gc.fillOval(rocketPos, startPosY + 42 - (engineWidth / 2), engineHeight, engineWidth); // Круглый двигатель
|
||||
gc.fillOval(rocketPos, startPosY + 90 - (engineWidth / 2), engineHeight, engineWidth); // Круглый двигатель
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
engineByTail = new double[]{startPosX, startPosX, startPosX, startPosX};
|
||||
for (double rocketPos : engineByTail) {
|
||||
gc.fillOval(rocketPos, startPosY + 28 - (engineWidth / 2), engineHeight, engineWidth); // Круглый двигатель
|
||||
gc.fillOval(rocketPos, startPosY + 53 - (engineWidth / 2), engineHeight, engineWidth); // Круглый двигатель
|
||||
gc.fillOval(rocketPos, startPosY + 78 - (engineWidth / 2), engineHeight, engineWidth); // Круглый двигатель
|
||||
gc.fillOval(rocketPos, startPosY + 103 - (engineWidth / 2), engineHeight, engineWidth); // Круглый двигатель
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
engineHeight = 15;
|
||||
engineByTail = new double[]{startPosX, startPosX, startPosX, startPosX, startPosX, startPosX};
|
||||
engineByWings = new double[]{startPosX + 65, startPosX + 65};
|
||||
|
||||
for (double rocketPos : engineByWings) {
|
||||
gc.fillOval(rocketPos, startPosY + 28 - (engineWidth / 2), engineHeight, engineWidth); // Круглый двигатель
|
||||
gc.fillOval(rocketPos, startPosY + 107 - (engineWidth / 2), engineHeight, engineWidth); // Круглый двигатель
|
||||
}
|
||||
|
||||
engineHeight = 10;
|
||||
|
||||
for (double rocketPos : engineByTail) {
|
||||
gc.fillOval(rocketPos, startPosY + 28 - (engineWidth / 2), engineHeight, engineWidth); // Круглый двигатель
|
||||
gc.fillOval(rocketPos, startPosY + 53 - (engineWidth / 2), engineHeight, engineWidth); // Круглый двигатель
|
||||
gc.fillOval(rocketPos, startPosY + 78 - (engineWidth / 2), engineHeight, engineWidth); // Круглый двигатель
|
||||
gc.fillOval(rocketPos, startPosY + 103 - (engineWidth / 2), engineHeight, engineWidth); // Круглый двигатель
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String buffer = "";
|
||||
buffer += "Тип двигателей: овальный\nКоличество двигателей: " + engineCount.getValue();
|
||||
return buffer;
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package com.projectairfighter.drawnings;
|
||||
|
||||
public enum EngineCount {
|
||||
TWO(2),
|
||||
FOUR(4),
|
||||
SIX(6);
|
||||
|
||||
private final int value;
|
||||
|
||||
EngineCount(int Value) { value = Value; }
|
||||
|
||||
public int getValue() { return value; }
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package com.projectairfighter.drawnings;
|
||||
|
||||
import javafx.scene.canvas.GraphicsContext;
|
||||
import javafx.scene.paint.Color;
|
||||
|
||||
public interface IDrawableExtras {
|
||||
void setCountEngines(int countEngines);
|
||||
void drawEngine(GraphicsContext gc, Color color, int startPosX, int startPosY);
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
package com.projectairfighter.drawnings;
|
||||
|
||||
import javafx.scene.canvas.GraphicsContext;
|
||||
import javafx.scene.paint.Color;
|
||||
|
||||
public class RectangleEngineDrawing implements IDrawableExtras {
|
||||
private EngineCount engineCount;
|
||||
|
||||
@Override
|
||||
public void setCountEngines(int countEngines) {
|
||||
switch (countEngines) {
|
||||
case 4:
|
||||
engineCount = EngineCount.FOUR;
|
||||
break;
|
||||
case 6:
|
||||
engineCount = EngineCount.SIX;
|
||||
break;
|
||||
default:
|
||||
engineCount = EngineCount.TWO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawEngine(GraphicsContext gc, Color color, int startPosX, int startPosY) {
|
||||
double engineWidth = 6;
|
||||
double engineHeight = 10;
|
||||
double[] engineByTail;
|
||||
double[] engineByWings;
|
||||
gc.setFill(color);
|
||||
|
||||
// Прорисовка двигателей в зависимости от их количества
|
||||
switch (engineCount.getValue()) {
|
||||
case 2:
|
||||
engineByTail = new double[]{startPosX, startPosX}; // Изменено
|
||||
for (double rocketPos : engineByTail) {
|
||||
gc.fillRect(rocketPos, startPosY + 42 - (engineWidth / 2), engineHeight, engineWidth);
|
||||
gc.fillRect(rocketPos, startPosY + 90 - (engineWidth / 2), engineHeight, engineWidth);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
engineByTail = new double[]{startPosX, startPosX, startPosX, startPosX};
|
||||
for (double rocketPos : engineByTail) {
|
||||
gc.fillRect(rocketPos, startPosY + 28 - (engineWidth / 2), engineHeight, engineWidth);
|
||||
gc.fillRect(rocketPos, startPosY + 53 - (engineWidth / 2), engineHeight, engineWidth);
|
||||
gc.fillRect(rocketPos, startPosY + 78 - (engineWidth / 2), engineHeight, engineWidth);
|
||||
gc.fillRect(rocketPos, startPosY + 103 - (engineWidth / 2), engineHeight, engineWidth);
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
engineHeight = 15;
|
||||
engineByTail = new double[]{startPosX, startPosX, startPosX, startPosX, startPosX, startPosX};
|
||||
engineByWings = new double[]{startPosX + 65, startPosX + 65};
|
||||
|
||||
for (double rocketPos : engineByWings) {
|
||||
gc.fillRect(rocketPos, startPosY + 28 - (engineWidth / 2), engineHeight, engineWidth);
|
||||
gc.fillRect(rocketPos, startPosY + 107 - (engineWidth / 2), engineHeight, engineWidth);
|
||||
}
|
||||
|
||||
engineHeight = 10;
|
||||
|
||||
for (double rocketPos : engineByTail) {
|
||||
gc.fillRect(rocketPos, startPosY + 28 - (engineWidth / 2), engineHeight, engineWidth);
|
||||
gc.fillRect(rocketPos, startPosY + 53 - (engineWidth / 2), engineHeight, engineWidth);
|
||||
gc.fillRect(rocketPos, startPosY + 78 - (engineWidth / 2), engineHeight, engineWidth);
|
||||
gc.fillRect(rocketPos, startPosY + 103 - (engineWidth / 2), engineHeight, engineWidth);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String buffer = "";
|
||||
buffer += "Тип двигателей: прямоугольный\nКоличество двигателей: " + engineCount.getValue();
|
||||
return buffer;
|
||||
}
|
||||
}
|
@ -0,0 +1,90 @@
|
||||
package com.projectairfighter.drawnings;
|
||||
|
||||
import javafx.scene.canvas.GraphicsContext;
|
||||
import javafx.scene.paint.Color;
|
||||
|
||||
public class TriangleEngineDrawing implements IDrawableExtras {
|
||||
private EngineCount engineCount;
|
||||
|
||||
@Override
|
||||
public void setCountEngines(int countEngines) {
|
||||
switch (countEngines) {
|
||||
case 4:
|
||||
engineCount = EngineCount.FOUR;
|
||||
break;
|
||||
case 6:
|
||||
engineCount = EngineCount.SIX;
|
||||
break;
|
||||
default:
|
||||
engineCount = EngineCount.TWO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawEngine(GraphicsContext gc, Color color, int startPosX, int startPosY) {
|
||||
double engineWidth = 6;
|
||||
double engineHeight = 10;
|
||||
double[] engineByTail;
|
||||
double[] engineByWings;
|
||||
gc.setFill(color);
|
||||
|
||||
// Прорисовка двигателей в зависимости от их количества
|
||||
switch (engineCount.getValue()) {
|
||||
case 2:
|
||||
engineByTail = new double[]{startPosX - 3, startPosX - 3}; // Изменено
|
||||
for (double rocketPos : engineByTail) {
|
||||
drawTriangle(gc, rocketPos, startPosY + 42, engineHeight, engineWidth);
|
||||
drawTriangle(gc, rocketPos, startPosY + 90, engineHeight, engineWidth);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
engineByTail = new double[]{startPosX - 3, startPosX - 3, startPosX - 3, startPosX - 3};
|
||||
for (double rocketPos : engineByTail) {
|
||||
drawTriangle(gc, rocketPos, startPosY + 28, engineHeight, engineWidth);
|
||||
drawTriangle(gc, rocketPos, startPosY + 53, engineHeight, engineWidth);
|
||||
drawTriangle(gc, rocketPos, startPosY + 78, engineHeight, engineWidth);
|
||||
drawTriangle(gc, rocketPos, startPosY + 103, engineHeight, engineWidth);
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
engineHeight = 15;
|
||||
engineByTail = new double[]{startPosX, startPosX, startPosX, startPosX, startPosX, startPosX};
|
||||
engineByWings = new double[]{startPosX + 61, startPosX + 61};
|
||||
|
||||
for (double rocketPos : engineByWings) {
|
||||
drawTriangle(gc, rocketPos, startPosY + 28, engineHeight, engineWidth);
|
||||
drawTriangle(gc, rocketPos, startPosY + 107, engineHeight, engineWidth);
|
||||
}
|
||||
|
||||
engineHeight = 10;
|
||||
|
||||
for (double rocketPos : engineByTail) {
|
||||
drawTriangle(gc, rocketPos, startPosY + 28, engineHeight, engineWidth);
|
||||
drawTriangle(gc, rocketPos, startPosY + 53, engineHeight, engineWidth);
|
||||
drawTriangle(gc, rocketPos, startPosY + 78, engineHeight, engineWidth);
|
||||
drawTriangle(gc, rocketPos, startPosY + 103, engineHeight, engineWidth);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void drawTriangle(GraphicsContext gc, double x, double y, double height, double width) {
|
||||
double halfHeight = height * 1.2; // Увеличиваем высоту на 20%
|
||||
double halfWidth = width * 1.2; // Увеличиваем ширину на 20%
|
||||
|
||||
gc.beginPath();
|
||||
gc.moveTo(x, y);
|
||||
gc.lineTo(x + halfHeight, y - halfWidth / 2);
|
||||
gc.lineTo(x + halfHeight, y + halfWidth / 2);
|
||||
gc.closePath();
|
||||
gc.fill();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String buffer = "";
|
||||
buffer += "Тип двигателей: треугольный\nКоличество двигателей: " + engineCount.getValue();
|
||||
return buffer;
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package com.projectairfighter.entities;
|
||||
|
||||
import javafx.scene.paint.Color;
|
||||
|
||||
public class EntityAirFighter extends EntityWarPlane {
|
||||
// Дополнительный цвет (для опциональных элементов)
|
||||
private Color additionalColor;
|
||||
// Признак (опция) наличия ракет
|
||||
private boolean bodyRockets;
|
||||
// Признак (опция) наличия дополнительных крыльев
|
||||
private boolean additionalWings;
|
||||
|
||||
public Color getAdditionalColor() {
|
||||
return additionalColor;
|
||||
}
|
||||
public void setAdditionalColor(Color additionalColor) {
|
||||
this.additionalColor = additionalColor;
|
||||
}
|
||||
|
||||
public void setBodyRockets(boolean bodyRockets) {
|
||||
this.bodyRockets = bodyRockets;
|
||||
}
|
||||
|
||||
public void setAdditionalWings(boolean additionalWings) {
|
||||
this.additionalWings = additionalWings;
|
||||
}
|
||||
|
||||
public boolean hasBodyRockets() {
|
||||
return bodyRockets;
|
||||
}
|
||||
|
||||
public boolean hasAdditionalWings() {
|
||||
return additionalWings;
|
||||
}
|
||||
|
||||
// Конструктор
|
||||
public EntityAirFighter(int speed, double weight, Color bodyColor, Color
|
||||
additionalColor, boolean bodyRockets, boolean additionalWings){
|
||||
super(speed, weight, bodyColor);
|
||||
this.additionalColor = additionalColor;
|
||||
this.bodyRockets = bodyRockets;
|
||||
this.additionalWings = additionalWings;
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package com.projectairfighter.entities;
|
||||
|
||||
import javafx.scene.paint.Color;
|
||||
|
||||
public class EntityWarPlane {
|
||||
// Скорость
|
||||
private int speed;
|
||||
// Вес
|
||||
private double weight;
|
||||
// Основной цвет
|
||||
private Color bodyColor;
|
||||
|
||||
public double getStep() {
|
||||
return speed * 100 / weight;
|
||||
}
|
||||
|
||||
public Color getBodyColor() {
|
||||
return bodyColor;
|
||||
}
|
||||
public void setBodyColor(Color bodyColor)
|
||||
{
|
||||
this.bodyColor = bodyColor;
|
||||
}
|
||||
|
||||
public void setSpeed(int speed) {
|
||||
this.speed = speed;
|
||||
}
|
||||
|
||||
public void setWeight(double weight) {
|
||||
this.weight = weight;
|
||||
}
|
||||
|
||||
public EntityWarPlane(int speed, double weight, Color bodyColor){
|
||||
this.speed = speed;
|
||||
this.weight = weight;
|
||||
this.bodyColor = bodyColor;
|
||||
}
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
package com.projectairfighter.movementstrategy;
|
||||
|
||||
public abstract class AbstractStrategy {
|
||||
// Перемещаемый объект
|
||||
private IMoveableObject moveableObject;
|
||||
|
||||
// Статус перемещения
|
||||
private StrategyStatus state = StrategyStatus.NotInit;
|
||||
|
||||
// Ширина поля
|
||||
protected int fieldWidth;
|
||||
|
||||
// Высота поля
|
||||
protected int fieldHeight;
|
||||
|
||||
// Конструктор
|
||||
public AbstractStrategy() {}
|
||||
|
||||
// Установка данных
|
||||
public void setData(IMoveableObject moveableObject, int width, int height) {
|
||||
if (moveableObject == null) {
|
||||
state = StrategyStatus.NotInit;
|
||||
return;
|
||||
}
|
||||
|
||||
state = StrategyStatus.InProgress;
|
||||
this.moveableObject = moveableObject;
|
||||
fieldHeight = height;
|
||||
fieldWidth = width;
|
||||
}
|
||||
|
||||
// Получение статуса перемещения
|
||||
public StrategyStatus getStatus() {
|
||||
return state;
|
||||
}
|
||||
|
||||
// Шаг перемещения
|
||||
public void makeStep() {
|
||||
if (state != StrategyStatus.InProgress) {
|
||||
return;
|
||||
}
|
||||
if (isTargetDestination()) {
|
||||
state = StrategyStatus.Finish;
|
||||
return;
|
||||
}
|
||||
moveToTarget();
|
||||
}
|
||||
|
||||
// Параметры объекта
|
||||
protected ObjectParameters getObjectParameters() {
|
||||
return moveableObject != null ? moveableObject.getObjectPosition() : null;
|
||||
}
|
||||
|
||||
// Шаг объекта
|
||||
protected Integer getStep() {
|
||||
return state == StrategyStatus.InProgress ? moveableObject.getStep() : null;
|
||||
}
|
||||
|
||||
// Перемещение влево
|
||||
protected boolean moveLeft() {
|
||||
return move(MovementDiraction.Left);
|
||||
}
|
||||
|
||||
// Перемещение вправо
|
||||
protected boolean moveRight() {
|
||||
return move(MovementDiraction.Right);
|
||||
}
|
||||
|
||||
// Перемещение вверх
|
||||
protected boolean moveUp() {
|
||||
return move(MovementDiraction.Up);
|
||||
}
|
||||
|
||||
// Перемещение вниз
|
||||
protected boolean moveDown() {
|
||||
return move(MovementDiraction.Down);
|
||||
}
|
||||
|
||||
// Попытка перемещения в требуемом направлении
|
||||
private boolean move(MovementDiraction direction) {
|
||||
if (state != StrategyStatus.InProgress) {
|
||||
return false;
|
||||
}
|
||||
return moveableObject.tryMoveObject(direction);
|
||||
}
|
||||
|
||||
// Абстрактные методы, которые должны быть реализованы в подклассах
|
||||
protected abstract void moveToTarget();
|
||||
protected abstract boolean isTargetDestination();
|
||||
}
|
||||
|
@ -0,0 +1,13 @@
|
||||
package com.projectairfighter.movementstrategy;
|
||||
|
||||
public interface IMoveableObject {
|
||||
// Получение координаты объекта
|
||||
ObjectParameters getObjectPosition();
|
||||
|
||||
// Шаг объекта
|
||||
int getStep();
|
||||
|
||||
// Попытка переместить объект в указанном направлении
|
||||
boolean tryMoveObject(MovementDiraction direction);
|
||||
}
|
||||
|
@ -0,0 +1,36 @@
|
||||
package com.projectairfighter.movementstrategy;
|
||||
|
||||
public class MoveToBorder extends AbstractStrategy {
|
||||
@Override
|
||||
protected boolean isTargetDestination() {
|
||||
ObjectParameters objParams = getObjectParameters();
|
||||
if (objParams == null) {
|
||||
return false;
|
||||
}
|
||||
return objParams.getRightBorder() + getStep() >= fieldWidth && objParams.getDownBorder() + getStep() >= fieldHeight;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void moveToTarget() {
|
||||
ObjectParameters objParams = getObjectParameters();
|
||||
if (objParams == null) {
|
||||
return;
|
||||
}
|
||||
int diffX = objParams.getRightBorder() - fieldWidth;
|
||||
if (Math.abs(diffX) > getStep()) {
|
||||
if (diffX > 0) {
|
||||
moveLeft();
|
||||
} else {
|
||||
moveRight();
|
||||
}
|
||||
}
|
||||
int diffY = objParams.getDownBorder() - fieldHeight;
|
||||
if (Math.abs(diffY) > getStep()) {
|
||||
if (diffY > 0) {
|
||||
moveUp();
|
||||
} else {
|
||||
moveDown();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package com.projectairfighter.movementstrategy;
|
||||
|
||||
public class MoveToCenter extends AbstractStrategy {
|
||||
@Override
|
||||
protected boolean isTargetDestination() {
|
||||
ObjectParameters objParams = getObjectParameters();
|
||||
if (objParams == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return objParams.getObjectMiddleHorizontal() - getStep() <= fieldWidth / 2 && objParams.getObjectMiddleHorizontal() + getStep() >= fieldWidth / 2 &&
|
||||
objParams.getObjectMiddleVertical() - getStep() <= fieldHeight / 2 && objParams.getObjectMiddleVertical() + getStep() >= fieldHeight / 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void moveToTarget() {
|
||||
ObjectParameters objParams = getObjectParameters();
|
||||
if (objParams == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
int diffX = objParams.getObjectMiddleHorizontal() - fieldWidth / 2;
|
||||
if (Math.abs(diffX) > getStep()) {
|
||||
if (diffX > 0) {
|
||||
moveLeft();
|
||||
} else {
|
||||
moveRight();
|
||||
}
|
||||
}
|
||||
|
||||
int diffY = objParams.getObjectMiddleVertical() - fieldHeight / 2;
|
||||
if (Math.abs(diffY) > getStep()) {
|
||||
if (diffY > 0) {
|
||||
moveUp();
|
||||
} else {
|
||||
moveDown();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,49 @@
|
||||
package com.projectairfighter.movementstrategy;
|
||||
|
||||
import com.projectairfighter.drawnings.DirectionType;
|
||||
import com.projectairfighter.drawnings.DrawningWarPlane;
|
||||
|
||||
public class MoveablePlane implements IMoveableObject {
|
||||
// Поле-объект класса DrawningWarPlane или его наследника
|
||||
private final DrawningWarPlane warPlane;
|
||||
|
||||
// Конструктор
|
||||
public MoveablePlane(DrawningWarPlane drawningFighter) {
|
||||
this.warPlane = drawningFighter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObjectParameters getObjectPosition() {
|
||||
if (warPlane == null || warPlane.entityWarPlane == null || warPlane.getPosX() == null || warPlane.getPosY() == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new ObjectParameters(warPlane.getPosX(), warPlane.getPosY(), warPlane.getWidth(), warPlane.getHeight());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStep() {
|
||||
return (int) (warPlane != null && warPlane.entityWarPlane != null ? warPlane.entityWarPlane.getStep() : 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean tryMoveObject(MovementDiraction direction) {
|
||||
if (warPlane == null || warPlane.entityWarPlane == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return warPlane.moveTransport(getDirectionType(direction));
|
||||
}
|
||||
|
||||
// Конвертация из MovementDirection в DirectionType
|
||||
private static DirectionType getDirectionType(MovementDiraction diraction) {
|
||||
return switch (diraction) {
|
||||
case Left -> DirectionType.LEFT;
|
||||
case Right -> DirectionType.RIGHT;
|
||||
case Up -> DirectionType.UP;
|
||||
case Down -> DirectionType.DOWN;
|
||||
default -> DirectionType.UNKNOWN;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
package com.projectairfighter.movementstrategy;
|
||||
|
||||
public enum MovementDiraction {
|
||||
Up,
|
||||
|
||||
Down,
|
||||
|
||||
Left,
|
||||
|
||||
Right
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package com.projectairfighter.movementstrategy;
|
||||
|
||||
public class ObjectParameters {
|
||||
private final int x;
|
||||
private final int y;
|
||||
private final int width;
|
||||
private final int height;
|
||||
|
||||
public ObjectParameters(int x, int y, int width, int height) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public int getLeftBorder() {
|
||||
return x;
|
||||
}
|
||||
|
||||
public int getTopBorder() {
|
||||
return y;
|
||||
}
|
||||
|
||||
public int getRightBorder() {
|
||||
return x + width;
|
||||
}
|
||||
|
||||
public int getDownBorder() {
|
||||
return y + height;
|
||||
}
|
||||
|
||||
public int getObjectMiddleHorizontal() {
|
||||
return x + width / 2;
|
||||
}
|
||||
|
||||
public int getObjectMiddleVertical() {
|
||||
return y + height / 2;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,13 @@
|
||||
package com.projectairfighter.movementstrategy;
|
||||
|
||||
public enum StrategyStatus {
|
||||
// Все готово к началу
|
||||
NotInit,
|
||||
|
||||
// Выполняется
|
||||
InProgress,
|
||||
|
||||
// Завершено
|
||||
Finish
|
||||
}
|
||||
|
@ -1,9 +1,17 @@
|
||||
module com.example.projectairfighter {
|
||||
module com.projectairfighter {
|
||||
requires javafx.controls;
|
||||
requires javafx.fxml;
|
||||
|
||||
requires org.controlsfx.controls;
|
||||
|
||||
opens com.example.projectairfighter to javafx.fxml;
|
||||
exports com.example.projectairfighter;
|
||||
opens com.projectairfighter to javafx.fxml;
|
||||
exports com.projectairfighter;
|
||||
exports com.projectairfighter.drawnings;
|
||||
opens com.projectairfighter.drawnings to javafx.fxml;
|
||||
exports com.projectairfighter.entities;
|
||||
opens com.projectairfighter.entities to javafx.fxml;
|
||||
exports com.projectairfighter.movementstrategy;
|
||||
opens com.projectairfighter.movementstrategy to javafx.fxml;
|
||||
exports com.projectairfighter.collectiongenericobjects;
|
||||
opens com.projectairfighter.collectiongenericobjects to javafx.fxml;
|
||||
}
|
@ -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.example.projectairfighter.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>
|
@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.canvas.*?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<?import javafx.scene.text.*?>
|
||||
|
||||
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="400.0" minWidth="800.0" prefHeight="400.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/17.0.2-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.projectairfighter.FormAirFighter">
|
||||
<Canvas fx:id="canvasAirFighter" height="400.0" width="800.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
|
||||
<Button id="Down" maxHeight="33.0" maxWidth="33.0" minHeight="33.0" minWidth="33.0" mnemonicParsing="false" onAction="#moveAirFighterByMouse" onKeyPressed="#moveAirFighterByKey" text="↓" AnchorPane.bottomAnchor="10.0" AnchorPane.rightAnchor="61.0">
|
||||
<font>
|
||||
<Font size="15.0" />
|
||||
</font>
|
||||
</Button>
|
||||
<Button id="Up" layoutX="506.0" layoutY="317.0" maxHeight="33.0" maxWidth="33.0" minHeight="33.0" minWidth="33.0" mnemonicParsing="false" onAction="#moveAirFighterByMouse" onKeyPressed="#moveAirFighterByKey" text="↑" textAlignment="CENTER" AnchorPane.bottomAnchor="50.0" AnchorPane.rightAnchor="61.0">
|
||||
<font>
|
||||
<Font size="15.0" />
|
||||
</font>
|
||||
</Button>
|
||||
<Button id="Left" maxHeight="33.0" maxWidth="33.0" minHeight="33.0" minWidth="33.0" mnemonicParsing="false" onAction="#moveAirFighterByMouse" onKeyPressed="#moveAirFighterByKey" text="←" AnchorPane.bottomAnchor="10.0" AnchorPane.rightAnchor="102.0">
|
||||
<font>
|
||||
<Font size="15.0" />
|
||||
</font>
|
||||
</Button>
|
||||
<Button id="Right" maxHeight="33.0" maxWidth="33.0" minHeight="33.0" minWidth="33.0" mnemonicParsing="false" onAction="#moveAirFighterByMouse" onKeyPressed="#moveAirFighterByKey" text="→" AnchorPane.bottomAnchor="10.0" AnchorPane.rightAnchor="20.0">
|
||||
<font>
|
||||
<Font size="15.0" />
|
||||
</font>
|
||||
</Button>
|
||||
<ComboBox fx:id="comboBoxStrategy" layoutX="499.0" layoutY="9.0" prefHeight="25.0" prefWidth="99.0" visibleRowCount="2" AnchorPane.rightAnchor="9.0" AnchorPane.topAnchor="9.0" />
|
||||
<Button layoutX="695.0" layoutY="42.0" mnemonicParsing="false" onAction="#buttonStrategy" onKeyPressed="#buttonStrategy" prefHeight="25.0" prefWidth="53.0" text="Шаг" AnchorPane.rightAnchor="9.0" AnchorPane.topAnchor="42.0" />
|
||||
</AnchorPane>
|
@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.canvas.*?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<?import javafx.scene.text.*?>
|
||||
|
||||
<SplitPane dividerPositions="0.3429844097995546, 0.7360801781737194" maxHeight="-Infinity" maxWidth="-Infinity"
|
||||
minHeight="-Infinity" minWidth="-Infinity" prefHeight="500.0" prefWidth="900.0"
|
||||
xmlns="http://javafx.com/javafx/17.0.2-ea" xmlns:fx="http://javafx.com/fxml/1"
|
||||
fx:controller="com.projectairfighter.FormConstructor">
|
||||
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
|
||||
<SplitPane dividerPositions="0.20481927710843373" layoutY="-1.0" orientation="VERTICAL" prefHeight="500.0"
|
||||
prefWidth="305.0">
|
||||
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="151.0" prefWidth="298.0">
|
||||
<Button alignment="CENTER" contentDisplay="CENTER" layoutX="14.0" layoutY="39.0"
|
||||
mnemonicParsing="false" onAction="#generatePlane" text="Сгенерировать"/>
|
||||
<Button alignment="CENTER" contentDisplay="CENTER" layoutX="214.0" layoutY="39.0"
|
||||
mnemonicParsing="false" onAction="#buttonGoToForm" text="Отправить"/>
|
||||
</AnchorPane>
|
||||
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="198.0" prefWidth="242.0">
|
||||
<Canvas fx:id="canvas" height="393.0" width="303.0"/>
|
||||
</AnchorPane>
|
||||
</SplitPane>
|
||||
</AnchorPane>
|
||||
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
|
||||
<Text layoutX="20.0" layoutY="27.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Информация об объекте"/>
|
||||
<Label fx:id="labelInfoObject" alignment="TOP_LEFT" layoutX="14.0" layoutY="44.0" prefHeight="441.0"
|
||||
prefWidth="321.0" AnchorPane.bottomAnchor="13.0" AnchorPane.leftAnchor="14.0"
|
||||
AnchorPane.rightAnchor="12.0" AnchorPane.topAnchor="44.0"/>
|
||||
</AnchorPane>
|
||||
<AnchorPane prefHeight="398.0" prefWidth="160.0">
|
||||
<Text layoutX="14.0" layoutY="27.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Информация о двигателях"/>
|
||||
<Label fx:id="labelInfoEngines" alignment="TOP_LEFT" layoutX="14.0" layoutY="35.0" prefHeight="452.0"
|
||||
prefWidth="209.0"/>
|
||||
</AnchorPane>
|
||||
</SplitPane>
|
@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.canvas.*?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<?import javafx.scene.text.*?>
|
||||
|
||||
<SplitPane dividerPositions="0.7316341829085458" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="251.0" prefWidth="799.0" xmlns="http://javafx.com/javafx/17.0.2-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.projectairfighter.FormPlaneConfig">
|
||||
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
|
||||
<Label layoutX="14.0" layoutY="24.0" text="Скорость" />
|
||||
<Spinner fx:id="speed" layoutX="75.0" layoutY="20.0" prefHeight="25.0" prefWidth="77.0" />
|
||||
<Spinner fx:id="weight" layoutX="75.0" layoutY="60.0" prefHeight="25.0" prefWidth="77.0" />
|
||||
<Label layoutX="15.0" layoutY="64.0" text="Вес" />
|
||||
<CheckBox fx:id="checkBoxRockets" layoutX="14.0" layoutY="111.0" mnemonicParsing="false" text="Признак наличия ракет" />
|
||||
<CheckBox fx:id="checkBoxWings" layoutX="14.0" layoutY="143.0" mnemonicParsing="false" text="Признак наличия дополнительных крыльев" />
|
||||
<Region layoutX="333.0" layoutY="8.0" prefHeight="106.0" prefWidth="179.0" style="-fx-border-color: black;" />
|
||||
<Label id="red" layoutX="339.0" layoutY="16.0" onDragDetected="#onColorDragDetected" prefHeight="35.0" prefWidth="35.0" style="-fx-background-color: red;" />
|
||||
<Label id="green" layoutX="382.0" layoutY="16.0" onDragDetected="#onColorDragDetected" prefHeight="35.0" prefWidth="35.0" style="-fx-background-color: green;" />
|
||||
<Label id="blue" layoutX="426.0" layoutY="15.0" onDragDetected="#onColorDragDetected" prefHeight="35.0" prefWidth="35.0" style="-fx-background-color: blue;" />
|
||||
<Label id="yellow" layoutX="469.0" layoutY="15.0" onDragDetected="#onColorDragDetected" prefHeight="35.0" prefWidth="35.0" style="-fx-background-color: yellow;" />
|
||||
<Label id="white" layoutX="339.0" layoutY="68.0" onDragDetected="#onColorDragDetected" prefHeight="35.0" prefWidth="35.0" style="-fx-background-color: white;" />
|
||||
<Label id="grey" layoutX="382.0" layoutY="68.0" onDragDetected="#onColorDragDetected" prefHeight="35.0" prefWidth="35.0" style="-fx-background-color: grey;" />
|
||||
<Label id="black" layoutX="426.0" layoutY="68.0" onDragDetected="#onColorDragDetected" prefHeight="35.0" prefWidth="35.0" style="-fx-background-color: black;" />
|
||||
<Label id="purple" layoutX="469.0" layoutY="68.0" onDragDetected="#onColorDragDetected" prefHeight="35.0" prefWidth="35.0" style="-fx-background-color: purple;" />
|
||||
<Label alignment="CENTER" contentDisplay="CENTER" layoutX="333.0" layoutY="130.0" onDragDetected="#onPanelDragDetected" prefHeight="35.0" prefWidth="70.0" style="-fx-border-color: black;" text="Простой" />
|
||||
<Label alignment="CENTER" contentDisplay="CENTER" layoutX="412.0" layoutY="129.0" onDragDetected="#onPanelDragDetected" prefHeight="35.0" prefWidth="101.0" style="-fx-border-color: black;" text="Продвинутый" />
|
||||
<Region layoutX="10.0" layoutY="182.0" prefHeight="66.0" prefWidth="473.0" style="-fx-border-color: black;" />
|
||||
<Label alignment="CENTER" contentDisplay="CENTER" layoutX="15.0" layoutY="210.0" onDragDetected="#onRegionDragDetected" prefHeight="25.0" prefWidth="101.0" style="-fx-border-color: black;" text="Прямоугольная" />
|
||||
<Label alignment="CENTER" contentDisplay="CENTER" layoutX="131.0" layoutY="210.0" onDragDetected="#onRegionDragDetected" prefHeight="25.0" prefWidth="101.0" style="-fx-border-color: black;" text="Треугольная" />
|
||||
<Label alignment="CENTER" contentDisplay="CENTER" layoutX="248.0" layoutY="210.0" onDragDetected="#onRegionDragDetected" prefHeight="25.0" prefWidth="101.0" style="-fx-border-color: black;" text="Овальная" />
|
||||
<Text layoutX="16.0" layoutY="201.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Форма двигателя" />
|
||||
<Label layoutX="374.0" layoutY="188.0" text="Кол-во двигателей" />
|
||||
<Spinner fx:id="countEngine" layoutX="385.0" layoutY="210.0" prefHeight="25.0" prefWidth="77.0" />
|
||||
</AnchorPane>
|
||||
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="262.0" prefWidth="253.0">
|
||||
<Label id="labelBodyColor" alignment="CENTER" contentDisplay="CENTER" layoutX="8.0" layoutY="10.0" onDragDropped="#onColorLabelDragDropped" onDragOver="#onDragOver" prefHeight="25.0" prefWidth="69.0" style="-fx-border-color: black;" text="Цвет" />
|
||||
<Label id="labelAdditionalColor" alignment="CENTER" contentDisplay="CENTER" layoutX="134.0" layoutY="9.0" onDragDropped="#onColorLabelDragDropped" onDragOver="#onDragOver" prefHeight="25.0" prefWidth="69.0" style="-fx-border-color: black;" text="Доп цвет" />
|
||||
<Canvas fx:id="canvas" height="155.0" layoutX="8.0" layoutY="43.0" onDragDropped="#onCanvasPlaneDragDropped" onDragOver="#onCanvasDragOver" width="194.0" />
|
||||
<Button layoutX="8.0" layoutY="204.0" mnemonicParsing="false" onAction="#buttonAdd" text="Добавить" />
|
||||
<Button fx:id="buttonCancel" layoutX="137.0" layoutY="204.0" mnemonicParsing="false" prefHeight="25.0" prefWidth="69.0" text="Отмена" />
|
||||
</AnchorPane>
|
||||
</SplitPane>
|
@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.canvas.*?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<?import javafx.scene.text.*?>
|
||||
|
||||
<SplitPane dividerPositions="0.811965811965812" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="765.0" prefWidth="1292.0" xmlns="http://javafx.com/javafx/17.0.2-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.projectairfighter.FormWarPlaneCollection">
|
||||
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="698.0" prefWidth="965.0">
|
||||
<Canvas fx:id="canvasWarPlane" height="763.0" width="1044.0" />
|
||||
</AnchorPane>
|
||||
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="196.0">
|
||||
<SplitPane dividerPositions="0.43889618922470436" orientation="VERTICAL" prefHeight="763.0" prefWidth="237.0">
|
||||
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="100.0" prefWidth="160.0">
|
||||
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Инструменты" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="6.0" />
|
||||
<TextField fx:id="textFieldCollectionName" layoutX="6.0" layoutY="49.0" prefHeight="25.0" prefWidth="224.0" />
|
||||
<RadioButton fx:id="radioButtonMassive" layoutX="25.0" layoutY="77.0" mnemonicParsing="false" text="Массив">
|
||||
<toggleGroup>
|
||||
<ToggleGroup fx:id="toggle" />
|
||||
</toggleGroup>
|
||||
</RadioButton>
|
||||
<RadioButton fx:id="radioButtonList" layoutX="141.0" layoutY="77.0" mnemonicParsing="false" text="Список" toggleGroup="$toggle" />
|
||||
<Button layoutX="6.0" layoutY="101.0" mnemonicParsing="false" onAction="#buttonCollectionAdd" prefHeight="25.0" prefWidth="224.0" text="Добавить в коллекцию" />
|
||||
<Button layoutX="6.0" layoutY="299.0" mnemonicParsing="false" onAction="#buttonCollectionDel" prefHeight="25.0" prefWidth="224.0" text="Удалить коллекцию" />
|
||||
<ListView fx:id="listViewCollection" layoutX="6.0" layoutY="136.0" prefHeight="155.0" prefWidth="224.0" />
|
||||
<Label layoutX="56.0" layoutY="26.0" text="Название коллекции" />
|
||||
</AnchorPane>
|
||||
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="100.0" prefWidth="160.0">
|
||||
<SplitPane fx:id="splitPane" dividerPositions="0.18691588785046728" layoutY="-8.0" orientation="VERTICAL" prefHeight="430.0" prefWidth="237.0">
|
||||
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="116.0" prefWidth="235.0">
|
||||
<ComboBox fx:id="comboBox" layoutX="6.0" layoutY="15.0" onAction="#comboBoxSelectorCompany" prefHeight="25.0" prefWidth="224.0" />
|
||||
<Button layoutX="6.0" layoutY="46.0" mnemonicParsing="false" onAction="#buttonCreateCompany" prefHeight="25.0" prefWidth="224.0" text="Создать компанию" />
|
||||
</AnchorPane>
|
||||
<AnchorPane disable="true" minHeight="0.0" minWidth="0.0" prefHeight="312.0" prefWidth="235.0">
|
||||
<Button alignment="CENTER" contentDisplay="CENTER" layoutX="5.0" layoutY="12.0" mnemonicParsing="false" onAction="#buttonGoToFormCreate" prefHeight="35.0" prefWidth="224.0" text="Добавление самолета" />
|
||||
<TextField fx:id="textBox" layoutX="6.0" layoutY="132.0" prefHeight="25.0" prefWidth="224.0" />
|
||||
<Button alignment="CENTER" contentDisplay="CENTER" layoutX="6.0" layoutY="162.0" mnemonicParsing="false" onAction="#buttonRemovePlaneClicked" prefHeight="35.0" prefWidth="224.0" text="Удалить истребитель" />
|
||||
<Button alignment="CENTER" contentDisplay="CENTER" layoutX="6.0" layoutY="215.0" mnemonicParsing="false" onAction="#buttonGoToCheck" prefHeight="35.0" prefWidth="224.0" text="Передать на тесты" />
|
||||
<Button alignment="CENTER" contentDisplay="CENTER" layoutX="6.0" layoutY="300.0" mnemonicParsing="false" onAction="#buttonRefresh" prefHeight="35.0" prefWidth="224.0" text="Обновить" />
|
||||
<Button alignment="CENTER" contentDisplay="CENTER" layoutX="6.0" layoutY="90.0" mnemonicParsing="false" onAction="#buttonGoFormConstructor" prefHeight="35.0" prefWidth="224.0" text="Добавить через конструктор" />
|
||||
<Button layoutX="6.0" layoutY="257.0" mnemonicParsing="false" onAction="#buttonGoToFormWithDeleteObject" prefHeight="35.0" text="Передать на тесты удаленный объект" />
|
||||
</AnchorPane>
|
||||
</SplitPane>
|
||||
</AnchorPane>
|
||||
</SplitPane>
|
||||
</AnchorPane>
|
||||
</SplitPane>
|
Loading…
x
Reference in New Issue
Block a user