30 lines
1.1 KiB
Java
30 lines
1.1 KiB
Java
package Drawnings;
|
|
|
|
import java.awt.*;
|
|
|
|
public class DrawningTriangleWheels implements IDrawWheels {
|
|
private WheelsCount wheelsCount;
|
|
|
|
@Override
|
|
public void setNumber(int wheelCount) {
|
|
for (WheelsCount value : WheelsCount.values()) {
|
|
if (value.getEnumNumber() == wheelCount) {
|
|
wheelsCount = value;
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public void drawWheels(Graphics2D g2d, Color color, int _startX, int _startY) {
|
|
g2d.setColor(color);
|
|
g2d.setStroke(new BasicStroke(4));
|
|
int wheelDistance = 100 / wheelsCount.getEnumNumber();
|
|
for (int i = 0; i < wheelsCount.getEnumNumber(); i++) {
|
|
g2d.drawLine(_startX + 5 + i * wheelDistance - 4, (int) _startY + 44, _startX + 5 + i * wheelDistance + 4, (int) _startY + 44);
|
|
g2d.drawLine(_startX + 5 + i * wheelDistance + 4, (int) _startY + 44, _startX + 5 + i * wheelDistance, (int) _startY + 48);
|
|
g2d.drawLine(_startX + 5 + i * wheelDistance, (int) _startY + 48, _startX + 5 + i * wheelDistance - 4, (int) _startY + 44);
|
|
}
|
|
}
|
|
}
|