예제 #1
0
        void LoadGroupInfo(GroupShapes shape)
        {
            gname.Text = shape.name.ToString();
            tbdx2.Text = shape.dx.ToString();
            tbdy2.Text = shape.dy.ToString();
            tbdz2.Text = shape.dz.ToString();

            dx_slider2.Value = shape.dx;
            dy_slider2.Value = shape.dy;
            dz_slider2.Value = shape.dz;

            tbsx2.Text = shape.scale_x.ToString();
            tbsy2.Text = shape.scale_y.ToString();
            tbsz2.Text = shape.scale_z.ToString();

            scx_slider2.Value = shape.scale_x;
            scy_slider2.Value = shape.scale_y;
            scz_slider2.Value = shape.scale_z;

            tbrx2.Text = shape.rotation_x.ToString();
            tbry2.Text = shape.rotation_y.ToString();
            tbrz2.Text = shape.rotation_z.ToString();

            rx_slider2.Value = shape.rotation_x;
            ry_slider2.Value = shape.rotation_y;
            rz_slider2.Value = shape.rotation_z;
        }
예제 #2
0
        public void DrawingPanelRightMouseButtonPressed(int mouseX, int mouseY)
        {
            RightClickPopUp = null;
            var clickedOnSelectedShape = SelectedShapes.Where(s => s.Contains(mouseX, mouseY)).ToList().Count > 0;

            if (SelectedShapes.Count > 1 && clickedOnSelectedShape)
            {
                var tmpSelectedShapes = new GroupShapes();
                foreach (var shape in SelectedShapes)
                {
                    tmpSelectedShapes.Add(shape);
                }
                RightClickPopUp = tmpSelectedShapes.CreateRightClickPopUp();
            }
            else
            {
                var shape = DrawnShapes.LastOrDefault(s => s.Contains(mouseX, mouseY));
                if (shape != null)
                {
                    RightClickPopUp = shape.CreateRightClickPopUp();
                }
            }
            if (RightClickPopUp != null)
            {
                _g.OpenRightClickPopUp();
            }
        }
예제 #3
0
        private List <IShape> LoadDrawnShapes(XmlNode drawnShapesNode)
        {
            var drawnShapes = new List <IShape>();

            foreach (XmlNode node in drawnShapesNode.ChildNodes)
            {
                IShape shape = null;
                switch (node.Name)
                {
                case "CIRCLE":
                    shape = new Circle();
                    break;

                case "RECTANGLE":
                    shape = new Rectangle();
                    break;

                case "GROUP":
                    shape = new GroupShapes();
                    break;

                default:
                    break;
                }
                if (shape != null)
                {
                    shape.XmlToShape(node);
                    drawnShapes.Add(shape);
                }
            }

            return(drawnShapes);
        }
예제 #4
0
        public ToolBar LoadToolBar(XmlNode toolbarNode)
        {
            var toolbar = new ToolBar();

            foreach (XmlNode node  in toolbarNode.ChildNodes)
            {
                IShape shape = null;
                switch (node.Name)
                {
                case "CIRCLE":
                    shape = new Circle();
                    break;

                case "RECTANGLE":
                    shape = new Rectangle();
                    break;

                case "GROUP":
                    shape = new GroupShapes();
                    break;
                }
                if (shape != null)
                {
                    shape.XmlToShape(node);
                    toolbar.Add(shape);
                }
            }

            return(toolbar);
        }
예제 #5
0
 public void VisitGroup(GroupShapes group)
 {
     foreach (var shape in group.Children)
     {
         shape.Accept(new ReplaceShape(shape.X + (_x - group.X), shape.Y + (_y - group.Y)));
     }
     group.UpdateBounds();
 }
예제 #6
0
 public void VisitGroup(GroupShapes group)
 {
     foreach (var shape in group.Children)
     {
         ReplaceGroupOnDrawing(shape, _mouseX, _mouseY, group.X, group.XMax, group.Y, group.YMax);
     }
     group.UpdateBounds();
 }
예제 #7
0
            protected override NShapeInfo CreateShapeInfo(int index)
            {
                GroupShapes shape = (GroupShapes)index;
                string      name  = NSystem.InsertSpacesBeforeUppers(shape.ToString());
                NShapeInfo  info  = new NShapeInfo(name);

                return(info);
            }
예제 #8
0
 public void CreateGroup(GroupShapes gr)
 {
     foreach (var shape in gr.Children)
     {
         DrawnShapes.Remove(shape);
         SelectedShapes.Remove(shape);
     }
     DrawnShapes.Add(gr);
     SelectedShapes.Add(gr);
     CreateMemento();
 }
예제 #9
0
        public void VisitGroup(GroupShapes group)
        {
            if (!_amISelected)
            {
                _amISelected = Mediator.Instance.SelectedShapes.Contains(group);
            }

            foreach (var shape in group.Children)
            {
                shape.Accept(this);
            }
        }
예제 #10
0
        public void VisitGroup(GroupShapes group)
        {
            var ratioX = (double)_panelWidth / (double)(group.XMax - group.X);
            var ratioY = (double)_panelHeight / (double)(group.YMax - group.Y);
            var ratio  = Math.Min(ratioX, ratioY);
            var x      = group.X;
            var y      = group.Y;

            foreach (var shape in group.Children)
            {
                VisitGroupRecurs(shape, x, y, ratio);
            }
        }
예제 #11
0
        public void VisitGroup(GroupShapes group)
        {
            var x     = (int)_params[0];
            var y     = (int)_params[1];
            var color = (Color)_params[2];

            group.Color = color;
            foreach (var shape in group.Children)
            {
                shape.Accept(new ReplaceShape(shape.X + (x - group.X), shape.Y + (y - group.Y)));
            }
            group.UpdateBounds();
        }
예제 #12
0
 public void DeleteGroup(GroupShapes gr)
 {
     if (DrawnShapes.Contains(gr))
     {
         DrawnShapes.Remove(gr);
         foreach (var shape in gr.Children)
         {
             DrawnShapes.Add(shape);
         }
         SelectedShapes.Clear();
         _g.RefreshView();
     }
     CreateMemento();
 }
예제 #13
0
        public void InitializeTest()
        {
            center.X = 1;
            center.Y = 2;
            circle   = new GraphicalApp.Circle.Circle(radius, center);

            A.X    = 3;
            A.Y    = 2;
            B.X    = 6;
            B.Y    = 2;
            C.X    = 6;
            C.Y    = 5;
            D.X    = 3;
            D.Y    = 5;
            square = new GraphicalApp.Square.Square(A, B, C, D);
            group  = new GroupShapes();
        }
예제 #14
0
        public GroupEditor(CsGraphics parent, GroupShapes group)
        {
            InitializeComponent();

            _parent         = parent;
            _parent.Enabled = false;
            _group          = group;
            var width  = group.XMax - group.X;
            var height = group.YMax - group.Y;

            originXField.Minimum = -width / 2;
            originXField.Maximum = _parent.DrawingPanel.Width - width / 2;
            originXField.Value   = group.X;

            originYField.Minimum = -height / 2;
            originYField.Maximum = _parent.DrawingPanel.Height - height / 2;
            originYField.Value   = group.Y;

            colorIndicator.BackColor = _group.Color;

            colorPicker.Color = _group.Color;
        }
        void ReleaseDesignerOutlets()
        {
            if (AlignBottomTool != null)
            {
                AlignBottomTool.Dispose();
                AlignBottomTool = null;
            }

            if (AlignLeftTool != null)
            {
                AlignLeftTool.Dispose();
                AlignLeftTool = null;
            }

            if (AlignRightTool != null)
            {
                AlignRightTool.Dispose();
                AlignRightTool = null;
            }

            if (AlignTopTool != null)
            {
                AlignTopTool.Dispose();
                AlignTopTool = null;
            }

            if (CenterHorizontalTool != null)
            {
                CenterHorizontalTool.Dispose();
                CenterHorizontalTool = null;
            }

            if (CenterTool != null)
            {
                CenterTool.Dispose();
                CenterTool = null;
            }

            if (CenterVerticalTool != null)
            {
                CenterVerticalTool.Dispose();
                CenterVerticalTool = null;
            }

            if (MoveBackwardsTool != null)
            {
                MoveBackwardsTool.Dispose();
                MoveBackwardsTool = null;
            }

            if (MoveBottomTool != null)
            {
                MoveBottomTool.Dispose();
                MoveBottomTool = null;
            }

            if (MoveForwardsTool != null)
            {
                MoveForwardsTool.Dispose();
                MoveForwardsTool = null;
            }

            if (MoveTopTool != null)
            {
                MoveTopTool.Dispose();
                MoveTopTool = null;
            }

            if (GroupShapes != null)
            {
                GroupShapes.Dispose();
                GroupShapes = null;
            }

            if (UngroupShapes != null)
            {
                UngroupShapes.Dispose();
                UngroupShapes = null;
            }
        }
예제 #16
0
 public void VisitGroup(GroupShapes group)
 {
     _g.OpenGroupEditMenu(group);
 }
예제 #17
0
        public void OpenGroupEditMenu(GroupShapes g)
        {
            var GroupEditor = new GroupEditor(this, g);

            GroupEditor.Show();
        }
예제 #18
0
 public void UpdateGroup(GroupShapes group, Color color, int x, int y)
 {
     group.Accept(new UpdateShape(x, y, color));
     CreateMemento();
 }