final
This commit is contained in:
parent
7e0d0d42b1
commit
1949aadf52
@ -0,0 +1,67 @@
|
||||
package SelfPropelledArtilleryUnit.DrawningObjects;
|
||||
import SelfPropelledArtilleryUnit.NumbeRollers;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.geom.Ellipse2D;
|
||||
|
||||
public class DrawningClamps implements IDrawable {
|
||||
|
||||
Graphics2D g2d;
|
||||
int startPosX;
|
||||
int startPosY;
|
||||
Color color;
|
||||
private NumbeRollers _numbeRollers;
|
||||
|
||||
@Override
|
||||
public void setNum(int numRollers) {
|
||||
if (numRollers < 4 || numRollers > 6 ){
|
||||
|
||||
_numbeRollers = NumbeRollers.fromNumberToEnum(numRollers);
|
||||
return;
|
||||
}
|
||||
_numbeRollers = NumbeRollers.fromNumberToEnum(numRollers);
|
||||
}
|
||||
|
||||
public DrawningClamps(Graphics2D g2d, int startPosX, int startPosY, Color color, int numRollers){
|
||||
this.color = color;
|
||||
this.g2d = g2d;
|
||||
this.startPosX = startPosX;
|
||||
this.startPosY = startPosY;
|
||||
setNum(numRollers);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Draw(){
|
||||
Ellipse2D ellipse1 = new Ellipse2D.Double(startPosX + 10, startPosY + 55, 10, 10);
|
||||
Ellipse2D ellipse2 = new Ellipse2D.Double(startPosX + 35, startPosY + 55, 10, 10);
|
||||
Ellipse2D ellipse3 = new Ellipse2D.Double(startPosX + 60, startPosY + 55, 10, 10);
|
||||
Ellipse2D ellipse4 = new Ellipse2D.Double(startPosX + 85, startPosY + 55, 10, 10);
|
||||
Ellipse2D ellipse5 = new Ellipse2D.Double(startPosX + 110, startPosY + 55, 10, 10);
|
||||
Ellipse2D ellipse6 = new Ellipse2D.Double(startPosX + 127, startPosY + 60, 5, 5);
|
||||
g2d.setPaint(color);
|
||||
switch (_numbeRollers) {
|
||||
case Min:
|
||||
g2d.fill(ellipse1);
|
||||
g2d.fill(ellipse2);
|
||||
g2d.fill(ellipse3);
|
||||
g2d.fill(ellipse4);
|
||||
break;
|
||||
case Mid:
|
||||
g2d.fill(ellipse1);
|
||||
g2d.fill(ellipse2);
|
||||
g2d.fill(ellipse3);
|
||||
g2d.fill(ellipse4);
|
||||
g2d.fill(ellipse5);
|
||||
break;
|
||||
case Max:
|
||||
g2d.fill(ellipse1);
|
||||
g2d.fill(ellipse2);
|
||||
g2d.fill(ellipse3);
|
||||
g2d.fill(ellipse4);
|
||||
g2d.fill(ellipse5);
|
||||
g2d.fill(ellipse6);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
package SelfPropelledArtilleryUnit.DrawningObjects;
|
||||
import SelfPropelledArtilleryUnit.NumbeRollers;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.geom.Ellipse2D;
|
||||
|
||||
public class DrawningNails implements IDrawable {
|
||||
|
||||
Graphics2D g2d;
|
||||
int startPosX;
|
||||
int startPosY;
|
||||
Color color;
|
||||
private NumbeRollers _numbeRollers;
|
||||
|
||||
@Override
|
||||
public void setNum(int numRollers) {
|
||||
if (numRollers < 4 || numRollers > 6 ){
|
||||
|
||||
_numbeRollers = NumbeRollers.fromNumberToEnum(numRollers);
|
||||
return;
|
||||
}
|
||||
_numbeRollers = NumbeRollers.fromNumberToEnum(numRollers);
|
||||
}
|
||||
|
||||
public DrawningNails(Graphics2D g2d, int startPosX, int startPosY, Color color, int numRollers){
|
||||
this.color = color;
|
||||
this.g2d = g2d;
|
||||
this.startPosX = startPosX;
|
||||
this.startPosY = startPosY;
|
||||
setNum(numRollers);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Draw(){
|
||||
Ellipse2D ellipse1 = new Ellipse2D.Double(startPosX + 15, startPosY + 60, 2, 2);
|
||||
Ellipse2D ellipse2 = new Ellipse2D.Double(startPosX + 40, startPosY + 60, 2, 2);
|
||||
Ellipse2D ellipse3 = new Ellipse2D.Double(startPosX + 65, startPosY + 60, 2, 2);
|
||||
Ellipse2D ellipse4 = new Ellipse2D.Double(startPosX + 90, startPosY + 60, 2, 2);
|
||||
Ellipse2D ellipse5 = new Ellipse2D.Double(startPosX + 115, startPosY + 60, 2, 2);
|
||||
Ellipse2D ellipse6 = new Ellipse2D.Double(startPosX + 130, startPosY + 65, 1, 1);
|
||||
g2d.setPaint(Color.BLACK);
|
||||
switch (_numbeRollers) {
|
||||
case Min:
|
||||
g2d.fill(ellipse1);
|
||||
g2d.fill(ellipse2);
|
||||
g2d.fill(ellipse3);
|
||||
g2d.fill(ellipse4);
|
||||
break;
|
||||
case Mid:
|
||||
g2d.fill(ellipse1);
|
||||
g2d.fill(ellipse2);
|
||||
g2d.fill(ellipse3);
|
||||
g2d.fill(ellipse4);
|
||||
g2d.fill(ellipse5);
|
||||
break;
|
||||
case Max:
|
||||
g2d.fill(ellipse1);
|
||||
g2d.fill(ellipse2);
|
||||
g2d.fill(ellipse3);
|
||||
g2d.fill(ellipse4);
|
||||
g2d.fill(ellipse5);
|
||||
g2d.fill(ellipse6);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
@ -5,14 +5,15 @@ import java.awt.Color;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.geom.Ellipse2D;
|
||||
|
||||
public class DrawningRollers {
|
||||
public class DrawningRollers implements IDrawable{
|
||||
Graphics2D g2d;
|
||||
int startPosX;
|
||||
int startPosY;
|
||||
Color color;
|
||||
private NumbeRollers _numbeRollers;
|
||||
|
||||
public void setNumRollers(int numRollers) {
|
||||
@Override
|
||||
public void setNum(int numRollers) {
|
||||
if (numRollers < 4 || numRollers > 6 ){
|
||||
|
||||
_numbeRollers = NumbeRollers.fromNumberToEnum(numRollers);
|
||||
@ -26,9 +27,10 @@ public class DrawningRollers {
|
||||
this.g2d = g2d;
|
||||
this.startPosX = startPosX;
|
||||
this.startPosY = startPosY;
|
||||
setNumRollers(numRollers);
|
||||
setNum(numRollers);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Draw(){
|
||||
g2d.setPaint(Color.BLACK);
|
||||
Ellipse2D ellipse7 = new Ellipse2D.Double(startPosX + 10, startPosY + 55, 120, 20);
|
||||
@ -39,7 +41,6 @@ public class DrawningRollers {
|
||||
Ellipse2D ellipse4 = new Ellipse2D.Double(startPosX + 80, startPosY + 50, 20, 20);
|
||||
Ellipse2D ellipse5 = new Ellipse2D.Double(startPosX + 105, startPosY + 50, 20, 20);
|
||||
Ellipse2D ellipse6 = new Ellipse2D.Double(startPosX + 125, startPosY + 60, 10, 10);
|
||||
g2d.setPaint(color);
|
||||
g2d.draw(ellipse7);
|
||||
switch (_numbeRollers) {
|
||||
case Min:
|
||||
|
@ -113,6 +113,10 @@ public class DrawningSPAU {
|
||||
//гусеницы
|
||||
DrawningRollers Rollers = new DrawningRollers(g2d, startPosX, startPosY, bodyColor, _numbeRollers);
|
||||
Rollers.Draw();
|
||||
DrawningClamps Clamps = new DrawningClamps(g2d, startPosX, startPosY, bodyColor, _numbeRollers);
|
||||
Clamps.Draw();
|
||||
DrawningNails Nails = new DrawningNails(g2d, startPosX, startPosY, bodyColor, _numbeRollers);
|
||||
Nails.Draw();
|
||||
|
||||
// пушка
|
||||
path.moveTo(startPosX + 35, startPosY + 40);
|
||||
|
@ -0,0 +1,6 @@
|
||||
package SelfPropelledArtilleryUnit.DrawningObjects;
|
||||
|
||||
public interface IDrawable {
|
||||
public void setNum(int num);
|
||||
public void Draw();
|
||||
}
|
Loading…
Reference in New Issue
Block a user