Merge branch 'Lab1' of http://student.git.athene.tech/StroevVladimir/PIbd-22-Stroev-V.M.-Monorail.Hard into Lab02
This commit is contained in:
commit
46f5f0f3e8
@ -3,8 +3,6 @@ import java.awt.Graphics;
|
|||||||
|
|
||||||
import Directions.CountWheels;
|
import Directions.CountWheels;
|
||||||
public class DrawingWheels{
|
public class DrawingWheels{
|
||||||
private int _startPosX;
|
|
||||||
private int _startPosY;
|
|
||||||
Graphics g;
|
Graphics g;
|
||||||
Color color;
|
Color color;
|
||||||
private CountWheels _countWheels;
|
private CountWheels _countWheels;
|
||||||
@ -18,14 +16,11 @@ public class DrawingWheels{
|
|||||||
_countWheels = CountWheels.fromNumberToEnum(numRollers);
|
_countWheels = CountWheels.fromNumberToEnum(numRollers);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DrawingWheels(Graphics g, int startPosX, int startPosY, Color color, int countWheels){
|
public DrawingWheels(Color color, int countWheels){
|
||||||
this.g = g;
|
|
||||||
_startPosX = startPosX;
|
|
||||||
_startPosY = startPosY;
|
|
||||||
this.color = color;
|
this.color = color;
|
||||||
setNumWheels(countWheels);
|
setNumWheels(countWheels);
|
||||||
}
|
}
|
||||||
public void Draw(){
|
public void Draw(Graphics g, int _startPosX, int _startPosY){
|
||||||
switch(_countWheels){
|
switch(_countWheels){
|
||||||
case Min:
|
case Min:
|
||||||
g.setColor(Color.BLACK);
|
g.setColor(Color.BLACK);
|
||||||
|
@ -18,7 +18,7 @@ public class DrawningMonorail extends JPanel {
|
|||||||
private int relWidth = 150;
|
private int relWidth = 150;
|
||||||
private final int relHeight = 46;
|
private final int relHeight = 46;
|
||||||
Random rd = new Random();
|
Random rd = new Random();
|
||||||
public DrawningMonorail(){}
|
private DrawingWheels _drawingWheels;
|
||||||
|
|
||||||
public boolean init(int wheelCount ,int speed, double weight, Color bodyColor, Color additionalColor,
|
public boolean init(int wheelCount ,int speed, double weight, Color bodyColor, Color additionalColor,
|
||||||
boolean monorails, boolean secondCabin, int width, int height) {
|
boolean monorails, boolean secondCabin, int width, int height) {
|
||||||
@ -30,6 +30,7 @@ public class DrawningMonorail extends JPanel {
|
|||||||
pictureHeight = height;
|
pictureHeight = height;
|
||||||
entity = new EntityMonorail();
|
entity = new EntityMonorail();
|
||||||
entity.init(wheelCount, speed, weight, bodyColor, additionalColor, monorails, secondCabin);
|
entity.init(wheelCount, speed, weight, bodyColor, additionalColor, monorails, secondCabin);
|
||||||
|
_drawingWheels = new DrawingWheels(entity.getBodyColor(), _countWheels);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,9 +83,7 @@ public class DrawningMonorail extends JPanel {
|
|||||||
g.fillRect(_startPosX + 82, _startPosY + 36, 40, 8);
|
g.fillRect(_startPosX + 82, _startPosY + 36, 40, 8);
|
||||||
g.fillOval( _startPosX + 3, _startPosY + 37, 30, 8);
|
g.fillOval( _startPosX + 3, _startPosY + 37, 30, 8);
|
||||||
g.fillOval( _startPosX + 110, _startPosY + 37, 29, 8);
|
g.fillOval( _startPosX + 110, _startPosY + 37, 29, 8);
|
||||||
DrawingWheels _drawingWheels = new DrawingWheels(g, _startPosX, _startPosY,
|
_drawingWheels.Draw(g, _startPosX, _startPosY);
|
||||||
entity.getBodyColor(), _countWheels);
|
|
||||||
_drawingWheels.Draw();
|
|
||||||
|
|
||||||
//Кабина
|
//Кабина
|
||||||
g.setColor(entity.getBodyColor());
|
g.setColor(entity.getBodyColor());
|
||||||
@ -144,9 +143,9 @@ public class DrawningMonorail extends JPanel {
|
|||||||
g.fillOval(_startPosX + 143, _startPosY + 37, 30, 8);
|
g.fillOval(_startPosX + 143, _startPosY + 37, 30, 8);
|
||||||
g.fillOval(_startPosX + 250, _startPosY + 37, 29, 8);
|
g.fillOval(_startPosX + 250, _startPosY + 37, 29, 8);
|
||||||
|
|
||||||
_drawingWheels = new DrawingWheels(g, _startPosX + 140, _startPosY,
|
//_drawingWheels = new DrawingWheels(g, _startPosX + 140, _startPosY,
|
||||||
entity.getAdditionalColor(), _countWheels);
|
//entity.getAdditionalColor(), _countWheels);
|
||||||
_drawingWheels.Draw();
|
_drawingWheels.Draw(g, _startPosX + 140, _startPosY);
|
||||||
if (entity.getMonorails())
|
if (entity.getMonorails())
|
||||||
{
|
{
|
||||||
g.setColor(Color.BLACK);
|
g.setColor(Color.BLACK);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user