80 lines
2.7 KiB
Java
80 lines
2.7 KiB
Java
import java.awt.*;
|
|
|
|
public class DrawningOarsOrn implements IDraw {
|
|
private NumberType OarsNumb;
|
|
public int Cont;
|
|
public int OarPosX, OarPosY;
|
|
private Color OarsColor;
|
|
// vesla Oars
|
|
public DrawningOarsOrn(int oarPosX, int oarPosY, Color oarsColor) {
|
|
OarPosX = oarPosX;
|
|
OarPosY = oarPosY;
|
|
OarsColor = oarsColor;
|
|
}
|
|
|
|
public void ChangeOarsNumb(int x) {
|
|
if (x <= 1)
|
|
OarsNumb = NumberType.One;
|
|
if (x == 2)
|
|
OarsNumb = NumberType.Two;
|
|
if (x >= 3)
|
|
OarsNumb = NumberType.Three;
|
|
}
|
|
|
|
public void ChangeX(int x) {
|
|
OarPosX = x;
|
|
}
|
|
|
|
public void ChangeY(int y) {
|
|
OarPosY = y;
|
|
}
|
|
|
|
public NumberType OarsNumb() {
|
|
return OarsNumb;
|
|
}
|
|
|
|
public void DrawOars(Graphics2D g2d) {
|
|
g2d.setColor(OarsColor);
|
|
int ind = 0;
|
|
// 1 veslo
|
|
int[] x_oar1 = { OarPosX + 10 + ind, OarPosX + 20 + ind, OarPosX + 36 + ind, OarPosX + 26 + ind };
|
|
int[] y_oar1 = { OarPosY + 10, OarPosY + 10, OarPosY + 26, OarPosY + 26 };
|
|
g2d.fillPolygon(x_oar1, y_oar1, 4);
|
|
g2d.setColor(Color.BLACK);
|
|
g2d.drawPolygon(x_oar1, y_oar1, 4);
|
|
g2d.setColor(OarsColor);
|
|
g2d.fillOval(OarPosX + ind + 5, OarPosY, 20, 15);
|
|
g2d.setColor(Color.BLACK);
|
|
g2d.drawOval(OarPosX + ind + 5, OarPosY, 20, 15);
|
|
|
|
// 2 vesla
|
|
if (OarsNumb == NumberType.Two || OarsNumb == NumberType.Three) {
|
|
ind = 30;
|
|
g2d.setColor(OarsColor);
|
|
int[] x_oar2 = { OarPosX + 10 + ind, OarPosX + 20 + ind, OarPosX + 36 + ind, OarPosX + 26 + ind };
|
|
int[] y_oar2 = { OarPosY + 10, OarPosY + 10, OarPosY + 26, OarPosY + 26 };
|
|
g2d.fillPolygon(x_oar2, y_oar2, 4);
|
|
g2d.setColor(Color.BLACK);
|
|
g2d.drawPolygon(x_oar2, y_oar2, 4);
|
|
g2d.setColor(OarsColor);
|
|
g2d.fillOval(OarPosX + ind + 5, OarPosY, 20, 15);
|
|
g2d.setColor(Color.BLACK);
|
|
g2d.drawOval(OarPosX + ind + 5, OarPosY, 20, 15);
|
|
}
|
|
// 3 vesla
|
|
if (OarsNumb == NumberType.Three) {
|
|
ind = 0;
|
|
g2d.setColor(OarsColor);
|
|
int[] x_oar3 = { OarPosX + 36 + ind, OarPosX + 26 + ind, OarPosX + 10 + ind, OarPosX + 20 + ind };
|
|
int[] y_oar3 = { OarPosY + 55, OarPosY + 55, OarPosY + 71, OarPosY + 71 };
|
|
g2d.fillPolygon(x_oar3, y_oar3, 4);
|
|
g2d.setColor(Color.BLACK);
|
|
g2d.drawPolygon(x_oar3, y_oar3, 4);
|
|
g2d.setColor(OarsColor);
|
|
g2d.fillOval(OarPosX + 5, OarPosY + 65, 20, 15);
|
|
g2d.setColor(Color.BLACK);
|
|
g2d.drawOval(OarPosX + 5, OarPosY + 65, 20, 15);
|
|
}
|
|
}
|
|
}
|