2023-09-25 18:40:25 +04:00
|
|
|
import java.awt.*;
|
|
|
|
|
2023-10-07 21:42:37 +04:00
|
|
|
public class DrawingContainerShip extends DrawingShip{
|
2023-10-09 23:11:13 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
2023-10-20 18:49:21 +04:00
|
|
|
|
|
|
|
private IDecksDrawing iDecksDrawing;
|
|
|
|
|
2023-10-07 21:42:37 +04:00
|
|
|
public DrawingContainerShip(int speed, double weight, Color bodyColor, Color
|
2023-10-09 23:11:13 +04:00
|
|
|
additionalColor, boolean crane, boolean containers,int deck, int deckType, int width, int height)
|
|
|
|
{
|
2023-10-24 01:06:14 +04:00
|
|
|
super(speed, weight, bodyColor, width, height, 110, 65);
|
2023-10-07 21:42:37 +04:00
|
|
|
if (EntityShip != null)
|
2023-09-25 18:40:25 +04:00
|
|
|
{
|
2023-10-07 21:42:37 +04:00
|
|
|
EntityShip = new EntityContainerShip(speed, weight, bodyColor,
|
2023-10-09 23:11:13 +04:00
|
|
|
additionalColor, crane, containers,deck, deckType);
|
2023-10-20 18:49:21 +04:00
|
|
|
|
|
|
|
|
|
|
|
if(deckType == 1){
|
|
|
|
iDecksDrawing = new DrawingDecks();
|
|
|
|
}
|
|
|
|
if(deckType == 2){
|
|
|
|
iDecksDrawing = new DrawingDecksTrapez();
|
|
|
|
}
|
|
|
|
if(deckType == 3){
|
|
|
|
iDecksDrawing = new DrawingDecksRect();
|
|
|
|
}
|
|
|
|
iDecksDrawing.setNumDecks(deck);
|
2023-09-25 18:40:25 +04:00
|
|
|
}
|
2023-10-07 21:42:37 +04:00
|
|
|
}
|
2023-10-24 01:06:14 +04:00
|
|
|
public DrawingContainerShip(EntityContainerShip ship, IDecksDrawing decks, int width, int height){
|
|
|
|
super(ship,width, height);
|
|
|
|
if(width < _pictureWidth || height < _pictureHeight){
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
iDecksDrawing = decks;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2023-10-09 23:11:13 +04:00
|
|
|
@Override
|
2023-09-25 18:40:25 +04:00
|
|
|
public void DrawShip(Graphics2D g)
|
|
|
|
{
|
2023-10-09 23:11:13 +04:00
|
|
|
super.DrawShip(g);
|
|
|
|
if (EntityShip == null)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2023-09-25 18:40:25 +04:00
|
|
|
//контейнеры
|
2023-10-09 23:11:13 +04:00
|
|
|
if (((EntityContainerShip)EntityShip).Conteiners)
|
2023-09-25 18:40:25 +04:00
|
|
|
{
|
2023-10-09 23:11:13 +04:00
|
|
|
g.setPaint(((EntityContainerShip)EntityShip).AdditionalColor);
|
2023-09-25 18:40:25 +04:00
|
|
|
g.fillRect(_startPosX + 50, _startPosY + 55, 35, 10);
|
|
|
|
g.fillRect(_startPosX + 85, _startPosY + 55, 20, 10);
|
|
|
|
g.fillRect(_startPosX + 105, _startPosY + 50, 15, 15);
|
|
|
|
g.fillRect(_startPosX + 50, _startPosY + 45, 15, 10);
|
|
|
|
g.fillRect(_startPosX + 65, _startPosY + 45, 55, 5);
|
|
|
|
g.fillRect(_startPosX + 65, _startPosY + 50, 40, 5);
|
|
|
|
g.setPaint(Color.BLACK);
|
|
|
|
g.drawRect(_startPosX + 50, _startPosY + 55, 35, 10);
|
|
|
|
g.drawRect(_startPosX + 85, _startPosY + 55, 20, 10);
|
|
|
|
g.drawRect(_startPosX + 105, _startPosY + 50, 15, 15);
|
|
|
|
g.drawRect(_startPosX + 50, _startPosY + 45, 15, 10);
|
|
|
|
g.drawRect(_startPosX + 65, _startPosY + 45, 55, 5);
|
|
|
|
g.drawRect(_startPosX + 65, _startPosY + 50, 40, 5);
|
|
|
|
}
|
|
|
|
//кран
|
2023-10-09 23:11:13 +04:00
|
|
|
if (((EntityContainerShip)EntityShip).Crane)
|
2023-09-25 18:40:25 +04:00
|
|
|
{
|
2023-10-09 23:11:13 +04:00
|
|
|
g.setPaint(((EntityContainerShip)EntityShip).AdditionalColor);
|
2023-09-25 18:40:25 +04:00
|
|
|
g.fillRect(_startPosX + 43, _startPosY+20, 5, 45);
|
|
|
|
g.fillRect(_startPosX + 47, _startPosY + 30, 20, 3);
|
|
|
|
g.setPaint(Color.BLACK);
|
|
|
|
g.drawRect(_startPosX + 43, _startPosY+20, 5, 45);
|
|
|
|
g.drawRect(_startPosX + 47, _startPosY + 30, 20, 3);
|
|
|
|
g.drawLine(_startPosX + 47, _startPosY+20, _startPosX + 67, _startPosY + 30);
|
|
|
|
g.drawLine(_startPosX + 67, _startPosY + 33, _startPosX + 67, _startPosY + 45);
|
|
|
|
}
|
2023-10-20 18:49:21 +04:00
|
|
|
iDecksDrawing.DrawDeck(_startPosX, _startPosY, EntityShip.BodyColor, g);
|
2023-09-25 18:40:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|