2022-11-07 01:52:50 +04:00
|
|
|
import java.awt.*;
|
|
|
|
|
|
|
|
public class DrawningSquaredRollers implements IDrawningRollers {
|
|
|
|
private RollersCount rollersCount;
|
|
|
|
private Color colorRollers;
|
|
|
|
|
|
|
|
public void setRollersCount(int count){
|
|
|
|
switch (count) {
|
|
|
|
case 4 -> rollersCount = RollersCount.Four;
|
|
|
|
case 5 -> rollersCount = RollersCount.Five;
|
|
|
|
case 6 -> rollersCount = RollersCount.Six;
|
|
|
|
default -> rollersCount = RollersCount.Four;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public DrawningSquaredRollers(int count, Color colorRollers){
|
|
|
|
setRollersCount(count);
|
|
|
|
this.colorRollers = colorRollers;
|
|
|
|
}
|
|
|
|
|
2022-12-06 15:01:05 +04:00
|
|
|
public int getRollersCount() {
|
|
|
|
return rollersCount.getValue();
|
|
|
|
}
|
|
|
|
|
2022-11-07 01:52:50 +04:00
|
|
|
public void DrawRollers(Graphics2D g, float _startPosX, float _startPosY){
|
|
|
|
Color penColor = Color.BLACK;
|
|
|
|
Color mainColor = colorRollers==null ? Color.LIGHT_GRAY : colorRollers;
|
|
|
|
|
|
|
|
// Крупные катки - всегда
|
|
|
|
// Узор для больших катков
|
|
|
|
Polygon bigRomb = new Polygon(
|
2022-11-07 02:08:18 +04:00
|
|
|
new int[]{(int)_startPosX + 5, (int)_startPosX + 16, (int)_startPosX + 27, (int)_startPosX + 16},
|
|
|
|
new int[]{(int)_startPosY + 71, (int)_startPosY + 60, (int)_startPosY + 71, (int)_startPosY + 82},
|
2022-11-07 01:52:50 +04:00
|
|
|
4
|
|
|
|
);
|
|
|
|
Polygon bigCube = new Polygon(
|
2022-11-07 02:08:18 +04:00
|
|
|
new int[]{(int)_startPosX + 10, (int)_startPosX + 22, (int)_startPosX + 22, (int)_startPosX + 10},
|
|
|
|
new int[]{(int)_startPosY + 65, (int)_startPosY + 65, (int)_startPosY + 77, (int)_startPosY + 77},
|
2022-11-07 01:52:50 +04:00
|
|
|
4
|
|
|
|
);
|
2022-11-07 02:08:18 +04:00
|
|
|
// 1
|
|
|
|
g.setColor(mainColor);
|
|
|
|
g.fillOval((int)_startPosX + 5, (int)_startPosY + 60, 22, 22);
|
|
|
|
g.setColor(penColor);
|
|
|
|
g.drawOval((int)_startPosX + 5, (int)_startPosY + 60, 22, 22);
|
2022-11-07 01:52:50 +04:00
|
|
|
g.drawPolygon(bigRomb);
|
|
|
|
g.drawPolygon(bigCube);
|
|
|
|
// Сдвиг
|
|
|
|
bigRomb.translate(78,0);
|
|
|
|
bigCube.translate(78,0);
|
2022-11-07 02:08:18 +04:00
|
|
|
// 2
|
2022-11-07 01:52:50 +04:00
|
|
|
g.setColor(mainColor);
|
|
|
|
g.fillOval((int)_startPosX + 83, (int)_startPosY + 60, 22, 22);
|
|
|
|
g.setColor(penColor);
|
|
|
|
g.drawOval((int)_startPosX + 83, (int)_startPosY + 60, 22, 22);
|
|
|
|
g.drawPolygon(bigRomb);
|
|
|
|
g.drawPolygon(bigCube);
|
|
|
|
|
|
|
|
// Малые катки - всегда
|
2022-11-07 02:08:18 +04:00
|
|
|
// Узор
|
2022-11-07 01:52:50 +04:00
|
|
|
Polygon smallRomb = new Polygon(
|
2022-11-07 02:08:18 +04:00
|
|
|
new int[]{(int)_startPosX + 43, (int)_startPosX + 46, (int)_startPosX + 49, (int)_startPosX + 46},
|
|
|
|
new int[]{(int)_startPosY + 61, (int)_startPosY + 58, (int)_startPosY + 61, (int)_startPosY + 64},
|
2022-11-07 01:52:50 +04:00
|
|
|
4
|
|
|
|
);
|
|
|
|
Polygon smallCube = new Polygon(
|
2022-11-07 02:08:18 +04:00
|
|
|
new int[]{(int)_startPosX + 44, (int)_startPosX + 48, (int)_startPosX + 48, (int)_startPosX + 44},
|
|
|
|
new int[]{(int)_startPosY + 59, (int)_startPosY + 63, (int)_startPosY + 63, (int)_startPosY + 59},
|
2022-11-07 01:52:50 +04:00
|
|
|
4
|
|
|
|
);
|
|
|
|
// 1
|
|
|
|
g.setColor(mainColor);
|
|
|
|
g.fillOval((int)_startPosX + 43, (int)_startPosY + 58, 6, 6);
|
|
|
|
g.setColor(penColor);
|
|
|
|
g.drawOval((int)_startPosX + 43, (int)_startPosY + 58, 6, 6);
|
|
|
|
g.drawPolygon(smallRomb);
|
|
|
|
g.drawPolygon(smallCube);
|
|
|
|
// Сдвиг
|
|
|
|
smallRomb.translate(18,0);
|
|
|
|
smallCube.translate(18,0);
|
|
|
|
// 2
|
|
|
|
g.setColor(mainColor);
|
|
|
|
g.fillOval((int)_startPosX + 61, (int)_startPosY + 58, 6, 6);
|
|
|
|
g.setColor(penColor);
|
|
|
|
g.drawOval((int)_startPosX + 61, (int)_startPosY + 58, 6, 6);
|
|
|
|
g.drawPolygon(smallRomb);
|
|
|
|
g.drawPolygon(smallCube);
|
|
|
|
|
2022-11-07 02:08:18 +04:00
|
|
|
// Средние катки - не всегда
|
|
|
|
// Узор
|
2022-11-07 01:52:50 +04:00
|
|
|
Polygon middleRomb = new Polygon(
|
2022-11-07 02:08:18 +04:00
|
|
|
new int[]{(int)_startPosX + 33, (int)_startPosX + 38, (int)_startPosX + 43, (int)_startPosX + 38},
|
|
|
|
new int[]{(int)_startPosY + 78, (int)_startPosY + 73, (int)_startPosY + 78, (int)_startPosY + 83},
|
2022-11-07 01:52:50 +04:00
|
|
|
4
|
|
|
|
);
|
|
|
|
Polygon middleCube = new Polygon(
|
2022-11-07 02:08:18 +04:00
|
|
|
new int[]{(int)_startPosX + 35, (int)_startPosX + 41, (int)_startPosX + 41, (int)_startPosX + 35},
|
|
|
|
new int[]{(int)_startPosY + 75, (int)_startPosY + 75, (int)_startPosY + 81, (int)_startPosY + 81},
|
2022-11-07 01:52:50 +04:00
|
|
|
4
|
|
|
|
);
|
|
|
|
switch (rollersCount){
|
|
|
|
case Six:
|
2022-11-07 02:08:18 +04:00
|
|
|
// 1
|
2022-11-07 01:52:50 +04:00
|
|
|
g.setColor(mainColor);
|
|
|
|
g.fillOval((int)_startPosX + 33, (int)_startPosY + 73, 10, 10);
|
|
|
|
g.setColor(penColor);
|
|
|
|
g.drawOval((int)_startPosX + 33, (int)_startPosY + 73, 10, 10);
|
|
|
|
g.drawPolygon(middleRomb);
|
|
|
|
g.drawPolygon(middleCube);
|
|
|
|
|
|
|
|
case Five:
|
|
|
|
// Сдвиг
|
|
|
|
middleRomb.translate(35,0);
|
|
|
|
middleCube.translate(35,0);
|
2022-11-07 02:08:18 +04:00
|
|
|
// 2
|
2022-11-07 01:52:50 +04:00
|
|
|
g.setColor(mainColor);
|
|
|
|
g.fillOval((int)_startPosX + 68, (int)_startPosY + 73, 10, 10);
|
|
|
|
g.setColor(penColor);
|
|
|
|
g.drawOval((int)_startPosX + 68, (int)_startPosY + 73, 10, 10);
|
|
|
|
g.drawPolygon(middleRomb);
|
|
|
|
g.drawPolygon(middleCube);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Центры крупных катков
|
|
|
|
g.setColor(Color.BLACK);
|
|
|
|
g.fillOval((int)_startPosX + 13, (int)_startPosY + 68, 6, 6);
|
|
|
|
g.fillOval((int)_startPosX + 91, (int)_startPosY + 68, 6, 6);
|
|
|
|
}
|
2022-12-04 00:19:21 +04:00
|
|
|
|
|
|
|
public void setColor(Color color) {
|
|
|
|
this.colorRollers = color;
|
|
|
|
}
|
2022-11-07 01:52:50 +04:00
|
|
|
}
|