프로젝트

일반

사용자정보

개정판 f816dd63

IDf816dd6357f0fb301a464a292ede54cf45105b5e
상위 d0b39faa
하위 4169a7ba, f86d9939

백흠경이(가) 5년 이상 전에 추가함

issue #923: add RedoCommand class

Change-Id: I4030ff812a02655439edccaa65cdaaa035e1549a

차이점 보기:

KCOM/Events/UndoCommand.cs
14 14
using System.Windows.Media;
15 15
using MarkupToPDF.Controls.Cad;
16 16
using KCOM.Common;
17
using KCOM.Controls;
17 18

  
18 19
namespace KCOM.Events
19 20
{
......
45 46
        /// <author>humkyung</author>
46 47
        /// <date>2019.06.14</date>
47 48
        /// <param name="comments"></param>
48
        public void Execute(ICollection<CommentUserInfo> comments, double dAngle)
49
        public void Push(ICollection<CommentUserInfo> comments, double dAngle)
49 50
        {
50 51
            List<Point> p_set = new List<Point>();
51 52

  
......
95 96

  
96 97
            ViewerDataModel.Instance.UndoDataList.Add(UndoData);
97 98
        }
99

  
100
        /// <summary>
101
        /// undo
102
        /// </summary>
103
        public void Execute()
104
        {
105
            AdornerFinal final;
106
            SelectionSet.Instance.UnSelect(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu);
107

  
108
            Undo_data undo = ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == false).ToList().OrderByDescending(order => order.EventTime).FirstOrDefault();
109
            if (undo == null) return;
110

  
111
            switch (undo.Event)
112
            {
113
                case (Event_Type.Create):
114
                    {
115
                        foreach (var item in undo.Markup_List)
116
                        {
117
                            ViewerDataModel.Instance.MarkupControls_USER.Remove((item.Markup));
118
                        }
119
                    }
120
                    break;
121
                case (Event_Type.Delete):
122
                    {
123
                        foreach (var item in undo.Markup_List)
124
                        {
125
                            ViewerDataModel.Instance.MarkupControls_USER.Add(item.Markup);
126
                        }
127
                    }
128
                    break;
129
                case (Event_Type.Thumb):
130
                    {
131
                        List<CommentUserInfo> comment = new List<CommentUserInfo>();
132

  
133
                        foreach (var item in undo.Markup_List)
134
                        {
135
                            ViewerDataModel.Instance.MarkupControls_USER.Remove((item.Markup));
136

  
137
                            if ((item.Markup as IViewBox) != null)
138
                            {
139
                                (item.Markup as IViewBox).Angle = item.Angle;
140
                            }
141
                            if ((item.Markup as TextControl) != null)
142
                            {
143
                                (item.Markup as TextControl).Angle = item.Angle;
144
                                Canvas.SetLeft((item.Markup as TextControl), item.PointSet[0].X);
145
                                Canvas.SetTop((item.Markup as TextControl), item.PointSet[0].Y);
146
                            }
147
                            else
148
                            {
149
                                (item.Markup as IPath).PointSet = item.PointSet;
150
                                (item.Markup as IPath).updateControl();
151
                            }
152

  
153
                            comment.Add(item.Markup);
154
                        }
155
                        final = new AdornerFinal(comment);
156
                        Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Add(final);
157
                        SelectionSet.Instance.UnSelect(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu);
158
                    }
159
                    break;
160
                case (Event_Type.Select):
161
                    {
162
                        List<CommentUserInfo> comment = new List<CommentUserInfo>();
163

  
164
                        foreach (var item in undo.Markup_List)
165
                        {
166
                            ViewerDataModel.Instance.MarkupControls_USER.Remove((item.Markup));
167

  
168
                            if ((item.Markup as IPath) != null)
169
                            {
170
                                (item.Markup as IPath).LineSize = item.LineSize;
171
                            }
172
                            if ((item.Markup as UIElement) != null)
173
                            {
174
                                (item.Markup as UIElement).Opacity = item.Opacity;
175
                            }
176
                            if ((item.Markup as IDashControl) != null)
177
                            {
178
                                (item.Markup as IDashControl).DashSize = item.DashSize;
179
                            }
180
                            if ((item.Markup as IShapeControl) != null)
181
                            {
182
                                (item.Markup as IShapeControl).Paint = item.paint;
183
                            }
184

  
185
                            comment.Add(item.Markup);
186
                        }
187

  
188
                        final = new AdornerFinal(comment);
189
                        Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Add(final);
190
                    }
191
                    break;
192
                case (Event_Type.Option):
193
                    {
194
                        List<CommentUserInfo> comment = new List<CommentUserInfo>();
195

  
196
                        foreach (var item in undo.Markup_List)
197
                        {
198
                            ViewerDataModel.Instance.MarkupControls_USER.Remove(item.Markup);
199

  
200
                            if (undo.LineSize != 0 && item.Markup as IPath != null)
201
                            {
202
                                (item.Markup as IPath).LineSize = undo.LineSize;
203
                            }
204
                            else if (undo.Opacity != 0 && item.Markup as UIElement != null)
205
                            {
206
                                (item.Markup as UIElement).Opacity = undo.Opacity;
207
                            }
208
                            else if (undo.DashSize != null && item.Markup as IDashControl != null)
209
                            {
210
                                (item.Markup as IDashControl).DashSize = undo.DashSize;
211
                            }
212
                            else if (undo.Interval != 0 && item.Markup as LineControl != null)
213
                            {
214
                                (item.Markup as LineControl).Interval = undo.Interval;
215
                            }
216
                            else if (item.Markup as IShapeControl != null)
217
                            {
218
                                (item.Markup as IShapeControl).Paint = undo.paint;
219
                            }
220
                            comment.Add(item.Markup);
221
                        }
222
                        final = new AdornerFinal(comment);
223
                        Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Add(final);
224
                    }
225
                    break;
226
            }
227
            ViewerDataModel.Instance.UndoDataList.Where(data => data.EventTime == undo.EventTime).ToList().OrderByDescending(order => order.EventTime).ToList().ForEach(i =>
228
            {
229
                i.IsUndo = true;
230
            });
231
        }
98 232
    }
99 233
}

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)