74 lines
3.2 KiB
Java
74 lines
3.2 KiB
Java
import java.awt.*;
|
|
|
|
public class DrawingContainerShip extends DrawingShip{
|
|
|
|
|
|
|
|
|
|
private IDecksDrawing iDecksDrawing;
|
|
|
|
public DrawingContainerShip(int speed, double weight, Color bodyColor, Color
|
|
additionalColor, boolean crane, boolean containers,int deck, int deckType, int width, int height)
|
|
{
|
|
super(speed, weight, bodyColor,width, height, 110, 65);
|
|
if (EntityShip != null)
|
|
{
|
|
EntityShip = new EntityContainerShip(speed, weight, bodyColor,
|
|
additionalColor, crane, containers,deck, deckType);
|
|
|
|
|
|
if(deckType == 1){
|
|
iDecksDrawing = new DrawingDecks();
|
|
}
|
|
if(deckType == 2){
|
|
iDecksDrawing = new DrawingDecksTrapez();
|
|
}
|
|
if(deckType == 3){
|
|
iDecksDrawing = new DrawingDecksRect();
|
|
}
|
|
iDecksDrawing.setNumDecks(deck);
|
|
}
|
|
}
|
|
@Override
|
|
public void DrawShip(Graphics2D g)
|
|
{
|
|
super.DrawShip(g);
|
|
if (EntityShip == null)
|
|
{
|
|
return;
|
|
}
|
|
//контейнеры
|
|
if (((EntityContainerShip)EntityShip).Conteiners)
|
|
{
|
|
g.setPaint(((EntityContainerShip)EntityShip).AdditionalColor);
|
|
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);
|
|
}
|
|
//кран
|
|
if (((EntityContainerShip)EntityShip).Crane)
|
|
{
|
|
g.setPaint(((EntityContainerShip)EntityShip).AdditionalColor);
|
|
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);
|
|
}
|
|
iDecksDrawing.DrawDeck(_startPosX, _startPosY, EntityShip.BodyColor, g);
|
|
}
|
|
|
|
}
|