PIbd-22_Chernyshev_G.J._29_.../Trolleybus/DrawingOvalDoors.java
2023-11-13 21:25:33 +03:00

59 lines
2.4 KiB
Java

package Trolleybus;
import java.awt.*;
public class DrawingOvalDoors implements IDrawingDoors {
private CntOfDoors _cntOfDoors;
public void SetCntOfDoors(int cnt) {
if (cnt <= 3) {
_cntOfDoors = CntOfDoors.Three;
}
if (cnt == 4) {
_cntOfDoors = CntOfDoors.Four;
}
if (cnt >= 5) {
_cntOfDoors = CntOfDoors.Five;
}
}
public void DrawDoors(Graphics2D g, Color BodyColor, int _startPosX, int _startPosY) {
switch (_cntOfDoors)
{
case Three:
g.setColor(BodyColor);
g.drawArc(_startPosX + 2, _startPosY + 50, 16, 60, 0, 180);
g.drawArc(_startPosX + 67, _startPosY + 50, 16, 60, 0, 180);
g.drawArc(_startPosX + 132, _startPosY + 50, 16, 60, 0, 180);
g.setColor(Color.CYAN);
g.drawOval(_startPosX + 22, _startPosY + 35, 16, 24);
g.drawOval(_startPosX + 47, _startPosY + 35, 16, 24);
g.drawOval(_startPosX + 87, _startPosY + 35, 16, 24);
g.drawOval(_startPosX + 112, _startPosY + 35, 16, 24);
break;
case Four:
g.setColor(BodyColor);
g.drawArc(_startPosX + 2, _startPosY + 50, 16, 60, 0, 180);
g.drawArc(_startPosX + 48, _startPosY + 50, 16, 60, 0, 180);
g.drawArc(_startPosX + 86, _startPosY + 50, 16, 60, 0, 180);
g.drawArc(_startPosX + 132, _startPosY + 50, 16, 60, 0, 180);
g.setColor(Color.CYAN);
g.drawOval(_startPosX + 25, _startPosY + 35, 16, 24);
g.drawOval(_startPosX + 67, _startPosY + 35, 16, 24);
g.drawOval(_startPosX + 109, _startPosY + 35, 16, 24);
break;
case Five:
g.setColor(BodyColor);
g.drawArc(_startPosX + 2, _startPosY + 50, 16, 60, 0, 180);
g.drawArc(_startPosX + 48, _startPosY + 50, 16, 60, 0, 180);
g.drawArc(_startPosX + 67, _startPosY + 50, 16, 60, 0, 180);
g.drawArc(_startPosX + 86, _startPosY + 50, 16, 60, 0, 180);
g.drawArc(_startPosX + 132, _startPosY + 50, 16, 60, 0, 180);
g.setColor(Color.CYAN);
g.drawOval(_startPosX + 25, _startPosY + 35, 16, 24);
g.drawOval(_startPosX + 109, _startPosY + 35, 16, 24);
break;
}
}
}