From 9f805eeba2c2dbecd924dd3d8a11eb3483b587d7 Mon Sep 17 00:00:00 2001 From: "ns.potapov" Date: Tue, 10 Oct 2023 12:26:20 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D0=B8=D0=BC=D0=B5?= =?UTF-8?q?=D0=BD=D0=BE=D0=B2=D0=B0=D0=BD=D1=8B=20=D0=BA=D0=BB=D0=B0=D1=81?= =?UTF-8?q?=D1=81=D1=8B=20=D0=BD=D0=B0=D1=81=D0=BB=D0=B5=D0=B4=D0=BD=D0=B8?= =?UTF-8?q?=D0=BA=D0=B8=20=D0=BE=D1=82=20=D0=B8=D0=BD=D1=82=D0=B5=D1=80?= =?UTF-8?q?=D1=84=D0=B5=D0=B9=D1=81=D0=B0=20=D0=98=D0=BD=D1=82=D0=B5=D1=80?= =?UTF-8?q?=D0=94=D0=BE=D0=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ProjectStormtrooper/DrawingEnginesEllipse.java | 12 ++---------- ...esWithFlame.java => DrawingEnginesPyramid.java} | 14 +++++++++++--- ...awingEngines.java => DrawingEnginesSimple.java} | 2 +- ProjectStormtrooper/DrawingPlane.java | 6 +++--- 4 files changed, 17 insertions(+), 17 deletions(-) rename ProjectStormtrooper/{DrawingEnginesWithFlame.java => DrawingEnginesPyramid.java} (57%) rename ProjectStormtrooper/{DrawingEngines.java => DrawingEnginesSimple.java} (93%) diff --git a/ProjectStormtrooper/DrawingEnginesEllipse.java b/ProjectStormtrooper/DrawingEnginesEllipse.java index 9a1e98f..7a82d78 100644 --- a/ProjectStormtrooper/DrawingEnginesEllipse.java +++ b/ProjectStormtrooper/DrawingEnginesEllipse.java @@ -23,17 +23,9 @@ public class DrawingEnginesEllipse implements IDrawingEngines { @Override public void DrawEngine(Graphics2D g2d, Color color, int x, int y, int w, int h) { - Polygon enginePolygon = new Polygon(); - enginePolygon.addPoint(x, y + h / 2); - enginePolygon.addPoint(x + w / 10, y); - enginePolygon.addPoint(x + w - w / 2, y + h / 2); - enginePolygon.addPoint(x + w, y); - enginePolygon.addPoint(x + w, y + h); - enginePolygon.addPoint(x + w - w / 2, y + h / 2); - enginePolygon.addPoint(x + w / 10, y + h); g2d.setColor(Color.WHITE); - g2d.fillPolygon(enginePolygon); + g2d.fillOval(x, y, w, h); g2d.setColor(Color.BLACK); - g2d.drawPolygon(enginePolygon); + g2d.drawOval(x, y, w, h); } } diff --git a/ProjectStormtrooper/DrawingEnginesWithFlame.java b/ProjectStormtrooper/DrawingEnginesPyramid.java similarity index 57% rename from ProjectStormtrooper/DrawingEnginesWithFlame.java rename to ProjectStormtrooper/DrawingEnginesPyramid.java index 83caabb..9df287c 100644 --- a/ProjectStormtrooper/DrawingEnginesWithFlame.java +++ b/ProjectStormtrooper/DrawingEnginesPyramid.java @@ -2,7 +2,7 @@ package ProjectStormtrooper; import java.awt.*; -public class DrawingEnginesWithFlame implements IDrawingEngines { +public class DrawingEnginesPyramid implements IDrawingEngines { private EnumEnginesCount _enumEnginesCount; @Override @@ -23,9 +23,17 @@ public class DrawingEnginesWithFlame implements IDrawingEngines { @Override public void DrawEngine(Graphics2D g2d, Color color, int x, int y, int w, int h) { + Polygon enginePolygon = new Polygon(); + enginePolygon.addPoint(x, y + h / 2); + enginePolygon.addPoint(x + w / 10, y); + enginePolygon.addPoint(x + w - w / 2, y + h / 2); + enginePolygon.addPoint(x + w, y); + enginePolygon.addPoint(x + w, y + h); + enginePolygon.addPoint(x + w - w / 2, y + h / 2); + enginePolygon.addPoint(x + w / 10, y + h); g2d.setColor(Color.WHITE); - g2d.fillOval(x, y, w, h); + g2d.fillPolygon(enginePolygon); g2d.setColor(Color.BLACK); - g2d.drawOval(x, y, w, h); + g2d.drawPolygon(enginePolygon); } } diff --git a/ProjectStormtrooper/DrawingEngines.java b/ProjectStormtrooper/DrawingEnginesSimple.java similarity index 93% rename from ProjectStormtrooper/DrawingEngines.java rename to ProjectStormtrooper/DrawingEnginesSimple.java index 616f666..1eb068c 100644 --- a/ProjectStormtrooper/DrawingEngines.java +++ b/ProjectStormtrooper/DrawingEnginesSimple.java @@ -2,7 +2,7 @@ package ProjectStormtrooper; import java.awt.*; -public class DrawingEngines implements IDrawingEngines { +public class DrawingEnginesSimple implements IDrawingEngines { private EnumEnginesCount _enumEnginesCount; @Override diff --git a/ProjectStormtrooper/DrawingPlane.java b/ProjectStormtrooper/DrawingPlane.java index 9b89b0a..8b5e9f5 100644 --- a/ProjectStormtrooper/DrawingPlane.java +++ b/ProjectStormtrooper/DrawingPlane.java @@ -39,11 +39,11 @@ public class DrawingPlane { Random random = new Random(); int drawingEnginesType = random.nextInt(0, 3); if (drawingEnginesType == 0) - _drawingEngines = new DrawingEngines(); + _drawingEngines = new DrawingEnginesSimple(); else if (drawingEnginesType == 1) - _drawingEngines = new DrawingEnginesEllipse(); + _drawingEngines = new DrawingEnginesPyramid(); else if (drawingEnginesType == 2) - _drawingEngines = new DrawingEnginesWithFlame(); + _drawingEngines = new DrawingEnginesEllipse(); } protected DrawingPlane(int speed, double weight, Color bodyColor,