Готовая лабораторная работа 5

This commit is contained in:
Никита Белянин 2023-11-30 20:49:50 +04:00
parent 767f265a61
commit 6522e6933a
2 changed files with 17 additions and 13 deletions

View File

@ -32,17 +32,22 @@ public class DrawingSuspensionOrnament implements IOrnamentForm {
g.fillOval(10 + _startPosX, 42 + _startPosY, 20, 20); g.fillOval(10 + _startPosX, 42 + _startPosY, 20, 20);
} }
public void DrawSuspension(Graphics g, int _startPosX, int _startPosY) {
SuspensionColor = Color.BLUE;
g.setColor(SuspensionColor);
g.fillRect(_startPosX + 27, _startPosY + 50, 10, 3);
}
public void Draw(Graphics g, int _startPosX, int _startPosY) { public void Draw(Graphics g, int _startPosX, int _startPosY) {
DrawWheels(g,_startPosX, _startPosY); DrawWheels(g,_startPosX, _startPosY);
g.fillRect(_startPosX + 27, _startPosY + 50, 10, 3); DrawSuspension(g, _startPosX, _startPosY);
if (wheels == CountWheels.Two) { if (wheels == CountWheels.Two) {
DrawWheels(g,_startPosX, _startPosY); DrawWheels(g,_startPosX, _startPosY);
DrawWheels(g,_startPosX + 100, _startPosY); DrawWheels(g,_startPosX + 100, _startPosY);
SuspensionColor = Color.RED;
g.setColor(SuspensionColor); DrawSuspension(g, _startPosX, _startPosY);
g.fillRect(_startPosX + 27, _startPosY + 50, 10, 3); DrawSuspension(g,_startPosX + 73, _startPosY);
g.fillRect(_startPosX + 51, _startPosY + 50, 10, 3);
} }
if (wheels == CountWheels.Three) { if (wheels == CountWheels.Three) {
@ -50,9 +55,9 @@ public class DrawingSuspensionOrnament implements IOrnamentForm {
DrawWheels(g,_startPosX + 50, _startPosY); DrawWheels(g,_startPosX + 50, _startPosY);
DrawWheels(g,_startPosX + 100, _startPosY); DrawWheels(g,_startPosX + 100, _startPosY);
g.fillRect(_startPosX + 27, _startPosY + 50, 10, 3); DrawSuspension(g, _startPosX, _startPosY);
g.fillRect(_startPosX + 51, _startPosY + 50, 10, 3); DrawSuspension(g,_startPosX + 24, _startPosY);
g.fillRect(_startPosX + 80, _startPosY + 50, 10, 3); DrawSuspension(g,_startPosX + 73, _startPosY);
} }
if (wheels == CountWheels.Four || wheels == CountWheels.Five) { if (wheels == CountWheels.Four || wheels == CountWheels.Five) {
@ -63,10 +68,10 @@ public class DrawingSuspensionOrnament implements IOrnamentForm {
DrawWheels(g,_startPosX + 75, _startPosY); DrawWheels(g,_startPosX + 75, _startPosY);
DrawWheels(g,_startPosX + 100, _startPosY); DrawWheels(g,_startPosX + 100, _startPosY);
g.fillRect(_startPosX + 27, _startPosY + 50, 10, 3); DrawSuspension(g, _startPosX, _startPosY);
g.fillRect(_startPosX + 51, _startPosY + 50, 10, 3); DrawSuspension(g,_startPosX + 24, _startPosY);
g.fillRect(_startPosX + 80, _startPosY + 50, 10, 3); DrawSuspension(g,_startPosX + 53, _startPosY);
g.fillRect(_startPosX + 101, _startPosY + 50, 10, 3); DrawSuspension(g,_startPosX + 73, _startPosY);
} }
} }
} }

View File

@ -72,7 +72,6 @@ public class DrawingWheelsCombination implements IOrnamentForm {
DrawSuspension(g,_startPosX + 24, _startPosY); DrawSuspension(g,_startPosX + 24, _startPosY);
DrawSuspension(g,_startPosX + 73, _startPosY); DrawSuspension(g,_startPosX + 73, _startPosY);
CaterpillarStar(g,_startPosX + 5, _startPosY + 12); CaterpillarStar(g,_startPosX + 5, _startPosY + 12);
CaterpillarStar(g,_startPosX + 55, _startPosY + 12); CaterpillarStar(g,_startPosX + 55, _startPosY + 12);
CaterpillarStar(g,_startPosX + 105, _startPosY + 12); CaterpillarStar(g,_startPosX + 105, _startPosY + 12);