74 lines
4.0 KiB
Java
74 lines
4.0 KiB
Java
|
import java.awt.*;
|
||
|
public class DrawingDecksRect implements IDecksDrawing {
|
||
|
private NumberOfDecks numDecks;
|
||
|
public NumberOfDecks getProperty(){
|
||
|
return numDecks;
|
||
|
}
|
||
|
public void setNumDecks(int nDecks){
|
||
|
switch(nDecks){
|
||
|
case 1:
|
||
|
numDecks = NumberOfDecks.Deck_1;
|
||
|
break;
|
||
|
case 2:
|
||
|
numDecks = NumberOfDecks.Deck_2;
|
||
|
break;
|
||
|
case 3:
|
||
|
numDecks = NumberOfDecks.Deck_3;
|
||
|
break;
|
||
|
default:
|
||
|
numDecks = NumberOfDecks.Deck_1;
|
||
|
System.out.println("Что-то пошло не так, количество палуб неверное" + Integer.toString(nDecks) + "сделаем вид, будто она одна");
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
public void DrawDeck(int _startPosX, int _startPosY, Color bodyColor, Graphics2D g){
|
||
|
if(numDecks == NumberOfDecks.Deck_1){
|
||
|
g.setPaint(bodyColor);
|
||
|
int x[] = {_startPosX+ 20, _startPosX+20, _startPosX+130, _startPosX+130,_startPosX+ 20};
|
||
|
int y[] = {_startPosY+65,_startPosY+85, _startPosY+85, _startPosY+65,_startPosY+65};
|
||
|
g.fillPolygon(x, y, 5);
|
||
|
g.setPaint(Color.BLACK);
|
||
|
int _x[] = {_startPosX+ 20, _startPosX+20, _startPosX+130, _startPosX+130,_startPosX+ 20};
|
||
|
int _y[] = {_startPosY+65,_startPosY+85, _startPosY+85, _startPosY+65,_startPosY+65};
|
||
|
g.drawPolyline(_x, _y, 5);
|
||
|
g.drawLine(_startPosX + 43, _startPosY + 80, _startPosX + 47, _startPosY + 80);
|
||
|
g.drawLine(_startPosX + 45, _startPosY + 70, _startPosX + 45, _startPosY + 80);
|
||
|
g.drawLine(_startPosX + 40, _startPosY + 75, _startPosX + 50, _startPosY + 75);
|
||
|
}
|
||
|
if(numDecks == NumberOfDecks.Deck_2){
|
||
|
g.setPaint(bodyColor);
|
||
|
int x[] = {_startPosX+ 20, _startPosX+20, _startPosX+130, _startPosX+130,_startPosX+ 20};
|
||
|
int y[] = {_startPosY+65,_startPosY+85, _startPosY+85, _startPosY+65,_startPosY+65};
|
||
|
g.fillPolygon(x, y, 5);
|
||
|
g.setPaint(Color.BLACK);
|
||
|
int _x[] = {_startPosX+ 20, _startPosX+20, _startPosX+130, _startPosX+130,_startPosX+ 20};
|
||
|
int _y[] = {_startPosY+65,_startPosY+85, _startPosY+85, _startPosY+65,_startPosY+65};
|
||
|
g.drawPolyline(_x, _y, 5);
|
||
|
g.drawLine(_startPosX + 43, _startPosY + 80, _startPosX + 47, _startPosY + 80);
|
||
|
g.drawLine(_startPosX + 45, _startPosY + 70, _startPosX + 45, _startPosY + 80);
|
||
|
g.drawLine(_startPosX + 40, _startPosY + 75, _startPosX + 50, _startPosY + 75);
|
||
|
|
||
|
g.drawLine(_startPosX + 20, _startPosY + 75, _startPosX+ 35, _startPosY + 75);
|
||
|
g.drawLine(_startPosX + 55, _startPosY + 75, _startPosX+ 130, _startPosY + 75);
|
||
|
}
|
||
|
if(numDecks == NumberOfDecks.Deck_3){
|
||
|
g.setPaint(bodyColor);
|
||
|
int x[] = {_startPosX+ 20, _startPosX+20, _startPosX+130, _startPosX+130,_startPosX+ 20};
|
||
|
int y[] = {_startPosY+65,_startPosY+85, _startPosY+85, _startPosY+65,_startPosY+65};
|
||
|
g.fillPolygon(x, y, 5);
|
||
|
g.setPaint(Color.BLACK);
|
||
|
int _x[] = {_startPosX+ 20, _startPosX+20, _startPosX+130, _startPosX+130,_startPosX+ 20};
|
||
|
int _y[] = {_startPosY+65,_startPosY+85, _startPosY+85, _startPosY+65,_startPosY+65};
|
||
|
g.drawPolyline(_x, _y, 5);
|
||
|
g.drawLine(_startPosX + 43, _startPosY + 80, _startPosX + 47, _startPosY + 80);
|
||
|
g.drawLine(_startPosX + 45, _startPosY + 70, _startPosX + 45, _startPosY + 80);
|
||
|
g.drawLine(_startPosX + 40, _startPosY + 75, _startPosX + 50, _startPosY + 75);
|
||
|
|
||
|
g.drawLine(_startPosX + 20, _startPosY + 75, _startPosX+ 35, _startPosY + 75);
|
||
|
g.drawLine(_startPosX + 55, _startPosY + 75, _startPosX+ 130, _startPosY + 75);
|
||
|
g.drawLine(_startPosX + 20, _startPosY + 70, _startPosX+ 40, _startPosY + 70);
|
||
|
g.drawLine(_startPosX + 50, _startPosY + 70, _startPosX+ 130, _startPosY + 70);
|
||
|
}
|
||
|
}
|
||
|
}
|