Готовая лабораторная 3
This commit is contained in:
parent
647d39432c
commit
b7cfb71c78
@ -2,7 +2,7 @@ import java.awt.*;
|
||||
|
||||
public class DrawingStarOrnament implements IOrnamentForm {
|
||||
private CountWheels wheels;
|
||||
private Color StarColor;
|
||||
private Color additionalColor;
|
||||
public CountWheels getNumWheel() {
|
||||
return wheels;
|
||||
}
|
||||
@ -22,12 +22,13 @@ public class DrawingStarOrnament implements IOrnamentForm {
|
||||
wheels = CountWheels.Two;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void CaterpillarStar(Graphics g, int _startPosX, int _startPosY) {
|
||||
StarColor = Color.RED;
|
||||
g.setColor(StarColor);
|
||||
int xPontsStar[] = {_startPosX + 15, _startPosX + 18, _startPosX + 21, _startPosX + 18, _startPosX + 19, _startPosX + 16, _startPosX + 12, _startPosX + 12, _startPosX + 11, _startPosX + 15, _startPosX + 16};
|
||||
additionalColor = Color.RED;
|
||||
g.setColor(additionalColor);
|
||||
int xPontsStar[] = {_startPosX + 15, _startPosX + 18, _startPosX + 21, _startPosX + 18, _startPosX + 19, _startPosX + 16, _startPosX + 12, _startPosX + 13, _startPosX + 12, _startPosX + 15, _startPosX + 16};
|
||||
int yPontsStar[] = {_startPosY + 35, _startPosY + 38, _startPosY + 38, _startPosY + 42, _startPosY + 45, _startPosY + 42, _startPosY + 45, _startPosY + 41, _startPosY + 38, _startPosY + 38, _startPosY + 35};
|
||||
g.drawPolygon(xPontsStar, yPontsStar, xPontsStar.length);
|
||||
g.fillPolygon(xPontsStar, yPontsStar, xPontsStar.length);
|
||||
@ -60,6 +61,7 @@ public class DrawingStarOrnament implements IOrnamentForm {
|
||||
DrawWheels(g,_startPosX, _startPosY);
|
||||
DrawWheels(g,_startPosX + 25, _startPosY);
|
||||
DrawWheels(g,_startPosX + 50, _startPosY);
|
||||
DrawWheels(g,_startPosX + 75, _startPosY);
|
||||
DrawWheels(g,_startPosX + 100, _startPosY);
|
||||
|
||||
CaterpillarStar(g,_startPosX + 5, _startPosY + 12);
|
||||
|
@ -2,7 +2,7 @@ import java.awt.*;
|
||||
|
||||
public class DrawingSuspensionOrnament implements IOrnamentForm {
|
||||
private CountWheels wheels;
|
||||
private Color SuspensionColor;
|
||||
private Color additionalColor;
|
||||
public CountWheels getNumWheel() {
|
||||
return wheels;
|
||||
}
|
||||
@ -22,26 +22,22 @@ public class DrawingSuspensionOrnament implements IOrnamentForm {
|
||||
wheels = CountWheels.Two;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void DrawWheels(Graphics g, int _startPosX, int _startPosY) {
|
||||
public void DrawWheels(Graphics g, int _startPosX, int _startPosY){
|
||||
g.setColor(Color.BLACK);
|
||||
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) {
|
||||
if (wheels == CountWheels.Two) {
|
||||
if (wheels == CountWheels.Two){
|
||||
DrawWheels(g,_startPosX, _startPosY);
|
||||
DrawWheels(g,_startPosX + 100, _startPosY);
|
||||
|
||||
DrawSuspension(g, _startPosX, _startPosY);
|
||||
DrawSuspension(g,_startPosX + 73, _startPosY);
|
||||
additionalColor = Color.RED;
|
||||
g.setColor(additionalColor);
|
||||
g.fillRect(_startPosX + 27, _startPosY + 50, 10, 3);
|
||||
g.fillRect(_startPosX + 51, _startPosY + 50, 10, 3);
|
||||
}
|
||||
|
||||
if (wheels == CountWheels.Three) {
|
||||
@ -49,9 +45,9 @@ public class DrawingSuspensionOrnament implements IOrnamentForm {
|
||||
DrawWheels(g,_startPosX + 50, _startPosY);
|
||||
DrawWheels(g,_startPosX + 100, _startPosY);
|
||||
|
||||
DrawSuspension(g, _startPosX, _startPosY);
|
||||
DrawSuspension(g,_startPosX + 24, _startPosY);
|
||||
DrawSuspension(g,_startPosX + 73, _startPosY);
|
||||
g.fillRect(_startPosX + 27, _startPosY + 50, 10, 3);
|
||||
g.fillRect(_startPosX + 51, _startPosY + 50, 10, 3);
|
||||
g.fillRect(_startPosX + 80, _startPosY + 50, 10, 3);
|
||||
}
|
||||
|
||||
if (wheels == CountWheels.Four) {
|
||||
@ -61,10 +57,10 @@ public class DrawingSuspensionOrnament implements IOrnamentForm {
|
||||
DrawWheels(g,_startPosX + 75, _startPosY);
|
||||
DrawWheels(g,_startPosX + 100, _startPosY);
|
||||
|
||||
DrawSuspension(g, _startPosX, _startPosY);
|
||||
DrawSuspension(g,_startPosX + 24, _startPosY);
|
||||
DrawSuspension(g,_startPosX + 53, _startPosY);
|
||||
DrawSuspension(g,_startPosX + 73, _startPosY);
|
||||
g.fillRect(_startPosX + 27, _startPosY + 50, 10, 3);
|
||||
g.fillRect(_startPosX + 51, _startPosY + 50, 10, 3);
|
||||
g.fillRect(_startPosX + 80, _startPosY + 50, 10, 3);
|
||||
g.fillRect(_startPosX + 101, _startPosY + 50, 10, 3);
|
||||
}
|
||||
}
|
||||
}
|
@ -2,13 +2,13 @@ import java.awt.*;
|
||||
|
||||
public class DrawingWheelsCombination implements IOrnamentForm {
|
||||
private CountWheels wheels;
|
||||
private Color CombinationColor;
|
||||
private Color additionalColor;
|
||||
public CountWheels getNumWheel() {
|
||||
return wheels;
|
||||
}
|
||||
|
||||
public void setDigit(int number) {
|
||||
switch(number) {
|
||||
switch(number){
|
||||
case 2:
|
||||
wheels = CountWheels.Two;
|
||||
break;
|
||||
@ -25,32 +25,27 @@ public class DrawingWheelsCombination implements IOrnamentForm {
|
||||
}
|
||||
|
||||
public void CaterpillarStar(Graphics g, int _startPosX, int _startPosY) {
|
||||
CombinationColor = Color.RED;
|
||||
g.setColor(CombinationColor);
|
||||
additionalColor = Color.RED;
|
||||
g.setColor(additionalColor);
|
||||
int xPontsStar[] = {_startPosX + 15, _startPosX + 18, _startPosX + 21, _startPosX + 18, _startPosX + 19, _startPosX + 16, _startPosX + 12, _startPosX + 13, _startPosX + 12, _startPosX + 15, _startPosX + 16};
|
||||
int yPontsStar[] = {_startPosY + 35, _startPosY + 38, _startPosY + 38, _startPosY + 42, _startPosY + 45, _startPosY + 42, _startPosY + 45, _startPosY + 41, _startPosY + 38, _startPosY + 38, _startPosY + 35};
|
||||
g.drawPolygon(xPontsStar, yPontsStar, xPontsStar.length);
|
||||
g.fillPolygon(xPontsStar, yPontsStar, xPontsStar.length);
|
||||
}
|
||||
|
||||
public void DrawSuspension(Graphics g, int _startPosX, int _startPosY) {
|
||||
CombinationColor = Color.BLUE;
|
||||
g.setColor(CombinationColor);
|
||||
g.fillRect(_startPosX + 27, _startPosY + 50, 10, 3);
|
||||
}
|
||||
|
||||
public void DrawWheels(Graphics g, int _startPosX, int _startPosY){
|
||||
g.setColor(Color.BLACK);
|
||||
g.fillOval(10 + _startPosX, 42 + _startPosY, 20, 20);
|
||||
}
|
||||
|
||||
|
||||
public void Draw(Graphics g, int _startPosX, int _startPosY) {
|
||||
if (wheels == CountWheels.Two){
|
||||
DrawWheels(g,_startPosX, _startPosY);
|
||||
DrawWheels(g,_startPosX + 100, _startPosY);
|
||||
|
||||
DrawSuspension(g, _startPosX, _startPosY);
|
||||
DrawSuspension(g,_startPosX + 73, _startPosY);
|
||||
g.fillRect(_startPosX + 27, _startPosY + 50, 10, 3);
|
||||
g.fillRect(_startPosX + 101, _startPosY + 50, 10, 3);
|
||||
|
||||
CaterpillarStar(g,_startPosX + 5, _startPosY + 12);
|
||||
CaterpillarStar(g,_startPosX + 105, _startPosY + 12);
|
||||
@ -61,9 +56,10 @@ public class DrawingWheelsCombination implements IOrnamentForm {
|
||||
DrawWheels(g,_startPosX + 50, _startPosY);
|
||||
DrawWheels(g,_startPosX + 100, _startPosY);
|
||||
|
||||
DrawSuspension(g, _startPosX, _startPosY);
|
||||
DrawSuspension(g,_startPosX + 24, _startPosY);
|
||||
DrawSuspension(g,_startPosX + 73, _startPosY);
|
||||
g.fillRect(_startPosX + 27, _startPosY + 50, 10, 3);
|
||||
g.fillRect(_startPosX + 51, _startPosY + 50, 10, 3);
|
||||
g.fillRect(_startPosX + 100, _startPosY + 50, 10, 3);
|
||||
|
||||
|
||||
CaterpillarStar(g,_startPosX + 5, _startPosY + 12);
|
||||
CaterpillarStar(g,_startPosX + 55, _startPosY + 12);
|
||||
@ -76,10 +72,10 @@ public class DrawingWheelsCombination implements IOrnamentForm {
|
||||
DrawWheels(g,_startPosX + 50, _startPosY);
|
||||
DrawWheels(g,_startPosX + 100, _startPosY);
|
||||
|
||||
DrawSuspension(g, _startPosX, _startPosY);
|
||||
DrawSuspension(g,_startPosX + 24, _startPosY);
|
||||
DrawSuspension(g,_startPosX + 53, _startPosY);
|
||||
DrawSuspension(g,_startPosX + 73, _startPosY);
|
||||
g.fillRect(_startPosX + 27, _startPosY + 50, 10, 3);
|
||||
g.fillRect(_startPosX + 51, _startPosY + 50, 10, 3);
|
||||
g.fillRect(_startPosX + 80, _startPosY + 50, 10, 3);
|
||||
g.fillRect(_startPosX + 101, _startPosY + 50, 10, 3);
|
||||
|
||||
CaterpillarStar(g,_startPosX + 5, _startPosY + 12);
|
||||
CaterpillarStar(g,_startPosX + 30, _startPosY + 12);
|
||||
@ -94,11 +90,6 @@ public class DrawingWheelsCombination implements IOrnamentForm {
|
||||
DrawWheels(g,_startPosX + 75, _startPosY);
|
||||
DrawWheels(g,_startPosX + 100, _startPosY);
|
||||
|
||||
DrawSuspension(g, _startPosX, _startPosY);
|
||||
DrawSuspension(g,_startPosX + 24, _startPosY);
|
||||
DrawSuspension(g,_startPosX + 53, _startPosY);
|
||||
DrawSuspension(g,_startPosX + 73, _startPosY);
|
||||
|
||||
CaterpillarStar(g,_startPosX + 5, _startPosY + 12);
|
||||
CaterpillarStar(g,_startPosX + 30, _startPosY + 12);
|
||||
CaterpillarStar(g,_startPosX + 55, _startPosY + 12);
|
||||
|
Loading…
Reference in New Issue
Block a user