Exemple #1
0
        private void MenuItemFigureClickHandler(object sender, EventArgs e)
        {
            ToolStripMenuItem clickedItem = (ToolStripMenuItem)sender;

            FigureCreator = (FigureCreator)clickedItem.Tag;
            figure        = FigureCreator.Create();
        }
Exemple #2
0
        public void InputRightTriangleSidesOutputRightTriangle(double leg1, double leg2, double hypotenuse)
        {
            var creator  = new FigureCreator();
            var triangle = creator.CreateTriangle(leg1, leg2, hypotenuse);

            Assert.IsInstanceOfType(triangle, typeof(RightTriangle));
        }
Exemple #3
0
        internal void MenuItemFigureClickHandler(object sender, EventArgs e)
        {
            IsHighlighterOn      = false;
            isUserFigureSelected = false;
            ToolStripMenuItem clickedItem = (ToolStripMenuItem)sender;

            FigureCreator = (FigureCreator)clickedItem.Tag;
        }
    // Use this for initialization
    void Start()
    {
        figureCreator    = new FigureCreator();
        figurePusher     = new FigurePusher(TetrisBorders, FiguresParent);
        nextFigurePusher = new NextFigurePusher(TetrisNextFigureArea);

        Screen.SetResolution(kScreenResolutionWidth, kScreenResolutionHeight, false);
    }
Exemple #5
0
        private void btnFigure_Click(object sender, EventArgs e)
        {
            canvas.Enabled = true;

            if (lsbPictures.Items.Count >= imagesCount)
            {
                lsbPictures.Items.RemoveAt(0);
                imageList.RemoveAt(0);
            }

            figureCreator     = creatorList[Convert.ToInt32((sender as Button).Tag.ToString())];
            figure            = figureCreator.CreateFigure();
            figureDrawer      = drawerList[Convert.ToInt32((sender as Button).Tag.ToString())];
            figureInitializer = initializerList[Convert.ToInt32((sender as Button).Tag.ToString())];
        }
        static void Main(string[] args)
        {
            List <Figures> FigureCollection = new List <Figures>();

            FigureCollection.Add(FigureCreator.CreatePoint(6, 7));
            FigureCollection.Add(FigureCreator.CreateLine(new Point(12, 18), new Point(4, 9)));
            FigureCollection.Add(FigureCreator.CreateRectangle(4, 6, new Point(10, 10)));
            FigureCollection.Add(FigureCreator.CreateCircle(new Point(2, 7), 15));
            FigureCollection.Add(FigureCreator.CreateRing(new Point(5, 5), 4, 6));
            foreach (var item in FigureCollection)
            {
                Console.WriteLine(item.GetType().ToString());
                item.ShowInfo();
            }
        }
Exemple #7
0
        protected void DrawAccordingState(DrawContext dc)
        {
            switch (State)
            {
            case States.SELECT:
                break;

            case States.START_DRAGING_POINTS:
                break;

            case States.RUBBER_BAND_SELECT:
                DrawSelRect(dc);
                break;

            case States.DRAGING_POINTS:
                break;

            case States.START_CREATE:
                break;

            case States.CREATING:
                if (FigureCreator != null)
                {
                    Vector3d p = dc.DevPointToWorldPoint(CrossCursor.Pos);
                    FigureCreator.DrawTemp(dc, (CadVertex)p, dc.GetPen(DrawTools.PEN_TEMP_FIGURE));
                }
                break;

            case States.MEASURING:
                if (MeasureFigureCreator != null)
                {
                    Vector3d p = dc.DevPointToWorldPoint(CrossCursor.Pos);
                    MeasureFigureCreator.DrawTemp(dc, (CadVertex)p, dc.GetPen(DrawTools.PEN_TEMP_FIGURE));
                }
                break;
            }

            if (mInteractCtrl.IsActive)
            {
                mInteractCtrl.Draw(dc, SnapPoint);
            }
        }
Exemple #8
0
 private void Awake()
 {
     creator = GameObject.FindObjectOfType <FigureCreator>();
 }
 private void Start()
 {
     gameController = FindObjectOfType <GameController>();
     shapeCreator   = GameObject.FindObjectOfType <FigureCreator>();
     props          = GameObject.FindObjectOfType <Properties>();
 }
Exemple #10
0
 public void InputBadCircleRadiusOutputException(double radius)
 {
     var creator = new FigureCreator();
     var circle  = creator.CreateCircle(radius);
 }
Exemple #11
0
 public void InputBadTrinagleSidesOutputException(double a, double b, double c)
 {
     var creator  = new FigureCreator();
     var triangle = creator.CreateTriangle(a, b, c);
 }
Exemple #12
0
        private void PanelPaintArea_MouseClick(object sender, MouseEventArgs e)
        {
            if (_manual)
            {
                var figure = FigureCreator.CreateFigure();

                var figureName = ComboBoxFigures.SelectedItem as string;
                var loc        = e.Location;

                figure.Name = figureName;

                var width  = Convert.ToInt32(TextBoxWidth.Text);
                var height = Convert.ToInt32(TextBoxHeight.Text);

                figure.Point    = loc;
                figure.Size     = new Size(width, height);
                figure.Color    = _color;
                figure.IsFilled = _isFilled;

                Figures.Add(figure);
            }
            else
            {
                if (Points.Count < 3)
                {
                    Points.Add(e.Location);

                    if (Points.Count == 2)
                    {
                        var width  = Points[1].X - Points[0].X;
                        var height = Points[1].Y - Points[0].Y;

                        var figure = FigureCreator.CreateFigure();

                        var figureName = ComboBoxFigures.SelectedItem as string;

                        figure.Name     = figureName;
                        figure.Color    = _color;
                        figure.IsFilled = _isFilled;

                        Point loc = Point.Empty;
                        if (width < 0 && height < 0)
                        {
                            loc = Points[1];
                        }
                        else if (width > 0 && height > 0)
                        {
                            loc = Points[0];
                        }
                        else if (width < 0 && height > 0)
                        {
                            loc = new Point(Points[0].X - Math.Abs(width), Points[0].Y);
                        }
                        else if (width > 0 && height < 0)
                        {
                            loc = new Point(Points[1].X - Math.Abs(width), Points[1].Y);
                        }

                        figure.Point = loc;

                        figure.Size = new Size(Math.Abs(width), Math.Abs(height));
                        Figures.Add(figure);
                        Points.Clear();
                    }
                }
            }


            this.Refresh();
        }