Pibd-22_Emelyanov_A.S._Airb.../DrawningTriangleIlluminator.java

37 lines
1.3 KiB
Java
Raw Normal View History

2022-11-29 21:33:34 +04:00
import java.awt.*;
public class DrawningTriangleIlluminator implements IDrawningIlluminator{
private IlluminatorCount _Illuminator;
@Override
public void SetIlluminatorCount(int numOfIllum) {
_Illuminator = IlluminatorCount.GetIlluminatorCount(numOfIllum);
}
@Override
public void DrawIlluminator(Graphics g, int _startPosX, int _startPosY) {
Graphics2D g2d = (Graphics2D) g;
g2d.setColor(Color.BLACK);
int numOfIlluminator = 0;
switch (_Illuminator)
{
case Ten:
numOfIlluminator = 10;
break;
case Twenty:
numOfIlluminator = 20;
break;
case Thirty:
numOfIlluminator = 30;
break;
}
for(int i = numOfIlluminator; i >= 1; --i){
g2d.setColor(Color.CYAN);
g2d.drawPolygon(new int[] {_startPosX + 105 - 3 * i, _startPosX + 102 - 3 * i, _startPosX + 108 - 3 * i}, new int[] {_startPosY + 35, _startPosY + 38, _startPosY + 38}, 3);
g2d.setColor(Color.BLACK);
g2d.fillPolygon(new int[] {_startPosX + 105 - 3 * i, _startPosX + 102 - 3 * i, _startPosX + 108 - 3 * i}, new int[] {_startPosY + 35, _startPosY + 38, _startPosY + 38}, 3);
}
}
}