public Shape GetShape(EShapeType shapeType) { if (shapeType == null) { return(null); } switch (shapeType) { case EShapeType.Square: return(new Square()); break; case EShapeType.Rectangle: return(new Rectangle()); break; case EShapeType.Circle: return(new Circle()); break; } return(null); }
public IShape CreateShape(EShapeType currentMode) { switch (currentMode) { case EShapeType.Dot: return(new Dot()); case EShapeType.Line: return(new Line()); case EShapeType.Curve: return(new Curve()); case EShapeType.Rect: return(new Rect()); case EShapeType.Ellipse: return(new Ellipse()); case EShapeType.Triangle: return(new Triangle()); case EShapeType.Hexagon: return(new Hexagon()); case EShapeType.RoundingRect: return(new RoundingRect()); default: throw new Exception("This figure doesn't exist"); } }
public void Init(EShapeType type, int thickness, PaintColor color) { _newshape = _shape.CreateShape(type); _newshape.Thickness = thickness; _newshape.Color = color; _storage.Add(_newshape); }
public ShapeInfo(ShapeInfo anotherInfo) { shapeId = anotherInfo.shapeId; shapeType = anotherInfo.shapeType; shapePosition = anotherInfo.shapePosition; shapePositionIds = anotherInfo.shapePositionIds; shapeRotation = anotherInfo.shapeRotation; shapeRotationId = anotherInfo.shapeRotationId; }
public void AddTestCase(EShapeType type) { IShape exp = _factory.CreateShape(type); _storage.Add(exp); var act = _storage.GetShapeForIndex(0); Assert.AreSame(exp, act); }
public Paint() { InitializeComponent(); _currentMode = EShapeType.Curve; _bl = new BusinessLogic(new Storage(), new ShapeFactory(), new JsonLogic()); _bl.Init(_currentMode, _currentBrashSize, _curentcolor); _currentBitmap = new PaintBitmap(pictureBoxMain.Width, pictureBoxMain.Height); _bufferedBitmap = _currentBitmap.Clone() as PaintBitmap; pictureBoxMain.Image = _currentBitmap.ToImage(); }
public override Shape GetShape(EShapeType shapeType) { switch (shapeType) { case EShapeType.Square: return(new Square()); case EShapeType.Rectangle: return(new Rectangle()); } return(null); }
public void NewShape(EShapeType type, int thickness, PaintColor color, int cornes, ShapeSize size) { _newshape = _shape.CreateShape(type); _newshape.Thickness = thickness; _newshape.Color = color; if (_newshape is Hexagon) { (_newshape as Hexagon).Cornes = cornes; (_newshape as Hexagon).Size = size; } _storage.Add(_newshape); }
public ObjectShape(EShapeType type, Vector size, Color c) { switch (type) { case EShapeType.Circle: shape = new Ellipse(); break; case EShapeType.Square: shape = new Rectangle(); break; } shape.Width = size.X; shape.Height = size.Y; shape.Fill = new SolidColorBrush(c); this.color = c; this.size = size; }
public void MoveMegaTest(EShapeType type, int dx, int dy, int startX, int startY, int finX, int finY) { IShape expShape = _shape.CreateShape(type); expShape.Location = new ShapePoint(dx + startX, dy + startY); expShape.FinishLocation = new ShapePoint(dx + finX, dy + finY); IShape actShape = _shape.CreateShape(type); actShape.Location = new ShapePoint(startX, startY); actShape.FinishLocation = new ShapePoint(finX, finY); _bl.Move(dx, dy, actShape); Assert.AreEqual(expShape.Location.X, actShape.Location.X); Assert.AreEqual(expShape.Location.Y, actShape.Location.Y); Assert.AreEqual(expShape.FinishLocation.X, actShape.FinishLocation.X); Assert.AreEqual(expShape.FinishLocation.Y, actShape.FinishLocation.Y); }
private void RoundingRectButton_Click(object sender, EventArgs e) { _currentMode = EShapeType.RoundingRect; }
private void HexagonButton_Click(object sender, EventArgs e) { _currentMode = EShapeType.Hexagon; }
private void TriangleButton_Click(object sender, EventArgs e) { _currentMode = EShapeType.Triangle; }
private void EllipseButton_Click(object sender, EventArgs e) { _currentMode = EShapeType.Ellipse; }
private void CurveButton_Click(object sender, EventArgs e) { _currentMode = EShapeType.Curve; }
private void DotButton_Click(object sender, EventArgs e) { _currentMode = EShapeType.Dot; }
public AbstractShape(EShapeType name) { this.name = name; }
public abstract Shape GetShape(EShapeType shapeType);