Merge branch 'LabWork01' into LabWork02

# Conflicts:
#	Classes/DrawingEngines.java
#	Classes/EntityAircraft.java
This commit is contained in:
Yuee Shiness 2022-11-08 21:21:52 +04:00
commit 6896e331eb
3 changed files with 64 additions and 11 deletions

View File

@ -3,7 +3,6 @@ package Classes;
import java.awt.*;
import java.util.Random;
public class DrawingAircraft
{
public EntityAircraft Plane;
@ -101,7 +100,6 @@ public class DrawingAircraft
public void DrawTransport(Graphics g)
{
if (_startPosX < 0 || _startPosY < 0 || _pictureHeight == null || _pictureWidth == null)
{
return;
@ -151,7 +149,6 @@ public class DrawingAircraft
g.setColor(Plane.BodyColor);
g.fillPolygon(pathWing2);
//BackWings
Polygon pathBackWing1 = new Polygon();
@ -160,7 +157,6 @@ public class DrawingAircraft
Point point3W = new Point(point2W.x + 15, point2W.y - 16);
Point point4W = new Point(point3W.x, point1W.y);
pathBackWing1.addPoint(point1W.x, point1W.y);
pathBackWing1.addPoint(point2W.x, point2W.y);
pathBackWing1.addPoint(point3W.x, point3W.y);
@ -201,7 +197,6 @@ public class DrawingAircraft
pathBoseBody.addPoint(point2N.x, point2N.y);
pathBoseBody.addPoint(point3N.x, point3N.y);
g.setColor(Color.BLACK);
g.drawPolygon(pathBoseBody);

View File

@ -0,0 +1,64 @@
package Classes;
import java.awt.*;
public class DrawingEngines
{
private Engines enginesCount;
public void setEngines(int count)
{
enginesCount = Engines.getEnginesEnum(count);
}
public void drawEngines(Graphics g,int startPosX,int startPosY,Color bodyColor)
{
if(enginesCount != null)
{
switch(enginesCount)
{
case TwoEngines -> {
g.setColor((Color.BLACK));
g.drawOval(startPosX + 40,startPosY + 5,30,10);
g.drawOval(startPosX + 40,startPosY + 90,30,10);
g.setColor((bodyColor));
g.fillOval(startPosX + 40,startPosY + 5,30,10);
g.fillOval(startPosX + 40,startPosY + 90,30,10);
}
case FourEngines -> {
g.setColor((Color.BLACK));
g.drawOval(startPosX + 40,startPosY + 5,30,10);
g.drawOval(startPosX + 40,startPosY + 90,30,10);
g.drawOval(startPosX + 40,startPosY + 20,30,10);
g.drawOval(startPosX + 40,startPosY + 75,30,10);
g.setColor(bodyColor);
g.fillOval(startPosX + 40,startPosY + 5,30,10);
g.fillOval(startPosX + 40,startPosY + 90,30,10);
g.fillOval(startPosX + 40,startPosY + 20,30,10);
g.fillOval(startPosX + 40,startPosY + 75,30,10);
}
case SixEngines -> {
g.setColor((Color.BLACK));
g.drawOval(startPosX + 40,startPosY + 5,30,10);
g.drawOval(startPosX + 40,startPosY + 90,30,10);
g.drawOval(startPosX + 40,startPosY + 20,30,10);
g.drawOval(startPosX + 40,startPosY + 75,30,10);
g.drawOval(startPosX + 40,startPosY + 35,30,10);
g.drawOval(startPosX + 40,startPosY + 60,30,10);
g.setColor(bodyColor);
g.fillOval(startPosX + 40,startPosY + 5,30,10);
g.fillOval(startPosX + 40,startPosY + 90,30,10);
g.fillOval(startPosX + 40,startPosY + 20,30,10);
g.fillOval(startPosX + 40,startPosY + 75,30,10);
g.fillOval(startPosX + 40,startPosY + 35,30,10);
g.fillOval(startPosX + 40,startPosY + 60,30,10);
}
}
}
}
}

View File

@ -9,16 +9,12 @@ public class EntityAircraft
public Color BodyColor;
public float Step;
public EntityAircraft(int speed,float weight,Color bodyColor)
{
Speed = speed;
Weight = weight;
BodyColor = bodyColor;
Step = speed * 100 / weight;
}
public int getSpeed()
@ -40,6 +36,4 @@ public class EntityAircraft
{
return BodyColor;
}
}