Example #1
0
        public bool Execute(EditorForm form)
        {
            bool     flag   = false;
            MyVector vector = form.GetStorage();
            int      side   = 0;

            if (delta_x < 0)
            {
                side = 1;
            }
            if (delta_x > 0)
            {
                side = 3;
            }
            if (delta_y < 0)
            {
                side = 2;
            }
            if (delta_y > 0)
            {
                side = 4;
            }
            for (int i = 0; i < vector.Count(); i++)
            {
                vector[i].ResetObstacles();
                List <Observer> list = vector[i].GetObservers();
                for (int j = 0; j < list.Count; j++)
                {
                    ((Figure)list[j]).ResetObstacles();
                    ((Figure)list[j]).FillArrayForMove(ref ((Figure)list[j]).GetObstacles(), form.GetPanelWidth(), form.GetPanelHeight());
                    ((Observable)list[j]).NotifyAboutObstacle();
                }
                vector[i].FillArrayForMove(ref vector[i].GetObstacles(), form.GetPanelWidth(), form.GetPanelHeight());
                if (vector[i].IsSelected() && !vector[i].IsSticked() && !vector[i].GetObstacles()[side])
                {
                    flag = true;
                    shapes.Add(vector[i]);
                    vector[i].Move(delta_x, delta_y);
                }
            }
            return(flag);
        }
Example #2
0
        public bool Execute(EditorForm form)
        {
            bool flag = false;

            vector = form.GetStorage();
            if (delta > 0)
            {
                for (int i = 0; i < vector.Count(); i++)
                {
                    if (vector[i].IsSelected() && !vector[i].IsSticked() && !vector[i].IsObstacle(form.GetPanelWidth(), form.GetPanelHeight()))
                    {
                        flag = true;
                        shapes.Add(vector[i]);
                        vector[i].Scale(delta);
                    }
                }
                return(flag);
            }
            for (int i = 0; i < vector.Count(); i++)
            {
                if (vector[i].IsSelected() && !vector[i].IsSticked() && !vector[i].IsTooSmall())
                {
                    flag = true;
                    shapes.Add(vector[i]);
                    vector[i].Scale(delta);
                }
            }
            return(flag);
        }