markus / KCOM / Views / MainMenu.xaml.cs @ 0c997b99
이력 | 보기 | 이력해설 | 다운로드 (300 KB)
1 | 787a4489 | KangIngu | |
---|---|---|---|
2 | using MarkupToPDF.Controls.Common; |
||
3 | using MarkupToPDF.Controls.Line; |
||
4 | using MarkupToPDF.Controls.Polygon; |
||
5 | using MarkupToPDF.Controls.Shape; |
||
6 | using MarkupToPDF.Controls.Text; |
||
7 | using MarkupToPDF.Controls.Etc; |
||
8 | using System; |
||
9 | using System.Collections.Generic; |
||
10 | using System.Linq; |
||
11 | using System.Text; |
||
12 | using System.Windows; |
||
13 | using System.Windows.Controls; |
||
14 | using System.Windows.Data; |
||
15 | using System.Windows.Documents; |
||
16 | using System.Windows.Input; |
||
17 | using System.Windows.Media; |
||
18 | using System.Windows.Media.Imaging; |
||
19 | using System.Windows.Navigation; |
||
20 | using System.Windows.Shapes; |
||
21 | using KCOM.Common; |
||
22 | using IKCOM; |
||
23 | using System.Windows.Ink; |
||
24 | using System.Collections.ObjectModel; |
||
25 | using Telerik.Windows.Controls; |
||
26 | using KCOM.Events; |
||
27 | using System.Reflection; |
||
28 | using MarkupToPDF.Common; |
||
29 | using KCOM.Controls; |
||
30 | 670a4be2 | humkyung | using KCOMDataModel.DataModel; |
31 | d7548b21 | ljiyeon | using System.Xml; |
32 | 6707a5c7 | ljiyeon | using static KCOM.TempFile; |
33 | using System.Windows.Threading; |
||
34 | using System.Diagnostics; |
||
35 | using System.Threading; |
||
36 | 787a4489 | KangIngu | |
37 | namespace KCOM.Views |
||
38 | { |
||
39 | public static class ControlExtensions |
||
40 | { |
||
41 | public static T Clone<T>(this T controlToClone) |
||
42 | where T : System.Windows.Controls.Control |
||
43 | { |
||
44 | System.Reflection.PropertyInfo[] controlProperties = typeof(T).GetProperties(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance); |
||
45 | |||
46 | T instance = Activator.CreateInstance<T>(); |
||
47 | |||
48 | foreach (PropertyInfo propInfo in controlProperties) |
||
49 | { |
||
50 | if (propInfo.CanWrite) |
||
51 | { |
||
52 | if (propInfo.Name != "WindowTarget") |
||
53 | propInfo.SetValue(instance, propInfo.GetValue(controlToClone, null), null); |
||
54 | } |
||
55 | } |
||
56 | return instance; |
||
57 | } |
||
58 | } |
||
59 | |||
60 | a0bab669 | KangIngu | public class MyConsole |
61 | { |
||
62 | private readonly System.Threading.ManualResetEvent _readLineSignal; |
||
63 | private string _lastLine; |
||
64 | public MyConsole() |
||
65 | { |
||
66 | _readLineSignal = new System.Threading.ManualResetEvent(false); |
||
67 | Gui = new TextBox(); |
||
68 | Gui.AcceptsReturn = true; |
||
69 | Gui.KeyUp += OnKeyUp; |
||
70 | } |
||
71 | |||
72 | private void OnKeyUp(object sender, KeyEventArgs e) |
||
73 | { |
||
74 | // this is always fired on UI thread |
||
75 | if (e.Key == Key.Enter) |
||
76 | { |
||
77 | // quick and dirty, but that is not relevant to your question |
||
78 | _lastLine = Gui.Text.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries).Last(); |
||
79 | // now, when you detected that user typed a line, set signal |
||
80 | _readLineSignal.Set(); |
||
81 | } |
||
82 | } |
||
83 | |||
84 | public TextBox Gui { get; private set; } |
||
85 | |||
86 | public string ReadLine() |
||
87 | { |
||
88 | // that should always be called from non-ui thread |
||
89 | if (Gui.Dispatcher.CheckAccess()) |
||
90 | throw new Exception("Cannot be called on UI thread"); |
||
91 | // reset signal |
||
92 | _readLineSignal.Reset(); |
||
93 | // wait until signal is set. This call is blocking, but since we are on non-ui thread - there is no problem with that |
||
94 | _readLineSignal.WaitOne(); |
||
95 | // we got signalled - return line user typed. |
||
96 | return _lastLine; |
||
97 | } |
||
98 | |||
99 | public void WriteLine(string line) |
||
100 | { |
||
101 | if (!Gui.Dispatcher.CheckAccess()) |
||
102 | { |
||
103 | Gui.Dispatcher.Invoke(new Action(() => WriteLine(line))); |
||
104 | return; |
||
105 | } |
||
106 | |||
107 | Gui.Text += line + Environment.NewLine; |
||
108 | } |
||
109 | } |
||
110 | |||
111 | 787a4489 | KangIngu | /// <summary> |
112 | /// MainMenu.xaml에 대한 상호 작용 논리 |
||
113 | /// </summary> |
||
114 | public partial class MainMenu : UserControl |
||
115 | { |
||
116 | #region 프로퍼티 |
||
117 | public Undo_data UndoData { get; set; } |
||
118 | public CommentUserInfo currentControl { get; set; } |
||
119 | public ControlType controlType { get; set; } |
||
120 | private Move move; |
||
121 | private double[] rotateValue = { 0, 90, 180, 270 }; |
||
122 | public MouseHandlingMode mouseHandlingMode = MouseHandlingMode.None; |
||
123 | public MouseButton mouseButtonDown { get; set; } |
||
124 | private static readonly double DragThreshold = 5; |
||
125 | eb2b9248 | KangIngu | private System.Windows.Input.Cursor cursor { get; set; } |
126 | 787a4489 | KangIngu | private Point canvasDrawingMouseDownPoint; |
127 | public string filename { get; set; } |
||
128 | private Point canvasZoomPanningMouseDownPoint; |
||
129 | public Point getCurrentPoint; |
||
130 | private Point canvasZoommovingMouseDownPoint; |
||
131 | List<object> ControlList = new List<object>(); |
||
132 | private ListBox listBox = new ListBox(); |
||
133 | private Dictionary<Geometry, string> selected_item = new Dictionary<Geometry, string>(); |
||
134 | private bool isDraggingSelectionRect = false; |
||
135 | DrawingAttributes inkDA = new DrawingAttributes(); |
||
136 | private VPRevision CurrentRev { get; set; } |
||
137 | public RadRibbonButton btnConsolidate { get; set; } |
||
138 | public RadRibbonButton btnFinalPDF { get; set; } |
||
139 | public RadRibbonButton btnTeamConsolidate { get; set; } |
||
140 | public string Filename_ { get; set; } |
||
141 | public double L_Size = 0; |
||
142 | public AdornerFinal adorner_; |
||
143 | public Multi_Undo_data multi_Undo_Data; |
||
144 | 5ce56a3a | KangIngu | public string Symbol_ID = ""; |
145 | 787a4489 | KangIngu | /// <summary> |
146 | /// Set to 'true' when the left mouse-button is down. |
||
147 | /// </summary> |
||
148 | 9f473fb7 | KangIngu | public bool isLeftMouseButtonDownOnWindow = false; |
149 | 787a4489 | KangIngu | |
150 | public InkPresenter _InkBoard = null; |
||
151 | Stroke stroke; |
||
152 | Boolean IsDrawing = false; |
||
153 | StylusPointCollection strokePoints; |
||
154 | StylusPointCollection erasePoints; |
||
155 | RenderTargetBitmap canvasImage; |
||
156 | Point Sync_Offset_Point; |
||
157 | |||
158 | //강인구 테스트 |
||
159 | private Path _SelectionPath { get; set; } |
||
160 | public Path SelectionPath |
||
161 | { |
||
162 | get |
||
163 | { |
||
164 | return _SelectionPath; |
||
165 | } |
||
166 | set |
||
167 | { |
||
168 | if (_SelectionPath != value) |
||
169 | { |
||
170 | _SelectionPath = value; |
||
171 | RaisePropertyChanged("SelectionPath"); |
||
172 | |||
173 | } |
||
174 | } |
||
175 | } |
||
176 | |||
177 | private System.Windows.Controls.Image _imageViewer { get; set; } |
||
178 | public System.Windows.Controls.Image imageViewer |
||
179 | { |
||
180 | get |
||
181 | { |
||
182 | if (_imageViewer == null) |
||
183 | { |
||
184 | _imageViewer = new System.Windows.Controls.Image(); |
||
185 | return _imageViewer; |
||
186 | } |
||
187 | else |
||
188 | { |
||
189 | return _imageViewer; |
||
190 | } |
||
191 | } |
||
192 | set |
||
193 | { |
||
194 | if (_imageViewer != value) |
||
195 | { |
||
196 | _imageViewer = value; |
||
197 | } |
||
198 | } |
||
199 | } |
||
200 | |||
201 | public bool IsSyncPDFMode { get; set; } |
||
202 | |||
203 | private System.Windows.Controls.Image _imageViewer_Compare { get; set; } |
||
204 | public System.Windows.Controls.Image imageViewer_Compare |
||
205 | { |
||
206 | get |
||
207 | { |
||
208 | if (_imageViewer_Compare == null) |
||
209 | { |
||
210 | _imageViewer_Compare = new System.Windows.Controls.Image(); |
||
211 | return _imageViewer_Compare; |
||
212 | } |
||
213 | else |
||
214 | { |
||
215 | return _imageViewer_Compare; |
||
216 | } |
||
217 | } |
||
218 | set |
||
219 | { |
||
220 | if (_imageViewer_Compare != value) |
||
221 | { |
||
222 | _imageViewer_Compare = value; |
||
223 | } |
||
224 | } |
||
225 | } |
||
226 | |||
227 | #endregion |
||
228 | 6707a5c7 | ljiyeon | |
229 | 787a4489 | KangIngu | public MainMenu() |
230 | { |
||
231 | 0c997b99 | ljiyeon | //InitializeComponent(); |
232 | this.Loaded += MainMenu_Loaded; |
||
233 | 787a4489 | KangIngu | } |
234 | 6707a5c7 | ljiyeon | |
235 | public class TempDt |
||
236 | { |
||
237 | public int PageNumber { get; set; } |
||
238 | public string CommentID { get; set; } |
||
239 | public string ConvertData { get; set; } |
||
240 | public int DATA_TYPE { get; set; } |
||
241 | public string MarkupInfoID { get; set; } |
||
242 | public int IsUpdate { get; set; } |
||
243 | } |
||
244 | |||
245 | List<TempDt> tempDtList = new List<TempDt>(); |
||
246 | |||
247 | 787a4489 | KangIngu | private void SetCursor() |
248 | { |
||
249 | this.Cursor = cursor; |
||
250 | } |
||
251 | |||
252 | private bool IsDrawingEnable(Point _canvasZoomPanningMouseDownPoint) |
||
253 | { |
||
254 | if ((_canvasZoomPanningMouseDownPoint.X > 0 && |
||
255 | ca40e004 | ljiyeon | zoomAndPanCanvas.ActualWidth > _canvasZoomPanningMouseDownPoint.X) && |
256 | (_canvasZoomPanningMouseDownPoint.Y > 0 && |
||
257 | zoomAndPanCanvas.ActualHeight > _canvasZoomPanningMouseDownPoint.Y)) |
||
258 | 787a4489 | KangIngu | { |
259 | return true; |
||
260 | } |
||
261 | |||
262 | return false; |
||
263 | } |
||
264 | |||
265 | ca40e004 | ljiyeon | private bool IsRotationDrawingEnable(Point _canvasZoomPanningMouseDownPoint) |
266 | { |
||
267 | if (rotate.Angle == 90 || rotate.Angle == 270) |
||
268 | { |
||
269 | if ((_canvasZoomPanningMouseDownPoint.X > 0 && |
||
270 | zoomAndPanCanvas.ActualHeight > _canvasZoomPanningMouseDownPoint.X) && |
||
271 | (_canvasZoomPanningMouseDownPoint.Y > 0 && |
||
272 | zoomAndPanCanvas.ActualWidth > _canvasZoomPanningMouseDownPoint.Y)) |
||
273 | { |
||
274 | return true; |
||
275 | } |
||
276 | } |
||
277 | else |
||
278 | { |
||
279 | if ((_canvasZoomPanningMouseDownPoint.X > 0 && |
||
280 | zoomAndPanCanvas.ActualWidth > _canvasZoomPanningMouseDownPoint.X) && |
||
281 | (_canvasZoomPanningMouseDownPoint.Y > 0 && |
||
282 | zoomAndPanCanvas.ActualHeight > _canvasZoomPanningMouseDownPoint.Y)) |
||
283 | { |
||
284 | return true; |
||
285 | } |
||
286 | } |
||
287 | |||
288 | return false; |
||
289 | } |
||
290 | |||
291 | d7548b21 | ljiyeon | |
292 | 787a4489 | KangIngu | public void DeleteItem(MarkupInfoItem item) |
293 | { |
||
294 | if (PreviewUserMarkupInfoItem != null && item.Consolidate == 1 && item.AvoidConsolidate == 0) |
||
295 | { |
||
296 | App.Custom_ViewInfoId = PreviewUserMarkupInfoItem.MarkupInfoID; |
||
297 | } |
||
298 | |||
299 | ViewerDataModel.Instance._markupInfoList.Remove(item); |
||
300 | |||
301 | ViewerDataModel.Instance.MarkupControls.Where(data => data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(a => |
||
302 | { |
||
303 | ViewerDataModel.Instance.MarkupControls.Remove(a); |
||
304 | }); |
||
305 | |||
306 | ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(a => |
||
307 | { |
||
308 | ViewerDataModel.Instance.MarkupControls_USER.Remove(a); |
||
309 | }); |
||
310 | |||
311 | ViewerDataModel.Instance.MarkupList_USER.Where(data => data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(a => |
||
312 | { |
||
313 | ComingNewBieEnd = false; |
||
314 | ViewerDataModel.Instance.MarkupList_USER.Remove(a); |
||
315 | 6707a5c7 | ljiyeon | //임시파일에서도 삭제 |
316 | for (int i = 0; i < item.MarkupList.Count; i++) |
||
317 | { |
||
318 | temp.DelTemp(item.MarkupList[i].ID, this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber.ToString()); |
||
319 | } |
||
320 | 787a4489 | KangIngu | }); |
321 | |||
322 | gridViewMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoList; |
||
323 | if (PreviewUserMarkupInfoItem == null && gridViewMarkup.SelectedItems.Where(d => (d as MarkupInfoItem).UserID == App.ViewInfo.UserID).FirstOrDefault() == null) |
||
324 | { |
||
325 | if (gridViewMarkup.Items.Cast<MarkupInfoItem>().ToList().Where(d => d.UserID == App.ViewInfo.UserID).Count() == 0) |
||
326 | { |
||
327 | var infoId = Events.Save.shortGuid(); |
||
328 | PreviewUserMarkupInfoItem = new MarkupInfoItem |
||
329 | { |
||
330 | CreateTime = DateTime.Now, |
||
331 | Depatment = userData.DEPARTMENT, |
||
332 | 992a98b4 | KangIngu | UpdateTime = DateTime.Now, |
333 | 787a4489 | KangIngu | DisplayColor = "#FFFF0000", |
334 | UserID = userData.ID, |
||
335 | UserName = userData.NAME, |
||
336 | PageCount = 1, |
||
337 | Description = "", |
||
338 | MarkupInfoID = infoId, |
||
339 | MarkupList = null, |
||
340 | MarkupVersionID = Events.Save.shortGuid(), |
||
341 | Consolidate = 0, |
||
342 | PartConsolidate = 0, |
||
343 | userDelete = true, |
||
344 | AvoidConsolidate = 0, |
||
345 | IsPreviewUser = true |
||
346 | }; |
||
347 | App.Custom_ViewInfoId = infoId; |
||
348 | } |
||
349 | } |
||
350 | BaseClient.DeleteMarkupAsync(App.ViewInfo.ProjectNO, item.MarkupInfoID); |
||
351 | } |
||
352 | |||
353 | public void DeleteCommentEvent(object sender, RoutedEventArgs e) |
||
354 | { |
||
355 | //선택된 어도너가 있을시 삭제가 되지 않음(강인구 추가) |
||
356 | this.ReleaseAdorner(); |
||
357 | |||
358 | Button content = (sender as Button); |
||
359 | MarkupInfoItem item = content.CommandParameter as MarkupInfoItem; |
||
360 | |||
361 | DeleteItem(item); |
||
362 | } |
||
363 | |||
364 | System.Windows.Media.Animation.DoubleAnimation da = new System.Windows.Media.Animation.DoubleAnimation(); |
||
365 | |||
366 | 6707a5c7 | ljiyeon | private static Timer timer; |
367 | private int InitInterval = KCOM.Properties.Settings.Default.InitInterval; |
||
368 | 787a4489 | KangIngu | private void MainMenu_Loaded(object sender, RoutedEventArgs e) |
369 | 0c997b99 | ljiyeon | { |
370 | ////측정 |
||
371 | //Stopwatch sw = new Stopwatch(); |
||
372 | //sw.Start(); |
||
373 | InitializeComponent(); |
||
374 | //System.Diagnostics.Debug.WriteLine("MainMenu() : " + sw.ElapsedMilliseconds.ToString() + "ms"); |
||
375 | |||
376 | 787a4489 | KangIngu | if (App.ParameterMode) |
377 | 6707a5c7 | ljiyeon | { |
378 | this.pageNavigator.PageChanging += pageNavigator_PageChanging; |
||
379 | imageViewer_Compare = new Image(); |
||
380 | layerControl.ProjectNo = App.ViewInfo.ProjectNO; |
||
381 | ViewerDataModel.Instance.Capture_Opacity = 0; |
||
382 | da.From = 0.8; |
||
383 | da.To = 0; |
||
384 | da.Duration = new Duration(TimeSpan.FromSeconds(1)); |
||
385 | da.AutoReverse = true; |
||
386 | da.RepeatBehavior = System.Windows.Media.Animation.RepeatBehavior.Forever; |
||
387 | } |
||
388 | timer = new Timer(timercallback, null, 0, InitInterval * 60000); |
||
389 | ccf944bb | ljiyeon | } |
390 | |||
391 | 6707a5c7 | ljiyeon | private void timercallback(Object o) |
392 | ccf944bb | ljiyeon | { |
393 | 6707a5c7 | ljiyeon | Stopwatch sw = new Stopwatch(); |
394 | sw.Start(); |
||
395 | TempFileAdd(); |
||
396 | sw.Stop(); |
||
397 | ccf944bb | ljiyeon | |
398 | 6707a5c7 | ljiyeon | Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate |
399 | ccf944bb | ljiyeon | { |
400 | 6707a5c7 | ljiyeon | if (this.ParentOfType<MainWindow>().dzTopMenu.cbAutoSave.IsChecked == true) //Auto Save Checked? |
401 | { |
||
402 | timer.Change(((int)this.ParentOfType<MainWindow>().dzTopMenu.cbSaveInterval.Value * 60000) / 2, sw.ElapsedMilliseconds); //Timer Setting |
||
403 | } |
||
404 | })); |
||
405 | ccf944bb | ljiyeon | |
406 | 6707a5c7 | ljiyeon | GC.Collect(); |
407 | } |
||
408 | ccf944bb | ljiyeon | |
409 | 6707a5c7 | ljiyeon | void TempFileAdd() |
410 | 44c5e27e | ljiyeon | { |
411 | 6707a5c7 | ljiyeon | Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate |
412 | ccf944bb | ljiyeon | { |
413 | 44c5e27e | ljiyeon | if (ViewerDataModel.Instance.UndoDataList.Count > 0) |
414 | ccf944bb | ljiyeon | { |
415 | 44c5e27e | ljiyeon | DateTime undoTime = ViewerDataModel.Instance.UndoDataList.OrderByDescending(order => order.EventTime).FirstOrDefault().EventTime; |
416 | DateTime updatetime = DateTime.Now.AddDays(-1); |
||
417 | if (ViewerDataModel.Instance._markupInfoList.Count > 0) |
||
418 | { |
||
419 | updatetime = ViewerDataModel.Instance._markupInfoList.OrderByDescending(order => order.UpdateTime).FirstOrDefault().UpdateTime; |
||
420 | } |
||
421 | ccf944bb | ljiyeon | |
422 | 6707a5c7 | ljiyeon | EmptyControlCheck(); |
423 | ccf944bb | ljiyeon | |
424 | 6707a5c7 | ljiyeon | if (undoTime > updatetime) |
425 | ccf944bb | ljiyeon | { |
426 | 6707a5c7 | ljiyeon | if (ViewerDataModel.Instance.MarkupControls_USER.Count > 0) |
427 | ccf944bb | ljiyeon | { |
428 | 6707a5c7 | ljiyeon | foreach (var control in ViewerDataModel.Instance.MarkupControls_USER) |
429 | { |
||
430 | var root = layerControl.MarkupToString(control, App.ViewInfo.UserID); |
||
431 | 44c5e27e | ljiyeon | |
432 | 6707a5c7 | ljiyeon | var existItem = ViewerDataModel.Instance.MarkupList_USER.Where(data => data.ID == root.CommentID).FirstOrDefault(); |
433 | if (existItem != null) |
||
434 | { |
||
435 | 44c5e27e | ljiyeon | if (existItem.Data != root.ConvertData) |
436 | 6707a5c7 | ljiyeon | { |
437 | tempDtList.Add(new TempDt() |
||
438 | { |
||
439 | CommentID = control.CommentID, |
||
440 | ConvertData = root.ConvertData, |
||
441 | DATA_TYPE = root.DATA_TYPE, |
||
442 | MarkupInfoID = App.Custom_ViewInfoId, |
||
443 | PageNumber = this.pageNavigator.CurrentPage.PageNumber, |
||
444 | IsUpdate = 1 |
||
445 | }); |
||
446 | } |
||
447 | } |
||
448 | else //신규 추가 된 코멘트 |
||
449 | { |
||
450 | if (root.CommentID != null) |
||
451 | { |
||
452 | var currentCommentCheck = ViewerDataModel.Instance.MarkupList_USER.Where(dt => dt.ID == control.CommentID).FirstOrDefault(); |
||
453 | if (currentCommentCheck != null) |
||
454 | { |
||
455 | tempDtList.Add(new TempDt() |
||
456 | { |
||
457 | CommentID = control.CommentID, |
||
458 | ConvertData = root.ConvertData, |
||
459 | DATA_TYPE = root.DATA_TYPE, |
||
460 | MarkupInfoID = App.Custom_ViewInfoId, |
||
461 | PageNumber = this.pageNavigator.CurrentPage.PageNumber, |
||
462 | IsUpdate = 1 |
||
463 | }); |
||
464 | } |
||
465 | else |
||
466 | { |
||
467 | tempDtList.Add(new TempDt() |
||
468 | { |
||
469 | CommentID = control.CommentID, |
||
470 | ConvertData = root.ConvertData, |
||
471 | DATA_TYPE = root.DATA_TYPE, |
||
472 | MarkupInfoID = App.Custom_ViewInfoId, |
||
473 | PageNumber = this.pageNavigator.CurrentPage.PageNumber, |
||
474 | IsUpdate = 0 |
||
475 | }); |
||
476 | } |
||
477 | } |
||
478 | } |
||
479 | 44c5e27e | ljiyeon | } |
480 | 6707a5c7 | ljiyeon | } |
481 | ccf944bb | ljiyeon | |
482 | 6707a5c7 | ljiyeon | temp.WriteTemp(tempDtList); |
483 | tempDtList.Clear(); |
||
484 | ccf944bb | ljiyeon | } |
485 | } |
||
486 | 6707a5c7 | ljiyeon | })); |
487 | ccf944bb | ljiyeon | |
488 | 6707a5c7 | ljiyeon | } |
489 | ccf944bb | ljiyeon | |
490 | |||
491 | 6707a5c7 | ljiyeon | public class TempLoadData |
492 | { |
||
493 | public int PageNumber { get; set; } |
||
494 | public string CommentID { get; set; } |
||
495 | public string ConvertData { get; set; } |
||
496 | public string DATA_TYPE { get; set; } |
||
497 | public string MarkupInfoID { get; set; } |
||
498 | public int IsUpdate { get; set; } |
||
499 | } |
||
500 | ccf944bb | ljiyeon | |
501 | 6707a5c7 | ljiyeon | List<TempLoadData> tempLoadData = new List<TempLoadData>(); |
502 | public string FilePath = AppDomain.CurrentDomain.BaseDirectory + "Temp\\" + App.ViewInfo.DocumentItemID + ".tmp"; |
||
503 | ccf944bb | ljiyeon | |
504 | 6707a5c7 | ljiyeon | public void TempLoad() |
505 | { |
||
506 | if ((System.IO.File.Exists(FilePath)) == true) |
||
507 | { |
||
508 | XmlDocument xdoc = new XmlDocument(); |
||
509 | xdoc.Load(FilePath); |
||
510 | XmlNodeList nodes = xdoc.SelectNodes("/Root/CommentID"); |
||
511 | int PageNumber = 0; |
||
512 | if (nodes.Count > 0) |
||
513 | { |
||
514 | if (MessageBox.Show("저장하지 못한 데이터가 있습니다. 불러오시겠습니까?", "MARKUS", MessageBoxButton.OKCancel) == MessageBoxResult.OK) |
||
515 | ccf944bb | ljiyeon | { |
516 | 6707a5c7 | ljiyeon | foreach (XmlNode node in nodes) |
517 | ccf944bb | ljiyeon | { |
518 | 6707a5c7 | ljiyeon | string CommentID = node.Attributes["Value"].Value; |
519 | string ConvertData = node.SelectSingleNode("ConvertData").InnerText; |
||
520 | string DATA_TYPE = node.SelectSingleNode("DATA_TYPE").InnerText; |
||
521 | string MarkupInfoID = node.SelectSingleNode("MarkupInfoID").InnerText; |
||
522 | int IsUpdate = Convert.ToInt32(node.SelectSingleNode("IsUpdate").InnerText); |
||
523 | PageNumber = Convert.ToInt32(node.SelectSingleNode("PageNumber").InnerText); |
||
524 | |||
525 | tempLoadData.Add(new TempLoadData() |
||
526 | ccf944bb | ljiyeon | { |
527 | 6707a5c7 | ljiyeon | PageNumber = PageNumber, |
528 | CommentID = CommentID, |
||
529 | ConvertData = ConvertData, |
||
530 | DATA_TYPE = DATA_TYPE, |
||
531 | MarkupInfoID = MarkupInfoID, |
||
532 | IsUpdate = IsUpdate |
||
533 | ccf944bb | ljiyeon | }); |
534 | 6707a5c7 | ljiyeon | } |
535 | ccf944bb | ljiyeon | |
536 | 6707a5c7 | ljiyeon | if (PageNumber > 0) |
537 | { |
||
538 | this.pageNavigator.GotoPage(PageNumber); |
||
539 | } |
||
540 | ccf944bb | ljiyeon | |
541 | 6707a5c7 | ljiyeon | // Temp Object add |
542 | if (pageNavigator.CurrentPage.PageNumber == PageNumber) |
||
543 | { |
||
544 | TempControlLoad(); |
||
545 | } |
||
546 | tempLoadData.Clear(); |
||
547 | } |
||
548 | } |
||
549 | else //파일 삭제 |
||
550 | { |
||
551 | temp.Remove(); |
||
552 | } |
||
553 | } |
||
554 | ccf944bb | ljiyeon | } |
555 | 6707a5c7 | ljiyeon | |
556 | 787a4489 | KangIngu | |
557 | public void ReleaseAdorner() |
||
558 | { |
||
559 | if (SelectLayer.Children.Count > 0) |
||
560 | { |
||
561 | foreach (var item in SelectLayer.Children) |
||
562 | { |
||
563 | if (item.GetType().Name == "AdornerFinal") |
||
564 | { |
||
565 | (item as AdornerFinal).unRegister(); |
||
566 | |||
567 | foreach (var InnerItem in (item as AdornerFinal).MemberSet.Cast<AdornerMember>()) |
||
568 | { |
||
569 | if (!ViewerDataModel.Instance.MarkupControls_USER.Contains(InnerItem.DrawingData)) |
||
570 | { |
||
571 | if (InnerItem.DrawingData.GetType().Name == "PolygonControl") |
||
572 | { |
||
573 | if ((InnerItem.DrawingData as PolygonControl).CommentID == null) |
||
574 | { |
||
575 | (InnerItem.DrawingData as PolygonControl).CommentID = KCOM.Events.Save.shortGuid(); |
||
576 | } |
||
577 | } |
||
578 | |||
579 | ViewerDataModel.Instance.MarkupControls_USER.Add(InnerItem.DrawingData as CommentUserInfo); |
||
580 | } |
||
581 | } |
||
582 | } |
||
583 | } |
||
584 | SelectLayer.Children.Clear(); |
||
585 | } |
||
586 | } |
||
587 | |||
588 | public List<CommentUserInfo> AddAdorner() |
||
589 | { |
||
590 | List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>(); |
||
591 | |||
592 | if (SelectLayer.Children.Count > 0) |
||
593 | { |
||
594 | foreach (var item in SelectLayer.Children) |
||
595 | { |
||
596 | if (item.GetType().Name == "AdornerFinal") |
||
597 | { |
||
598 | (item as AdornerFinal).unRegister(); |
||
599 | |||
600 | foreach (var InnerItem in (item as AdornerFinal).MemberSet.Cast<AdornerMember>()) |
||
601 | { |
||
602 | if (!ViewerDataModel.Instance.MarkupControls_USER.Contains(InnerItem.DrawingData)) |
||
603 | { |
||
604 | adornerSet.Add(InnerItem.DrawingData as CommentUserInfo); |
||
605 | } |
||
606 | |||
607 | Control_Style(InnerItem.DrawingData as CommentUserInfo); |
||
608 | |||
609 | UndoData.Markup_List.Add(multi_Undo_Data); |
||
610 | multi_Undo_Data = new Multi_Undo_data(); |
||
611 | } |
||
612 | } |
||
613 | } |
||
614 | SelectLayer.Children.Clear(); |
||
615 | } |
||
616 | return adornerSet; |
||
617 | } |
||
618 | |||
619 | public void ChangeCommentReact() |
||
620 | { |
||
621 | bool isComingNewBie = false; |
||
622 | |||
623 | if (ViewerDataModel.Instance.MarkupControls_USER.Count > 0) |
||
624 | { |
||
625 | foreach (var control in ViewerDataModel.Instance.MarkupControls_USER) |
||
626 | { |
||
627 | var root = layerControl.MarkupToString(control, App.ViewInfo.UserID); |
||
628 | d7548b21 | ljiyeon | |
629 | 6707a5c7 | ljiyeon | var existItem = ViewerDataModel.Instance.MarkupList_USER.Where(data => data.ID == root.CommentID).FirstOrDefault(); |
630 | if (existItem != null) //신규 추가 된 코멘트 |
||
631 | { |
||
632 | if (existItem.Data != root.ConvertData) //코멘트가 같은지 |
||
633 | 787a4489 | KangIngu | { |
634 | 6707a5c7 | ljiyeon | existItem.Data = root.ConvertData; |
635 | existItem.IsUpdate = true; |
||
636 | d7548b21 | ljiyeon | } |
637 | 6707a5c7 | ljiyeon | } |
638 | else |
||
639 | { |
||
640 | if (root.CommentID != null) |
||
641 | d7548b21 | ljiyeon | { |
642 | 6707a5c7 | ljiyeon | isComingNewBie = true; |
643 | var currentCommentCheck = ViewerDataModel.Instance.MarkupList_USER.Where(dt => dt.ID == control.CommentID).FirstOrDefault(); |
||
644 | if (currentCommentCheck != null) |
||
645 | 787a4489 | KangIngu | { |
646 | 6707a5c7 | ljiyeon | currentCommentCheck.Data = root.ConvertData; |
647 | } |
||
648 | else |
||
649 | { |
||
650 | ViewerDataModel.Instance.MarkupList_USER.Add(new MarkupItemEx |
||
651 | 787a4489 | KangIngu | { |
652 | 6707a5c7 | ljiyeon | ID = control.CommentID, |
653 | Data = root.ConvertData, |
||
654 | Data_Type = root.DATA_TYPE, |
||
655 | MarkupInfoID = App.Custom_ViewInfoId, |
||
656 | PageNumber = this.pageNavigator.CurrentPage.PageNumber, |
||
657 | }); |
||
658 | 787a4489 | KangIngu | } |
659 | } |
||
660 | 6707a5c7 | ljiyeon | } |
661 | 787a4489 | KangIngu | } |
662 | } |
||
663 | |||
664 | 6707a5c7 | ljiyeon | |
665 | 787a4489 | KangIngu | if (PreviewUserMarkupInfoItem != null && isComingNewBie && !ComingNewBieEnd) |
666 | { |
||
667 | if (ViewerDataModel.Instance._markupInfoList.Where(info => info.UserID == PreviewUserMarkupInfoItem.UserID).FirstOrDefault() == null) |
||
668 | { |
||
669 | ComingNewBieEnd = true; |
||
670 | ViewerDataModel.Instance._markupInfoList.Insert(0, PreviewUserMarkupInfoItem); |
||
671 | PreviewUserMarkupInfoItem.IsPreviewUser = false; |
||
672 | gridViewMarkup.ItemsSource = null; |
||
673 | gridViewMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoList; |
||
674 | gridViewMarkup.SelectedItem = PreviewUserMarkupInfoItem; |
||
675 | } |
||
676 | } |
||
677 | |||
678 | } |
||
679 | |||
680 | MarkupToPDF.Controls.Parsing.LayerControl layerControl = new MarkupToPDF.Controls.Parsing.LayerControl(); |
||
681 | bool ComingNewBieEnd = false; |
||
682 | |||
683 | private void pageNavigator_PageChanging(object sender, Controls.Sample.PageChangeEventArgs e) |
||
684 | 23a96932 | djkim | { |
685 | 316d0f5c | KangIngu | if (ViewerDataModel.Instance.UndoDataList.Count > 0) |
686 | d7548b21 | ljiyeon | { |
687 | 316d0f5c | KangIngu | this.ParentOfType<MainWindow>().dzTopMenu.SaveEvent(null, null); |
688 | } |
||
689 | 6707a5c7 | ljiyeon | |
690 | 787a4489 | KangIngu | ViewerDataModel.Instance.UndoDataList.Clear(); |
691 | 6707a5c7 | ljiyeon | |
692 | 787a4489 | KangIngu | InkControl_Convert(); |
693 | |||
694 | ReleaseAdorner(); |
||
695 | ChangeCommentReact(); |
||
696 | CompareMode.IsChecked = false; |
||
697 | var BalancePoint = ViewerDataModel.Instance.PageBalanceMode == true ? e.PageNumber + ViewerDataModel.Instance.PageBalanceNumber : e.PageNumber; |
||
698 | |||
699 | |||
700 | #region 페이지가 벗어난 경우 |
||
701 | |||
702 | if (BalancePoint < 1) |
||
703 | { |
||
704 | BalancePoint = 1; |
||
705 | ViewerDataModel.Instance.PageBalanceNumber = 0; |
||
706 | } |
||
707 | |||
708 | if (pageNavigator.PageCount < BalancePoint) |
||
709 | { |
||
710 | BalancePoint = pageNavigator.PageCount; |
||
711 | ViewerDataModel.Instance.PageBalanceNumber = 0; |
||
712 | } |
||
713 | |||
714 | #endregion |
||
715 | |||
716 | ViewerDataModel.Instance.PageNumber = BalancePoint; |
||
717 | |||
718 | a874198d | humkyung | string uri = ""; |
719 | a1716fa5 | KangIngu | if (userData.COMPANY != "EXT") |
720 | a874198d | humkyung | { |
721 | uri = String.Format(Properties.Settings.Default.mainServerImageWebPath, _ViewInfo.ProjectNO, (Convert.ToInt32(_ViewInfo.DocumentItemID) / 100).ToString(), _ViewInfo.DocumentItemID, e.PageNumber); |
||
722 | } |
||
723 | else |
||
724 | { |
||
725 | uri = String.Format(Properties.Settings.Default.subServerImageWebPath, _ViewInfo.ProjectNO, _ViewInfo.DocumentItemID, e.PageNumber); |
||
726 | } |
||
727 | 787a4489 | KangIngu | |
728 | 8a9f6742 | djkim | var defaultBitmapImage = new BitmapImage(); |
729 | defaultBitmapImage.BeginInit(); |
||
730 | defaultBitmapImage.CreateOptions = BitmapCreateOptions.IgnoreImageCache; |
||
731 | defaultBitmapImage.CacheOption = BitmapCacheOption.OnLoad; |
||
732 | defaultBitmapImage.UriSource = new Uri(uri); |
||
733 | defaultBitmapImage.EndInit(); |
||
734 | |||
735 | ViewerDataModel.Instance.ImageViewPath = null; |
||
736 | 4ca11b36 | djkim | GC.Collect(); |
737 | 787a4489 | KangIngu | |
738 | if (defaultBitmapImage.IsDownloading) |
||
739 | { |
||
740 | defaultBitmapImage.DownloadCompleted += (ex, arg) => |
||
741 | { |
||
742 | 8a9f6742 | djkim | defaultBitmapImage.Freeze(); |
743 | mainPanel.UpdateLayout(); |
||
744 | 4ca11b36 | djkim | GC.Collect(); |
745 | 787a4489 | KangIngu | ViewerDataModel.Instance.ImageViewPath = defaultBitmapImage; |
746 | ViewerDataModel.Instance.ImageViewWidth = defaultBitmapImage.PixelWidth; |
||
747 | ViewerDataModel.Instance.ImageViewHeight = defaultBitmapImage.PixelHeight; |
||
748 | }; |
||
749 | } |
||
750 | |||
751 | zoomAndPanCanvas.Width = Convert.ToDouble(e.CurrentPage.PAGE_WIDTH); |
||
752 | zoomAndPanCanvas.Height = Convert.ToDouble(e.CurrentPage.PAGE_HEIGHT); |
||
753 | |||
754 | |||
755 | Common.ViewerDataModel.Instance.ContentWidth = zoomAndPanCanvas.Width; |
||
756 | Common.ViewerDataModel.Instance.ContentHeight = zoomAndPanCanvas.Height; |
||
757 | inkBoard.Width = zoomAndPanCanvas.Width; |
||
758 | inkBoard.Height = zoomAndPanCanvas.Height; |
||
759 | |||
760 | 6707a5c7 | ljiyeon | |
761 | 787a4489 | KangIngu | |
762 | if (!testPanel2.IsHidden) |
||
763 | { |
||
764 | //PDF모드일때 잠시 대기(강인구) |
||
765 | if (IsSyncPDFMode) |
||
766 | { |
||
767 | Get_FinalImage.Get_PdfImage get_PdfImage = new Get_FinalImage.Get_PdfImage(); |
||
768 | var pdfpath = new BitmapImage(new Uri(get_PdfImage.Run(CurrentRev.TO_VENDOR, App.ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber))); |
||
769 | |||
770 | if (pdfpath.IsDownloading) |
||
771 | { |
||
772 | pdfpath.DownloadCompleted += (ex, arg) => |
||
773 | { |
||
774 | ViewerDataModel.Instance.ImageViewPath_C = pdfpath; |
||
775 | ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth; |
||
776 | ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight; |
||
777 | zoomAndPanCanvas2.Width = pdfpath.PixelWidth; |
||
778 | zoomAndPanCanvas2.Height = pdfpath.PixelHeight; |
||
779 | }; |
||
780 | } |
||
781 | else |
||
782 | { |
||
783 | ViewerDataModel.Instance.ImageViewPath_C = pdfpath; |
||
784 | ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth; |
||
785 | ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight; |
||
786 | |||
787 | zoomAndPanCanvas2.Width = pdfpath.PixelWidth; |
||
788 | zoomAndPanCanvas2.Height = pdfpath.PixelHeight; |
||
789 | } |
||
790 | } |
||
791 | else |
||
792 | { |
||
793 | a874198d | humkyung | string uri2 = ""; |
794 | a1716fa5 | KangIngu | if (userData.COMPANY != "EXT") |
795 | a874198d | humkyung | { |
796 | uri2 = String.Format(Properties.Settings.Default.mainServerImageWebPath, _ViewInfo.ProjectNO, (Convert.ToInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, BalancePoint); |
||
797 | } |
||
798 | else |
||
799 | { |
||
800 | uri2 = String.Format(Properties.Settings.Default.subServerImageWebPath, _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, BalancePoint); |
||
801 | } |
||
802 | a1716fa5 | KangIngu | |
803 | 787a4489 | KangIngu | |
804 | var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri2)); |
||
805 | |||
806 | ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare; |
||
807 | ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth; |
||
808 | ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight; |
||
809 | zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth; |
||
810 | zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight; |
||
811 | |||
812 | zoomAndPanControl.ZoomTo(new Rect |
||
813 | { |
||
814 | X = 0, |
||
815 | Y = 0, |
||
816 | Width = Math.Max(zoomAndPanCanvas.Width, zoomAndPanCanvas2.Width), |
||
817 | Height = Math.Max(zoomAndPanCanvas.Height, zoomAndPanCanvas2.Height), |
||
818 | }); |
||
819 | |||
820 | if (defaultBitmapImage_Compare.IsDownloading) |
||
821 | { |
||
822 | defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) => |
||
823 | { |
||
824 | |||
825 | ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare; |
||
826 | ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth; |
||
827 | ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight; |
||
828 | |||
829 | zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth; |
||
830 | zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight; |
||
831 | |||
832 | zoomAndPanControl.ZoomTo(new Rect |
||
833 | { |
||
834 | X = 0, |
||
835 | Y = 0, |
||
836 | Width = Math.Max(zoomAndPanCanvas.Width, zoomAndPanCanvas2.Width), |
||
837 | Height = Math.Max(zoomAndPanCanvas.Height, zoomAndPanCanvas2.Height), |
||
838 | }); |
||
839 | }; |
||
840 | } |
||
841 | } |
||
842 | tlSyncPageNum.Text = String.Format("Current Page : {0}", BalancePoint); |
||
843 | } |
||
844 | |||
845 | this.pageNavigator.SetNextPage(); |
||
846 | |||
847 | if (zoomAndPanCanvas2.Width.IsNaN()) |
||
848 | { |
||
849 | zoomAndPanControl.ZoomTo(new Rect { X = 0, Y = 0, Width = zoomAndPanCanvas.Width, Height = zoomAndPanCanvas.Height }); |
||
850 | } |
||
851 | |||
852 | Common.ViewerDataModel.Instance.MarkupControls_USER.Clear(); //전체 제거 |
||
853 | Common.ViewerDataModel.Instance.MarkupControls.Clear(); //전체 제거 |
||
854 | |||
855 | List<MarkupInfoItem> gridSelectionItem = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업 |
||
856 | d7548b21 | ljiyeon | |
857 | 787a4489 | KangIngu | foreach (var item in gridSelectionItem) |
858 | { |
||
859 | if (item.UserID == App.ViewInfo.UserID) |
||
860 | { |
||
861 | 6707a5c7 | ljiyeon | ViewerDataModel.Instance.current_page_commentcnt = ViewerDataModel.Instance.MarkupList_USER.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList().Count; |
862 | 787a4489 | KangIngu | ViewerDataModel.Instance.MarkupList_USER.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(delegate (MarkupItemEx markupitem) |
863 | { |
||
864 | layerControl.markupParseEx(markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, item.DisplayColor, "", item.MarkupInfoID, markupitem.ID); |
||
865 | }); |
||
866 | 6707a5c7 | ljiyeon | |
867 | 787a4489 | KangIngu | } |
868 | else |
||
869 | { |
||
870 | ViewerDataModel.Instance.MarkupList_Pre.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(delegate (MarkupItemEx markupitem) |
||
871 | { |
||
872 | layerControl.markupParse(markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls, item.DisplayColor, "", item.MarkupInfoID); |
||
873 | }); |
||
874 | } |
||
875 | } |
||
876 | 6707a5c7 | ljiyeon | |
877 | 787a4489 | KangIngu | if (!testPanel2.IsHidden) |
878 | { |
||
879 | dd0ffcfb | KangIngu | ViewerDataModel.Instance.Sync_ContentOffsetX = zoomAndPanControl.ContentOffsetX; |
880 | ViewerDataModel.Instance.Sync_ContentOffsetY = zoomAndPanControl.ContentOffsetY; |
||
881 | ViewerDataModel.Instance.Sync_ContentScale = zoomAndPanControl.ContentScale; |
||
882 | |||
883 | 787a4489 | KangIngu | Common.ViewerDataModel.Instance.MarkupControls_Sync.Clear(); |
884 | List<MarkupInfoItem> gridSelectionRevItem = gridViewRevMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); |
||
885 | |||
886 | |||
887 | foreach (var item in gridSelectionRevItem) |
||
888 | { |
||
889 | item.MarkupList.Where(pageItem => pageItem.PageNumber == BalancePoint).ToList().ForEach(delegate (MarkupItem markupitem) |
||
890 | { |
||
891 | layerControl.markupParse(markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync, item.DisplayColor, "", item.MarkupInfoID); |
||
892 | }); |
||
893 | } |
||
894 | |||
895 | } |
||
896 | |||
897 | var instanceMain = this.ParentOfType<MainWindow>(); |
||
898 | instanceMain.dzTopMenu.tlcurrentPage.Text = e.CurrentPage.PAGE_NUMBER.ToString(); |
||
899 | 992a98b4 | KangIngu | instanceMain.dzTopMenu.tlcurrentPage_readonly.Text = e.CurrentPage.PAGE_NUMBER.ToString(); |
900 | 787a4489 | KangIngu | |
901 | instanceMain.dzTopMenu.rotateOffSet = 0; |
||
902 | var pageinfo = this.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == e.CurrentPage.PAGE_NUMBER).FirstOrDefault(); |
||
903 | drawingPannelRotate(pageinfo.PAGE_ANGLE); |
||
904 | |||
905 | //} |
||
906 | SetCommentPages(true); |
||
907 | } |
||
908 | 6707a5c7 | ljiyeon | |
909 | |||
910 | //Temp Control Load |
||
911 | public void TempControlLoad() |
||
912 | { |
||
913 | List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>(); |
||
914 | |||
915 | for (int k = 0; k < tempLoadData.Count; k++) |
||
916 | { |
||
917 | System.Windows.Controls.Control item = null; |
||
918 | Multi_Undo_data multi_Undo_Data; |
||
919 | |||
920 | |||
921 | switch (tempLoadData[k].IsUpdate) |
||
922 | { |
||
923 | case 0://추가 |
||
924 | var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.CommentID == tempLoadData[k].CommentID).FirstOrDefault(); |
||
925 | if (control != null) |
||
926 | { |
||
927 | ViewerDataModel.Instance.MarkupControls_USER.Remove(control); |
||
928 | var Item_ = ViewerDataModel.Instance.MarkupList_USER.Where(d => d.ID == (control as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault(); |
||
929 | ViewerDataModel.Instance.MarkupList_USER.Remove(Item_); |
||
930 | } |
||
931 | |||
932 | //Control |
||
933 | item = layerControl.TempMarkupParseEx(tempLoadData[k].ConvertData, Common.ViewerDataModel.Instance.MarkupControls_USER, "#FFFF0000", "", tempLoadData[k].MarkupInfoID, tempLoadData[k].CommentID); |
||
934 | |||
935 | UndoData = new Undo_data() |
||
936 | { |
||
937 | IsUndo = false, |
||
938 | Event = Event_Type.Create, |
||
939 | EventTime = DateTime.Now, |
||
940 | Opacity = ViewerDataModel.Instance.ControlOpacity, |
||
941 | Markup_List = new List<Multi_Undo_data>() |
||
942 | }; |
||
943 | |||
944 | multi_Undo_Data = new Multi_Undo_data(); |
||
945 | multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(item as MarkupToPDF.Common.CommentUserInfo); |
||
946 | UndoData.Markup_List.Add(multi_Undo_Data); |
||
947 | ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
||
948 | break; |
||
949 | case 1://수정 |
||
950 | control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.CommentID == tempLoadData[k].CommentID).FirstOrDefault(); |
||
951 | if (control != null) |
||
952 | { |
||
953 | ViewerDataModel.Instance.MarkupControls_USER.Remove(control); |
||
954 | var Item_ = ViewerDataModel.Instance.MarkupList_USER.Where(d => d.ID == (control as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault(); |
||
955 | ViewerDataModel.Instance.MarkupList_USER.Remove(Item_); |
||
956 | } |
||
957 | |||
958 | //Control |
||
959 | item = layerControl.TempMarkupParseEx(tempLoadData[k].ConvertData, Common.ViewerDataModel.Instance.MarkupControls_USER, "#FFFF0000", "", tempLoadData[k].MarkupInfoID, tempLoadData[k].CommentID); |
||
960 | |||
961 | UndoData = new Undo_data() |
||
962 | { |
||
963 | IsUndo = false, |
||
964 | Event = Event_Type.Thumb, |
||
965 | EventTime = DateTime.Now, |
||
966 | Opacity = ViewerDataModel.Instance.ControlOpacity, |
||
967 | Markup_List = new List<Multi_Undo_data>() |
||
968 | }; |
||
969 | |||
970 | multi_Undo_Data = new Multi_Undo_data(); |
||
971 | multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(item as MarkupToPDF.Common.CommentUserInfo); |
||
972 | UndoData.Markup_List.Add(multi_Undo_Data); |
||
973 | ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
||
974 | break; |
||
975 | case 2://삭제 |
||
976 | |||
977 | control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.CommentID == tempLoadData[k].CommentID).FirstOrDefault(); |
||
978 | if (control != null) |
||
979 | { |
||
980 | ViewerDataModel.Instance.MarkupControls_USER.Remove(control); |
||
981 | var Item_ = ViewerDataModel.Instance.MarkupList_USER.Where(d => d.ID == (control as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault(); |
||
982 | ViewerDataModel.Instance.MarkupList_USER.Remove(Item_); |
||
983 | } |
||
984 | break; |
||
985 | } |
||
986 | } |
||
987 | } |
||
988 | 787a4489 | KangIngu | |
989 | private void SetCommentPages(bool onlyMe = false) |
||
990 | { |
||
991 | |||
992 | List<UsersCommentPagesMember> _pages = new List<UsersCommentPagesMember>(); |
||
993 | foreach (var item in ViewerDataModel.Instance._markupInfoList) |
||
994 | { |
||
995 | UsersCommentPagesMember instance = new UsersCommentPagesMember(); |
||
996 | instance.UserName = item.UserName; |
||
997 | instance.Depart = item.Depatment; |
||
998 | instance.MarkupInfoID = item.MarkupInfoID; |
||
999 | instance.IsSelected = true; |
||
1000 | instance.isConSolidation = item.Consolidate; |
||
1001 | instance.SetColor = item.DisplayColor; |
||
1002 | if (item.UserID == App.ViewInfo.UserID && item.MarkupInfoID == item.MarkupInfoID) |
||
1003 | { |
||
1004 | instance.PageNumber = ViewerDataModel.Instance.MarkupList_USER.Select(d => d.PageNumber).ToList(); |
||
1005 | } |
||
1006 | else |
||
1007 | { |
||
1008 | instance.PageNumber = ViewerDataModel.Instance.MarkupList_Pre.Where(data => data.MarkupInfoID == item.MarkupInfoID).Select(d => d.PageNumber).ToList(); |
||
1009 | } |
||
1010 | _pages.Add(instance); |
||
1011 | } |
||
1012 | this.pageNavigator.SetCommentList(_pages.ToList()); |
||
1013 | } |
||
1014 | |||
1015 | private void zoomAndPanControl_MouseWheel(object sender, MouseWheelEventArgs e) |
||
1016 | { |
||
1017 | if (e.MiddleButton == MouseButtonState.Pressed) |
||
1018 | { |
||
1019 | |||
1020 | } |
||
1021 | e.Handled = true; |
||
1022 | if (e.Delta > 0) |
||
1023 | { |
||
1024 | Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas); |
||
1025 | ZoomIn(currentContentMousePoint); |
||
1026 | } |
||
1027 | else |
||
1028 | { |
||
1029 | Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas); |
||
1030 | ZoomOut(currentContentMousePoint); |
||
1031 | } |
||
1032 | } |
||
1033 | |||
1034 | a1716fa5 | KangIngu | private void zoomAndPanControl2_MouseWheel(object sender, MouseWheelEventArgs e) |
1035 | { |
||
1036 | e.Handled = true; |
||
1037 | if (e.Delta > 0) |
||
1038 | { |
||
1039 | Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas2); |
||
1040 | ZoomIn_Sync(currentContentMousePoint); |
||
1041 | } |
||
1042 | else |
||
1043 | { |
||
1044 | Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas2); |
||
1045 | ZoomOut_Sync(currentContentMousePoint); |
||
1046 | } |
||
1047 | } |
||
1048 | |||
1049 | 787a4489 | KangIngu | #region ZoomIn & ZoomOut |
1050 | |||
1051 | private void ZoomOut_Executed(object sender, ExecutedRoutedEventArgs e) |
||
1052 | { |
||
1053 | ZoomOut(new Point(zoomAndPanControl.ContentZoomFocusX, |
||
1054 | zoomAndPanControl.ContentZoomFocusY)); |
||
1055 | } |
||
1056 | |||
1057 | private void ZoomIn_Executed(object sender, ExecutedRoutedEventArgs e) |
||
1058 | { |
||
1059 | ZoomIn(new Point(zoomAndPanControl.ContentZoomFocusX, |
||
1060 | zoomAndPanControl.ContentZoomFocusY)); |
||
1061 | } |
||
1062 | |||
1063 | |||
1064 | //강인구 추가 (줌 인아웃 수치 변경) |
||
1065 | //큰해상도의 문서일 경우 줌 인 아웃시 사이즈 변동이 큼 |
||
1066 | private void ZoomOut(Point contentZoomCenter) |
||
1067 | { |
||
1068 | if (zoomAndPanControl.ContentScale > 0.39) |
||
1069 | { |
||
1070 | zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale - 0.2, contentZoomCenter); |
||
1071 | } |
||
1072 | else |
||
1073 | { |
||
1074 | zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale / 2, contentZoomCenter); |
||
1075 | } |
||
1076 | |||
1077 | 9cd2865b | KangIngu | if (zoomAndPanControl2 != null && Sync.IsChecked) |
1078 | 787a4489 | KangIngu | { |
1079 | 9cd2865b | KangIngu | zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl.ContentScale, contentZoomCenter); |
1080 | 787a4489 | KangIngu | } |
1081 | } |
||
1082 | |||
1083 | private void ZoomIn(Point contentZoomCenter) |
||
1084 | { |
||
1085 | if (zoomAndPanControl.ContentScale > 0.19) |
||
1086 | { |
||
1087 | zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale + 0.2, contentZoomCenter); |
||
1088 | } |
||
1089 | else |
||
1090 | { |
||
1091 | zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale * 2, contentZoomCenter); |
||
1092 | } |
||
1093 | |||
1094 | 9cd2865b | KangIngu | if (zoomAndPanControl2 != null && Sync.IsChecked) |
1095 | 787a4489 | KangIngu | { |
1096 | 9cd2865b | KangIngu | zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl.ContentScale, contentZoomCenter); |
1097 | 787a4489 | KangIngu | } |
1098 | a1716fa5 | KangIngu | |
1099 | } |
||
1100 | |||
1101 | private void ZoomOut_Sync(Point contentZoomCenter) |
||
1102 | { |
||
1103 | if (zoomAndPanControl2.ContentScale > 0.39) |
||
1104 | { |
||
1105 | zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale - 0.2, contentZoomCenter); |
||
1106 | } |
||
1107 | else |
||
1108 | { |
||
1109 | zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale / 2, contentZoomCenter); |
||
1110 | } |
||
1111 | |||
1112 | if (Sync.IsChecked) |
||
1113 | { |
||
1114 | zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl2.ContentScale, contentZoomCenter); |
||
1115 | } |
||
1116 | } |
||
1117 | |||
1118 | private void ZoomIn_Sync(Point contentZoomCenter) |
||
1119 | { |
||
1120 | if (zoomAndPanControl2.ContentScale > 0.19) |
||
1121 | { |
||
1122 | zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale + 0.2, contentZoomCenter); |
||
1123 | } |
||
1124 | else |
||
1125 | { |
||
1126 | zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale * 2, contentZoomCenter); |
||
1127 | } |
||
1128 | |||
1129 | if (Sync.IsChecked) |
||
1130 | { |
||
1131 | zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl2.ContentScale, contentZoomCenter); |
||
1132 | } |
||
1133 | 787a4489 | KangIngu | } |
1134 | |||
1135 | private void ZoomOut() |
||
1136 | { |
||
1137 | zoomAndPanControl.ContentScale -= 0.1; |
||
1138 | //if (zoomAndPanControl2 != null) |
||
1139 | //{ |
||
1140 | // zoomAndPanControl2.ContentScale -= 0.1; |
||
1141 | //} |
||
1142 | } |
||
1143 | |||
1144 | private void ZoomIn() |
||
1145 | { |
||
1146 | zoomAndPanControl.ContentScale += 0.1; |
||
1147 | //if (zoomAndPanControl2 != null) |
||
1148 | //{ |
||
1149 | // zoomAndPanControl2.ContentScale += 0.1; |
||
1150 | //} |
||
1151 | } |
||
1152 | |||
1153 | #endregion |
||
1154 | |||
1155 | private void init() |
||
1156 | { |
||
1157 | foreach (var item in ViewerDataModel.Instance.MarkupControls) |
||
1158 | { |
||
1159 | |||
1160 | ControlList.Clear(); |
||
1161 | listBox.Items.Clear(); |
||
1162 | selected_item.Clear(); |
||
1163 | |||
1164 | (item as IMarkupCommonData).IsSelected = false; |
||
1165 | } |
||
1166 | |||
1167 | } |
||
1168 | |||
1169 | private HitTestResultBehavior MyCallback(HitTestResult result) |
||
1170 | { |
||
1171 | //this.cursor = Cursors.UpArrow; |
||
1172 | var element = result.VisualHit; |
||
1173 | while (element != null && !(element is CommentUserInfo)) |
||
1174 | element = VisualTreeHelper.GetParent(element); |
||
1175 | |||
1176 | if (element == null) |
||
1177 | { |
||
1178 | return HitTestResultBehavior.Stop; |
||
1179 | } |
||
1180 | else |
||
1181 | { |
||
1182 | if (element is CommentUserInfo) |
||
1183 | { |
||
1184 | if (!hitList.Contains(element)) |
||
1185 | { |
||
1186 | hitList.Add((CommentUserInfo)element); |
||
1187 | } |
||
1188 | else |
||
1189 | { |
||
1190 | return HitTestResultBehavior.Stop; |
||
1191 | } |
||
1192 | //IntersectionDetail intersectionDetail = |
||
1193 | //((GeometryHitTestResult)result).IntersectionDetail; |
||
1194 | //switch (intersectionDetail) |
||
1195 | //{ |
||
1196 | // case IntersectionDetail.FullyContains: |
||
1197 | // // Add the hit test result to the list: |
||
1198 | // hitList.Add((CommentUserInfo)result.VisualHit); |
||
1199 | // return HitTestResultBehavior.Continue; |
||
1200 | // case IntersectionDetail.Intersects: |
||
1201 | // // Set the behavior to return visuals at all z-order levels: |
||
1202 | // return HitTestResultBehavior.Continue; |
||
1203 | // case IntersectionDetail.FullyInside: |
||
1204 | // // Set the behavior to return visuals at all z-order levels: |
||
1205 | // return HitTestResultBehavior.Continue; |
||
1206 | // default: |
||
1207 | // return HitTestResultBehavior.Stop; |
||
1208 | //} |
||
1209 | } |
||
1210 | } |
||
1211 | return HitTestResultBehavior.Continue; |
||
1212 | } |
||
1213 | |||
1214 | public void ReleaseSelectPath() |
||
1215 | { |
||
1216 | if (SelectionPath == null) |
||
1217 | { |
||
1218 | SelectionPath = new Path(); |
||
1219 | SelectionPath.Name = ""; |
||
1220 | } |
||
1221 | if (SelectionPath.Name != "") |
||
1222 | { |
||
1223 | SelectionPath.Name = "None"; |
||
1224 | } |
||
1225 | SelectionPath.Opacity = 0.01; |
||
1226 | SelectionPath.RenderTransform = null; |
||
1227 | SelectionPath.RenderTransformOrigin = new Point(0, 0); |
||
1228 | } |
||
1229 | |||
1230 | #region 컨트롤 초기화 |
||
1231 | public void Control_Init(object control) |
||
1232 | { |
||
1233 | if (L_Size != 0 && (control as IPath) != null) |
||
1234 | { |
||
1235 | (control as IPath).LineSize = L_Size; |
||
1236 | L_Size = 0; |
||
1237 | } |
||
1238 | |||
1239 | switch (control.GetType().Name) |
||
1240 | { |
||
1241 | case "RectangleControl": |
||
1242 | { |
||
1243 | (control as RectangleControl).StrokeColor = Brushes.Red; |
||
1244 | } |
||
1245 | break; |
||
1246 | case "CircleControl": |
||
1247 | { |
||
1248 | (control as CircleControl).StrokeColor = Brushes.Red; |
||
1249 | } |
||
1250 | break; |
||
1251 | case "TriControl": |
||
1252 | { |
||
1253 | (control as TriControl).StrokeColor = Brushes.Red; |
||
1254 | } |
||
1255 | break; |
||
1256 | case "RectCloudControl": |
||
1257 | { |
||
1258 | (control as RectCloudControl).StrokeColor = Brushes.Red; |
||
1259 | } |
||
1260 | break; |
||
1261 | case "CloudControl": |
||
1262 | { |
||
1263 | (control as CloudControl).StrokeColor = Brushes.Red; |
||
1264 | } |
||
1265 | break; |
||
1266 | case "PolygonControl": |
||
1267 | { |
||
1268 | (control as PolygonControl).StrokeColor = Brushes.Red; |
||
1269 | } |
||
1270 | break; |
||
1271 | case "ArcControl": |
||
1272 | { |
||
1273 | (control as ArcControl).StrokeColor = Brushes.Red; |
||
1274 | } |
||
1275 | break; |
||
1276 | case "LineControl": |
||
1277 | { |
||
1278 | (control as LineControl).StrokeColor = Brushes.Red; |
||
1279 | } |
||
1280 | break; |
||
1281 | case "ArrowControl_Multi": |
||
1282 | { |
||
1283 | (control as ArrowControl_Multi).StrokeColor = Brushes.Red; |
||
1284 | } |
||
1285 | break; |
||
1286 | case "TextControl": |
||
1287 | { |
||
1288 | (control as TextControl).BackInnerColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.White.R, Colors.White.G, Colors.White.B)); |
||
1289 | } |
||
1290 | break; |
||
1291 | case "ArrowTextControl": |
||
1292 | { |
||
1293 | (control as ArrowTextControl).BackInnerColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.White.R, Colors.White.G, Colors.White.B)); |
||
1294 | } |
||
1295 | break; |
||
1296 | } |
||
1297 | } |
||
1298 | #endregion |
||
1299 | |||
1300 | public void firstCondition_MouseLeave(object sender, MouseEventArgs e) |
||
1301 | { |
||
1302 | //Control_Init(e.Source); |
||
1303 | } |
||
1304 | |||
1305 | private void zoomAndPanControl_MouseMove(object sender, MouseEventArgs e) |
||
1306 | { |
||
1307 | if (Common.ViewerDataModel.Instance.SelectedControl == "Batch") |
||
1308 | { |
||
1309 | if (!floatingTip.IsOpen) { floatingTip.IsOpen = true; } |
||
1310 | |||
1311 | Point currentPos = e.GetPosition(rect); |
||
1312 | ca40e004 | ljiyeon | |
1313 | 787a4489 | KangIngu | floatingTip.HorizontalOffset = currentPos.X + 20; |
1314 | floatingTip.VerticalOffset = currentPos.Y; |
||
1315 | |||
1316 | |||
1317 | //ToolTip tool = new System.Windows.Controls.ToolTip(); |
||
1318 | //tool.Content = "ToolTip"; |
||
1319 | //panel.ToolTip = tool; |
||
1320 | } |
||
1321 | |||
1322 | if (mouseHandlingMode != MouseHandlingMode.Drawing) |
||
1323 | { |
||
1324 | #region 마우스 오버 시 색상 변경 |
||
1325 | //var firstCondition = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseOver).FirstOrDefault(); |
||
1326 | //Color TempColor = MarkupToPDF.Controls.Common.ValueConverter.StringToColorConverter.Parse("FF07B4FF"); |
||
1327 | |||
1328 | //if (firstCondition != null) |
||
1329 | //{ |
||
1330 | // firstCondition.MouseLeave += new System.Windows.Input.MouseEventHandler(firstCondition_MouseLeave); |
||
1331 | |||
1332 | // if (firstCondition.GetType().Name == "TextControl") |
||
1333 | // { |
||
1334 | // (firstCondition as TextControl).BackInnerColor = new SolidColorBrush(TempColor); |
||
1335 | // return; |
||
1336 | // } |
||
1337 | // else if (firstCondition.GetType().Name == "ArrowTextControl") |
||
1338 | // { |
||
1339 | // (firstCondition as ArrowTextControl).BackInnerColor = new SolidColorBrush(TempColor); |
||
1340 | // return; |
||
1341 | // } |
||
1342 | |||
1343 | // if (L_Size == 0) |
||
1344 | // { |
||
1345 | // L_Size = (firstCondition as IPath).LineSize; |
||
1346 | // (firstCondition as IPath).LineSize *= 4; |
||
1347 | // } |
||
1348 | // switch (firstCondition.GetType().Name) |
||
1349 | // { |
||
1350 | // case "RectangleControl": |
||
1351 | // { |
||
1352 | // (firstCondition as RectangleControl).StrokeColor = new SolidColorBrush(TempColor); |
||
1353 | // } |
||
1354 | // break; |
||
1355 | // case "CircleControl": |
||
1356 | // { |
||
1357 | // (firstCondition as CircleControl).StrokeColor = new SolidColorBrush(TempColor); |
||
1358 | // } |
||
1359 | // break; |
||
1360 | // case "TriControl": |
||
1361 | // { |
||
1362 | // (firstCondition as TriControl).StrokeColor = new SolidColorBrush(TempColor); |
||
1363 | // } |
||
1364 | // break; |
||
1365 | // case "RectCloudControl": |
||
1366 | // { |
||
1367 | // (firstCondition as RectCloudControl).StrokeColor = new SolidColorBrush(TempColor); |
||
1368 | // } |
||
1369 | // break; |
||
1370 | // case "CloudControl": |
||
1371 | // { |
||
1372 | // (firstCondition as CloudControl).StrokeColor = new SolidColorBrush(TempColor); |
||
1373 | // } |
||
1374 | // break; |
||
1375 | // case "PolygonControl": |
||
1376 | // { |
||
1377 | // (firstCondition as PolygonControl).StrokeColor = new SolidColorBrush(TempColor); |
||
1378 | // } |
||
1379 | // break; |
||
1380 | // case "ArcControl": |
||
1381 | // { |
||
1382 | // (firstCondition as ArcControl).StrokeColor = new SolidColorBrush(TempColor); |
||
1383 | // } |
||
1384 | // break; |
||
1385 | // case "LineControl": |
||
1386 | // { |
||
1387 | // (firstCondition as LineControl).StrokeColor = new SolidColorBrush(TempColor); |
||
1388 | // } |
||
1389 | // break; |
||
1390 | // case "ArrowControl_Multi": |
||
1391 | // { |
||
1392 | // (firstCondition as ArrowControl_Multi).StrokeColor = new SolidColorBrush(TempColor); |
||
1393 | // } |
||
1394 | // break; |
||
1395 | |||
1396 | // default: |
||
1397 | // { |
||
1398 | |||
1399 | // } |
||
1400 | // break; |
||
1401 | // } |
||
1402 | //} |
||
1403 | #endregion |
||
1404 | } |
||
1405 | |||
1406 | getCurrentPoint = e.GetPosition(drawingRotateCanvas); |
||
1407 | |||
1408 | 992a98b4 | KangIngu | //if (mouseButtonDown == MouseButton.Middle) |
1409 | //{ |
||
1410 | // SetCursor(); |
||
1411 | // Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas); |
||
1412 | // Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas); |
||
1413 | 9f473fb7 | KangIngu | |
1414 | 992a98b4 | KangIngu | // Vector dragOffset = currentCanvasZoomPanningMouseMovePoint - canvasZoommovingMouseDownPoint; |
1415 | // zoomAndPanControl.ContentOffsetX -= dragOffset.X; |
||
1416 | // zoomAndPanControl.ContentOffsetY -= dragOffset.Y; |
||
1417 | 9f473fb7 | KangIngu | |
1418 | 992a98b4 | KangIngu | // //SetCursor(); |
1419 | // //Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas); |
||
1420 | // //Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas); |
||
1421 | 787a4489 | KangIngu | |
1422 | 992a98b4 | KangIngu | // //Vector dragOffset = currentCanvasZoomPanningMouseMovePoint - canvasZoommovingMouseDownPoint; |
1423 | 787a4489 | KangIngu | |
1424 | 992a98b4 | KangIngu | // //zoomAndPanControl.ContentOffsetX += 1; |
1425 | // //zoomAndPanControl.ContentOffsetY += 1; |
||
1426 | 787a4489 | KangIngu | |
1427 | 992a98b4 | KangIngu | // //zoomAndPanControl.ContentOffsetX += dragOffset.X; |
1428 | // //zoomAndPanControl.ContentOffsetY += dragOffset.Y; |
||
1429 | //} |
||
1430 | if ((mouseButtonDown == MouseButton.Middle) || (mouseButtonDown == MouseButton.Right)) |
||
1431 | 787a4489 | KangIngu | { |
1432 | e54660e8 | KangIngu | SetCursor(); |
1433 | 787a4489 | KangIngu | Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas); |
1434 | Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas); |
||
1435 | |||
1436 | Vector dragOffset = currentCanvasZoomPanningMouseMovePoint - canvasZoommovingMouseDownPoint; |
||
1437 | zoomAndPanControl.ContentOffsetX -= dragOffset.X; |
||
1438 | zoomAndPanControl.ContentOffsetY -= dragOffset.Y; |
||
1439 | 9cd2865b | KangIngu | |
1440 | a1716fa5 | KangIngu | if (Sync.IsChecked) |
1441 | 9cd2865b | KangIngu | { |
1442 | ViewerDataModel.Instance.Sync_ContentOffsetX = zoomAndPanControl.ContentOffsetX; |
||
1443 | ViewerDataModel.Instance.Sync_ContentOffsetY = zoomAndPanControl.ContentOffsetY; |
||
1444 | } |
||
1445 | 787a4489 | KangIngu | } |
1446 | 992a98b4 | KangIngu | |
1447 | |||
1448 | if (mouseHandlingMode == MouseHandlingMode.Drawing && mouseButtonDown == MouseButton.Left) |
||
1449 | 787a4489 | KangIngu | { |
1450 | Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas); |
||
1451 | Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas); |
||
1452 | SetCursor(); |
||
1453 | |||
1454 | if (IsDrawing) |
||
1455 | { |
||
1456 | if (currentControl == null) |
||
1457 | { |
||
1458 | switch (controlType) |
||
1459 | { |
||
1460 | case ControlType.PenControl: |
||
1461 | { |
||
1462 | if (inkBoard.Tag.ToString() == "Ink") |
||
1463 | { |
||
1464 | stroke.StylusPoints.Add(new StylusPoint(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y)); |
||
1465 | } |
||
1466 | else if (inkBoard.Tag.ToString() == "EraseByPoint") |
||
1467 | { |
||
1468 | RemovePointStroke(currentCanvasDrawingMouseMovePoint); |
||
1469 | } |
||
1470 | else if (inkBoard.Tag.ToString() == "EraseByStroke") |
||
1471 | { |
||
1472 | RemoveLineStroke(currentCanvasDrawingMouseMovePoint); |
||
1473 | } |
||
1474 | |||
1475 | //inkBoard.Strokes.Add(stroke); |
||
1476 | } |
||
1477 | break; |
||
1478 | } |
||
1479 | return; |
||
1480 | } |
||
1481 | } |
||
1482 | |||
1483 | if (currentControl != null) |
||
1484 | { |
||
1485 | double moveX = currentCanvasDrawingMouseMovePoint.X - canvasDrawingMouseDownPoint.X; |
||
1486 | double moveY = currentCanvasDrawingMouseMovePoint.Y - canvasDrawingMouseDownPoint.Y; |
||
1487 | //강인구 추가 |
||
1488 | currentControl.Opacity = ViewerDataModel.Instance.ControlOpacity; |
||
1489 | |||
1490 | if ((currentControl as IPath) != null) |
||
1491 | { |
||
1492 | (currentControl as IPath).LineSize = ViewerDataModel.Instance.LineSize; |
||
1493 | } |
||
1494 | 5ce56a3a | KangIngu | if ((currentControl as LineControl) != null) |
1495 | { |
||
1496 | (currentControl as LineControl).Interval = ViewerDataModel.Instance.Interval; |
||
1497 | } |
||
1498 | |||
1499 | 787a4489 | KangIngu | if ((currentControl as IShapeControl) != null) |
1500 | { |
||
1501 | (currentControl as IShapeControl).Paint = ViewerDataModel.Instance.paintSet; |
||
1502 | } |
||
1503 | if ((currentControl as TextControl) != null) |
||
1504 | { |
||
1505 | if (this.ParentOfType<MainWindow>().dzTopMenu.btnItalic.IsChecked == true) |
||
1506 | { |
||
1507 | (currentControl as TextControl).TextStyle = FontStyles.Italic; |
||
1508 | } |
||
1509 | if (this.ParentOfType<MainWindow>().dzTopMenu.btnBold.IsChecked == true) |
||
1510 | { |
||
1511 | d4b0c723 | KangIngu | (currentControl as TextControl).TextWeight = FontWeights.Bold; |
1512 | 787a4489 | KangIngu | } |
1513 | if (this.ParentOfType<MainWindow>().dzTopMenu.btnUnderLine.IsChecked == true) |
||
1514 | { |
||
1515 | (currentControl as TextControl).UnderLine = TextDecorations.Underline; |
||
1516 | } |
||
1517 | } |
||
1518 | else if ((currentControl as ArrowTextControl) != null) |
||
1519 | { |
||
1520 | if (this.ParentOfType<MainWindow>().dzTopMenu.btnItalic.IsChecked == true) |
||
1521 | { |
||
1522 | (currentControl as ArrowTextControl).TextStyle = FontStyles.Italic; |
||
1523 | } |
||
1524 | if (this.ParentOfType<MainWindow>().dzTopMenu.btnBold.IsChecked == true) |
||
1525 | { |
||
1526 | d4b0c723 | KangIngu | (currentControl as ArrowTextControl).TextWeight = FontWeights.Bold; |
1527 | 787a4489 | KangIngu | } |
1528 | if (this.ParentOfType<MainWindow>().dzTopMenu.btnUnderLine.IsChecked == true) |
||
1529 | { |
||
1530 | (currentControl as ArrowTextControl).UnderLine = TextDecorations.Underline; |
||
1531 | } |
||
1532 | } |
||
1533 | 9f473fb7 | KangIngu | else if ((currentControl as RectCloudControl) != null) |
1534 | { |
||
1535 | (currentControl as RectCloudControl).ArcLength = ViewerDataModel.Instance.ArcLength; |
||
1536 | } |
||
1537 | else if ((currentControl as CloudControl) != null) |
||
1538 | { |
||
1539 | (currentControl as CloudControl).ArcLength = ViewerDataModel.Instance.ArcLength; |
||
1540 | } |
||
1541 | 787a4489 | KangIngu | |
1542 | switch (controlType) |
||
1543 | { |
||
1544 | case ControlType.Rectangle: |
||
1545 | { |
||
1546 | var control = currentControl as RectangleControl; |
||
1547 | |||
1548 | if (control != null) |
||
1549 | { |
||
1550 | if (move.mousemode == MouseMode.Drawing) |
||
1551 | { |
||
1552 | //move.control_Move(ControlList, true, moveX, moveY); |
||
1553 | } |
||
1554 | else |
||
1555 | { |
||
1556 | 17a22987 | KangIngu | control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y); |
1557 | control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
1558 | control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y); |
||
1559 | control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
1560 | 787a4489 | KangIngu | |
1561 | |||
1562 | 17a22987 | KangIngu | if (ViewerDataModel.Instance.IsPressShift) |
1563 | { |
||
1564 | 4318fdeb | KangIngu | Point setpoint = GetSquareEndPoint(control.StartPoint, control.EndPoint); |
1565 | 17a22987 | KangIngu | control.LeftBottomPoint = new Point(control.LeftBottomPoint.X, setpoint.Y); |
1566 | control.TopRightPoint = new Point(setpoint.X, control.TopRightPoint.Y); |
||
1567 | control.EndPoint = new Point(setpoint.X, setpoint.Y); |
||
1568 | } |
||
1569 | e54660e8 | KangIngu | |
1570 | 787a4489 | KangIngu | control.PointSet = new List<Point> |
1571 | { |
||
1572 | 17a22987 | KangIngu | control.StartPoint, |
1573 | control.LeftBottomPoint, |
||
1574 | control.EndPoint, |
||
1575 | control.TopRightPoint, |
||
1576 | 787a4489 | KangIngu | }; |
1577 | control.updateControl(); |
||
1578 | } |
||
1579 | |||
1580 | //강인구 추가 |
||
1581 | control.ControlType = controlType; |
||
1582 | control.DashSize = ViewerDataModel.Instance.DashSize; |
||
1583 | control.Paint = ViewerDataModel.Instance.paintSet; |
||
1584 | } |
||
1585 | } |
||
1586 | break; |
||
1587 | |||
1588 | case ControlType.RectCloud: |
||
1589 | { |
||
1590 | var control = currentControl as RectCloudControl; |
||
1591 | |||
1592 | if (control != null) |
||
1593 | { |
||
1594 | if (move.mousemode == MouseMode.Drawing) |
||
1595 | { |
||
1596 | //move.control_Move(ControlList, true, moveX, moveY); |
||
1597 | } |
||
1598 | else |
||
1599 | { |
||
1600 | control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y); |
||
1601 | control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
1602 | control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y); |
||
1603 | control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
1604 | |||
1605 | 17a22987 | KangIngu | if (ViewerDataModel.Instance.IsPressShift) |
1606 | { |
||
1607 | 4318fdeb | KangIngu | Point setpoint = GetSquareEndPoint(control.StartPoint, control.EndPoint); |
1608 | 17a22987 | KangIngu | control.LeftBottomPoint = new Point(control.LeftBottomPoint.X, setpoint.Y); |
1609 | control.TopRightPoint = new Point(setpoint.X, control.TopRightPoint.Y); |
||
1610 | control.EndPoint = new Point(setpoint.X, setpoint.Y); |
||
1611 | } |
||
1612 | |||
1613 | 787a4489 | KangIngu | control.PointSet = new List<Point> |
1614 | { |
||
1615 | control.StartPoint, |
||
1616 | control.LeftBottomPoint, |
||
1617 | control.EndPoint, |
||
1618 | control.TopRightPoint, |
||
1619 | }; |
||
1620 | } |
||
1621 | //강인구 추가 |
||
1622 | control.DashSize = ViewerDataModel.Instance.DashSize; |
||
1623 | control.Paint = ViewerDataModel.Instance.paintSet; |
||
1624 | } |
||
1625 | } |
||
1626 | break; |
||
1627 | |||
1628 | case ControlType.SingleLine: |
||
1629 | { |
||
1630 | if (currentControl != null) |
||
1631 | { |
||
1632 | var control = currentControl as LineControl; |
||
1633 | control.LineStyleSet = LineStyleSet.SingleLine; |
||
1634 | control.ControlType = controlType; |
||
1635 | if (control != null) |
||
1636 | { |
||
1637 | 5ce56a3a | KangIngu | control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y); |
1638 | control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
1639 | Point tempPoint = control.EndPoint; |
||
1640 | |||
1641 | if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift) |
||
1642 | 787a4489 | KangIngu | { |
1643 | 5ce56a3a | KangIngu | //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
1644 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
||
1645 | control.EndPoint = tempPoint; |
||
1646 | 787a4489 | KangIngu | } |
1647 | else |
||
1648 | { |
||
1649 | 5ce56a3a | KangIngu | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false); |
1650 | 787a4489 | KangIngu | } |
1651 | 5ce56a3a | KangIngu | |
1652 | e54660e8 | KangIngu | control.PointSet = new List<Point> |
1653 | 5ce56a3a | KangIngu | { |
1654 | control.StartPoint, |
||
1655 | control.EndPoint, |
||
1656 | }; |
||
1657 | 787a4489 | KangIngu | //강인구 추가 |
1658 | control.DashSize = ViewerDataModel.Instance.DashSize; |
||
1659 | } |
||
1660 | } |
||
1661 | |||
1662 | } |
||
1663 | break; |
||
1664 | |||
1665 | case ControlType.CancelLine: |
||
1666 | { |
||
1667 | if (currentControl != null) |
||
1668 | { |
||
1669 | var control = currentControl as LineControl; |
||
1670 | control.LineStyleSet = LineStyleSet.CancelLine; |
||
1671 | //control.LineStyle = LineControl.LineStyleSet.MultiLine; |
||
1672 | control.ControlType = controlType; |
||
1673 | if (control != null) |
||
1674 | { |
||
1675 | 5ce56a3a | KangIngu | control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y); |
1676 | control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
1677 | Point tempPoint = control.EndPoint; |
||
1678 | 787a4489 | KangIngu | |
1679 | if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift) |
||
1680 | { |
||
1681 | 5ce56a3a | KangIngu | //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
1682 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
||
1683 | 787a4489 | KangIngu | control.EndPoint = tempPoint; |
1684 | } |
||
1685 | else |
||
1686 | { |
||
1687 | 5ce56a3a | KangIngu | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false); |
1688 | 787a4489 | KangIngu | } |
1689 | |||
1690 | |||
1691 | control.PointSet = new List<Point> |
||
1692 | { |
||
1693 | control.StartPoint, |
||
1694 | control.EndPoint, |
||
1695 | }; |
||
1696 | } |
||
1697 | //강인구 추가 |
||
1698 | control.DashSize = ViewerDataModel.Instance.DashSize; |
||
1699 | } |
||
1700 | } |
||
1701 | break; |
||
1702 | |||
1703 | case ControlType.ArrowLine: |
||
1704 | { |
||
1705 | if (currentControl != null) |
||
1706 | { |
||
1707 | var control = currentControl as LineControl; |
||
1708 | control.LineStyleSet = LineStyleSet.ArrowLine; |
||
1709 | control.ControlType = controlType; |
||
1710 | if (control != null) |
||
1711 | { |
||
1712 | 5ce56a3a | KangIngu | control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y); |
1713 | control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
1714 | Point tempPoint = control.EndPoint; |
||
1715 | 787a4489 | KangIngu | |
1716 | if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift) |
||
1717 | { |
||
1718 | 5ce56a3a | KangIngu | //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
1719 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
||
1720 | 787a4489 | KangIngu | control.EndPoint = tempPoint; |
1721 | } |
||
1722 | else |
||
1723 | { |
||
1724 | 5ce56a3a | KangIngu | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false); |
1725 | 787a4489 | KangIngu | } |
1726 | |||
1727 | |||
1728 | control.PointSet = new List<Point> |
||
1729 | { |
||
1730 | control.StartPoint, |
||
1731 | control.EndPoint, |
||
1732 | }; |
||
1733 | } |
||
1734 | //강인구 추가 |
||
1735 | control.DashSize = ViewerDataModel.Instance.DashSize; |
||
1736 | } |
||
1737 | |||
1738 | } |
||
1739 | break; |
||
1740 | |||
1741 | case ControlType.TwinLine: |
||
1742 | { |
||
1743 | if (currentControl != null) |
||
1744 | { |
||
1745 | var control = currentControl as LineControl; |
||
1746 | control.LineStyleSet = LineStyleSet.TwinLine; |
||
1747 | control.ControlType = controlType; |
||
1748 | if (control != null) |
||
1749 | { |
||
1750 | 5ce56a3a | KangIngu | control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y); |
1751 | control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
1752 | Point tempPoint = control.EndPoint; |
||
1753 | 787a4489 | KangIngu | |
1754 | if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift) |
||
1755 | { |
||
1756 | 5ce56a3a | KangIngu | //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
1757 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
||
1758 | 787a4489 | KangIngu | control.EndPoint = tempPoint; |
1759 | } |
||
1760 | else |
||
1761 | { |
||
1762 | 5ce56a3a | KangIngu | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false); |
1763 | 787a4489 | KangIngu | } |
1764 | |||
1765 | |||
1766 | control.PointSet = new List<Point> |
||
1767 | { |
||
1768 | control.StartPoint, |
||
1769 | control.EndPoint, |
||
1770 | }; |
||
1771 | } |
||
1772 | //강인구 추가 |
||
1773 | control.DashSize = ViewerDataModel.Instance.DashSize; |
||
1774 | } |
||
1775 | |||
1776 | } |
||
1777 | break; |
||
1778 | |||
1779 | case ControlType.DimLine: |
||
1780 | { |
||
1781 | if (currentControl != null) |
||
1782 | { |
||
1783 | var control = currentControl as LineControl; |
||
1784 | control.LineStyleSet = LineStyleSet.DimLine; |
||
1785 | control.ControlType = controlType; |
||
1786 | if (control != null) |
||
1787 | { |
||
1788 | 5ce56a3a | KangIngu | control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y); |
1789 | control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
1790 | Point tempPoint = control.EndPoint; |
||
1791 | 787a4489 | KangIngu | |
1792 | if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift) |
||
1793 | { |
||
1794 | 5ce56a3a | KangIngu | //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
1795 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
||
1796 | 787a4489 | KangIngu | control.EndPoint = tempPoint; |
1797 | } |
||
1798 | else |
||
1799 | { |
||
1800 | 5ce56a3a | KangIngu | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false); |
1801 | 787a4489 | KangIngu | } |
1802 | |||
1803 | control.PointSet = new List<Point> |
||
1804 | { |
||
1805 | control.StartPoint, |
||
1806 | control.EndPoint, |
||
1807 | }; |
||
1808 | } |
||
1809 | //강인구 추가 |
||
1810 | control.DashSize = ViewerDataModel.Instance.DashSize; |
||
1811 | } |
||
1812 | |||
1813 | } |
||
1814 | break; |
||
1815 | |||
1816 | case ControlType.ChainLine: |
||
1817 | { |
||
1818 | var control = currentControl as PolygonControl; |
||
1819 | |||
1820 | if (control != null) |
||
1821 | { |
||
1822 | 2eac4f76 | KangIngu | |
1823 | 787a4489 | KangIngu | control.PointSet.RemoveAt(control.PointSet.Count - 1); |
1824 | control.PointSet.Add(currentCanvasDrawingMouseMovePoint); |
||
1825 | 2eac4f76 | KangIngu | |
1826 | Point tempPoint = control.PointSet[control.PointSet.Count - 1]; |
||
1827 | |||
1828 | if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift) |
||
1829 | { |
||
1830 | //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
||
1831 | e54660e8 | KangIngu | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.PointSet[control.PointSet.Count - 2], ref tempPoint, true); |
1832 | 2eac4f76 | KangIngu | control.PointSet[control.PointSet.Count - 1] = tempPoint; |
1833 | //control.EndPoint = tempPoint; |
||
1834 | } |
||
1835 | else |
||
1836 | { |
||
1837 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false); |
||
1838 | } |
||
1839 | |||
1840 | 787a4489 | KangIngu | control.SetPolyPath(); |
1841 | //movePoint.X = currentCanvasDrawingMouseMovePoint.X; |
||
1842 | //movePoint.Y = currentCanvasDrawingMouseMovePoint.Y; |
||
1843 | //control.PointC.pointSet.Add(new Point(currentCanvasDrawingMouseMovePoint.X,currentCanvasDrawingMouseMovePoint.Y)); |
||
1844 | |||
1845 | //강인구 추가 |
||
1846 | control.DashSize = ViewerDataModel.Instance.DashSize; |
||
1847 | } |
||
1848 | } |
||
1849 | break; |
||
1850 | |||
1851 | case ControlType.ArcLine: |
||
1852 | { |
||
1853 | if (currentControl != null) |
||
1854 | { |
||
1855 | var control = currentControl as ArcControl; |
||
1856 | control.isTransOn = false; |
||
1857 | control.ControlType = controlType; |
||
1858 | |||
1859 | if (control != null) |
||
1860 | { |
||
1861 | 5ce56a3a | KangIngu | control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y); |
1862 | control.MidPoint = new Point(0, 0); |
||
1863 | control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
1864 | Point tempPoint = control.EndPoint; |
||
1865 | |||
1866 | if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift) |
||
1867 | 787a4489 | KangIngu | { |
1868 | 5ce56a3a | KangIngu | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
1869 | control.EndPoint = tempPoint; |
||
1870 | 787a4489 | KangIngu | } |
1871 | else |
||
1872 | { |
||
1873 | 5ce56a3a | KangIngu | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false); |
1874 | 787a4489 | KangIngu | } |
1875 | |||
1876 | |||
1877 | control.PointSet = new List<Point> |
||
1878 | { |
||
1879 | control.StartPoint, |
||
1880 | control.MidPoint, |
||
1881 | control.EndPoint, |
||
1882 | }; |
||
1883 | } |
||
1884 | //강인구 추가 |
||
1885 | control.DashSize = ViewerDataModel.Instance.DashSize; |
||
1886 | } |
||
1887 | |||
1888 | } |
||
1889 | break; |
||
1890 | |||
1891 | case ControlType.ArcArrow: |
||
1892 | { |
||
1893 | if (currentControl != null) |
||
1894 | { |
||
1895 | var control = currentControl as ArcControl; |
||
1896 | control.isTransOn = true; |
||
1897 | control.ControlType = controlType; |
||
1898 | |||
1899 | if (control != null) |
||
1900 | { |
||
1901 | if (move.mousemode == MouseMode.Drawing) |
||
1902 | { |
||
1903 | //move.control_Move(ControlList, true, moveX, moveY); |
||
1904 | } |
||
1905 | else |
||
1906 | { |
||
1907 | control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y); |
||
1908 | control.MidPoint = new Point(0, 0); |
||
1909 | control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
1910 | } |
||
1911 | |||
1912 | control.PointSet = new List<Point> |
||
1913 | { |
||
1914 | control.StartPoint, |
||
1915 | control.MidPoint, |
||
1916 | control.EndPoint, |
||
1917 | }; |
||
1918 | } |
||
1919 | //강인구 추가 |
||
1920 | control.DashSize = ViewerDataModel.Instance.DashSize; |
||
1921 | } |
||
1922 | } |
||
1923 | break; |
||
1924 | |||
1925 | case ControlType.ArrowMultiLine: |
||
1926 | { |
||
1927 | if (currentControl != null) |
||
1928 | { |
||
1929 | var control = currentControl as ArrowControl_Multi; |
||
1930 | |||
1931 | if (control != null) |
||
1932 | { |
||
1933 | 5ce56a3a | KangIngu | control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y); |
1934 | Point tempPoint = control.EndPoint; |
||
1935 | 787a4489 | KangIngu | if (control.MiddlePoint == new Point(0, 0)) |
1936 | { |
||
1937 | if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift) |
||
1938 | { |
||
1939 | 5ce56a3a | KangIngu | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
1940 | //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
||
1941 | 787a4489 | KangIngu | control.EndPoint = tempPoint; |
1942 | } |
||
1943 | else |
||
1944 | { |
||
1945 | 5ce56a3a | KangIngu | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false); |
1946 | 787a4489 | KangIngu | } |
1947 | } |
||
1948 | else |
||
1949 | { |
||
1950 | if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift) |
||
1951 | { |
||
1952 | 5ce56a3a | KangIngu | //var AngleValue = MathSet.returnAngleString(control.MiddlePoint, ref tempPoint, true); |
1953 | 2eac4f76 | KangIngu | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.MiddlePoint, ref tempPoint, true); |
1954 | 787a4489 | KangIngu | control.EndPoint = tempPoint; |
1955 | } |
||
1956 | else |
||
1957 | { |
||
1958 | 2eac4f76 | KangIngu | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.MiddlePoint, ref tempPoint, false); |
1959 | 787a4489 | KangIngu | } |
1960 | |||
1961 | } |
||
1962 | |||
1963 | control.PointSet = new List<Point> |
||
1964 | { |
||
1965 | control.StartPoint, |
||
1966 | control.MiddlePoint, |
||
1967 | control.EndPoint, |
||
1968 | }; |
||
1969 | |||
1970 | } |
||
1971 | //강인구 추가 |
||
1972 | control.DashSize = ViewerDataModel.Instance.DashSize; |
||
1973 | } |
||
1974 | |||
1975 | } |
||
1976 | break; |
||
1977 | |||
1978 | case ControlType.Circle: |
||
1979 | { |
||
1980 | var control = currentControl as CircleControl; |
||
1981 | |||
1982 | if (control != null) |
||
1983 | { |
||
1984 | if (move.mousemode == MouseMode.Drawing) |
||
1985 | { |
||
1986 | //move.control_Move(ControlList, true, moveX, moveY); |
||
1987 | } |
||
1988 | else |
||
1989 | { |
||
1990 | control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y); |
||
1991 | control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
1992 | control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y); |
||
1993 | control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
1994 | |||
1995 | 17a22987 | KangIngu | if (ViewerDataModel.Instance.IsPressShift) |
1996 | { |
||
1997 | 4318fdeb | KangIngu | Point setpoint = GetSquareEndPoint(control.StartPoint, control.EndPoint); |
1998 | 17a22987 | KangIngu | control.LeftBottomPoint = new Point(control.LeftBottomPoint.X, setpoint.Y); |
1999 | control.TopRightPoint = new Point(setpoint.X, control.TopRightPoint.Y); |
||
2000 | control.EndPoint = new Point(setpoint.X, setpoint.Y); |
||
2001 | } |
||
2002 | |||
2003 | 787a4489 | KangIngu | control.PointSet = new List<Point> |
2004 | { |
||
2005 | control.StartPoint, |
||
2006 | control.LeftBottomPoint, |
||
2007 | control.EndPoint, |
||
2008 | control.TopRightPoint, |
||
2009 | }; |
||
2010 | } |
||
2011 | //강인구 추가 |
||
2012 | control.DashSize = ViewerDataModel.Instance.DashSize; |
||
2013 | control.Paint = ViewerDataModel.Instance.paintSet; |
||
2014 | |||
2015 | } |
||
2016 | } |
||
2017 | break; |
||
2018 | |||
2019 | case ControlType.PolygonCloud: |
||
2020 | { |
||
2021 | var control = currentControl as CloudControl; |
||
2022 | |||
2023 | if (control != null) |
||
2024 | { |
||
2025 | control.isTransOn = true; |
||
2026 | control.PointSet.RemoveAt(control.PointSet.Count - 1); |
||
2027 | |||
2028 | control.PointSet.Add(currentCanvasDrawingMouseMovePoint); |
||
2029 | |||
2030 | control.SetCloud(); |
||
2031 | //강인구 추가 |
||
2032 | control.DashSize = ViewerDataModel.Instance.DashSize; |
||
2033 | control.Paint = ViewerDataModel.Instance.paintSet; |
||
2034 | } |
||
2035 | } |
||
2036 | break; |
||
2037 | |||
2038 | case ControlType.Triangle: |
||
2039 | { |
||
2040 | var control = currentControl as TriControl; |
||
2041 | |||
2042 | if (control != null) |
||
2043 | { |
||
2044 | if (move.mousemode == MouseMode.Drawing) |
||
2045 | { |
||
2046 | //move.control_Move(ControlList, true, moveX, moveY); |
||
2047 | } |
||
2048 | else |
||
2049 | { |
||
2050 | control.Paint = ViewerDataModel.Instance.paintSet; |
||
2051 | control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
2052 | |||
2053 | 992a98b4 | KangIngu | if (ViewerDataModel.Instance.checkAxis) |
2054 | { |
||
2055 | Point tempPoint = control.EndPoint; |
||
2056 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
||
2057 | control.EndPoint = tempPoint; |
||
2058 | } |
||
2059 | |||
2060 | 4318fdeb | KangIngu | |
2061 | if (ViewerDataModel.Instance.IsPressShift) |
||
2062 | { |
||
2063 | e753423e | humkyung | List<Point> Points = GetRegularTrianglePoints(control.StartPoint, control.EndPoint); |
2064 | if (2 == Points.Count()) |
||
2065 | { |
||
2066 | control.MidPoint = Points[0]; |
||
2067 | control.EndPoint = Points[1]; |
||
2068 | } |
||
2069 | 4318fdeb | KangIngu | } |
2070 | |||
2071 | 787a4489 | KangIngu | control.PointSet = new List<Point> |
2072 | { |
||
2073 | control.StartPoint, |
||
2074 | control.MidPoint, |
||
2075 | control.EndPoint, |
||
2076 | }; |
||
2077 | } |
||
2078 | //강인구 추가 |
||
2079 | control.DashSize = ViewerDataModel.Instance.DashSize; |
||
2080 | control.Paint = ViewerDataModel.Instance.paintSet; |
||
2081 | } |
||
2082 | } |
||
2083 | break; |
||
2084 | |||
2085 | case ControlType.ImgControl: |
||
2086 | { |
||
2087 | var control = currentControl as ImgControl; |
||
2088 | |||
2089 | if (control != null) |
||
2090 | { |
||
2091 | control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y); |
||
2092 | control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
2093 | control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y); |
||
2094 | control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
2095 | |||
2096 | control.PointSet = new List<Point> |
||
2097 | { |
||
2098 | control.StartPoint, |
||
2099 | control.LeftBottomPoint, |
||
2100 | control.EndPoint, |
||
2101 | control.TopRightPoint, |
||
2102 | }; |
||
2103 | } |
||
2104 | } |
||
2105 | break; |
||
2106 | |||
2107 | case ControlType.Date: |
||
2108 | { |
||
2109 | var control = currentControl as DateControl; |
||
2110 | |||
2111 | if (control != null) |
||
2112 | { |
||
2113 | control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y); |
||
2114 | control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
2115 | control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y); |
||
2116 | control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
2117 | //control.Text = DateTime.Now.ToString("yyyy-MM-dd"); |
||
2118 | |||
2119 | control.PointSet = new List<Point> |
||
2120 | { |
||
2121 | control.StartPoint, |
||
2122 | control.LeftBottomPoint, |
||
2123 | control.EndPoint, |
||
2124 | control.TopRightPoint, |
||
2125 | }; |
||
2126 | } |
||
2127 | } |
||
2128 | break; |
||
2129 | |||
2130 | case ControlType.ArrowTextControl: |
||
2131 | { |
||
2132 | var control = currentControl as ArrowTextControl; |
||
2133 | |||
2134 | if (control != null) |
||
2135 | { |
||
2136 | control.EndPoint = currentCanvasDrawingMouseMovePoint; |
||
2137 | 5ce56a3a | KangIngu | Point tempPoint = control.EndPoint; |
2138 | 9f473fb7 | KangIngu | |
2139 | control.MidPoint = new Point(control.EndPoint.X - 100, control.EndPoint.Y - 100); |
||
2140 | |||
2141 | 5ce56a3a | KangIngu | if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift) |
2142 | { |
||
2143 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
||
2144 | control.EndPoint = tempPoint; |
||
2145 | } |
||
2146 | else |
||
2147 | { |
||
2148 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false); |
||
2149 | } |
||
2150 | 992a98b4 | KangIngu | control.MidPoint = MathSet.getMiddlePoint(control.StartPoint, control.EndPoint); |
2151 | 787a4489 | KangIngu | |
2152 | control.PointSet = new List<Point> |
||
2153 | { |
||
2154 | control.StartPoint, |
||
2155 | control.MidPoint, |
||
2156 | control.EndPoint, |
||
2157 | }; |
||
2158 | } |
||
2159 | } |
||
2160 | break; |
||
2161 | |||
2162 | case ControlType.ArrowTransTextControl: |
||
2163 | { |
||
2164 | var control = currentControl as ArrowTextControl; |
||
2165 | |||
2166 | if (control != null) |
||
2167 | { |
||
2168 | control.EndPoint = currentCanvasDrawingMouseMovePoint; |
||
2169 | 5ce56a3a | KangIngu | Point tempPoint = control.EndPoint; |
2170 | 01cbc243 | KangIngu | //control.MidPoint = currentCanvasDrawingMouseMovePoint; |
2171 | 9f473fb7 | KangIngu | |
2172 | 5ce56a3a | KangIngu | if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift) |
2173 | { |
||
2174 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
||
2175 | control.EndPoint = tempPoint; |
||
2176 | } |
||
2177 | else |
||
2178 | { |
||
2179 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false); |
||
2180 | } |
||
2181 | 01cbc243 | KangIngu | control.MidPoint = MathSet.getMiddlePoint(control.StartPoint, control.EndPoint); |
2182 | 787a4489 | KangIngu | control.isFixed = true; |
2183 | |||
2184 | control.PointSet = new List<Point> |
||
2185 | { |
||
2186 | control.StartPoint, |
||
2187 | control.MidPoint, |
||
2188 | control.EndPoint, |
||
2189 | }; |
||
2190 | } |
||
2191 | } |
||
2192 | break; |
||
2193 | |||
2194 | case ControlType.ArrowTextBorderControl: |
||
2195 | { |
||
2196 | var control = currentControl as ArrowTextControl; |
||
2197 | |||
2198 | if (control != null) |
||
2199 | { |
||
2200 | control.EndPoint = currentCanvasDrawingMouseMovePoint; |
||
2201 | 5ce56a3a | KangIngu | Point tempPoint = control.EndPoint; |
2202 | if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift) |
||
2203 | { |
||
2204 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
||
2205 | control.EndPoint = tempPoint; |
||
2206 | } |
||
2207 | else |
||
2208 | { |
||
2209 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false); |
||
2210 | } |
||
2211 | 992a98b4 | KangIngu | control.MidPoint = MathSet.getMiddlePoint(control.StartPoint, control.EndPoint); |
2212 | 787a4489 | KangIngu | control.PointSet = new List<Point> |
2213 | { |
||
2214 | control.StartPoint, |
||
2215 | control.MidPoint, |
||
2216 | control.EndPoint, |
||
2217 | }; |
||
2218 | } |
||
2219 | |||
2220 | } |
||
2221 | break; |
||
2222 | case ControlType.ArrowTransTextBorderControl: |
||
2223 | { |
||
2224 | var control = currentControl as ArrowTextControl; |
||
2225 | |||
2226 | if (control != null) |
||
2227 | { |
||
2228 | control.isFixed = true; |
||
2229 | control.EndPoint = currentCanvasDrawingMouseMovePoint; |
||
2230 | 5ce56a3a | KangIngu | Point tempPoint = control.EndPoint; |
2231 | if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift) |
||
2232 | { |
||
2233 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
||
2234 | control.EndPoint = tempPoint; |
||
2235 | } |
||
2236 | else |
||
2237 | { |
||
2238 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false); |
||
2239 | } |
||
2240 | 01cbc243 | KangIngu | |
2241 | control.MidPoint = MathSet.getMiddlePoint(control.StartPoint, control.EndPoint); |
||
2242 | 787a4489 | KangIngu | control.PointSet = new List<Point> |
2243 | { |
||
2244 | control.StartPoint, |
||
2245 | control.MidPoint, |
||
2246 | control.EndPoint, |
||
2247 | }; |
||
2248 | } |
||
2249 | |||
2250 | } |
||
2251 | break; |
||
2252 | case ControlType.ArrowTextCloudControl: |
||
2253 | { |
||
2254 | var control = currentControl as ArrowTextControl; |
||
2255 | |||
2256 | if (control != null) |
||
2257 | { |
||
2258 | control.EndPoint = currentCanvasDrawingMouseMovePoint; |
||
2259 | 5ce56a3a | KangIngu | Point tempPoint = control.EndPoint; |
2260 | if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift) |
||
2261 | { |
||
2262 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
||
2263 | control.EndPoint = tempPoint; |
||
2264 | } |
||
2265 | else |
||
2266 | { |
||
2267 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false); |
||
2268 | } |
||
2269 | 992a98b4 | KangIngu | control.MidPoint = MathSet.getMiddlePoint(control.StartPoint, control.EndPoint); |
2270 | 787a4489 | KangIngu | control.PointSet = new List<Point> |
2271 | { |
||
2272 | control.StartPoint, |
||
2273 | control.MidPoint, |
||
2274 | control.EndPoint, |
||
2275 | }; |
||
2276 | } |
||
2277 | |||
2278 | } |
||
2279 | break; |
||
2280 | case ControlType.ArrowTransTextCloudControl: |
||
2281 | { |
||
2282 | var control = currentControl as ArrowTextControl; |
||
2283 | |||
2284 | if (control != null) |
||
2285 | { |
||
2286 | control.isFixed = true; |
||
2287 | control.EndPoint = currentCanvasDrawingMouseMovePoint; |
||
2288 | 5ce56a3a | KangIngu | Point tempPoint = control.EndPoint; |
2289 | if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift) |
||
2290 | { |
||
2291 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
||
2292 | control.EndPoint = tempPoint; |
||
2293 | } |
||
2294 | else |
||
2295 | { |
||
2296 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false); |
||
2297 | } |
||
2298 | 01cbc243 | KangIngu | control.MidPoint = MathSet.getMiddlePoint(control.StartPoint, control.EndPoint); |
2299 | 787a4489 | KangIngu | control.PointSet = new List<Point> |
2300 | { |
||
2301 | control.StartPoint, |
||
2302 | control.MidPoint, |
||
2303 | control.EndPoint, |
||
2304 | }; |
||
2305 | } |
||
2306 | |||
2307 | } |
||
2308 | break; |
||
2309 | case ControlType.PolygonControl: |
||
2310 | { |
||
2311 | e54660e8 | KangIngu | |
2312 | 787a4489 | KangIngu | var control = currentControl as PolygonControl; |
2313 | |||
2314 | if (control != null) |
||
2315 | { |
||
2316 | control.PointSet.RemoveAt(control.PointSet.Count - 1); |
||
2317 | control.PointSet.Add(currentCanvasDrawingMouseMovePoint); |
||
2318 | control.Paint = ViewerDataModel.Instance.paintSet; |
||
2319 | control.SetPolyPath(); |
||
2320 | //강인구 추가 |
||
2321 | control.DashSize = ViewerDataModel.Instance.DashSize; |
||
2322 | control.Paint = ViewerDataModel.Instance.paintSet; |
||
2323 | } |
||
2324 | } |
||
2325 | break; |
||
2326 | //강인구 추가 |
||
2327 | case ControlType.Sign: |
||
2328 | { |
||
2329 | var control = currentControl as SignControl; |
||
2330 | |||
2331 | if (control != null) |
||
2332 | { |
||
2333 | control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y); |
||
2334 | control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
2335 | control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y); |
||
2336 | control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
2337 | |||
2338 | if (control.StartPoint != control.EndPoint && control.SignImage == null) |
||
2339 | { |
||
2340 | GetUserSign getUser = new GetUserSign(); |
||
2341 | var _sign = getUser.GetSign(App.ViewInfo.UserID, App.ViewInfo.ProjectNO); |
||
2342 | byte[] imageBytes = System.Convert.FromBase64String(_sign); |
||
2343 | System.IO.MemoryStream stream = new System.IO.MemoryStream(); |
||
2344 | stream.Write(imageBytes, 0, imageBytes.Length); |
||
2345 | stream.Position = 0; |
||
2346 | System.Drawing.Image img = System.Drawing.Image.FromStream(stream); |
||
2347 | BitmapImage returnImage = new BitmapImage(); |
||
2348 | returnImage.BeginInit(); |
||
2349 | System.IO.MemoryStream ms = new System.IO.MemoryStream(); |
||
2350 | img.Save(ms, System.Drawing.Imaging.ImageFormat.Png); |
||
2351 | ms.Seek(0, System.IO.SeekOrigin.Begin); |
||
2352 | returnImage.StreamSource = ms; |
||
2353 | returnImage.EndInit(); |
||
2354 | stream.Close(); |
||
2355 | |||
2356 | control.SignImage = returnImage; |
||
2357 | } |
||
2358 | control.PointSet = new List<Point> |
||
2359 | { |
||
2360 | control.StartPoint, |
||
2361 | control.LeftBottomPoint, |
||
2362 | control.EndPoint, |
||
2363 | control.TopRightPoint, |
||
2364 | }; |
||
2365 | } |
||
2366 | } |
||
2367 | break; |
||
2368 | 5a9353a9 | humkyung | //TODO: 강인구 추가 |
2369 | 787a4489 | KangIngu | case ControlType.Symbol: |
2370 | { |
||
2371 | var control = currentControl as SymControl; |
||
2372 | |||
2373 | if (control != null) |
||
2374 | { |
||
2375 | control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y); |
||
2376 | control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
2377 | control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y); |
||
2378 | control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
2379 | control.LineSize = ViewerDataModel.Instance.LineSize + 3; |
||
2380 | control.StrokeColor = new SolidColorBrush(Colors.Red); |
||
2381 | |||
2382 | if (control.StartPoint != control.EndPoint) |
||
2383 | { |
||
2384 | if (control.PathData == null) |
||
2385 | { |
||
2386 | using (StringToPathConverter Convert = new StringToPathConverter()) |
||
2387 | { |
||
2388 | control.PathData = Convert.Convert("M-5,5L0,0L20,30L40,-20 "); |
||
2389 | } |
||
2390 | } |
||
2391 | } |
||
2392 | |||
2393 | control.PointSet = new List<Point> |
||
2394 | { |
||
2395 | control.StartPoint, |
||
2396 | control.LeftBottomPoint, |
||
2397 | control.EndPoint, |
||
2398 | control.TopRightPoint, |
||
2399 | }; |
||
2400 | } |
||
2401 | } |
||
2402 | break; |
||
2403 | 5a9353a9 | humkyung | ///TODO: |
2404 | 787a4489 | KangIngu | case ControlType.Stamp: |
2405 | { |
||
2406 | var control = currentControl as SymControlN; |
||
2407 | |||
2408 | if (control != null) |
||
2409 | { |
||
2410 | |||
2411 | if (control.StartPoint == control.EndPoint) |
||
2412 | { |
||
2413 | 9a1ce1db | KangIngu | string appovalData = ""; |
2414 | 787a4489 | KangIngu | |
2415 | 9a1ce1db | KangIngu | var xamlData = MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressString_NonPrefix(App.SystemInfo.STAMP); |
2416 | 787a4489 | KangIngu | xamlData = xamlData.Replace("daelim", "DAELIM"); |
2417 | |||
2418 | a0bab669 | KangIngu | |
2419 | 787a4489 | KangIngu | //object obj = System.Windows.Markup.XamlReader.Load(xamlData); |
2420 | |||
2421 | System.IO.MemoryStream stream = new System.IO.MemoryStream(); |
||
2422 | System.IO.StreamWriter writer = new System.IO.StreamWriter(stream); |
||
2423 | writer.Write(xamlData); |
||
2424 | writer.Flush(); |
||
2425 | stream.Position = 0; |
||
2426 | |||
2427 | control.StrokeColor = new SolidColorBrush(Colors.Red); |
||
2428 | object obj = System.Windows.Markup.XamlReader.Load(stream); |
||
2429 | UIElement ob = obj as UIElement; |
||
2430 | |||
2431 | //control.ApplyTemplate(); |
||
2432 | |||
2433 | control.SetViewBox(); |
||
2434 | b200de5a | KangIngu | control.PathXathData = App.SystemInfo.STAMP; |
2435 | 787a4489 | KangIngu | control.Base_ViewBox.Child = ob; |
2436 | } |
||
2437 | |||
2438 | control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y); |
||
2439 | control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
2440 | control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y); |
||
2441 | control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
2442 | //control.LineSize = ViewerDataModel.Instance.LineSize + 3; |
||
2443 | |||
2444 | |||
2445 | control.PointSet = new List<Point> |
||
2446 | { |
||
2447 | control.StartPoint, |
||
2448 | control.LeftBottomPoint, |
||
2449 | control.EndPoint, |
||
2450 | control.TopRightPoint, |
||
2451 | }; |
||
2452 | } |
||
2453 | } |
||
2454 | break; |
||
2455 | case ControlType.Mark: |
||
2456 | { |
||
2457 | var control = currentControl as RectangleControl; |
||
2458 | |||
2459 | if (control != null) |
||
2460 | { |
||
2461 | if (move.mousemode == MouseMode.Drawing) |
||
2462 | { |
||
2463 | //move.control_Move(ControlList, true, moveX, moveY); |
||
2464 | } |
||
2465 | else |
||
2466 | { |
||
2467 | control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y); |
||
2468 | control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
2469 | control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y); |
||
2470 | control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
2471 | |||
2472 | |||
2473 | control.PointSet = new List<Point> |
||
2474 | { |
||
2475 | control.StartPoint, |
||
2476 | control.LeftBottomPoint, |
||
2477 | control.EndPoint, |
||
2478 | control.TopRightPoint, |
||
2479 | }; |
||
2480 | } |
||
2481 | |||
2482 | //강인구 추가 |
||
2483 | control.Paint = PaintSet.Fill; |
||
2484 | } |
||
2485 | } |
||
2486 | break; |
||
2487 | case ControlType.PenControl: |
||
2488 | { |
||
2489 | stroke.StylusPoints.Add(new StylusPoint(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y)); |
||
2490 | //inkBoard.Strokes.Add(stroke); |
||
2491 | } |
||
2492 | break; |
||
2493 | default: |
||
2494 | break; |
||
2495 | } |
||
2496 | } |
||
2497 | } |
||
2498 | 9f473fb7 | KangIngu | else if (mouseButtonDown == MouseButton.Left && mouseHandlingMode == MouseHandlingMode.Selecting || mouseButtonDown == MouseButton.Left && mouseHandlingMode == MouseHandlingMode.Capture || mouseButtonDown == MouseButton.Left && mouseHandlingMode == MouseHandlingMode.DragZoom) |
2499 | 787a4489 | KangIngu | { |
2500 | Point curMouseDownPoint = e.GetPosition(drawingRotateCanvas); |
||
2501 | |||
2502 | if (isDraggingSelectionRect) |
||
2503 | { |
||
2504 | UpdateDragSelectionRect(canvasDrawingMouseDownPoint, curMouseDownPoint); |
||
2505 | |||
2506 | e.Handled = true; |
||
2507 | } |
||
2508 | else if (isLeftMouseButtonDownOnWindow) |
||
2509 | { |
||
2510 | var dragDelta = curMouseDownPoint - canvasDrawingMouseDownPoint; |
||
2511 | double dragDistance = Math.Abs(dragDelta.Length); |
||
2512 | |||
2513 | if (dragDistance > DragThreshold) |
||
2514 | { |
||
2515 | isDraggingSelectionRect = true; |
||
2516 | |||
2517 | InitDragSelectionRect(canvasDrawingMouseDownPoint, curMouseDownPoint); |
||
2518 | } |
||
2519 | |||
2520 | e.Handled = true; |
||
2521 | } |
||
2522 | |||
2523 | |||
2524 | if (canvasDrawingMouseDownPoint == curMouseDownPoint) |
||
2525 | { |
||
2526 | //SelectionPath = new Path(); |
||
2527 | //PathFigure pathFigure = new PathFigure(); |
||
2528 | //SelectionPath.Fill = new SolidColorBrush(Colors.Yellow); |
||
2529 | //SelectionPath.Opacity = 0.5; |
||
2530 | //SelectionPath.StrokeDashArray = new DoubleCollection() { 1 }; |
||
2531 | //SelectionPath.StrokeDashCap = PenLineCap.Round; |
||
2532 | //SelectionPath.Stroke = new SolidColorBrush(Colors.Black); |
||
2533 | } |
||
2534 | else |
||
2535 | { |
||
2536 | //List<Stroke> removingStroke = new List<Stroke>(); |
||
2537 | //Rect p1 = new Rect(canvasDrawingMouseDownPoint, curMouseDownPoint); |
||
2538 | //StrokeCollection stC = new StrokeCollection(); |
||
2539 | //for (int i = 0; i <= inkBoard.Strokes.Count - 1; i++) |
||
2540 | //{ |
||
2541 | // Rect p2 = inkBoard.Strokes[i].GetBounds(); |
||
2542 | // p1.Intersect(p2); |
||
2543 | // if (p1.IsEmpty) |
||
2544 | // { |
||
2545 | |||
2546 | |||
2547 | // p1 = SelectionPath.Data.Bounds; |
||
2548 | // bool intersectCheck = false; |
||
2549 | // foreach (var T in inkBoard.Strokes[i].StylusPoints) |
||
2550 | // { |
||
2551 | // Rect p3 = new Rect(new Point(T.X, T.Y), new Size(10, 10)); |
||
2552 | // p1.Intersect(p3); |
||
2553 | // if (!p1.IsEmpty) |
||
2554 | // { |
||
2555 | // intersectCheck = true; |
||
2556 | // } |
||
2557 | // } |
||
2558 | // if (intersectCheck) |
||
2559 | // { |
||
2560 | // removingStroke.Add(inkBoard.Strokes[i]); |
||
2561 | // } |
||
2562 | |||
2563 | // } |
||
2564 | // else |
||
2565 | // { |
||
2566 | // removingStroke.Add(inkBoard.Strokes[i]); |
||
2567 | // } |
||
2568 | //} |
||
2569 | |||
2570 | e.Handled = true; |
||
2571 | } |
||
2572 | } |
||
2573 | else if (mouseButtonDown == MouseButton.Left && ViewerDataModel.Instance.MarkupControls_USER.Count > 0) |
||
2574 | { |
||
2575 | var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseOver).FirstOrDefault(); |
||
2576 | if (control != null) |
||
2577 | { |
||
2578 | this.cursor = Cursors.Hand; |
||
2579 | SetCursor(); |
||
2580 | } |
||
2581 | else |
||
2582 | { |
||
2583 | this.cursor = Cursors.Arrow; |
||
2584 | SetCursor(); |
||
2585 | } |
||
2586 | } |
||
2587 | else |
||
2588 | { |
||
2589 | //var hitRect = new Rect(currentCanvasDrawingMouseMovePoint.X - 10, currentCanvasDrawingMouseMovePoint.Y - 10, 20, 20); |
||
2590 | |||
2591 | //VisualTreeHelper.HitTest(this.drawingRotateCanvas, null, MyCallback, |
||
2592 | // new GeometryHitTestParameters(new RectangleGeometry(hitRect))); |
||
2593 | |||
2594 | //if (hitList.Count > 0) |
||
2595 | //{ |
||
2596 | |||
2597 | //} |
||
2598 | |||
2599 | #region 조건 설정 : firstCondition |
||
2600 | //GeneralTransform generalTransform = this.DeepLayer._BaseLayer.TransformToVisual(Application.Current.RootVisual); |
||
2601 | //pnts = generalTransform.Transform(pnts); |
||
2602 | //Rect areaInAbsoluteCoordinates = new Rect(pnts.X - 10, pnts.Y - 10, 20, 20); |
||
2603 | //var firstCondition = (from kkk in VisualTreeHelper.FindElementsInHostCoordinates(areaInAbsoluteCoordinates, |
||
2604 | // this.DeepLayer._BaseLayer).ToObservable() |
||
2605 | // where String.IsNullOrEmpty((kkk as FrameworkElement).Name) |
||
2606 | // select kkk).FirstOrDefault(); |
||
2607 | |||
2608 | //var canvas = LogicalTreeHelper.FindLogicalNode(this, "drawingRotateCanvas") as Canvas; |
||
2609 | //if (canvas !=null) |
||
2610 | //{ |
||
2611 | // foreach (var item in (canvas.Children[0] as ItemsControl).Items) |
||
2612 | // { |
||
2613 | // UIElement uiElement = (UIElement)(canvas.Children[0] as ItemsControl).ItemContainerGenerator.ContainerFromItem(item); |
||
2614 | // if (uiElement!=null) |
||
2615 | // { |
||
2616 | // uiElement.InputHitTest(currentCanvasDrawingMouseMovePoint). |
||
2617 | // } |
||
2618 | // } |
||
2619 | //} |
||
2620 | |||
2621 | //EllipseGeometry expandedHitTestArea = new EllipseGeometry(currentCanvasDrawingMouseMovePoint, 10.0, 10.0); |
||
2622 | //hitResultsList.Clear(); |
||
2623 | |||
2624 | #endregion |
||
2625 | } |
||
2626 | } |
||
2627 | |||
2628 | a1716fa5 | KangIngu | private void zoomAndPanControl2_MouseMove(object sender, MouseEventArgs e) |
2629 | { |
||
2630 | if ((mouseButtonDown == MouseButton.Middle) || (mouseButtonDown == MouseButton.Right)) |
||
2631 | { |
||
2632 | SetCursor(); |
||
2633 | Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas2); |
||
2634 | Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas2); |
||
2635 | |||
2636 | Vector dragOffset = currentCanvasZoomPanningMouseMovePoint - canvasZoommovingMouseDownPoint; |
||
2637 | |||
2638 | ViewerDataModel.Instance.Sync_ContentOffsetX -= dragOffset.X; |
||
2639 | ViewerDataModel.Instance.Sync_ContentOffsetY -= dragOffset.Y; |
||
2640 | |||
2641 | if (Sync.IsChecked) |
||
2642 | { |
||
2643 | zoomAndPanControl.ContentOffsetX = ViewerDataModel.Instance.Sync_ContentOffsetX; |
||
2644 | zoomAndPanControl.ContentOffsetY = ViewerDataModel.Instance.Sync_ContentOffsetY; |
||
2645 | } |
||
2646 | } |
||
2647 | } |
||
2648 | |||
2649 | 787a4489 | KangIngu | private List<CommentUserInfo> hitList = new List<CommentUserInfo>(); |
2650 | |||
2651 | private EllipseGeometry hitArea = new EllipseGeometry(); |
||
2652 | |||
2653 | private void zoomAndPanControl_MouseUp(object sender, MouseButtonEventArgs e) |
||
2654 | { |
||
2655 | IsDrawing = false; |
||
2656 | |||
2657 | if (mouseHandlingMode != MouseHandlingMode.None) |
||
2658 | { |
||
2659 | if (mouseHandlingMode == MouseHandlingMode.Drawing) |
||
2660 | { |
||
2661 | this.cursor = Cursors.Arrow; |
||
2662 | |||
2663 | SetCursor(); |
||
2664 | |||
2665 | switch (controlType) |
||
2666 | { |
||
2667 | case ControlType.None: |
||
2668 | break; |
||
2669 | case ControlType.Rectangle: |
||
2670 | { |
||
2671 | |||
2672 | } |
||
2673 | break; |
||
2674 | case ControlType.PenControl: |
||
2675 | { |
||
2676 | |||
2677 | } |
||
2678 | break; |
||
2679 | default: |
||
2680 | break; |
||
2681 | } |
||
2682 | } |
||
2683 | 9f473fb7 | KangIngu | else if (mouseHandlingMode == MouseHandlingMode.Selecting && e.ChangedButton == MouseButton.Left || mouseHandlingMode == MouseHandlingMode.Capture && e.ChangedButton == MouseButton.Left || mouseHandlingMode == MouseHandlingMode.DragZoom && e.ChangedButton == MouseButton.Left) |
2684 | 787a4489 | KangIngu | { |
2685 | if (isLeftMouseButtonDownOnWindow) |
||
2686 | { |
||
2687 | bool wasDragSelectionApplied = false; |
||
2688 | |||
2689 | if (isDraggingSelectionRect) |
||
2690 | { |
||
2691 | if (mouseHandlingMode == MouseHandlingMode.Capture) |
||
2692 | { |
||
2693 | dragCaptureBorder.Visibility = Visibility.Collapsed; |
||
2694 | mouseHandlingMode = MouseHandlingMode.None; |
||
2695 | Set_Capture(); |
||
2696 | |||
2697 | ViewerDataModel.Instance.ViewVisible = Visibility.Collapsed; |
||
2698 | ViewerDataModel.Instance.ViewVisible = Visibility.Visible; |
||
2699 | ViewerDataModel.Instance.Capture_Opacity = 0; |
||
2700 | } |
||
2701 | 9f473fb7 | KangIngu | else if (mouseHandlingMode == MouseHandlingMode.Selecting) |
2702 | 787a4489 | KangIngu | { |
2703 | ApplyDragSelectionRect(); |
||
2704 | } |
||
2705 | 9f473fb7 | KangIngu | else |
2706 | { |
||
2707 | double x = Canvas.GetLeft(dragZoomBorder); |
||
2708 | double y = Canvas.GetTop(dragZoomBorder); |
||
2709 | double width = dragZoomBorder.Width; |
||
2710 | double height = dragZoomBorder.Height; |
||
2711 | Rect dragRect = new Rect(x, y, width, height); |
||
2712 | |||
2713 | ViewerDataModel.Instance.SystemMain.dzMainMenu.zoomAndPanControl.ZoomTo(dragRect); |
||
2714 | |||
2715 | dragZoomBorder.Visibility = Visibility.Collapsed; |
||
2716 | } |
||
2717 | 787a4489 | KangIngu | |
2718 | 9f473fb7 | KangIngu | isDraggingSelectionRect = false; |
2719 | 787a4489 | KangIngu | e.Handled = true; |
2720 | wasDragSelectionApplied = true; |
||
2721 | } |
||
2722 | |||
2723 | if (isLeftMouseButtonDownOnWindow) |
||
2724 | { |
||
2725 | isLeftMouseButtonDownOnWindow = false; |
||
2726 | this.ReleaseMouseCapture(); |
||
2727 | e.Handled = true; |
||
2728 | } |
||
2729 | |||
2730 | if (!wasDragSelectionApplied) |
||
2731 | { |
||
2732 | init(); |
||
2733 | } |
||
2734 | } |
||
2735 | } |
||
2736 | else if (mouseButtonDown == MouseButton.Right) |
||
2737 | { |
||
2738 | this.cursor = Cursors.Arrow; |
||
2739 | SetCursor(); |
||
2740 | } |
||
2741 | |||
2742 | zoomAndPanControl.ReleaseMouseCapture(); |
||
2743 | |||
2744 | |||
2745 | e.Handled = true; |
||
2746 | } |
||
2747 | else |
||
2748 | { |
||
2749 | this.cursor = Cursors.Arrow; |
||
2750 | SetCursor(); |
||
2751 | } |
||
2752 | mouseButtonDown = MouseButton.Left; |
||
2753 | |||
2754 | //controlType = ControlType.SingleLine; |
||
2755 | } |
||
2756 | |||
2757 | a1716fa5 | KangIngu | private void zoomAndPanControl2_MouseUp(object sender, MouseButtonEventArgs e) |
2758 | { |
||
2759 | mouseButtonDown = MouseButton.Left; |
||
2760 | } |
||
2761 | |||
2762 | 787a4489 | KangIngu | private void zoomAndPanControl_MouseLeave(object sender, MouseEventArgs e) |
2763 | { |
||
2764 | mouseButtonDown = MouseButton.Left; |
||
2765 | this.Cursor = Cursors.Arrow; |
||
2766 | } |
||
2767 | |||
2768 | private void zoomAndPanControl_MouseDoubleClick(object sender, MouseButtonEventArgs e) |
||
2769 | { |
||
2770 | |||
2771 | } |
||
2772 | |||
2773 | 2aaf9645 | humkyung | /// <summary> |
2774 | /// select item which's bouding rectangle is equal to given rectangle |
||
2775 | /// </summary> |
||
2776 | /// <author>humkyung</author> |
||
2777 | /// <date>2018.06.14</date> |
||
2778 | /// <param name="rect"></param> |
||
2779 | public void SelecteItemByRect(Rect rect) |
||
2780 | { |
||
2781 | multi_Undo_Data = new Multi_Undo_data(); |
||
2782 | |||
2783 | UndoData = new Undo_data() |
||
2784 | { |
||
2785 | IsUndo = false, |
||
2786 | Event = Event_Type.Select, |
||
2787 | EventTime = DateTime.Now, |
||
2788 | Markup_List = new List<Multi_Undo_data>() |
||
2789 | }; |
||
2790 | |||
2791 | var Items = ViewerDataModel.Instance.MarkupControls_USER.ToList(); |
||
2792 | |||
2793 | CommentUserInfo selected = null; |
||
2794 | double dMinDiff = double.MaxValue; |
||
2795 | Move tmp = new Move(); |
||
2796 | foreach (var item in Items) |
||
2797 | { |
||
2798 | Rect boundingBox = tmp.ItemRect(item); |
||
2799 | double dx = rect.X - boundingBox.X; |
||
2800 | double dy = rect.Y - boundingBox.Y; |
||
2801 | double dxx = rect.Right - boundingBox.Right; |
||
2802 | double dyy = rect.Bottom - boundingBox.Bottom; |
||
2803 | double dDiff = Math.Sqrt(dx * dx + dy * dy + dxx * dxx + dyy * dyy); |
||
2804 | if (dDiff < dMinDiff) |
||
2805 | { |
||
2806 | dMinDiff = dDiff; |
||
2807 | selected = item; |
||
2808 | } |
||
2809 | } |
||
2810 | |||
2811 | if (selected != null) |
||
2812 | { |
||
2813 | this.ReleaseAdorner(); |
||
2814 | |||
2815 | List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>(); |
||
2816 | adornerSet.Add(selected); |
||
2817 | ViewerDataModel.Instance.MarkupControls_USER.Remove(selected); |
||
2818 | |||
2819 | Control_Style(selected); |
||
2820 | UndoData.Markup_List.Add(multi_Undo_Data); |
||
2821 | multi_Undo_Data = new Multi_Undo_data(); |
||
2822 | |||
2823 | ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i => |
||
2824 | { |
||
2825 | ViewerDataModel.Instance.UndoDataList.Remove(i); |
||
2826 | }); |
||
2827 | ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
||
2828 | |||
2829 | Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet); |
||
2830 | SelectLayer.Children.Add(final); |
||
2831 | } |
||
2832 | } |
||
2833 | |||
2834 | 787a4489 | KangIngu | private void ApplyDragSelectionRect() |
2835 | { |
||
2836 | multi_Undo_Data = new Multi_Undo_data(); |
||
2837 | |||
2838 | UndoData = new Undo_data() |
||
2839 | { |
||
2840 | IsUndo = false, |
||
2841 | Event = Event_Type.Select, |
||
2842 | EventTime = DateTime.Now, |
||
2843 | Markup_List = new List<Multi_Undo_data>() |
||
2844 | }; |
||
2845 | |||
2846 | dragSelectionBorder.Visibility = Visibility.Collapsed; |
||
2847 | |||
2848 | double x = Canvas.GetLeft(dragSelectionBorder); |
||
2849 | double y = Canvas.GetTop(dragSelectionBorder); |
||
2850 | double width = dragSelectionBorder.Width; |
||
2851 | double height = dragSelectionBorder.Height; |
||
2852 | Rect dragRect = new Rect(x, y, width, height); |
||
2853 | Boolean Flag = false; |
||
2854 | dragRect.Inflate(width / 10, height / 10); |
||
2855 | List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>(); |
||
2856 | var Items = ViewerDataModel.Instance.MarkupControls_USER.ToList(); |
||
2857 | |||
2858 | dragRect = new Rect(x, y, width, height); |
||
2859 | dragRect.Inflate(width / 10, height / 10); |
||
2860 | |||
2861 | foreach (var item in Items) |
||
2862 | { |
||
2863 | Flag = move.control_Select(item, dragRect); |
||
2864 | |||
2865 | if (Flag) |
||
2866 | { |
||
2867 | adornerSet.Add(item); |
||
2868 | ViewerDataModel.Instance.MarkupControls_USER.Remove(item); |
||
2869 | |||
2870 | Control_Style(item); |
||
2871 | UndoData.Markup_List.Add(multi_Undo_Data); |
||
2872 | multi_Undo_Data = new Multi_Undo_data(); |
||
2873 | } |
||
2874 | } |
||
2875 | if (adornerSet.Count > 0) |
||
2876 | { |
||
2877 | ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i => |
||
2878 | { |
||
2879 | ViewerDataModel.Instance.UndoDataList.Remove(i); |
||
2880 | }); |
||
2881 | ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
||
2882 | |||
2883 | Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet); |
||
2884 | SelectLayer.Children.Add(final); |
||
2885 | } |
||
2886 | } |
||
2887 | |||
2888 | private void InitDragSelectionRect(Point pt1, Point pt2) |
||
2889 | { |
||
2890 | 9f473fb7 | KangIngu | //캡쳐 중 |
2891 | if (mouseHandlingMode == MouseHandlingMode.Capture) |
||
2892 | { |
||
2893 | dragCaptureBorder.Visibility = Visibility.Visible; |
||
2894 | } |
||
2895 | 787a4489 | KangIngu | //선택 중 |
2896 | 9f473fb7 | KangIngu | else if (mouseHandlingMode == MouseHandlingMode.Selecting) |
2897 | 787a4489 | KangIngu | { |
2898 | e54660e8 | KangIngu | |
2899 | 787a4489 | KangIngu | dragSelectionBorder.Visibility = Visibility.Visible; |
2900 | } |
||
2901 | else |
||
2902 | { |
||
2903 | 9f473fb7 | KangIngu | dragZoomBorder.Visibility = Visibility.Visible; |
2904 | 787a4489 | KangIngu | } |
2905 | UpdateDragSelectionRect(pt1, pt2); |
||
2906 | } |
||
2907 | |||
2908 | /// <summary> |
||
2909 | /// Update the position and size of the rectangle used for drag selection. |
||
2910 | /// </summary> |
||
2911 | private void UpdateDragSelectionRect(Point pt1, Point pt2) |
||
2912 | { |
||
2913 | double x, y, width, height; |
||
2914 | |||
2915 | // |
||
2916 | // Determine x,y,width and height of the rect inverting the points if necessary. |
||
2917 | // |
||
2918 | |||
2919 | if (pt2.X < pt1.X) |
||
2920 | { |
||
2921 | x = pt2.X; |
||
2922 | width = pt1.X - pt2.X; |
||
2923 | } |
||
2924 | else |
||
2925 | { |
||
2926 | x = pt1.X; |
||
2927 | width = pt2.X - pt1.X; |
||
2928 | } |
||
2929 | |||
2930 | if (pt2.Y < pt1.Y) |
||
2931 | { |
||
2932 | y = pt2.Y; |
||
2933 | height = pt1.Y - pt2.Y; |
||
2934 | } |
||
2935 | else |
||
2936 | { |
||
2937 | y = pt1.Y; |
||
2938 | height = pt2.Y - pt1.Y; |
||
2939 | } |
||
2940 | |||
2941 | // |
||
2942 | // Update the coordinates of the rectangle used for drag selection. |
||
2943 | // |
||
2944 | 9f473fb7 | KangIngu | //캡쳐 중 |
2945 | if (mouseHandlingMode == MouseHandlingMode.Capture) |
||
2946 | { |
||
2947 | Canvas.SetLeft(dragCaptureBorder, x); |
||
2948 | Canvas.SetTop(dragCaptureBorder, y); |
||
2949 | dragCaptureBorder.Width = width; |
||
2950 | dragCaptureBorder.Height = height; |
||
2951 | } |
||
2952 | 787a4489 | KangIngu | //선택 중 |
2953 | a1716fa5 | KangIngu | else if (mouseHandlingMode == MouseHandlingMode.Selecting) |
2954 | 787a4489 | KangIngu | { |
2955 | Canvas.SetLeft(dragSelectionBorder, x); |
||
2956 | Canvas.SetTop(dragSelectionBorder, y); |
||
2957 | dragSelectionBorder.Width = width; |
||
2958 | dragSelectionBorder.Height = height; |
||
2959 | } |
||
2960 | else |
||
2961 | { |
||
2962 | 9f473fb7 | KangIngu | Canvas.SetLeft(dragZoomBorder, x); |
2963 | Canvas.SetTop(dragZoomBorder, y); |
||
2964 | dragZoomBorder.Width = width; |
||
2965 | dragZoomBorder.Height = height; |
||
2966 | 787a4489 | KangIngu | } |
2967 | } |
||
2968 | |||
2969 | public bool IsSelectionControl(Rect dragRect, Rect controlRect, Geometry OverViewPathData, ControlType type) |
||
2970 | { |
||
2971 | //// X, Y, WIDTH, HEIGHT 형태로 RECT를 만든다. |
||
2972 | |||
2973 | bool result = false; |
||
2974 | if (dragRect.Contains(controlRect)) |
||
2975 | { |
||
2976 | result = true; |
||
2977 | //잡은 객체들을 담은 리스트 |
||
2978 | try |
||
2979 | { |
||
2980 | selected_item.Add(OverViewPathData, type.ToString()); |
||
2981 | } |
||
2982 | catch (Exception) |
||
2983 | { |
||
2984 | |||
2985 | } |
||
2986 | } |
||
2987 | return result; |
||
2988 | } |
||
2989 | |||
2990 | private void drawingPannelRotate(double angle) |
||
2991 | { |
||
2992 | rotate.Angle = angle; |
||
2993 | var rotationNum = Math.Abs((rotate.Angle / 90)); |
||
2994 | |||
2995 | if (angle == 90 || angle == 270) |
||
2996 | { |
||
2997 | double emptySize = zoomAndPanCanvas.Width; |
||
2998 | zoomAndPanCanvas.Width = zoomAndPanCanvas.Height; |
||
2999 | zoomAndPanCanvas.Height = emptySize; |
||
3000 | } |
||
3001 | if (angle == 0) |
||
3002 | { |
||
3003 | translate.X = 0; |
||
3004 | translate.Y = 0; |
||
3005 | } |
||
3006 | else if (angle == 90) |
||
3007 | { |
||
3008 | translate.X = zoomAndPanCanvas.Width; |
||
3009 | translate.Y = 0; |
||
3010 | } |
||
3011 | else if (angle == 180) |
||
3012 | { |
||
3013 | translate.X = zoomAndPanCanvas.Width; |
||
3014 | translate.Y = zoomAndPanCanvas.Height; |
||
3015 | } |
||
3016 | else |
||
3017 | { |
||
3018 | translate.X = 0; |
||
3019 | translate.Y = zoomAndPanCanvas.Height; |
||
3020 | } |
||
3021 | |||
3022 | zoomAndPanControl.RotationAngle = rotate.Angle; |
||
3023 | |||
3024 | |||
3025 | if (!testPanel2.IsHidden) |
||
3026 | { |
||
3027 | zoomAndPanControl2.RotationAngle = rotate.Angle; |
||
3028 | zoomAndPanCanvas2.Width = zoomAndPanCanvas.Width; |
||
3029 | zoomAndPanCanvas2.Height = zoomAndPanCanvas.Height; |
||
3030 | } |
||
3031 | |||
3032 | ViewerDataModel.Instance.ContentWidth = zoomAndPanCanvas.Width; |
||
3033 | ViewerDataModel.Instance.ContentHeight = zoomAndPanCanvas.Height; |
||
3034 | ViewerDataModel.Instance.AngleOffsetX = translate.X; |
||
3035 | ViewerDataModel.Instance.AngleOffsetY = translate.Y; |
||
3036 | ViewerDataModel.Instance.Angle = rotate.Angle; |
||
3037 | } |
||
3038 | |||
3039 | private void zoomAndPanControl_MouseDown(object sender, MouseButtonEventArgs e) |
||
3040 | { |
||
3041 | 992a98b4 | KangIngu | var set_option = this.ParentOfType<MainWindow>().dzTopMenu.Parent.ChildrenOfType<RadNumericUpDown>().Where(item => item.IsKeyboardFocusWithin).FirstOrDefault(); |
3042 | if (set_option != null) |
||
3043 | { |
||
3044 | set_option.Value = double.Parse(set_option.ContentText); |
||
3045 | } |
||
3046 | |||
3047 | 787a4489 | KangIngu | InkControl_Convert(); |
3048 | |||
3049 | var text_item = ViewerDataModel.Instance.MarkupControls_USER.Where(data => |
||
3050 | (data as TextControl) != null && (data as TextControl).Text == "" || (data as ArrowTextControl) != null && (data as ArrowTextControl).ArrowText == "").FirstOrDefault(); |
||
3051 | |||
3052 | a1716fa5 | KangIngu | if (text_item != null && (currentControl as ArrowTextControl) == null) |
3053 | 787a4489 | KangIngu | { |
3054 | ViewerDataModel.Instance.MarkupControls_USER.Remove(text_item); |
||
3055 | } |
||
3056 | |||
3057 | foreach (var arrow_text in ViewerDataModel.Instance.MarkupControls_USER) |
||
3058 | { |
||
3059 | if (arrow_text as ArrowTextControl != null) |
||
3060 | { |
||
3061 | (arrow_text as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
||
3062 | } |
||
3063 | } |
||
3064 | |||
3065 | 32e95118 | KangIngu | mouseButtonDown = e.ChangedButton; |
3066 | /// complete drawing text control when user click mouse right button - 2018.05.14 added by humkyung |
||
3067 | e54660e8 | KangIngu | |
3068 | 49b217ad | humkyung | //if (currentControl != null) |
3069 | 787a4489 | KangIngu | { |
3070 | var text_item_ = ViewerDataModel.Instance.MarkupControls_USER.Where(data => (data as TextControl) != null && (data as TextControl).Base_TextBox.Visibility == Visibility.Visible).FirstOrDefault(); |
||
3071 | if (text_item_ != null) |
||
3072 | { |
||
3073 | (text_item_ as TextControl).Base_TextBlock.Visibility = Visibility.Visible; |
||
3074 | (text_item_ as TextControl).Base_TextBox.Visibility = Visibility.Collapsed; |
||
3075 | (text_item_ as TextControl).IsEditing = false; |
||
3076 | (text_item_ as TextControl).EnableEditing = false; |
||
3077 | 49b217ad | humkyung | currentControl = null; |
3078 | 787a4489 | KangIngu | } |
3079 | |||
3080 | var Arrowtext_item_ = ViewerDataModel.Instance.MarkupControls_USER.Where(data => (data as ArrowTextControl) != null && (data as ArrowTextControl).IsEditingMode == true).FirstOrDefault(); |
||
3081 | 49b217ad | humkyung | if (Arrowtext_item_ != null && ((Arrowtext_item_ as ArrowTextControl).IsNew == false)) |
3082 | 787a4489 | KangIngu | { |
3083 | (Arrowtext_item_ as ArrowTextControl).IsEditingMode = false; |
||
3084 | (Arrowtext_item_ as ArrowTextControl).Base_TextBox.Focusable = false; |
||
3085 | 49b217ad | humkyung | currentControl = null; |
3086 | 787a4489 | KangIngu | } |
3087 | } |
||
3088 | |||
3089 | ca40e004 | ljiyeon | double Ang = 0; |
3090 | 787a4489 | KangIngu | if (rotate.Angle != 0) |
3091 | { |
||
3092 | Ang = 360 - rotate.Angle; |
||
3093 | } |
||
3094 | move = new Move(); |
||
3095 | |||
3096 | if (e.OriginalSource is System.Windows.Controls.Image) |
||
3097 | { |
||
3098 | (e.OriginalSource as System.Windows.Controls.Image).Focus(); |
||
3099 | } |
||
3100 | e54660e8 | KangIngu | |
3101 | 787a4489 | KangIngu | if (mouseButtonDown == MouseButton.Left) |
3102 | { |
||
3103 | canvasDrawingMouseDownPoint = e.GetPosition(drawingRotateCanvas); |
||
3104 | canvasZoomPanningMouseDownPoint = e.GetPosition(zoomAndPanCanvas); |
||
3105 | |||
3106 | this.cursor = Cursors.Arrow; |
||
3107 | SetCursor(); |
||
3108 | |||
3109 | if (!ViewerDataModel.Instance.IsPressCtrl) |
||
3110 | { |
||
3111 | ReleaseAdorner(); |
||
3112 | } |
||
3113 | } |
||
3114 | if (mouseButtonDown == MouseButton.Middle) |
||
3115 | { |
||
3116 | canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas); |
||
3117 | cursor = Cursors.SizeAll; |
||
3118 | SetCursor(); |
||
3119 | } |
||
3120 | if (mouseButtonDown == MouseButton.Right) |
||
3121 | { |
||
3122 | canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas); |
||
3123 | cursor = Cursors.SizeAll; |
||
3124 | SetCursor(); |
||
3125 | } |
||
3126 | else if (mouseButtonDown == MouseButton.XButton1) |
||
3127 | { |
||
3128 | if (this.pageNavigator.CurrentPage.PageNumber + 1 <= this.pageNavigator.PageCount) |
||
3129 | { |
||
3130 | this.pageNavigator.GotoPage(this.pageNavigator._NextPage.PageNumber + 1); |
||
3131 | } |
||
3132 | |||
3133 | this.pageNavigator.GotoPage(this.pageNavigator._NextPage.PageNumber); |
||
3134 | |||
3135 | } |
||
3136 | else if (mouseButtonDown == MouseButton.XButton2) |
||
3137 | { |
||
3138 | if (this.pageNavigator.CurrentPage.PageNumber > 1) |
||
3139 | { |
||
3140 | this.pageNavigator.GotoPage(this.pageNavigator.CurrentPage.PageNumber - 1); |
||
3141 | } |
||
3142 | } |
||
3143 | |||
3144 | 9f473fb7 | KangIngu | //if (mouseButtonDown == MouseButton.Left && ViewerDataModel.Instance.MarkupControls_USER.Count > 0 && mouseHandlingMode != MouseHandlingMode.Drawing && currentControl == null) |
3145 | if (mouseButtonDown == MouseButton.Left && mouseHandlingMode != MouseHandlingMode.Drawing && currentControl == null) |
||
3146 | 787a4489 | KangIngu | { |
3147 | if (mouseHandlingMode == MouseHandlingMode.Selecting) |
||
3148 | { |
||
3149 | if (SelectLayer.Children.Count == 0) |
||
3150 | { |
||
3151 | isLeftMouseButtonDownOnWindow = true; |
||
3152 | mouseHandlingMode = MouseHandlingMode.Selecting; |
||
3153 | } |
||
3154 | |||
3155 | if (controlType == ControlType.None) |
||
3156 | { |
||
3157 | isLeftMouseButtonDownOnWindow = true; |
||
3158 | } |
||
3159 | } |
||
3160 | |||
3161 | 9f473fb7 | KangIngu | //캡쳐 모드 설정 |
3162 | if (mouseHandlingMode == MouseHandlingMode.Capture) |
||
3163 | { |
||
3164 | dragCaptureBorder.Visibility = Visibility.Visible; |
||
3165 | isLeftMouseButtonDownOnWindow = true; |
||
3166 | } |
||
3167 | |||
3168 | //줌 모드 설정 |
||
3169 | if (mouseHandlingMode == MouseHandlingMode.DragZoom) |
||
3170 | { |
||
3171 | //dragSelectionBorder.Visibility = Visibility.Visible; |
||
3172 | isLeftMouseButtonDownOnWindow = true; |
||
3173 | 6707a5c7 | ljiyeon | } |
3174 | 787a4489 | KangIngu | |
3175 | var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseOver).FirstOrDefault(); |
||
3176 | if (control != null) |
||
3177 | { |
||
3178 | //강인구 추가 컨트롤 누르고 멀티 선택(다시확인필요) |
||
3179 | AdornerFinal final; |
||
3180 | List<Point> p_set = new List<Point>(); |
||
3181 | List<CommentUserInfo> comment = new List<CommentUserInfo>(); |
||
3182 | ViewerDataModel.Instance.MarkupControls.Remove(control); |
||
3183 | ViewerDataModel.Instance.MarkupControls_USER.Remove(control); |
||
3184 | multi_Undo_Data = new Multi_Undo_data(); |
||
3185 | |||
3186 | //강인구 Undo/Redo 보류 |
||
3187 | UndoData = new Undo_data() |
||
3188 | { |
||
3189 | IsUndo = false, |
||
3190 | Event = Event_Type.Select, |
||
3191 | EventTime = DateTime.Now, |
||
3192 | Markup_List = new List<Multi_Undo_data>() |
||
3193 | }; |
||
3194 | |||
3195 | if (!ViewerDataModel.Instance.IsPressCtrl) |
||
3196 | { |
||
3197 | ReleaseAdorner(); |
||
3198 | final = new AdornerFinal(control); |
||
3199 | //단일 컨트롤 언두 저장 |
||
3200 | |||
3201 | Control_Style(control); |
||
3202 | UndoData.Markup_List.Add(multi_Undo_Data); |
||
3203 | |||
3204 | if ((control as IPath) != null) |
||
3205 | { |
||
3206 | if ((control as IPath).LineSize != 0) |
||
3207 | { |
||
3208 | ViewerDataModel.Instance.LineSize = (control as IPath).LineSize; |
||
3209 | } |
||
3210 | } |
||
3211 | if ((control as IShapeControl) != null) |
||
3212 | { |
||
3213 | if ((control as IShapeControl).Paint == PaintSet.Hatch) |
||
3214 | { |
||
3215 | ViewerDataModel.Instance.checkHatchShape = true; |
||
3216 | } |
||
3217 | else if ((control as IShapeControl).Paint == PaintSet.Fill) |
||
3218 | { |
||
3219 | ViewerDataModel.Instance.checkFillShape = true; |
||
3220 | } |
||
3221 | else |
||
3222 | { |
||
3223 | ViewerDataModel.Instance.checkHatchShape = false; |
||
3224 | ViewerDataModel.Instance.checkFillShape = false; |
||
3225 | } |
||
3226 | ViewerDataModel.Instance.paintSet = (control as IShapeControl).Paint; |
||
3227 | } |
||
3228 | 9f473fb7 | KangIngu | |
3229 | 787a4489 | KangIngu | ViewerDataModel.Instance.ControlOpacity = control.Opacity; |
3230 | d4b0c723 | KangIngu | |
3231 | if ((control as TextControl) != null) |
||
3232 | { |
||
3233 | if ((control as TextControl).TextStyle == FontStyles.Italic) |
||
3234 | { |
||
3235 | ViewerDataModel.Instance.checkTextStyle = true; |
||
3236 | } |
||
3237 | else |
||
3238 | { |
||
3239 | ViewerDataModel.Instance.checkTextStyle = false; |
||
3240 | } |
||
3241 | |||
3242 | if ((control as TextControl).TextStyle == FontStyles.Italic) |
||
3243 | { |
||
3244 | ViewerDataModel.Instance.checkTextStyle = true; |
||
3245 | } |
||
3246 | else |
||
3247 | { |
||
3248 | ViewerDataModel.Instance.checkTextStyle = false; |
||
3249 | } |
||
3250 | if ((control as TextControl).TextWeight == FontWeights.Bold) |
||
3251 | { |
||
3252 | ViewerDataModel.Instance.checkTextWeight = true; |
||
3253 | } |
||
3254 | else |
||
3255 | { |
||
3256 | ViewerDataModel.Instance.checkTextWeight = false; |
||
3257 | } |
||
3258 | if ((control as TextControl).UnderLine == TextDecorations.Underline) |
||
3259 | { |
||
3260 | ViewerDataModel.Instance.checkUnderLine = true; |
||
3261 | } |
||
3262 | else |
||
3263 | { |
||
3264 | ViewerDataModel.Instance.checkUnderLine = false; |
||
3265 | } |
||
3266 | ViewerDataModel.Instance.TextSize = (control as TextControl).TextSize; |
||
3267 | ViewerDataModel.Instance.checkHighlight = (control as TextControl).IsHighLight; |
||
3268 | e54660e8 | KangIngu | |
3269 | d4b0c723 | KangIngu | } |
3270 | else if ((control as ArrowTextControl) != null) |
||
3271 | { |
||
3272 | e17af42b | KangIngu | if ((control as ArrowTextControl).TextStyle == FontStyles.Italic) |
3273 | d4b0c723 | KangIngu | { |
3274 | e17af42b | KangIngu | ViewerDataModel.Instance.checkTextStyle = true; |
3275 | } |
||
3276 | else |
||
3277 | { |
||
3278 | ViewerDataModel.Instance.checkTextStyle = false; |
||
3279 | } |
||
3280 | |||
3281 | if ((control as ArrowTextControl).TextStyle == FontStyles.Italic) |
||
3282 | { |
||
3283 | ViewerDataModel.Instance.checkTextStyle = true; |
||
3284 | d4b0c723 | KangIngu | } |
3285 | e17af42b | KangIngu | else |
3286 | d4b0c723 | KangIngu | { |
3287 | e17af42b | KangIngu | ViewerDataModel.Instance.checkTextStyle = false; |
3288 | d4b0c723 | KangIngu | } |
3289 | e17af42b | KangIngu | if ((control as ArrowTextControl).TextWeight == FontWeights.Bold) |
3290 | d4b0c723 | KangIngu | { |
3291 | e17af42b | KangIngu | ViewerDataModel.Instance.checkTextWeight = true; |
3292 | } |
||
3293 | else |
||
3294 | { |
||
3295 | ViewerDataModel.Instance.checkTextWeight = false; |
||
3296 | } |
||
3297 | if ((control as ArrowTextControl).UnderLine == TextDecorations.Underline) |
||
3298 | { |
||
3299 | ViewerDataModel.Instance.checkUnderLine = true; |
||
3300 | } |
||
3301 | else |
||
3302 | { |
||
3303 | ViewerDataModel.Instance.checkUnderLine = false; |
||
3304 | d4b0c723 | KangIngu | } |
3305 | ViewerDataModel.Instance.checkHighlight = (control as ArrowTextControl).isHighLight; |
||
3306 | ViewerDataModel.Instance.TextSize = (control as ArrowTextControl).TextSize; |
||
3307 | } |
||
3308 | 9f473fb7 | KangIngu | else if ((control as RectCloudControl) != null) |
3309 | { |
||
3310 | ViewerDataModel.Instance.ArcLength = (control as RectCloudControl).ArcLength; |
||
3311 | } |
||
3312 | else if ((control as CloudControl) != null) |
||
3313 | { |
||
3314 | ViewerDataModel.Instance.ArcLength = (control as CloudControl).ArcLength; |
||
3315 | } |
||
3316 | d4b0c723 | KangIngu | |
3317 | 787a4489 | KangIngu | } |
3318 | else |
||
3319 | { |
||
3320 | comment = AddAdorner(); |
||
3321 | comment.Add(control); |
||
3322 | |||
3323 | Control_Style(control); |
||
3324 | UndoData.Markup_List.Add(multi_Undo_Data); |
||
3325 | |||
3326 | final = new AdornerFinal(comment); |
||
3327 | //다중 컨트롤 언두 저장 |
||
3328 | } |
||
3329 | |||
3330 | ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i => |
||
3331 | { |
||
3332 | ViewerDataModel.Instance.UndoDataList.Remove(i); |
||
3333 | }); |
||
3334 | |||
3335 | ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
||
3336 | |||
3337 | SelectLayer.Children.Add(final); |
||
3338 | 6707a5c7 | ljiyeon | } |
3339 | 787a4489 | KangIngu | } |
3340 | else if (mouseHandlingMode == MouseHandlingMode.Drawing) |
||
3341 | 6707a5c7 | ljiyeon | { |
3342 | 787a4489 | KangIngu | init(); |
3343 | //강인구 추가(우 클릭 일 경우 커서 변경 하지 않음) |
||
3344 | if (cursor != Cursors.SizeAll) |
||
3345 | { |
||
3346 | cursor = Cursors.Cross; |
||
3347 | SetCursor(); |
||
3348 | } |
||
3349 | bool init_user = false; |
||
3350 | foreach (var user in gridViewMarkup.Items) |
||
3351 | { |
||
3352 | if ((user as MarkupInfoItem).UserID == App.ViewInfo.UserID) |
||
3353 | { |
||
3354 | init_user = true; |
||
3355 | } |
||
3356 | } |
||
3357 | if (init_user && gridViewMarkup.SelectedItems.Where(d => (d as MarkupInfoItem).UserID == App.ViewInfo.UserID).FirstOrDefault() == null && e.LeftButton == MouseButtonState.Pressed) |
||
3358 | { |
||
3359 | RadWindow.Alert(new DialogParameters |
||
3360 | { |
||
3361 | Theme = new VisualStudio2013Theme(), |
||
3362 | Header = "안내", |
||
3363 | Content = "기존의 코멘트가 존재합니다. 사용자 리스트에서 먼저 선택해주세요", |
||
3364 | }); |
||
3365 | return; |
||
3366 | } |
||
3367 | else |
||
3368 | { |
||
3369 | var item = gridViewMarkup.SelectedItems.Where(d => (d as MarkupInfoItem).UserID == App.ViewInfo.UserID).FirstOrDefault() as MarkupInfoItem; |
||
3370 | if (item != null) |
||
3371 | { |
||
3372 | App.Custom_ViewInfoId = item.MarkupInfoID; |
||
3373 | } |
||
3374 | } |
||
3375 | |||
3376 | multi_Undo_Data = new Multi_Undo_data(); |
||
3377 | //강인구 Undo/Redo 보류 |
||
3378 | UndoData = new Undo_data() |
||
3379 | { |
||
3380 | IsUndo = false, |
||
3381 | Event = Event_Type.Create, |
||
3382 | EventTime = DateTime.Now, |
||
3383 | Markup_List = new List<Multi_Undo_data>() |
||
3384 | }; |
||
3385 | |||
3386 | ca40e004 | ljiyeon | switch (controlType) |
3387 | 787a4489 | KangIngu | { |
3388 | case ControlType.Rectangle: |
||
3389 | { |
||
3390 | if (mouseButtonDown == MouseButton.Left) |
||
3391 | { |
||
3392 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
3393 | //{ |
||
3394 | 787a4489 | KangIngu | if (currentControl is RectangleControl) |
3395 | { |
||
3396 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
3397 | if (IsGetoutpoint((currentControl as RectangleControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
3398 | e66f22eb | KangIngu | { |
3399 | return; |
||
3400 | } |
||
3401 | |||
3402 | 787a4489 | KangIngu | CreateControl(); |
3403 | |||
3404 | (currentControl as RectangleControl).ApplyOverViewData(); |
||
3405 | currentControl = null; |
||
3406 | this.cursor = Cursors.Arrow; |
||
3407 | } |
||
3408 | else |
||
3409 | { |
||
3410 | currentControl = new RectangleControl |
||
3411 | { |
||
3412 | Background = new SolidColorBrush(Colors.Black), |
||
3413 | ControlType = ControlType.Rectangle |
||
3414 | }; |
||
3415 | |||
3416 | currentControl.CommentID = Save.shortGuid(); |
||
3417 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
3418 | currentControl.IsNew = true; |
||
3419 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
3420 | |||
3421 | currentControl.SetValue(Canvas.ZIndexProperty, 3); |
||
3422 | } |
||
3423 | e66f22eb | KangIngu | //} |
3424 | 787a4489 | KangIngu | } |
3425 | } |
||
3426 | break; |
||
3427 | case ControlType.RectCloud: |
||
3428 | { |
||
3429 | if (mouseButtonDown == MouseButton.Left) |
||
3430 | { |
||
3431 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
3432 | //{ |
||
3433 | 787a4489 | KangIngu | if (currentControl is RectCloudControl) |
3434 | { |
||
3435 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
3436 | if (IsGetoutpoint((currentControl as RectCloudControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
3437 | e66f22eb | KangIngu | { |
3438 | return; |
||
3439 | } |
||
3440 | |||
3441 | 787a4489 | KangIngu | CreateControl(); |
3442 | |||
3443 | (currentControl as RectCloudControl).ApplyOverViewData(); |
||
3444 | currentControl = null; |
||
3445 | this.cursor = Cursors.Arrow; |
||
3446 | } |
||
3447 | else |
||
3448 | { |
||
3449 | currentControl = new RectCloudControl |
||
3450 | { |
||
3451 | Background = new SolidColorBrush(Colors.Black) |
||
3452 | }; |
||
3453 | |||
3454 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
3455 | currentControl.CommentID = Save.shortGuid(); |
||
3456 | currentControl.IsNew = true; |
||
3457 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
3458 | } |
||
3459 | e66f22eb | KangIngu | //} |
3460 | 787a4489 | KangIngu | } |
3461 | } |
||
3462 | break; |
||
3463 | case ControlType.Circle: |
||
3464 | { |
||
3465 | if (mouseButtonDown == MouseButton.Left) |
||
3466 | { |
||
3467 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
3468 | //{ |
||
3469 | 787a4489 | KangIngu | if (currentControl is CircleControl) |
3470 | { |
||
3471 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
3472 | if (IsGetoutpoint((currentControl as CircleControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
3473 | e66f22eb | KangIngu | { |
3474 | return; |
||
3475 | } |
||
3476 | |||
3477 | 787a4489 | KangIngu | CreateControl(); |
3478 | |||
3479 | (currentControl as CircleControl).ApplyOverViewData(); |
||
3480 | currentControl = null; |
||
3481 | } |
||
3482 | else |
||
3483 | { |
||
3484 | currentControl = new CircleControl |
||
3485 | { |
||
3486 | Background = new SolidColorBrush(Colors.Black) |
||
3487 | }; |
||
3488 | |||
3489 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
3490 | currentControl.CommentID = Save.shortGuid(); |
||
3491 | currentControl.IsNew = true; |
||
3492 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
3493 | } |
||
3494 | e66f22eb | KangIngu | //} |
3495 | 787a4489 | KangIngu | } |
3496 | } |
||
3497 | break; |
||
3498 | case ControlType.Triangle: |
||
3499 | { |
||
3500 | if (mouseButtonDown == MouseButton.Left) |
||
3501 | { |
||
3502 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
3503 | //{ |
||
3504 | 787a4489 | KangIngu | if (currentControl is TriControl) |
3505 | { |
||
3506 | var content = currentControl as TriControl; |
||
3507 | if (content.MidPoint == new Point(0, 0)) |
||
3508 | { |
||
3509 | content.MidPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y); |
||
3510 | } |
||
3511 | else |
||
3512 | { |
||
3513 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
3514 | if (IsGetoutpoint((currentControl as TriControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
3515 | e66f22eb | KangIngu | { |
3516 | return; |
||
3517 | } |
||
3518 | |||
3519 | 787a4489 | KangIngu | CreateControl(); |
3520 | |||
3521 | (currentControl as TriControl).ApplyOverViewData(); |
||
3522 | currentControl = null; |
||
3523 | } |
||
3524 | } |
||
3525 | else |
||
3526 | { |
||
3527 | currentControl = new TriControl |
||
3528 | { |
||
3529 | StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y), |
||
3530 | Background = new SolidColorBrush(Colors.Black), |
||
3531 | }; |
||
3532 | |||
3533 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
3534 | currentControl.CommentID = Save.shortGuid(); |
||
3535 | currentControl.IsNew = true; |
||
3536 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
3537 | } |
||
3538 | e66f22eb | KangIngu | //} |
3539 | 787a4489 | KangIngu | } |
3540 | } |
||
3541 | break; |
||
3542 | case ControlType.SingleLine: |
||
3543 | { |
||
3544 | if (mouseButtonDown == MouseButton.Left) |
||
3545 | { |
||
3546 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
3547 | //{ |
||
3548 | 787a4489 | KangIngu | if (currentControl is LineControl) |
3549 | { |
||
3550 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
3551 | if (IsGetoutpoint((currentControl as LineControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
3552 | e66f22eb | KangIngu | { |
3553 | return; |
||
3554 | } |
||
3555 | |||
3556 | 787a4489 | KangIngu | CreateControl(); |
3557 | |||
3558 | (currentControl as LineControl).ApplyOverViewData(); |
||
3559 | currentControl = null; |
||
3560 | 5ce56a3a | KangIngu | this.MainAngle.Visibility = Visibility.Collapsed; |
3561 | 787a4489 | KangIngu | } |
3562 | else |
||
3563 | { |
||
3564 | currentControl = new LineControl |
||
3565 | { |
||
3566 | Background = new SolidColorBrush(Colors.Black) |
||
3567 | }; |
||
3568 | |||
3569 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
3570 | currentControl.CommentID = Save.shortGuid(); |
||
3571 | currentControl.IsNew = true; |
||
3572 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
3573 | 5ce56a3a | KangIngu | this.MainAngle.Visibility = Visibility.Visible; |
3574 | 787a4489 | KangIngu | } |
3575 | e66f22eb | KangIngu | //} |
3576 | 787a4489 | KangIngu | } |
3577 | } |
||
3578 | break; |
||
3579 | case ControlType.CancelLine: |
||
3580 | { |
||
3581 | if (mouseButtonDown == MouseButton.Left) |
||
3582 | { |
||
3583 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
3584 | //{ |
||
3585 | 787a4489 | KangIngu | if (currentControl is LineControl) |
3586 | { |
||
3587 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
3588 | if (IsGetoutpoint((currentControl as LineControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
3589 | e66f22eb | KangIngu | { |
3590 | return; |
||
3591 | } |
||
3592 | |||
3593 | 787a4489 | KangIngu | CreateControl(); |
3594 | |||
3595 | (currentControl as LineControl).ApplyOverViewData(); |
||
3596 | currentControl = null; |
||
3597 | 5ce56a3a | KangIngu | this.MainAngle.Visibility = Visibility.Collapsed; |
3598 | 787a4489 | KangIngu | } |
3599 | else |
||
3600 | { |
||
3601 | currentControl = new LineControl |
||
3602 | { |
||
3603 | Background = new SolidColorBrush(Colors.Black) |
||
3604 | }; |
||
3605 | |||
3606 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
3607 | currentControl.CommentID = Save.shortGuid(); |
||
3608 | currentControl.IsNew = true; |
||
3609 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
3610 | 5ce56a3a | KangIngu | this.MainAngle.Visibility = Visibility.Visible; |
3611 | 787a4489 | KangIngu | } |
3612 | e66f22eb | KangIngu | //} |
3613 | 787a4489 | KangIngu | } |
3614 | } |
||
3615 | break; |
||
3616 | case ControlType.ArrowLine: |
||
3617 | { |
||
3618 | if (mouseButtonDown == MouseButton.Left) |
||
3619 | { |
||
3620 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
3621 | //{ |
||
3622 | 787a4489 | KangIngu | if (currentControl is LineControl) |
3623 | { |
||
3624 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
3625 | if (IsGetoutpoint((currentControl as LineControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
3626 | e66f22eb | KangIngu | { |
3627 | return; |
||
3628 | } |
||
3629 | |||
3630 | 787a4489 | KangIngu | CreateControl(); |
3631 | |||
3632 | (currentControl as LineControl).ApplyOverViewData(); |
||
3633 | currentControl = null; |
||
3634 | 5ce56a3a | KangIngu | this.MainAngle.Visibility = Visibility.Collapsed; |
3635 | 787a4489 | KangIngu | } |
3636 | else |
||
3637 | { |
||
3638 | currentControl = new LineControl |
||
3639 | { |
||
3640 | Background = new SolidColorBrush(Colors.Black) |
||
3641 | }; |
||
3642 | |||
3643 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
3644 | currentControl.CommentID = Save.shortGuid(); |
||
3645 | currentControl.IsNew = true; |
||
3646 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
3647 | 5ce56a3a | KangIngu | this.MainAngle.Visibility = Visibility.Visible; |
3648 | 787a4489 | KangIngu | } |
3649 | e66f22eb | KangIngu | //} |
3650 | 787a4489 | KangIngu | } |
3651 | } |
||
3652 | break; |
||
3653 | case ControlType.TwinLine: |
||
3654 | { |
||
3655 | if (mouseButtonDown == MouseButton.Left) |
||
3656 | { |
||
3657 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
3658 | //{ |
||
3659 | 787a4489 | KangIngu | if (currentControl is LineControl) |
3660 | { |
||
3661 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
3662 | if (IsGetoutpoint((currentControl as LineControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
3663 | e66f22eb | KangIngu | { |
3664 | return; |
||
3665 | } |
||
3666 | |||
3667 | 787a4489 | KangIngu | CreateControl(); |
3668 | |||
3669 | (currentControl as LineControl).ApplyOverViewData(); |
||
3670 | currentControl = null; |
||
3671 | 5ce56a3a | KangIngu | this.MainAngle.Visibility = Visibility.Collapsed; |
3672 | 787a4489 | KangIngu | } |
3673 | else |
||
3674 | { |
||
3675 | currentControl = new LineControl |
||
3676 | { |
||
3677 | Background = new SolidColorBrush(Colors.Black) |
||
3678 | }; |
||
3679 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
3680 | currentControl.CommentID = Save.shortGuid(); |
||
3681 | currentControl.IsNew = true; |
||
3682 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
3683 | 5ce56a3a | KangIngu | this.MainAngle.Visibility = Visibility.Visible; |
3684 | 787a4489 | KangIngu | } |
3685 | e66f22eb | KangIngu | //} |
3686 | 787a4489 | KangIngu | } |
3687 | } |
||
3688 | break; |
||
3689 | case ControlType.DimLine: |
||
3690 | { |
||
3691 | if (mouseButtonDown == MouseButton.Left) |
||
3692 | { |
||
3693 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
3694 | //{ |
||
3695 | 787a4489 | KangIngu | if (currentControl is LineControl) |
3696 | { |
||
3697 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
3698 | if (IsGetoutpoint((currentControl as LineControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
3699 | e66f22eb | KangIngu | { |
3700 | return; |
||
3701 | } |
||
3702 | 787a4489 | KangIngu | CreateControl(); |
3703 | |||
3704 | (currentControl as LineControl).ApplyOverViewData(); |
||
3705 | currentControl = null; |
||
3706 | 5ce56a3a | KangIngu | this.MainAngle.Visibility = Visibility.Collapsed; |
3707 | 787a4489 | KangIngu | } |
3708 | else |
||
3709 | { |
||
3710 | currentControl = new LineControl |
||
3711 | { |
||
3712 | Background = new SolidColorBrush(Colors.Black) |
||
3713 | }; |
||
3714 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
3715 | currentControl.CommentID = Save.shortGuid(); |
||
3716 | currentControl.IsNew = true; |
||
3717 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
3718 | 5ce56a3a | KangIngu | this.MainAngle.Visibility = Visibility.Visible; |
3719 | 787a4489 | KangIngu | } |
3720 | e66f22eb | KangIngu | //} |
3721 | 787a4489 | KangIngu | } |
3722 | } |
||
3723 | break; |
||
3724 | case ControlType.ChainLine: |
||
3725 | { |
||
3726 | if (currentControl is PolygonControl) |
||
3727 | { |
||
3728 | var control = currentControl as PolygonControl; |
||
3729 | |||
3730 | if (mouseButtonDown == MouseButton.Right) |
||
3731 | { |
||
3732 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
3733 | if (IsGetoutpoint((currentControl as PolygonControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
3734 | e66f22eb | KangIngu | { |
3735 | return; |
||
3736 | } |
||
3737 | |||
3738 | 787a4489 | KangIngu | CreateControl(); |
3739 | |||
3740 | (currentControl as PolygonControl).ApplyOverViewData(); |
||
3741 | currentControl = null; |
||
3742 | 2eac4f76 | KangIngu | this.MainAngle.Visibility = Visibility.Collapsed; |
3743 | 787a4489 | KangIngu | return; |
3744 | } |
||
3745 | |||
3746 | if (!control.IsCompleted) |
||
3747 | { |
||
3748 | control.PointSet.Add(control.EndPoint); |
||
3749 | 2eac4f76 | KangIngu | this.MainAngle.Visibility = Visibility.Visible; |
3750 | 787a4489 | KangIngu | } |
3751 | } |
||
3752 | else |
||
3753 | { |
||
3754 | if (mouseButtonDown == MouseButton.Left) |
||
3755 | { |
||
3756 | 2eac4f76 | KangIngu | MainAngle.Visibility = Visibility.Visible; |
3757 | 787a4489 | KangIngu | currentControl = new PolygonControl |
3758 | { |
||
3759 | PointSet = new List<Point>(), |
||
3760 | //강인구 추가(ChainLine일때는 채우기 스타일을 주지 않기 위해 설정) |
||
3761 | ControlType = ControlType.ChainLine, |
||
3762 | DashSize = ViewerDataModel.Instance.DashSize, |
||
3763 | LineSize = ViewerDataModel.Instance.LineSize, |
||
3764 | //PointC = new StylusPointSet() |
||
3765 | }; |
||
3766 | |||
3767 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
3768 | //{ |
||
3769 | 787a4489 | KangIngu | var polygonControl = (currentControl as PolygonControl); |
3770 | currentControl.CommentID = Save.shortGuid(); |
||
3771 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
3772 | currentControl.IsNew = true; |
||
3773 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
3774 | //currentControl.OnApplyTemplate(); |
||
3775 | //polygonControl.PointC.pointSet.Add(canvasDrawingMouseDownPoint); |
||
3776 | //polygonControl.PointC.pointSet.Add(canvasDrawingMouseDownPoint); |
||
3777 | polygonControl.PointSet.Add(canvasDrawingMouseDownPoint); |
||
3778 | polygonControl.PointSet.Add(canvasDrawingMouseDownPoint); |
||
3779 | e66f22eb | KangIngu | //} |
3780 | 787a4489 | KangIngu | } |
3781 | } |
||
3782 | } |
||
3783 | break; |
||
3784 | case ControlType.ArcLine: |
||
3785 | { |
||
3786 | if (mouseButtonDown == MouseButton.Left) |
||
3787 | { |
||
3788 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
3789 | //{ |
||
3790 | 787a4489 | KangIngu | if (currentControl is ArcControl) |
3791 | { |
||
3792 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
3793 | if (IsGetoutpoint((currentControl as ArcControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
3794 | e66f22eb | KangIngu | { |
3795 | return; |
||
3796 | } |
||
3797 | |||
3798 | 787a4489 | KangIngu | CreateControl(); |
3799 | |||
3800 | (currentControl as ArcControl).ApplyOverViewData(); |
||
3801 | currentControl = null; |
||
3802 | 5ce56a3a | KangIngu | this.MainAngle.Visibility = Visibility.Collapsed; |
3803 | 787a4489 | KangIngu | } |
3804 | else |
||
3805 | { |
||
3806 | currentControl = new ArcControl |
||
3807 | { |
||
3808 | Background = new SolidColorBrush(Colors.Black) |
||
3809 | }; |
||
3810 | currentControl.CommentID = Save.shortGuid(); |
||
3811 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
3812 | currentControl.IsNew = true; |
||
3813 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
3814 | 5ce56a3a | KangIngu | this.MainAngle.Visibility = Visibility.Visible; |
3815 | 787a4489 | KangIngu | } |
3816 | e66f22eb | KangIngu | //} |
3817 | 787a4489 | KangIngu | } |
3818 | else if (mouseButtonDown == MouseButton.Right) |
||
3819 | { |
||
3820 | if (currentControl != null) |
||
3821 | { |
||
3822 | (currentControl as ArcControl).setClock(); |
||
3823 | 05f4d127 | KangIngu | (currentControl as ArcControl).MidPoint = new Point(0, 0); |
3824 | //(currentControl as ArcControl).ApplyTemplate(); |
||
3825 | 787a4489 | KangIngu | } |
3826 | } |
||
3827 | } |
||
3828 | break; |
||
3829 | case ControlType.ArcArrow: |
||
3830 | { |
||
3831 | if (mouseButtonDown == MouseButton.Left) |
||
3832 | { |
||
3833 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
3834 | //{ |
||
3835 | 787a4489 | KangIngu | if (currentControl is ArcControl) |
3836 | { |
||
3837 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
3838 | if (IsGetoutpoint((currentControl as ArcControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
3839 | e66f22eb | KangIngu | { |
3840 | return; |
||
3841 | } |
||
3842 | |||
3843 | 787a4489 | KangIngu | CreateControl(); |
3844 | |||
3845 | (currentControl as ArcControl).ApplyOverViewData(); |
||
3846 | currentControl = null; |
||
3847 | 5ce56a3a | KangIngu | this.MainAngle.Visibility = Visibility.Collapsed; |
3848 | 787a4489 | KangIngu | } |
3849 | else |
||
3850 | { |
||
3851 | currentControl = new ArcControl |
||
3852 | { |
||
3853 | Background = new SolidColorBrush(Colors.Red), |
||
3854 | }; |
||
3855 | currentControl.CommentID = Save.shortGuid(); |
||
3856 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
3857 | currentControl.IsNew = true; |
||
3858 | (currentControl as IMarkupCommonData).ControlType = ControlType.ArcArrow; |
||
3859 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
3860 | 5ce56a3a | KangIngu | this.MainAngle.Visibility = Visibility.Visible; |
3861 | 787a4489 | KangIngu | } |
3862 | e66f22eb | KangIngu | //} |
3863 | 787a4489 | KangIngu | } |
3864 | else if (mouseButtonDown == MouseButton.Right) |
||
3865 | { |
||
3866 | (currentControl as ArcControl).setClock(); |
||
3867 | } |
||
3868 | } |
||
3869 | break; |
||
3870 | case ControlType.ArrowMultiLine: |
||
3871 | { |
||
3872 | if (mouseButtonDown == MouseButton.Left) |
||
3873 | { |
||
3874 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
3875 | //{ |
||
3876 | 787a4489 | KangIngu | |
3877 | if (currentControl is ArrowControl_Multi) |
||
3878 | { |
||
3879 | var content = currentControl as ArrowControl_Multi; |
||
3880 | if (content.MiddlePoint == new Point(0, 0)) |
||
3881 | { |
||
3882 | 2eac4f76 | KangIngu | if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift) |
3883 | { |
||
3884 | content.MiddlePoint = content.EndPoint; |
||
3885 | } |
||
3886 | else |
||
3887 | { |
||
3888 | content.MiddlePoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y); |
||
3889 | } |
||
3890 | 787a4489 | KangIngu | } |
3891 | else |
||
3892 | { |
||
3893 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
3894 | if (IsGetoutpoint((currentControl as ArrowControl_Multi).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
3895 | e66f22eb | KangIngu | { |
3896 | return; |
||
3897 | } |
||
3898 | |||
3899 | 787a4489 | KangIngu | CreateControl(); |
3900 | |||
3901 | (currentControl as ArrowControl_Multi).ApplyOverViewData(); |
||
3902 | currentControl = null; |
||
3903 | 5ce56a3a | KangIngu | this.MainAngle.Visibility = Visibility.Collapsed; |
3904 | 787a4489 | KangIngu | } |
3905 | } |
||
3906 | else |
||
3907 | { |
||
3908 | currentControl = new ArrowControl_Multi |
||
3909 | { |
||
3910 | StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y), |
||
3911 | Background = new SolidColorBrush(Colors.Black) |
||
3912 | }; |
||
3913 | currentControl.CommentID = Save.shortGuid(); |
||
3914 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
3915 | currentControl.IsNew = true; |
||
3916 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
3917 | 5ce56a3a | KangIngu | this.MainAngle.Visibility = Visibility.Visible; |
3918 | 787a4489 | KangIngu | } |
3919 | e66f22eb | KangIngu | //} |
3920 | 787a4489 | KangIngu | } |
3921 | } |
||
3922 | break; |
||
3923 | case ControlType.PolygonCloud: |
||
3924 | { |
||
3925 | if (currentControl is CloudControl) |
||
3926 | { |
||
3927 | var control = currentControl as CloudControl; |
||
3928 | if (mouseButtonDown == MouseButton.Right) |
||
3929 | { |
||
3930 | control.IsCompleted = true; |
||
3931 | } |
||
3932 | |||
3933 | if (!control.IsCompleted) |
||
3934 | { |
||
3935 | control.PointSet.Add(control.EndPoint); |
||
3936 | } |
||
3937 | else |
||
3938 | { |
||
3939 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
3940 | if (IsGetoutpoint((currentControl as CloudControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
3941 | e66f22eb | KangIngu | { |
3942 | return; |
||
3943 | } |
||
3944 | |||
3945 | 787a4489 | KangIngu | CreateControl(); |
3946 | |||
3947 | control.isTransOn = true; |
||
3948 | var firstPoint = control.PointSet.First(); |
||
3949 | |||
3950 | control.PointSet.Add(firstPoint); |
||
3951 | control.DrawingCloud(); |
||
3952 | control.ApplyOverViewData(); |
||
3953 | |||
3954 | currentControl = null; |
||
3955 | } |
||
3956 | } |
||
3957 | else |
||
3958 | { |
||
3959 | if (mouseButtonDown == MouseButton.Left) |
||
3960 | { |
||
3961 | currentControl = new CloudControl |
||
3962 | { |
||
3963 | PointSet = new List<Point>(), |
||
3964 | PointC = new StylusPointSet() |
||
3965 | }; |
||
3966 | |||
3967 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
3968 | //{ |
||
3969 | 787a4489 | KangIngu | var polygonControl = (currentControl as CloudControl); |
3970 | currentControl.CommentID = Save.shortGuid(); |
||
3971 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
3972 | currentControl.IsNew = true; |
||
3973 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
3974 | |||
3975 | polygonControl.PointSet.Add(canvasDrawingMouseDownPoint); |
||
3976 | polygonControl.PointSet.Add(canvasDrawingMouseDownPoint); |
||
3977 | e66f22eb | KangIngu | //} |
3978 | 787a4489 | KangIngu | } |
3979 | } |
||
3980 | } |
||
3981 | break; |
||
3982 | case ControlType.ImgControl: |
||
3983 | { |
||
3984 | if (mouseButtonDown == MouseButton.Left) |
||
3985 | { |
||
3986 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
3987 | //{ |
||
3988 | 787a4489 | KangIngu | if (currentControl is ImgControl) |
3989 | { |
||
3990 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
3991 | if (IsGetoutpoint((currentControl as ImgControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
3992 | e66f22eb | KangIngu | { |
3993 | return; |
||
3994 | } |
||
3995 | |||
3996 | 787a4489 | KangIngu | CreateControl(); |
3997 | (currentControl as ImgControl).ApplyOverViewData(); |
||
3998 | |||
3999 | currentControl = null; |
||
4000 | } |
||
4001 | else |
||
4002 | { |
||
4003 | string extension = System.IO.Path.GetExtension(filename).ToUpper(); |
||
4004 | if (extension == ".PNG" || extension == ".JPEG" || extension == ".GIF" || extension == ".BMP" || extension == ".JPG") |
||
4005 | { |
||
4006 | Image img = new Image(); |
||
4007 | img.Source = new BitmapImage(new Uri(filename)); |
||
4008 | |||
4009 | currentControl = new ImgControl |
||
4010 | { |
||
4011 | Background = new SolidColorBrush(Colors.Black), |
||
4012 | PointSet = new List<Point>(), |
||
4013 | FilePath = filename, |
||
4014 | ImageData = img.Source, |
||
4015 | StartPoint = canvasDrawingMouseDownPoint, |
||
4016 | EndPoint = new Point(canvasDrawingMouseDownPoint.X + 100, canvasDrawingMouseDownPoint.Y + 100), |
||
4017 | TopRightPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y + 100), |
||
4018 | LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X + 100, canvasDrawingMouseDownPoint.Y) |
||
4019 | }; |
||
4020 | |||
4021 | currentControl.CommentID = Save.shortGuid(); |
||
4022 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
4023 | currentControl.IsNew = true; |
||
4024 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
4025 | ca40e004 | ljiyeon | |
4026 | //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
||
4027 | (currentControl as ImgControl).Angle -= rotate.Angle; |
||
4028 | } |
||
4029 | 787a4489 | KangIngu | } |
4030 | e66f22eb | KangIngu | //} |
4031 | 787a4489 | KangIngu | } |
4032 | } |
||
4033 | break; |
||
4034 | case ControlType.Date: |
||
4035 | { |
||
4036 | if (mouseButtonDown == MouseButton.Left) |
||
4037 | { |
||
4038 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
4039 | //{ |
||
4040 | 787a4489 | KangIngu | if (currentControl is DateControl) |
4041 | { |
||
4042 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
4043 | if (IsGetoutpoint((currentControl as DateControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
4044 | e66f22eb | KangIngu | { |
4045 | return; |
||
4046 | } |
||
4047 | |||
4048 | 787a4489 | KangIngu | CreateControl(); |
4049 | (currentControl as DateControl).ApplyOverViewData(); |
||
4050 | currentControl = null; |
||
4051 | |||
4052 | if (Common.ViewerDataModel.Instance.SelectedControl == "Batch") |
||
4053 | { |
||
4054 | controlType = ControlType.None; |
||
4055 | IsSwingMode = false; |
||
4056 | Common.ViewerDataModel.Instance.SelectedControl = ""; |
||
4057 | Common.ViewerDataModel.Instance.ControlTag = null; |
||
4058 | mouseHandlingMode = MouseHandlingMode.None; |
||
4059 | this.ParentOfType<MainWindow>().dzTopMenu.btn_Batch.IsChecked = false; |
||
4060 | txtBatch.Visibility = Visibility.Collapsed; |
||
4061 | |||
4062 | } |
||
4063 | } |
||
4064 | else |
||
4065 | { |
||
4066 | currentControl = new DateControl |
||
4067 | { |
||
4068 | Background = new SolidColorBrush(Colors.Black) |
||
4069 | }; |
||
4070 | currentControl.CommentID = Save.shortGuid(); |
||
4071 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
4072 | currentControl.IsNew = true; |
||
4073 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
4074 | ca40e004 | ljiyeon | |
4075 | //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
||
4076 | (currentControl as DateControl).Angle -= rotate.Angle; |
||
4077 | } |
||
4078 | e66f22eb | KangIngu | //} |
4079 | 787a4489 | KangIngu | } |
4080 | } |
||
4081 | break; |
||
4082 | case ControlType.TextControl: |
||
4083 | { |
||
4084 | if (mouseButtonDown == MouseButton.Left) |
||
4085 | { |
||
4086 | if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
||
4087 | { |
||
4088 | currentControl = new TextControl |
||
4089 | { |
||
4090 | ControlType = controlType |
||
4091 | }; |
||
4092 | 610a4b86 | KangIngu | (currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize; |
4093 | 8742caa5 | humkyung | currentControl.CommentID = Save.shortGuid(); |
4094 | currentControl.IsNew = true; |
||
4095 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
4096 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
4097 | currentControl.SetValue(Canvas.ZIndexProperty, 2); |
||
4098 | currentControl.SetValue(TextControl.CanvasXProperty, canvasDrawingMouseDownPoint.X); |
||
4099 | currentControl.SetValue(TextControl.CanvasYProperty, canvasDrawingMouseDownPoint.Y); |
||
4100 | currentControl.Focus(); |
||
4101 | (currentControl as TextControl).ApplyOverViewData(); |
||
4102 | (currentControl as TextControl).ControlType_No = 0; |
||
4103 | (currentControl as TextControl).Angle -= rotate.Angle; |
||
4104 | (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape; |
||
4105 | 787a4489 | KangIngu | |
4106 | 8742caa5 | humkyung | CreateControl(); |
4107 | 787a4489 | KangIngu | |
4108 | 49b217ad | humkyung | //currentControl = null; |
4109 | 787a4489 | KangIngu | } |
4110 | } |
||
4111 | } |
||
4112 | break; |
||
4113 | case ControlType.TextBorder: |
||
4114 | { |
||
4115 | if (mouseButtonDown == MouseButton.Left) |
||
4116 | { |
||
4117 | if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
||
4118 | { |
||
4119 | currentControl = new TextControl |
||
4120 | { |
||
4121 | ControlType = controlType |
||
4122 | }; |
||
4123 | |||
4124 | 610a4b86 | KangIngu | (currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize; |
4125 | 787a4489 | KangIngu | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
4126 | currentControl.CommentID = Save.shortGuid(); |
||
4127 | currentControl.IsNew = true; |
||
4128 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
4129 | currentControl.SetValue(Canvas.ZIndexProperty, 3); |
||
4130 | currentControl.SetValue(TextControl.CanvasXProperty, canvasDrawingMouseDownPoint.X); |
||
4131 | currentControl.SetValue(TextControl.CanvasYProperty, canvasDrawingMouseDownPoint.Y); |
||
4132 | currentControl.Focus(); |
||
4133 | (currentControl as TextControl).ControlType_No = 1; |
||
4134 | (currentControl as TextControl).Angle = Ang; |
||
4135 | (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape; |
||
4136 | CreateControl(); |
||
4137 | |||
4138 | 49b217ad | humkyung | //currentControl = null; |
4139 | 787a4489 | KangIngu | } |
4140 | } |
||
4141 | } |
||
4142 | break; |
||
4143 | case ControlType.TextCloud: |
||
4144 | { |
||
4145 | if (mouseButtonDown == MouseButton.Left) |
||
4146 | { |
||
4147 | if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
||
4148 | { |
||
4149 | currentControl = new TextControl |
||
4150 | { |
||
4151 | ControlType = controlType |
||
4152 | }; |
||
4153 | 610a4b86 | KangIngu | |
4154 | (currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize; |
||
4155 | 787a4489 | KangIngu | currentControl.CommentID = Save.shortGuid(); |
4156 | currentControl.IsNew = true; |
||
4157 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
4158 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
4159 | |||
4160 | currentControl.SetValue(Canvas.ZIndexProperty, 3); |
||
4161 | currentControl.SetValue(TextControl.CanvasXProperty, canvasDrawingMouseDownPoint.X); |
||
4162 | currentControl.SetValue(TextControl.CanvasYProperty, canvasDrawingMouseDownPoint.Y); |
||
4163 | currentControl.Focus(); |
||
4164 | |||
4165 | (currentControl as TextControl).Angle = Ang; |
||
4166 | (currentControl as TextControl).ControlType_No = 2; |
||
4167 | (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape; |
||
4168 | |||
4169 | CreateControl(); |
||
4170 | 49b217ad | humkyung | //currentControl = null; |
4171 | 787a4489 | KangIngu | } |
4172 | } |
||
4173 | } |
||
4174 | break; |
||
4175 | case ControlType.ArrowTextControl: |
||
4176 | ca40e004 | ljiyeon | { |
4177 | 787a4489 | KangIngu | if (mouseButtonDown == MouseButton.Left) |
4178 | { |
||
4179 | if (currentControl is ArrowTextControl) |
||
4180 | { |
||
4181 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
4182 | if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
4183 | e66f22eb | KangIngu | { |
4184 | return; |
||
4185 | ca40e004 | ljiyeon | } |
4186 | e66f22eb | KangIngu | |
4187 | 787a4489 | KangIngu | CreateControl(); |
4188 | |||
4189 | (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
||
4190 | (currentControl as ArrowTextControl).IsEditing = false; |
||
4191 | (currentControl as ArrowTextControl).EnableEditing = false; |
||
4192 | 49b217ad | humkyung | (currentControl as ArrowTextControl).IsNew = false; |
4193 | 787a4489 | KangIngu | currentControl = null; |
4194 | } |
||
4195 | else |
||
4196 | { |
||
4197 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
4198 | //{ |
||
4199 | 787a4489 | KangIngu | currentControl = new ArrowTextControl(); |
4200 | currentControl.CommentID = Save.shortGuid(); |
||
4201 | currentControl.IsNew = true; |
||
4202 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
4203 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
4204 | |||
4205 | currentControl.SetValue(Canvas.ZIndexProperty, 3); |
||
4206 | currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint); |
||
4207 | currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint); |
||
4208 | 610a4b86 | KangIngu | (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize; |
4209 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape; |
4210 | |||
4211 | ca40e004 | ljiyeon | //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
4212 | (currentControl as ArrowTextControl).Angle -= rotate.Angle; |
||
4213 | 787a4489 | KangIngu | |
4214 | ca40e004 | ljiyeon | (currentControl as ArrowTextControl).ApplyTemplate(); |
4215 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).Base_TextBox.Focus(); |
4216 | 5ce56a3a | KangIngu | this.MainAngle.Visibility = Visibility.Visible; |
4217 | ca40e004 | ljiyeon | |
4218 | |||
4219 | e66f22eb | KangIngu | //} |
4220 | 787a4489 | KangIngu | } |
4221 | } |
||
4222 | } |
||
4223 | break; |
||
4224 | case ControlType.ArrowTransTextControl: |
||
4225 | { |
||
4226 | if (mouseButtonDown == MouseButton.Left) |
||
4227 | { |
||
4228 | if (currentControl is ArrowTextControl) |
||
4229 | { |
||
4230 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
4231 | if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
4232 | e66f22eb | KangIngu | { |
4233 | return; |
||
4234 | ca40e004 | ljiyeon | } |
4235 | e66f22eb | KangIngu | |
4236 | 787a4489 | KangIngu | CreateControl(); |
4237 | (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
||
4238 | 49b217ad | humkyung | currentControl.IsNew = false; |
4239 | 787a4489 | KangIngu | currentControl = null; |
4240 | 5ce56a3a | KangIngu | this.MainAngle.Visibility = Visibility.Collapsed; |
4241 | 787a4489 | KangIngu | } |
4242 | else |
||
4243 | { |
||
4244 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
4245 | //{ |
||
4246 | ca40e004 | ljiyeon | currentControl = new ArrowTextControl(); |
4247 | 787a4489 | KangIngu | currentControl.CommentID = Save.shortGuid(); |
4248 | currentControl.IsNew = true; |
||
4249 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
4250 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
4251 | currentControl.SetValue(Canvas.ZIndexProperty, 3); |
||
4252 | currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint); |
||
4253 | ca40e004 | ljiyeon | currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint); |
4254 | 610a4b86 | KangIngu | (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize; |
4255 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).isFixed = true; |
4256 | (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape; |
||
4257 | |||
4258 | ca40e004 | ljiyeon | //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
4259 | (currentControl as ArrowTextControl).Angle -= rotate.Angle; |
||
4260 | |||
4261 | (currentControl as ArrowTextControl).ApplyTemplate(); |
||
4262 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).Base_TextBox.Focus(); |
4263 | ca40e004 | ljiyeon | (currentControl as ArrowTextControl).isTrans = true; |
4264 | 787a4489 | KangIngu | } |
4265 | } |
||
4266 | } |
||
4267 | break; |
||
4268 | case ControlType.ArrowTextBorderControl: |
||
4269 | ca40e004 | ljiyeon | { |
4270 | 787a4489 | KangIngu | if (mouseButtonDown == MouseButton.Left) |
4271 | { |
||
4272 | if (currentControl is ArrowTextControl) |
||
4273 | { |
||
4274 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
4275 | if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
4276 | e66f22eb | KangIngu | { |
4277 | return; |
||
4278 | } |
||
4279 | |||
4280 | 787a4489 | KangIngu | CreateControl(); |
4281 | (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
||
4282 | 49b217ad | humkyung | currentControl.IsNew = false; |
4283 | 787a4489 | KangIngu | currentControl = null; |
4284 | 5ce56a3a | KangIngu | this.MainAngle.Visibility = Visibility.Collapsed; |
4285 | 787a4489 | KangIngu | } |
4286 | else |
||
4287 | { |
||
4288 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
4289 | //{ |
||
4290 | 787a4489 | KangIngu | currentControl = new ArrowTextControl() |
4291 | { |
||
4292 | ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Rect |
||
4293 | }; |
||
4294 | currentControl.CommentID = Save.shortGuid(); |
||
4295 | currentControl.IsNew = true; |
||
4296 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
4297 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
4298 | |||
4299 | currentControl.SetValue(Canvas.ZIndexProperty, 3); |
||
4300 | |||
4301 | currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint); |
||
4302 | |||
4303 | currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint); |
||
4304 | (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape; |
||
4305 | 610a4b86 | KangIngu | (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize; |
4306 | 787a4489 | KangIngu | |
4307 | ca40e004 | ljiyeon | //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
4308 | (currentControl as ArrowTextControl).Angle -= rotate.Angle; |
||
4309 | (currentControl as ArrowTextControl).ApplyTemplate(); |
||
4310 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).Base_TextBox.Focus(); |
4311 | ca40e004 | ljiyeon | this.MainAngle.Visibility = Visibility.Visible; |
4312 | e66f22eb | KangIngu | //} |
4313 | 787a4489 | KangIngu | } |
4314 | } |
||
4315 | } |
||
4316 | break; |
||
4317 | case ControlType.ArrowTransTextBorderControl: |
||
4318 | { |
||
4319 | if (mouseButtonDown == MouseButton.Left) |
||
4320 | { |
||
4321 | if (currentControl is ArrowTextControl) |
||
4322 | { |
||
4323 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
4324 | if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
4325 | e66f22eb | KangIngu | { |
4326 | return; |
||
4327 | } |
||
4328 | 787a4489 | KangIngu | CreateControl(); |
4329 | (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
||
4330 | 49b217ad | humkyung | currentControl.IsNew = false; |
4331 | 787a4489 | KangIngu | currentControl = null; |
4332 | 5ce56a3a | KangIngu | this.MainAngle.Visibility = Visibility.Collapsed; |
4333 | 787a4489 | KangIngu | } |
4334 | else |
||
4335 | { |
||
4336 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
4337 | //{ |
||
4338 | ca40e004 | ljiyeon | |
4339 | |||
4340 | currentControl = new ArrowTextControl() |
||
4341 | 787a4489 | KangIngu | { |
4342 | ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Rect |
||
4343 | }; |
||
4344 | currentControl.CommentID = Save.shortGuid(); |
||
4345 | currentControl.IsNew = true; |
||
4346 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
4347 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
4348 | |||
4349 | currentControl.SetValue(Canvas.ZIndexProperty, 3); |
||
4350 | |||
4351 | currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint); |
||
4352 | ca40e004 | ljiyeon | currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint); |
4353 | 610a4b86 | KangIngu | (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize; |
4354 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).isFixed = true; |
4355 | (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape; |
||
4356 | ca40e004 | ljiyeon | |
4357 | //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
||
4358 | (currentControl as ArrowTextControl).Angle -= rotate.Angle; |
||
4359 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).ApplyTemplate(); |
4360 | |||
4361 | ca40e004 | ljiyeon | (currentControl as ArrowTextControl).Base_TextBox.Focus(); |
4362 | 5ce56a3a | KangIngu | this.MainAngle.Visibility = Visibility.Visible; |
4363 | ca40e004 | ljiyeon | |
4364 | //20180911 LJY |
||
4365 | (currentControl as ArrowTextControl).isTrans = true; |
||
4366 | |||
4367 | |||
4368 | e66f22eb | KangIngu | //} |
4369 | 787a4489 | KangIngu | } |
4370 | } |
||
4371 | } |
||
4372 | break; |
||
4373 | case ControlType.ArrowTextCloudControl: |
||
4374 | { |
||
4375 | if (mouseButtonDown == MouseButton.Left) |
||
4376 | { |
||
4377 | if (currentControl is ArrowTextControl) |
||
4378 | { |
||
4379 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
4380 | if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
4381 | e66f22eb | KangIngu | { |
4382 | return; |
||
4383 | } |
||
4384 | 787a4489 | KangIngu | CreateControl(); |
4385 | (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
||
4386 | 49b217ad | humkyung | currentControl.IsNew = false; |
4387 | 787a4489 | KangIngu | currentControl = null; |
4388 | 5ce56a3a | KangIngu | this.MainAngle.Visibility = Visibility.Collapsed; |
4389 | 787a4489 | KangIngu | } |
4390 | else |
||
4391 | { |
||
4392 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
4393 | //{ |
||
4394 | 787a4489 | KangIngu | currentControl = new ArrowTextControl() |
4395 | { |
||
4396 | ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Cloud |
||
4397 | }; |
||
4398 | currentControl.CommentID = Save.shortGuid(); |
||
4399 | currentControl.IsNew = true; |
||
4400 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
4401 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
4402 | |||
4403 | currentControl.SetValue(Canvas.ZIndexProperty, 3); |
||
4404 | currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint); |
||
4405 | ca40e004 | ljiyeon | currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint); |
4406 | 610a4b86 | KangIngu | (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize; |
4407 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape; |
4408 | |||
4409 | ca40e004 | ljiyeon | //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
4410 | (currentControl as ArrowTextControl).Angle -= rotate.Angle; |
||
4411 | |||
4412 | (currentControl as ArrowTextControl).ApplyTemplate(); |
||
4413 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).Base_TextBox.Focus(); |
4414 | ca40e004 | ljiyeon | this.MainAngle.Visibility = Visibility.Visible; |
4415 | e66f22eb | KangIngu | //} |
4416 | 787a4489 | KangIngu | } |
4417 | } |
||
4418 | } |
||
4419 | break; |
||
4420 | case ControlType.ArrowTransTextCloudControl: |
||
4421 | { |
||
4422 | if (mouseButtonDown == MouseButton.Left) |
||
4423 | { |
||
4424 | if (currentControl is ArrowTextControl) |
||
4425 | { |
||
4426 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
4427 | if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
4428 | e66f22eb | KangIngu | { |
4429 | return; |
||
4430 | } |
||
4431 | 787a4489 | KangIngu | CreateControl(); |
4432 | (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
||
4433 | 49b217ad | humkyung | currentControl.IsNew = false; |
4434 | 787a4489 | KangIngu | currentControl = null; |
4435 | 5ce56a3a | KangIngu | this.MainAngle.Visibility = Visibility.Collapsed; |
4436 | 787a4489 | KangIngu | } |
4437 | else |
||
4438 | { |
||
4439 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
4440 | //{ |
||
4441 | 787a4489 | KangIngu | currentControl = new ArrowTextControl() |
4442 | { |
||
4443 | ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Cloud |
||
4444 | }; |
||
4445 | currentControl.CommentID = Save.shortGuid(); |
||
4446 | ca40e004 | ljiyeon | currentControl.IsNew = true; |
4447 | 787a4489 | KangIngu | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
4448 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
4449 | currentControl.SetValue(Canvas.ZIndexProperty, 3); |
||
4450 | |||
4451 | currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint); |
||
4452 | ca40e004 | ljiyeon | currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint); |
4453 | 610a4b86 | KangIngu | (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize; |
4454 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).isFixed = true; |
4455 | (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape; |
||
4456 | |||
4457 | ca40e004 | ljiyeon | //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
4458 | (currentControl as ArrowTextControl).Angle -= rotate.Angle; |
||
4459 | 787a4489 | KangIngu | |
4460 | ca40e004 | ljiyeon | (currentControl as ArrowTextControl).ApplyTemplate(); |
4461 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).Base_TextBox.Focus(); |
4462 | ca40e004 | ljiyeon | this.MainAngle.Visibility = Visibility.Visible; |
4463 | |||
4464 | //20180911 LJY |
||
4465 | (currentControl as ArrowTextControl).isTrans = true; |
||
4466 | e66f22eb | KangIngu | //} |
4467 | 787a4489 | KangIngu | } |
4468 | } |
||
4469 | } |
||
4470 | break; |
||
4471 | case ControlType.PolygonControl: |
||
4472 | { |
||
4473 | if (currentControl is PolygonControl) |
||
4474 | { |
||
4475 | var control = currentControl as PolygonControl; |
||
4476 | |||
4477 | if (mouseButtonDown == MouseButton.Right) |
||
4478 | { |
||
4479 | control.IsCompleted = true; |
||
4480 | } |
||
4481 | |||
4482 | if (!control.IsCompleted) |
||
4483 | { |
||
4484 | control.PointSet.Add(control.EndPoint); |
||
4485 | } |
||
4486 | else |
||
4487 | { |
||
4488 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
4489 | if (IsGetoutpoint((currentControl as PolygonControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
4490 | e66f22eb | KangIngu | { |
4491 | return; |
||
4492 | } |
||
4493 | |||
4494 | 787a4489 | KangIngu | var firstPoint = control.PointSet.First(); |
4495 | control.DashSize = ViewerDataModel.Instance.DashSize; |
||
4496 | control.LineSize = ViewerDataModel.Instance.LineSize; |
||
4497 | control.PointSet.Add(firstPoint); |
||
4498 | |||
4499 | control.SetPolyPath(); |
||
4500 | |||
4501 | control.ApplyOverViewData(); |
||
4502 | |||
4503 | CreateControl(); |
||
4504 | |||
4505 | currentControl = null; |
||
4506 | } |
||
4507 | } |
||
4508 | else |
||
4509 | { |
||
4510 | if (mouseButtonDown == MouseButton.Left) |
||
4511 | { |
||
4512 | currentControl = new PolygonControl |
||
4513 | { |
||
4514 | PointSet = new List<Point>(), |
||
4515 | //PointC = new StylusPointSet() |
||
4516 | }; |
||
4517 | |||
4518 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
4519 | //{ |
||
4520 | 787a4489 | KangIngu | var polygonControl = (currentControl as PolygonControl); |
4521 | currentControl.CommentID = Save.shortGuid(); |
||
4522 | currentControl.IsNew = true; |
||
4523 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
4524 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
4525 | //currentControl.OnApplyTemplate(); |
||
4526 | polygonControl.PointSet.Add(canvasDrawingMouseDownPoint); |
||
4527 | polygonControl.PointSet.Add(canvasDrawingMouseDownPoint); |
||
4528 | e66f22eb | KangIngu | //} |
4529 | 787a4489 | KangIngu | } |
4530 | } |
||
4531 | } |
||
4532 | break; |
||
4533 | //강인구 추가 |
||
4534 | case ControlType.Sign: |
||
4535 | { |
||
4536 | if (mouseButtonDown == MouseButton.Left) |
||
4537 | { |
||
4538 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
4539 | //{ |
||
4540 | 992a98b4 | KangIngu | GetUserSign getUser = new GetUserSign(); |
4541 | var _sign = getUser.GetSign(App.ViewInfo.UserID, App.ViewInfo.ProjectNO); |
||
4542 | |||
4543 | if (_sign == null) |
||
4544 | { |
||
4545 | txtBatch.Visibility = Visibility.Collapsed; |
||
4546 | mouseHandlingMode = IKCOM.MouseHandlingMode.None; |
||
4547 | controlType = ControlType.None; |
||
4548 | |||
4549 | this.ParentOfType<MainWindow>().DialogMessage_Alert("등록된 Sign이 없습니다.", "Alert"); |
||
4550 | this.ParentOfType<MainWindow>().ChildrenOfType<RadToggleButton>().Where(data => data.IsChecked == true).FirstOrDefault().IsChecked = false; |
||
4551 | return; |
||
4552 | } |
||
4553 | |||
4554 | 787a4489 | KangIngu | if (currentControl is SignControl) |
4555 | { |
||
4556 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
4557 | if (IsGetoutpoint((currentControl as SignControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
4558 | e66f22eb | KangIngu | { |
4559 | return; |
||
4560 | } |
||
4561 | |||
4562 | 787a4489 | KangIngu | CreateControl(); |
4563 | currentControl = null; |
||
4564 | if (Common.ViewerDataModel.Instance.SelectedControl == "Batch") |
||
4565 | { |
||
4566 | 999c9e40 | humkyung | txtBatch.Text = "Place Date"; |
4567 | 787a4489 | KangIngu | controlType = ControlType.Date; |
4568 | } |
||
4569 | } |
||
4570 | else |
||
4571 | { |
||
4572 | currentControl = new SignControl |
||
4573 | { |
||
4574 | Background = new SolidColorBrush(Colors.Black), |
||
4575 | UserNumber = App.ViewInfo.UserID, |
||
4576 | StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y), |
||
4577 | EndPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y), |
||
4578 | ControlType = ControlType.Sign |
||
4579 | }; |
||
4580 | |||
4581 | currentControl.CommentID = Save.shortGuid(); |
||
4582 | currentControl.IsNew = true; |
||
4583 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
4584 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
4585 | ca40e004 | ljiyeon | |
4586 | //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
||
4587 | (currentControl as SignControl).Angle -= rotate.Angle; |
||
4588 | } |
||
4589 | e66f22eb | KangIngu | //} |
4590 | 787a4489 | KangIngu | } |
4591 | } |
||
4592 | break; |
||
4593 | case ControlType.Mark: |
||
4594 | { |
||
4595 | if (mouseButtonDown == MouseButton.Left) |
||
4596 | { |
||
4597 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
4598 | //{ |
||
4599 | 787a4489 | KangIngu | if (currentControl is RectangleControl) |
4600 | { |
||
4601 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
4602 | if (IsGetoutpoint((currentControl as RectangleControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
4603 | e66f22eb | KangIngu | { |
4604 | return; |
||
4605 | } |
||
4606 | |||
4607 | 787a4489 | KangIngu | CreateControl(); |
4608 | (currentControl as RectangleControl).ApplyOverViewData(); |
||
4609 | currentControl = null; |
||
4610 | this.cursor = Cursors.Arrow; |
||
4611 | |||
4612 | if (Common.ViewerDataModel.Instance.SelectedControl == "Batch") |
||
4613 | { |
||
4614 | 999c9e40 | humkyung | txtBatch.Text = "Place Signature"; |
4615 | 787a4489 | KangIngu | controlType = ControlType.Sign; |
4616 | } |
||
4617 | } |
||
4618 | else |
||
4619 | { |
||
4620 | currentControl = new RectangleControl |
||
4621 | { |
||
4622 | Background = new SolidColorBrush(Colors.Black), |
||
4623 | Paint = PaintSet.Fill |
||
4624 | }; |
||
4625 | |||
4626 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
4627 | currentControl.CommentID = Save.shortGuid(); |
||
4628 | currentControl.IsNew = true; |
||
4629 | (currentControl as RectangleControl).DashSize = ViewerDataModel.Instance.DashSize; |
||
4630 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
4631 | } |
||
4632 | e66f22eb | KangIngu | //} |
4633 | 787a4489 | KangIngu | } |
4634 | } |
||
4635 | break; |
||
4636 | case ControlType.Symbol: |
||
4637 | { |
||
4638 | if (mouseButtonDown == MouseButton.Left) |
||
4639 | { |
||
4640 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
4641 | //{ |
||
4642 | 787a4489 | KangIngu | if (currentControl is SymControl) |
4643 | { |
||
4644 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
4645 | if (IsGetoutpoint((currentControl as SymControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
4646 | e66f22eb | KangIngu | { |
4647 | return; |
||
4648 | } |
||
4649 | 787a4489 | KangIngu | CreateControl(); |
4650 | currentControl = null; |
||
4651 | this.cursor = Cursors.Arrow; |
||
4652 | } |
||
4653 | else |
||
4654 | { |
||
4655 | currentControl = new SymControl |
||
4656 | { |
||
4657 | StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y), |
||
4658 | Background = new SolidColorBrush(Colors.Black), |
||
4659 | ControlType = ControlType.Symbol |
||
4660 | }; |
||
4661 | |||
4662 | currentControl.IsNew = true; |
||
4663 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
4664 | currentControl.CommentID = Save.shortGuid(); |
||
4665 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
4666 | ca40e004 | ljiyeon | |
4667 | //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
||
4668 | (currentControl as SymControl).Angle -= rotate.Angle; |
||
4669 | } |
||
4670 | e66f22eb | KangIngu | //} |
4671 | 787a4489 | KangIngu | } |
4672 | } |
||
4673 | break; |
||
4674 | case ControlType.Stamp: |
||
4675 | { |
||
4676 | if (mouseButtonDown == MouseButton.Left) |
||
4677 | { |
||
4678 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
4679 | //{ |
||
4680 | 787a4489 | KangIngu | if (currentControl is SymControlN) |
4681 | { |
||
4682 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
4683 | if (IsGetoutpoint((currentControl as SymControlN).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
4684 | e66f22eb | KangIngu | { |
4685 | return; |
||
4686 | } |
||
4687 | |||
4688 | 787a4489 | KangIngu | CreateControl(); |
4689 | currentControl = null; |
||
4690 | this.cursor = Cursors.Arrow; |
||
4691 | } |
||
4692 | else |
||
4693 | { |
||
4694 | currentControl = new SymControlN |
||
4695 | { |
||
4696 | StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y), |
||
4697 | Background = new SolidColorBrush(Colors.Black), |
||
4698 | ControlType = ControlType.Stamp |
||
4699 | }; |
||
4700 | |||
4701 | currentControl.IsNew = true; |
||
4702 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
4703 | currentControl.CommentID = Save.shortGuid(); |
||
4704 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
4705 | ca40e004 | ljiyeon | //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
4706 | (currentControl as SymControlN).Angle -= rotate.Angle; |
||
4707 | } |
||
4708 | e66f22eb | KangIngu | //} |
4709 | 787a4489 | KangIngu | } |
4710 | } |
||
4711 | break; |
||
4712 | case ControlType.PenControl: |
||
4713 | { |
||
4714 | if (inkBoard.Tag.ToString() == "Ink") |
||
4715 | { |
||
4716 | inkBoard.IsEnabled = true; |
||
4717 | StartNewStroke(canvasDrawingMouseDownPoint); |
||
4718 | } |
||
4719 | else if (inkBoard.Tag.ToString() == "EraseByPoint") |
||
4720 | { |
||
4721 | RemovePointStroke(canvasDrawingMouseDownPoint); |
||
4722 | } |
||
4723 | else if (inkBoard.Tag.ToString() == "EraseByStroke") |
||
4724 | { |
||
4725 | RemoveLineStroke(canvasDrawingMouseDownPoint); |
||
4726 | } |
||
4727 | IsDrawing = true; |
||
4728 | return; |
||
4729 | } |
||
4730 | default: |
||
4731 | if (currentControl != null) |
||
4732 | { |
||
4733 | currentControl.CommentID = null; |
||
4734 | currentControl.IsNew = false; |
||
4735 | } |
||
4736 | break; |
||
4737 | } |
||
4738 | } |
||
4739 | if (mouseHandlingMode != MouseHandlingMode.None && mouseButtonDown == MouseButton.Left) |
||
4740 | { |
||
4741 | if (mouseHandlingMode == MouseHandlingMode.Adorner && SelectLayer.Children.Count > 0) |
||
4742 | { |
||
4743 | bool mouseOff = false; |
||
4744 | foreach (var item in SelectLayer.Children) |
||
4745 | { |
||
4746 | if (item is AdornerFinal) |
||
4747 | { |
||
4748 | |||
4749 | var over = (item as AdornerFinal).MemberSet.Where(data => data.DrawingData.IsMouseOver).FirstOrDefault(); |
||
4750 | if (over != null) |
||
4751 | { |
||
4752 | mouseOff = true; |
||
4753 | } |
||
4754 | } |
||
4755 | } |
||
4756 | |||
4757 | if (!mouseOff) |
||
4758 | { |
||
4759 | ReleaseAdorner(); |
||
4760 | } |
||
4761 | } |
||
4762 | zoomAndPanControl.CaptureMouse(); |
||
4763 | e.Handled = true; |
||
4764 | } |
||
4765 | } |
||
4766 | e54660e8 | KangIngu | |
4767 | a1716fa5 | KangIngu | private void zoomAndPanControl2_MouseDown(object sender, MouseButtonEventArgs e) |
4768 | { |
||
4769 | mouseButtonDown = e.ChangedButton; |
||
4770 | canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas2); |
||
4771 | } |
||
4772 | |||
4773 | 787a4489 | KangIngu | private void RemoveLineStroke(Point P) |
4774 | { |
||
4775 | var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseOver).FirstOrDefault(); |
||
4776 | if (control != null) |
||
4777 | { |
||
4778 | UndoData = new Undo_data() |
||
4779 | { |
||
4780 | IsUndo = false, |
||
4781 | Event = Event_Type.Delete, |
||
4782 | EventTime = DateTime.Now, |
||
4783 | Markup_List = new List<Multi_Undo_data>() |
||
4784 | }; |
||
4785 | |||
4786 | |||
4787 | multi_Undo_Data.Markup = control as MarkupToPDF.Common.CommentUserInfo; |
||
4788 | UndoData.Markup_List.Add(multi_Undo_Data); |
||
4789 | multi_Undo_Data = new Multi_Undo_data(); |
||
4790 | |||
4791 | ViewerDataModel.Instance.MarkupControls_USER.Remove(control); |
||
4792 | var Item_ = ViewerDataModel.Instance.MarkupList_USER.Where(d => d.ID == (control as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault(); |
||
4793 | ViewerDataModel.Instance.MarkupList_USER.Remove(Item_); |
||
4794 | 6707a5c7 | ljiyeon | |
4795 | //임시파일에서도 삭제한다. |
||
4796 | temp.DelTemp((control as MarkupToPDF.Common.CommentUserInfo).CommentID, this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber.ToString()); |
||
4797 | |||
4798 | 787a4489 | KangIngu | ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i => |
4799 | { |
||
4800 | ViewerDataModel.Instance.UndoDataList.Remove(i); |
||
4801 | }); |
||
4802 | ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
||
4803 | e54660e8 | KangIngu | |
4804 | 787a4489 | KangIngu | } |
4805 | } |
||
4806 | |||
4807 | private void RemovePointStroke(Point P) |
||
4808 | { |
||
4809 | foreach (Stroke hits in inkBoard.Strokes) |
||
4810 | { |
||
4811 | foreach (StylusPoint sty in hits.StylusPoints) |
||
4812 | { |
||
4813 | |||
4814 | } |
||
4815 | if (hits.HitTest(P)) |
||
4816 | { |
||
4817 | inkBoard.Strokes.Remove(hits); |
||
4818 | return; |
||
4819 | } |
||
4820 | } |
||
4821 | } |
||
4822 | |||
4823 | private void StartNewStroke(Point P) |
||
4824 | { |
||
4825 | strokePoints = new StylusPointCollection(); |
||
4826 | StylusPoint segment1Start = new StylusPoint(P.X, P.Y); |
||
4827 | strokePoints.Add(segment1Start); |
||
4828 | stroke = new Stroke(strokePoints); |
||
4829 | |||
4830 | stroke.DrawingAttributes.Color = Colors.Red; |
||
4831 | stroke.DrawingAttributes.Width = 4; |
||
4832 | stroke.DrawingAttributes.Height = 4; |
||
4833 | |||
4834 | inkBoard.Strokes.Add(stroke); |
||
4835 | |||
4836 | } |
||
4837 | |||
4838 | private void btnConsolidate_Click(object sender, RoutedEventArgs e) |
||
4839 | { |
||
4840 | ConsolidationMethod(); |
||
4841 | } |
||
4842 | |||
4843 | 04a7385a | djkim | public void TeamConsolidationMethod() |
4844 | { |
||
4845 | ChangeCommentReact(); |
||
4846 | if (this.gridViewMarkup.SelectedItems.Count == 0) |
||
4847 | { |
||
4848 | this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert"); |
||
4849 | } |
||
4850 | else |
||
4851 | { |
||
4852 | foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems) |
||
4853 | { |
||
4854 | if (!this.userData.DEPARTMENT.Equals(item.Depatment)) |
||
4855 | { |
||
4856 | this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at your department", "Alert"); |
||
4857 | return; |
||
4858 | } |
||
4859 | } |
||
4860 | ViewerDataModel.Instance.IsConsolidate = true; |
||
4861 | this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null); |
||
4862 | List<KCOMDataModel.DataModel.MARKUP_DATA> instanceDataSet = new List<KCOMDataModel.DataModel.MARKUP_DATA>(); |
||
4863 | |||
4864 | string project_no = App.ViewInfo.ProjectNO; |
||
4865 | string doc_id = _DocInfo.ID; |
||
4866 | string user_id = App.ViewInfo.UserID; |
||
4867 | List<MarkupInfoItem> markupInfoItems = new List<MarkupInfoItem>(); |
||
4868 | foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems) |
||
4869 | { |
||
4870 | markupInfoItems.Add(item); |
||
4871 | } |
||
4872 | this.BaseClient.TeamConsolidate(project_no, user_id, doc_id, markupInfoItems); |
||
4873 | |||
4874 | this.BaseClient.GetMarkupInfoItemsAsync(App.ViewInfo.ProjectNO, _DocInfo.ID); |
||
4875 | } |
||
4876 | } |
||
4877 | 787a4489 | KangIngu | public void ConsolidationMethod() |
4878 | { |
||
4879 | ChangeCommentReact(); |
||
4880 | |||
4881 | if (this.gridViewMarkup.SelectedItems.Count == 0) |
||
4882 | { |
||
4883 | this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert"); |
||
4884 | } |
||
4885 | else |
||
4886 | 6c781c0c | djkim | { |
4887 | 787a4489 | KangIngu | ViewerDataModel.Instance.IsConsolidate = true; |
4888 | 7b312426 | KangIngu | this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null); |
4889 | 787a4489 | KangIngu | List<KCOMDataModel.DataModel.MARKUP_DATA> instanceDataSet = new List<KCOMDataModel.DataModel.MARKUP_DATA>(); |
4890 | |||
4891 | 6c781c0c | djkim | string project_no = App.ViewInfo.ProjectNO; |
4892 | string doc_id = _DocInfo.ID; |
||
4893 | string user_id = App.ViewInfo.UserID; |
||
4894 | List<MarkupInfoItem> markupInfoItems = new List<MarkupInfoItem>(); |
||
4895 | foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems) |
||
4896 | { |
||
4897 | markupInfoItems.Add(item); |
||
4898 | 787a4489 | KangIngu | } |
4899 | 6c781c0c | djkim | this.BaseClient.Consolidate(project_no, user_id, doc_id, markupInfoItems); |
4900 | |||
4901 | this.BaseClient.GetMarkupInfoItemsAsync(App.ViewInfo.ProjectNO, _DocInfo.ID); |
||
4902 | |||
4903 | 787a4489 | KangIngu | } |
4904 | } |
||
4905 | |||
4906 | private void btnConsolidate_Loaded(object sender, RoutedEventArgs e) |
||
4907 | { |
||
4908 | if (App.ViewInfo != null) |
||
4909 | { |
||
4910 | btnConsolidate = (sender as RadRibbonButton); |
||
4911 | if (!App.ViewInfo.NewCommentPermission) |
||
4912 | { |
||
4913 | (sender as RadRibbonButton).Visibility = System.Windows.Visibility.Collapsed; |
||
4914 | } |
||
4915 | } |
||
4916 | } |
||
4917 | |||
4918 | private void btnTeamConsolidate_Click(object sender, RoutedEventArgs e) |
||
4919 | { |
||
4920 | 04a7385a | djkim | TeamConsolidationMethod(); |
4921 | 787a4489 | KangIngu | } |
4922 | |||
4923 | private void btnTeamConsolidate_Loaded(object sender, RoutedEventArgs e) |
||
4924 | { |
||
4925 | btnTeamConsolidate = sender as RadRibbonButton; |
||
4926 | if (App.ViewInfo != null) |
||
4927 | { |
||
4928 | if (!App.ViewInfo.CreateFinalPDFPermission) //파이널이 True가 아니면 |
||
4929 | { |
||
4930 | if (btnConsolidate != null) |
||
4931 | { |
||
4932 | btnConsolidate.Visibility = Visibility.Collapsed; |
||
4933 | } |
||
4934 | |||
4935 | if (!App.ViewInfo.NewCommentPermission) |
||
4936 | { |
||
4937 | btnTeamConsolidate.Visibility = Visibility.Collapsed; |
||
4938 | } |
||
4939 | } |
||
4940 | else |
||
4941 | { |
||
4942 | btnTeamConsolidate.Visibility = Visibility.Collapsed; |
||
4943 | } |
||
4944 | } |
||
4945 | } |
||
4946 | |||
4947 | private void FinalPDFEvent(object sender, RoutedEventArgs e) |
||
4948 | { |
||
4949 | var item = gridViewMarkup.Items.Cast<MarkupInfoItem>().Where(d => d.Consolidate == 1 && d.AvoidConsolidate == 0).FirstOrDefault(); |
||
4950 | if (item != null) |
||
4951 | { |
||
4952 | BaseClient.SetFinalPDFAsync(_ViewInfo.ProjectNO, _DocInfo.ID, item.MarkupInfoID, _ViewInfo.UserID); |
||
4953 | } |
||
4954 | else |
||
4955 | { |
||
4956 | DialogMessage_Alert("Consolidation 된 코멘트가 존재하지 않습니다", "안내"); |
||
4957 | } |
||
4958 | } |
||
4959 | |||
4960 | private void btnFinalPDF_Loaded(object sender, RoutedEventArgs e) |
||
4961 | { |
||
4962 | btnFinalPDF = sender as RadRibbonButton; |
||
4963 | if (App.ViewInfo != null) |
||
4964 | { |
||
4965 | if (!App.ViewInfo.CreateFinalPDFPermission) //파이널이 True가 아니면 |
||
4966 | { |
||
4967 | btnFinalPDF.Visibility = System.Windows.Visibility.Collapsed; |
||
4968 | if (btnConsolidate != null) |
||
4969 | { |
||
4970 | btnConsolidate.Visibility = Visibility.Collapsed; |
||
4971 | } |
||
4972 | } |
||
4973 | } |
||
4974 | } |
||
4975 | |||
4976 | private void SyncCompare_Click(object sender, RoutedEventArgs e) |
||
4977 | { |
||
4978 | if (CompareMode.IsChecked) |
||
4979 | { |
||
4980 | if (ViewerDataModel.Instance.PageBalanceMode && ViewerDataModel.Instance.PageBalanceNumber == 0) |
||
4981 | { |
||
4982 | ViewerDataModel.Instance.PageBalanceNumber = 1; |
||
4983 | } |
||
4984 | if (ViewerDataModel.Instance.PageNumber == 0) |
||
4985 | { |
||
4986 | ViewerDataModel.Instance.PageNumber = 1; |
||
4987 | } |
||
4988 | |||
4989 | d9cf7d6e | djkim | BaseClient.GetCompareRectAsync(_ViewInfo.ProjectNO, _ViewInfo.DocumentItemID, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber.ToString(), ViewerDataModel.Instance.PageNumber.ToString(), userData.COMPANY != "EXT" ? "true" : "false"); |
4990 | 787a4489 | KangIngu | } |
4991 | else |
||
4992 | { |
||
4993 | da.From = 1; |
||
4994 | da.To = 1; |
||
4995 | da.Duration = new Duration(TimeSpan.FromSeconds(9999)); |
||
4996 | da.AutoReverse = false; |
||
4997 | canvas_compareBorder.Children.Clear(); |
||
4998 | canvas_compareBorder.BeginAnimation(OpacityProperty, da); |
||
4999 | } |
||
5000 | } |
||
5001 | |||
5002 | 9cd2865b | KangIngu | private void Sync_Click(object sender, RoutedEventArgs e) |
5003 | { |
||
5004 | a1716fa5 | KangIngu | if (Sync.IsChecked) |
5005 | 9cd2865b | KangIngu | { |
5006 | ViewerDataModel.Instance.Sync_ContentOffsetX = zoomAndPanControl.ContentOffsetX; |
||
5007 | ViewerDataModel.Instance.Sync_ContentOffsetY = zoomAndPanControl.ContentOffsetY; |
||
5008 | ViewerDataModel.Instance.Sync_ContentScale = zoomAndPanControl.ContentScale; |
||
5009 | } |
||
5010 | } |
||
5011 | |||
5012 | 787a4489 | KangIngu | private void SyncUserListExpender_Click(object sender, RoutedEventArgs e) |
5013 | { |
||
5014 | if (UserList.IsChecked) |
||
5015 | { |
||
5016 | this.gridViewRevMarkup.Visibility = Visibility.Visible; |
||
5017 | } |
||
5018 | else |
||
5019 | { |
||
5020 | this.gridViewRevMarkup.Visibility = Visibility.Collapsed; |
||
5021 | } |
||
5022 | } |
||
5023 | |||
5024 | private void SyncPageBalance_Click(object sender, RoutedEventArgs e) |
||
5025 | { |
||
5026 | |||
5027 | if (BalanceMode.IsChecked) |
||
5028 | { |
||
5029 | ViewerDataModel.Instance.PageBalanceMode = true; |
||
5030 | } |
||
5031 | else |
||
5032 | { |
||
5033 | ViewerDataModel.Instance.PageBalanceMode = false; |
||
5034 | ViewerDataModel.Instance.PageBalanceNumber = 0; |
||
5035 | } |
||
5036 | } |
||
5037 | |||
5038 | private void SyncExit_Click(object sender, RoutedEventArgs e) |
||
5039 | { |
||
5040 | //초기화 |
||
5041 | testPanel2.IsHidden = true; |
||
5042 | ViewerDataModel.Instance.PageBalanceMode = false; |
||
5043 | ViewerDataModel.Instance.PageBalanceNumber = 0; |
||
5044 | ViewerDataModel.Instance.PageNumber = 0; |
||
5045 | ViewerDataModel.Instance.MarkupControls_Sync.Clear(); |
||
5046 | this.gridViewRevMarkup.Visibility = Visibility.Collapsed; |
||
5047 | UserList.IsChecked = false; |
||
5048 | BalanceMode.IsChecked = false; |
||
5049 | } |
||
5050 | |||
5051 | private void SyncPageChange_Click(object sender, RoutedEventArgs e) |
||
5052 | { |
||
5053 | if ((sender as System.Windows.Controls.Control).Tag != null) |
||
5054 | { |
||
5055 | //Compare 초기화 |
||
5056 | CompareMode.IsChecked = false; |
||
5057 | var balancePoint = Convert.ToInt32((sender as System.Windows.Controls.Control).Tag); |
||
5058 | |||
5059 | if (ViewerDataModel.Instance.PageNumber == 0) |
||
5060 | { |
||
5061 | ViewerDataModel.Instance.PageNumber = 1; |
||
5062 | } |
||
5063 | |||
5064 | if (ViewerDataModel.Instance.PageBalanceNumber == pageNavigator.PageCount) |
||
5065 | { |
||
5066 | } |
||
5067 | else |
||
5068 | { |
||
5069 | ViewerDataModel.Instance.PageBalanceNumber += balancePoint; |
||
5070 | } |
||
5071 | |||
5072 | if (ViewerDataModel.Instance.PageNumber == pageNavigator.PageCount && balancePoint > 0) |
||
5073 | { |
||
5074 | |||
5075 | } |
||
5076 | else if ((ViewerDataModel.Instance.PageNumber + balancePoint) >= 1) |
||
5077 | { |
||
5078 | ViewerDataModel.Instance.PageNumber += balancePoint; |
||
5079 | } |
||
5080 | |||
5081 | if (!testPanel2.IsHidden) |
||
5082 | { |
||
5083 | if (IsSyncPDFMode) |
||
5084 | { |
||
5085 | Get_FinalImage.Get_PdfImage get_PdfImage = new Get_FinalImage.Get_PdfImage(); |
||
5086 | var pdfpath = new BitmapImage(new Uri(get_PdfImage.Run(CurrentRev.TO_VENDOR, App.ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber))); |
||
5087 | |||
5088 | if (pdfpath.IsDownloading) |
||
5089 | { |
||
5090 | pdfpath.DownloadCompleted += (ex, arg) => |
||
5091 | { |
||
5092 | ViewerDataModel.Instance.ImageViewPath_C = pdfpath; |
||
5093 | ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth; |
||
5094 | ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight; |
||
5095 | zoomAndPanCanvas2.Width = pdfpath.PixelWidth; |
||
5096 | zoomAndPanCanvas2.Height = pdfpath.PixelHeight; |
||
5097 | }; |
||
5098 | } |
||
5099 | else |
||
5100 | { |
||
5101 | ViewerDataModel.Instance.ImageViewPath_C = pdfpath; |
||
5102 | ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth; |
||
5103 | ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight; |
||
5104 | |||
5105 | zoomAndPanCanvas2.Width = pdfpath.PixelWidth; |
||
5106 | zoomAndPanCanvas2.Height = pdfpath.PixelHeight; |
||
5107 | } |
||
5108 | |||
5109 | } |
||
5110 | else |
||
5111 | { |
||
5112 | a874198d | humkyung | string uri = ""; |
5113 | |||
5114 | if (userData.COMPANY != "EXT") |
||
5115 | { |
||
5116 | uri = String.Format(Properties.Settings.Default.mainServerImageWebPath, _ViewInfo.ProjectNO, (Convert.ToInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber); |
||
5117 | } |
||
5118 | else |
||
5119 | { |
||
5120 | uri = String.Format(Properties.Settings.Default.subServerImageWebPath, _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber); |
||
5121 | } |
||
5122 | 787a4489 | KangIngu | |
5123 | var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri)); |
||
5124 | |||
5125 | ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare; |
||
5126 | ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth; |
||
5127 | ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight; |
||
5128 | |||
5129 | zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth; |
||
5130 | zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight; |
||
5131 | |||
5132 | if (defaultBitmapImage_Compare.IsDownloading) |
||
5133 | { |
||
5134 | defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) => |
||
5135 | { |
||
5136 | ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare; |
||
5137 | ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth; |
||
5138 | ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight; |
||
5139 | |||
5140 | zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth; |
||
5141 | zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight; |
||
5142 | }; |
||
5143 | } |
||
5144 | } |
||
5145 | |||
5146 | //강인구 추가(페이지 이동시 코멘트 재 호출) |
||
5147 | ViewerDataModel.Instance.MarkupControls_Sync.Clear(); |
||
5148 | List<MarkupInfoItem> gridSelectionRevItem = gridViewRevMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); |
||
5149 | |||
5150 | foreach (var item in gridSelectionRevItem) |
||
5151 | { |
||
5152 | item.MarkupList.Where(pageItem => pageItem.PageNumber == ViewerDataModel.Instance.PageNumber).ToList().ForEach(delegate (MarkupItem markupitem) |
||
5153 | { |
||
5154 | layerControl.markupParse(markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync, item.DisplayColor, "", item.MarkupInfoID); |
||
5155 | }); |
||
5156 | } |
||
5157 | e54660e8 | KangIngu | |
5158 | 787a4489 | KangIngu | //강인구 추가 |
5159 | zoomAndPanControl2.ZoomTo(new Rect |
||
5160 | { |
||
5161 | X = 0, |
||
5162 | Y = 0, |
||
5163 | Width = Math.Max(zoomAndPanCanvas.Width, zoomAndPanCanvas2.Width), |
||
5164 | Height = Math.Max(zoomAndPanCanvas.Height, zoomAndPanCanvas2.Height), |
||
5165 | }); |
||
5166 | ae56d52d | KangIngu | |
5167 | 787a4489 | KangIngu | tlSyncPageNum.Text = String.Format("Current Page : {0}", ViewerDataModel.Instance.PageNumber); |
5168 | |||
5169 | } |
||
5170 | } |
||
5171 | } |
||
5172 | |||
5173 | private void SyncChange_Click(object sender, RoutedEventArgs e) |
||
5174 | { |
||
5175 | if (MarkupMode.IsChecked) |
||
5176 | { |
||
5177 | IsSyncPDFMode = true; |
||
5178 | |||
5179 | var uri = CurrentRev.TO_VENDOR; |
||
5180 | ae56d52d | KangIngu | |
5181 | 787a4489 | KangIngu | if (ViewerDataModel.Instance.PageNumber == 0) |
5182 | { |
||
5183 | ViewerDataModel.Instance.PageNumber = 1; |
||
5184 | } |
||
5185 | |||
5186 | //PDF모드 잠시 대기(강인구) |
||
5187 | Get_FinalImage.Get_PdfImage get_PdfImage = new Get_FinalImage.Get_PdfImage(); |
||
5188 | var pdfpath = new BitmapImage(new Uri(get_PdfImage.Run(CurrentRev.TO_VENDOR, App.ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber))); |
||
5189 | |||
5190 | if (pdfpath.IsDownloading) |
||
5191 | { |
||
5192 | pdfpath.DownloadCompleted += (ex, arg) => |
||
5193 | { |
||
5194 | ViewerDataModel.Instance.ImageViewPath_C = pdfpath; |
||
5195 | ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth; |
||
5196 | ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight; |
||
5197 | zoomAndPanCanvas2.Width = pdfpath.PixelWidth; |
||
5198 | zoomAndPanCanvas2.Height = pdfpath.PixelHeight; |
||
5199 | }; |
||
5200 | } |
||
5201 | else |
||
5202 | { |
||
5203 | ViewerDataModel.Instance.ImageViewPath_C = pdfpath; |
||
5204 | ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth; |
||
5205 | ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight; |
||
5206 | |||
5207 | zoomAndPanCanvas2.Width = pdfpath.PixelWidth; |
||
5208 | zoomAndPanCanvas2.Height = pdfpath.PixelHeight; |
||
5209 | } |
||
5210 | } |
||
5211 | else |
||
5212 | { |
||
5213 | IsSyncPDFMode = false; |
||
5214 | a874198d | humkyung | string uri = ""; |
5215 | if (userData.COMPANY != "EXT") |
||
5216 | { |
||
5217 | uri = String.Format(Properties.Settings.Default.mainServerImageWebPath, _ViewInfo.ProjectNO, (Convert.ToInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber); |
||
5218 | } |
||
5219 | else |
||
5220 | { |
||
5221 | uri = String.Format(Properties.Settings.Default.subServerImageWebPath, _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber); |
||
5222 | } |
||
5223 | 787a4489 | KangIngu | |
5224 | var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri)); |
||
5225 | |||
5226 | ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare; |
||
5227 | ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth; |
||
5228 | ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight; |
||
5229 | |||
5230 | if (defaultBitmapImage_Compare.IsDownloading) |
||
5231 | { |
||
5232 | defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) => |
||
5233 | { |
||
5234 | ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare; |
||
5235 | ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth; |
||
5236 | ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight; |
||
5237 | }; |
||
5238 | } |
||
5239 | zoomAndPanControl2.ApplyTemplate(); |
||
5240 | zoomAndPanControl2.UpdateLayout(); |
||
5241 | zoomAndPanCanvas2.Width = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentWidth); |
||
5242 | zoomAndPanCanvas2.Height = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentHeight); |
||
5243 | } |
||
5244 | } |
||
5245 | |||
5246 | private void RadButton_Click(object sender, RoutedEventArgs e) |
||
5247 | { |
||
5248 | gridViewHistory_Busy.IsBusy = true; |
||
5249 | |||
5250 | RadButton instance = sender as RadButton; |
||
5251 | if (instance.CommandParameter != null) |
||
5252 | { |
||
5253 | CurrentRev = instance.CommandParameter as VPRevision; |
||
5254 | BaseClient.GetSyncMarkupInfoItemsCompleted += (sen, ea) => |
||
5255 | { |
||
5256 | if (ea.Error == null && ea.Result != null) |
||
5257 | { |
||
5258 | testPanel2.IsHidden = false; |
||
5259 | |||
5260 | ViewerDataModel.Instance._markupInfoRevList = SetDisplayColor(ea.Result, _ViewInfo.UserID); |
||
5261 | gridViewRevMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoRevList; |
||
5262 | |||
5263 | a874198d | humkyung | string uri = ""; |
5264 | if (userData.COMPANY != "EXT") |
||
5265 | { |
||
5266 | uri = String.Format(Properties.Settings.Default.mainServerImageWebPath, _ViewInfo.ProjectNO, (Convert.ToInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber); |
||
5267 | } |
||
5268 | else |
||
5269 | { |
||
5270 | uri = String.Format(Properties.Settings.Default.subServerImageWebPath, _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber); |
||
5271 | } |
||
5272 | 787a4489 | KangIngu | |
5273 | Sync_Offset_Point = new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY); |
||
5274 | |||
5275 | var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri)); |
||
5276 | |||
5277 | ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare; |
||
5278 | ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth; |
||
5279 | ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight; |
||
5280 | |||
5281 | if (defaultBitmapImage_Compare.IsDownloading) |
||
5282 | { |
||
5283 | defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) => |
||
5284 | { |
||
5285 | ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare; |
||
5286 | ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth; |
||
5287 | ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight; |
||
5288 | }; |
||
5289 | } |
||
5290 | |||
5291 | zoomAndPanCanvas2.Width = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentWidth); |
||
5292 | zoomAndPanCanvas2.Height = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentHeight); |
||
5293 | zoomAndPanControl2.RotationAngle = zoomAndPanControl.RotationAngle; |
||
5294 | zoomAndPanControl2.ApplyTemplate(); |
||
5295 | zoomAndPanControl2.UpdateLayout(); |
||
5296 | |||
5297 | if (Sync_Offset_Point != new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY)) |
||
5298 | { |
||
5299 | zoomAndPanControl.ContentOffsetX = Sync_Offset_Point.X; |
||
5300 | zoomAndPanControl.ContentOffsetY = Sync_Offset_Point.Y; |
||
5301 | } |
||
5302 | |||
5303 | 9cd2865b | KangIngu | ViewerDataModel.Instance.Sync_ContentOffsetX = Sync_Offset_Point.X; |
5304 | ViewerDataModel.Instance.Sync_ContentOffsetY = Sync_Offset_Point.Y; |
||
5305 | ViewerDataModel.Instance.Sync_ContentScale = zoomAndPanControl.ContentScale; |
||
5306 | |||
5307 | 787a4489 | KangIngu | tlSyncRev.Text = String.Format("Rev. {0}", CurrentRev.RevNo); |
5308 | tlSyncPageNum.Text = String.Format("Current Page : {0}", pageNavigator.CurrentPage.PageNumber); |
||
5309 | gridViewHistory_Busy.IsBusy = false; |
||
5310 | } |
||
5311 | }; |
||
5312 | BaseClient.GetSyncMarkupInfoItemsAsync(_ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, _ViewInfo.UserID); |
||
5313 | } |
||
5314 | } |
||
5315 | |||
5316 | public void Sync_Event(VPRevision Currnet_Rev) |
||
5317 | { |
||
5318 | CurrentRev = Currnet_Rev; |
||
5319 | |||
5320 | BaseClient.GetSyncMarkupInfoItemsCompleted += (sen, ea) => |
||
5321 | { |
||
5322 | if (ea.Error == null && ea.Result != null) |
||
5323 | { |
||
5324 | testPanel2.IsHidden = false; |
||
5325 | |||
5326 | ViewerDataModel.Instance._markupInfoRevList = SetDisplayColor(ea.Result, _ViewInfo.UserID); |
||
5327 | gridViewRevMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoRevList; |
||
5328 | |||
5329 | a874198d | humkyung | string uri = ""; |
5330 | a1716fa5 | KangIngu | if (userData.COMPANY != "EXT") |
5331 | a874198d | humkyung | { |
5332 | uri = String.Format(Properties.Settings.Default.mainServerImageWebPath, _ViewInfo.ProjectNO, (Convert.ToInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber); |
||
5333 | } |
||
5334 | else |
||
5335 | { |
||
5336 | uri = String.Format(Properties.Settings.Default.subServerImageWebPath, _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber); |
||
5337 | } |
||
5338 | 787a4489 | KangIngu | |
5339 | Sync_Offset_Point = new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY); |
||
5340 | |||
5341 | var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri)); |
||
5342 | |||
5343 | ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare; |
||
5344 | ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth; |
||
5345 | ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight; |
||
5346 | |||
5347 | if (defaultBitmapImage_Compare.IsDownloading) |
||
5348 | { |
||
5349 | defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) => |
||
5350 | { |
||
5351 | ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare; |
||
5352 | ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth; |
||
5353 | ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight; |
||
5354 | }; |
||
5355 | } |
||
5356 | d7548b21 | ljiyeon | |
5357 | |||
5358 | 787a4489 | KangIngu | zoomAndPanCanvas2.Width = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentWidth); |
5359 | zoomAndPanCanvas2.Height = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentHeight); |
||
5360 | zoomAndPanControl2.ApplyTemplate(); |
||
5361 | zoomAndPanControl2.UpdateLayout(); |
||
5362 | |||
5363 | if (Sync_Offset_Point != new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY)) |
||
5364 | { |
||
5365 | zoomAndPanControl.ContentOffsetX = Sync_Offset_Point.X; |
||
5366 | zoomAndPanControl.ContentOffsetY = Sync_Offset_Point.Y; |
||
5367 | } |
||
5368 | //} |
||
5369 | |||
5370 | tlSyncRev.Text = String.Format("Rev. {0}", CurrentRev.RevNo); |
||
5371 | tlSyncPageNum.Text = String.Format("Current Page : {0}", pageNavigator.CurrentPage.PageNumber); |
||
5372 | gridViewHistory_Busy.IsBusy = false; |
||
5373 | } |
||
5374 | }; |
||
5375 | BaseClient.GetSyncMarkupInfoItemsAsync(_ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, _ViewInfo.UserID); |
||
5376 | |||
5377 | |||
5378 | } |
||
5379 | |||
5380 | private void PdfLink_ButtonDown(object sender, MouseButtonEventArgs e) |
||
5381 | { |
||
5382 | if (sender is Image) |
||
5383 | { |
||
5384 | if ((sender as Image).Tag != null) |
||
5385 | { |
||
5386 | var pdfUrl = (sender as Image).Tag.ToString(); |
||
5387 | System.Diagnostics.Process.Start(pdfUrl); |
||
5388 | } |
||
5389 | else |
||
5390 | { |
||
5391 | this.ParentOfType<MainWindow>().DialogMessage_Alert("문서 정보가 잘못 되었습니다", "안내"); |
||
5392 | } |
||
5393 | } |
||
5394 | } |
||
5395 | |||
5396 | private void Create_Symbol(object sender, RoutedEventArgs e) |
||
5397 | { |
||
5398 | MarkupToPDF.Controls.Parsing.LayerControl.MarkupReturn markupReturn = new MarkupToPDF.Controls.Parsing.LayerControl.MarkupReturn(); |
||
5399 | MarkupToPDF.Controls.Parsing.LayerControl layer = new MarkupToPDF.Controls.Parsing.LayerControl(); |
||
5400 | |||
5401 | if (SelectLayer.Children.Count < 1) //선택된 것이 없으면 |
||
5402 | { |
||
5403 | DialogMessage_Alert("Please Select Controls", "Alert"); |
||
5404 | } |
||
5405 | else //선택된 것이 있으면 |
||
5406 | { |
||
5407 | string MarkupData = ""; |
||
5408 | adorner_ = new AdornerFinal(); |
||
5409 | |||
5410 | foreach (var item in SelectLayer.Children) |
||
5411 | { |
||
5412 | if (item.GetType().Name == "AdornerFinal") |
||
5413 | { |
||
5414 | adorner_ = (item as Controls.AdornerFinal); |
||
5415 | foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>()) |
||
5416 | { |
||
5417 | if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData)) |
||
5418 | { |
||
5419 | markupReturn = layer.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID); |
||
5420 | MarkupData += markupReturn.ConvertData; |
||
5421 | } |
||
5422 | } |
||
5423 | } |
||
5424 | } |
||
5425 | DialogParameters parameters = new DialogParameters() |
||
5426 | { |
||
5427 | Closed = (obj, args) => this.MarkupNamePromptClose(MarkupData, args), |
||
5428 | DefaultPromptResultValue = "Custom State", |
||
5429 | Content = "Name :", |
||
5430 | Header = "Insert Custom Symbol Name", |
||
5431 | Theme = new VisualStudio2013Theme(), |
||
5432 | ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 }, |
||
5433 | }; |
||
5434 | RadWindow.Prompt(parameters); |
||
5435 | } |
||
5436 | |||
5437 | } |
||
5438 | |||
5439 | private void MarkupNamePromptClose(string data, WindowClosedEventArgs args) |
||
5440 | { |
||
5441 | Save save = new Save(); |
||
5442 | |||
5443 | if (args.DialogResult.Value) |
||
5444 | { |
||
5445 | PngBitmapEncoder _Encoder = symImage(data); |
||
5446 | |||
5447 | System.IO.MemoryStream fs = new System.IO.MemoryStream(); |
||
5448 | _Encoder.Save(fs); |
||
5449 | System.Drawing.Image ImgOut = System.Drawing.Image.FromStream(fs); |
||
5450 | |||
5451 | byte[] Img_byte = fs.ToArray(); |
||
5452 | |||
5453 | kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload(); |
||
5454 | filename = fileUploader.Run(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, Save.shortGuid() + ".png", Img_byte); |
||
5455 | |||
5456 | save.SymbolSave(args.PromptResult, filename, data); |
||
5457 | } |
||
5458 | } |
||
5459 | |||
5460 | public PngBitmapEncoder symImage(string data) |
||
5461 | { |
||
5462 | |||
5463 | Canvas _canvas = new Canvas(); |
||
5464 | _canvas.Background = Brushes.White; |
||
5465 | _canvas.Width = adorner_.BorderSize.Width; |
||
5466 | _canvas.Height = adorner_.BorderSize.Height; |
||
5467 | layerControl.markupParse(data, _canvas, "#FFFF0000", ""); |
||
5468 | |||
5469 | BitmapEncoder encoder = new PngBitmapEncoder(); |
||
5470 | |||
5471 | |||
5472 | RenderTargetBitmap renderBitmap = new RenderTargetBitmap((int)_canvas.Width + 50, (int)_canvas.Height + 50, 96d, 96d, PixelFormats.Pbgra32); |
||
5473 | |||
5474 | DrawingVisual dv = new DrawingVisual(); |
||
5475 | |||
5476 | _canvas.Measure(new System.Windows.Size(adorner_.BorderSize.Width + 50, adorner_.BorderSize.Height + 50)); |
||
5477 | _canvas.Arrange(new Rect(new System.Windows.Point { X = -adorner_.BorderSize.X - 20, Y = -adorner_.BorderSize.Y - 20 }, new Point(adorner_.BorderSize.Width + 20, adorner_.BorderSize.Height + 20))); |
||
5478 | |||
5479 | using (DrawingContext ctx = dv.RenderOpen()) |
||
5480 | { |
||
5481 | VisualBrush vb = new VisualBrush(_canvas); |
||
5482 | ctx.DrawRectangle(vb, null, new Rect(new System.Windows.Point { X = -adorner_.BorderSize.X, Y = -adorner_.BorderSize.Y }, new Point(adorner_.BorderSize.Width + 20, adorner_.BorderSize.Height + 20))); |
||
5483 | } |
||
5484 | |||
5485 | try |
||
5486 | { |
||
5487 | renderBitmap.Render(dv); |
||
5488 | |||
5489 | GC.Collect(); |
||
5490 | GC.WaitForPendingFinalizers(); |
||
5491 | GC.Collect(); |
||
5492 | // encode png data |
||
5493 | PngBitmapEncoder pngEncoder = new PngBitmapEncoder(); |
||
5494 | // puch rendered bitmap into it |
||
5495 | pngEncoder.Interlace = PngInterlaceOption.Off; |
||
5496 | pngEncoder.Frames.Add(BitmapFrame.Create(renderBitmap)); |
||
5497 | return pngEncoder; |
||
5498 | |||
5499 | } |
||
5500 | catch (Exception ex) |
||
5501 | { |
||
5502 | return null; |
||
5503 | } |
||
5504 | |||
5505 | } |
||
5506 | |||
5507 | public void DialogMessage_Alert(string content, string header) |
||
5508 | { |
||
5509 | var box = new TextBlock(); |
||
5510 | box.MinWidth = 400; |
||
5511 | box.FontSize = 11; |
||
5512 | //box.FontSize = 12; |
||
5513 | box.Text = content; |
||
5514 | box.TextWrapping = System.Windows.TextWrapping.Wrap; |
||
5515 | |||
5516 | DialogParameters parameters = new DialogParameters() |
||
5517 | { |
||
5518 | Content = box, |
||
5519 | Header = header, |
||
5520 | Theme = new VisualStudio2013Theme(), |
||
5521 | ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 }, |
||
5522 | }; |
||
5523 | RadWindow.Alert(parameters); |
||
5524 | } |
||
5525 | |||
5526 | #region 캡쳐 기능 |
||
5527 | |||
5528 | public BitmapSource CutAreaToImage(int x, int y, int width, int height) |
||
5529 | { |
||
5530 | if (x < 0) |
||
5531 | { |
||
5532 | width += x; |
||
5533 | x = 0; |
||
5534 | } |
||
5535 | if (y < 0) |
||
5536 | { |
||
5537 | height += y; |
||
5538 | y = 0; |
||
5539 | |||
5540 | width = (int)zoomAndPanCanvas.ActualWidth - x; |
||
5541 | } |
||
5542 | if (x + width > zoomAndPanCanvas.ActualWidth) |
||
5543 | { |
||
5544 | width = (int)zoomAndPanCanvas.ActualWidth - x; |
||
5545 | } |
||
5546 | if (y + height > zoomAndPanCanvas.ActualHeight) |
||
5547 | { |
||
5548 | height = (int)zoomAndPanCanvas.ActualHeight - y; |
||
5549 | } |
||
5550 | |||
5551 | byte[] pixels = CopyPixels(x, y, width, height); |
||
5552 | |||
5553 | int stride = (width * canvasImage.Format.BitsPerPixel + 7) / 8; |
||
5554 | |||
5555 | return BitmapSource.Create(width, height, 96, 96, PixelFormats.Pbgra32, null, pixels, stride); |
||
5556 | } |
||
5557 | |||
5558 | public byte[] CopyPixels(int x, int y, int width, int height) |
||
5559 | { |
||
5560 | byte[] pixels = new byte[width * height * 4]; |
||
5561 | int stride = (width * canvasImage.Format.BitsPerPixel + 7) / 8; |
||
5562 | |||
5563 | // Canvas 이미지에서 객체 역역만큼 픽셀로 복사 |
||
5564 | canvasImage.CopyPixels(new Int32Rect(x, y, width, height), pixels, stride, 0); |
||
5565 | |||
5566 | return pixels; |
||
5567 | } |
||
5568 | |||
5569 | public RenderTargetBitmap ConverterBitmapImage(FrameworkElement element) |
||
5570 | { |
||
5571 | DrawingVisual drawingVisual = new DrawingVisual(); |
||
5572 | DrawingContext drawingContext = drawingVisual.RenderOpen(); |
||
5573 | |||
5574 | // 해당 객체의 그래픽요소로 사각형의 그림을 그립니다. |
||
5575 | drawingContext.DrawRectangle(new VisualBrush(element), null, |
||
5576 | new Rect(new Point(0, 0), new Point(element.ActualWidth, element.ActualHeight))); |
||
5577 | drawingContext.Close(); |
||
5578 | |||
5579 | // 비트맵으로 변환합니다. |
||
5580 | RenderTargetBitmap target = |
||
5581 | new RenderTargetBitmap((int)element.ActualWidth, (int)element.ActualHeight, |
||
5582 | 96, 96, System.Windows.Media.PixelFormats.Pbgra32); |
||
5583 | |||
5584 | target.Render(drawingVisual); |
||
5585 | return target; |
||
5586 | } |
||
5587 | |||
5588 | public void Save_Capture(BitmapSource source, int x, int y, int width, int height) |
||
5589 | { |
||
5590 | KCOM.Common.Converter.FileStreamToBase64 streamToBase64 = new Common.Converter.FileStreamToBase64(); |
||
5591 | KCOMDataModel.DataModel.CHECK_LIST check_; |
||
5592 | string Result = streamToBase64.ImageToBase64(source); |
||
5593 | KCOMDataModel.DataModel.CHECK_LIST Item = new KCOMDataModel.DataModel.CHECK_LIST(); |
||
5594 | 6c781c0c | djkim | string projectno = App.ViewInfo.ProjectNO; |
5595 | string checklist_id = ViewerDataModel.Instance.CheckList_ID; |
||
5596 | Item = this.BaseClient.GetCheckList(projectno, checklist_id); |
||
5597 | if (Item == null) |
||
5598 | 787a4489 | KangIngu | { |
5599 | 6c781c0c | djkim | check_ = new KCOMDataModel.DataModel.CHECK_LIST |
5600 | 787a4489 | KangIngu | { |
5601 | 6c781c0c | djkim | ID = Save.shortGuid(), |
5602 | USER_ID = App.ViewInfo.UserID, |
||
5603 | IMAGE_URL = Result, |
||
5604 | IMAGE_ANCHOR = x + "," + y + "," + width + "," + height, |
||
5605 | PAGENUMBER = this.pageNavigator.CurrentPage.PageNumber, |
||
5606 | REVISION = ViewerDataModel.Instance.SystemMain.dzMainMenu.CurrentDoc.Revision, |
||
5607 | DOCUMENT_ID = App.ViewInfo.DocumentItemID, |
||
5608 | PROJECT_NO = App.ViewInfo.ProjectNO, |
||
5609 | STATUS = "False", |
||
5610 | CREATE_TIME = DateTime.Now, |
||
5611 | UPDATE_TIME = DateTime.Now, |
||
5612 | DOCUMENT_NO = _DocItem.DOCUMENT_NO, |
||
5613 | STATUS_DESC_OPEN = "Vendor 반영 필요", |
||
5614 | }; |
||
5615 | this.BaseClient.AddCheckList(projectno, check_); |
||
5616 | 787a4489 | KangIngu | } |
5617 | 6c781c0c | djkim | else |
5618 | { |
||
5619 | Item.IMAGE_URL = Result; |
||
5620 | Item.IMAGE_ANCHOR = x + "," + y + "," + width + "," + height; |
||
5621 | Item.PAGENUMBER = this.pageNavigator.CurrentPage.PageNumber; |
||
5622 | this.BaseClient.SaveCheckList(projectno, checklist_id, Item); |
||
5623 | } |
||
5624 | |||
5625 | 787a4489 | KangIngu | } |
5626 | |||
5627 | public void Set_Capture() |
||
5628 | 6c781c0c | djkim | { |
5629 | 787a4489 | KangIngu | double x = canvasDrawingMouseDownPoint.X; |
5630 | double y = canvasDrawingMouseDownPoint.Y; |
||
5631 | double width = dragCaptureBorder.Width; |
||
5632 | double height = dragCaptureBorder.Height; |
||
5633 | |||
5634 | if (width > 5 || height > 5) |
||
5635 | { |
||
5636 | canvasImage = ConverterBitmapImage(zoomAndPanCanvas); |
||
5637 | BitmapSource source = CutAreaToImage((int)x, (int)y, (int)width, (int)height); |
||
5638 | Save_Capture(source, (int)x, (int)y, (int)width, (int)height); |
||
5639 | } |
||
5640 | } |
||
5641 | #endregion |
||
5642 | |||
5643 | 7cee8c20 | ljiyeon | TempFile temp = new TempFile(); |
5644 | d7548b21 | ljiyeon | //MarkupInfoItem |
5645 | 787a4489 | KangIngu | public void CreateControl() |
5646 | { |
||
5647 | d7548b21 | ljiyeon | |
5648 | 787a4489 | KangIngu | ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i => |
5649 | { |
||
5650 | ViewerDataModel.Instance.UndoDataList.Remove(i); |
||
5651 | }); |
||
5652 | multi_Undo_Data.Markup = currentControl; |
||
5653 | UndoData.Markup_List.Add(multi_Undo_Data); |
||
5654 | d7548b21 | ljiyeon | |
5655 | 787a4489 | KangIngu | ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
5656 | d7548b21 | ljiyeon | |
5657 | //List<MarkupInfoItem> gridSelectionItem = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); |
||
5658 | 787a4489 | KangIngu | } |
5659 | d7548b21 | ljiyeon | |
5660 | 787a4489 | KangIngu | public Multi_Undo_data Control_Style(CommentUserInfo control) |
5661 | { |
||
5662 | multi_Undo_Data = new Multi_Undo_data(); |
||
5663 | |||
5664 | multi_Undo_Data.Markup = control; |
||
5665 | |||
5666 | if ((control as IShapeControl) != null) |
||
5667 | { |
||
5668 | multi_Undo_Data.paint = (control as IShapeControl).Paint; |
||
5669 | } |
||
5670 | if ((control as IDashControl) != null) |
||
5671 | { |
||
5672 | multi_Undo_Data.DashSize = (control as IDashControl).DashSize; |
||
5673 | } |
||
5674 | if ((control as IPath) != null) |
||
5675 | { |
||
5676 | multi_Undo_Data.LineSize = (control as IPath).LineSize; |
||
5677 | } |
||
5678 | if ((control as UIElement) != null) |
||
5679 | { |
||
5680 | multi_Undo_Data.Opacity = (control as UIElement).Opacity; |
||
5681 | } |
||
5682 | |||
5683 | return multi_Undo_Data; |
||
5684 | } |
||
5685 | |||
5686 | public void Undo() |
||
5687 | { |
||
5688 | 4c8bb207 | djkim | if (ViewerDataModel.Instance.IsPressCtrl) |
5689 | { |
||
5690 | ViewerDataModel.Instance.IsPressCtrl = false; |
||
5691 | } |
||
5692 | 787a4489 | KangIngu | Undo_data undo = new Undo_data(); |
5693 | AdornerFinal final; |
||
5694 | ReleaseAdorner(); |
||
5695 | |||
5696 | undo = ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == false).ToList().OrderByDescending(order => order.EventTime).FirstOrDefault(); |
||
5697 | if (undo == null) |
||
5698 | return; |
||
5699 | |||
5700 | d7548b21 | ljiyeon | |
5701 | |||
5702 | 787a4489 | KangIngu | switch (undo.Event) |
5703 | { |
||
5704 | case (Event_Type.Create): |
||
5705 | { |
||
5706 | foreach (var item in undo.Markup_List) |
||
5707 | { |
||
5708 | ViewerDataModel.Instance.MarkupControls_USER.Remove((item.Markup)); |
||
5709 | } |
||
5710 | } |
||
5711 | break; |
||
5712 | case (Event_Type.Delete): |
||
5713 | { |
||
5714 | foreach (var item in undo.Markup_List) |
||
5715 | { |
||
5716 | ViewerDataModel.Instance.MarkupControls_USER.Add(item.Markup); |
||
5717 | } |
||
5718 | } |
||
5719 | break; |
||
5720 | case (Event_Type.Thumb): |
||
5721 | { |
||
5722 | List<CommentUserInfo> comment = new List<CommentUserInfo>(); |
||
5723 | |||
5724 | foreach (var item in undo.Markup_List) |
||
5725 | { |
||
5726 | ViewerDataModel.Instance.MarkupControls_USER.Remove((item.Markup)); |
||
5727 | |||
5728 | if ((item.Markup as IViewBox) != null) |
||
5729 | { |
||
5730 | (item.Markup as IViewBox).Angle = item.Angle; |
||
5731 | } |
||
5732 | if ((item.Markup as TextControl) != null) |
||
5733 | { |
||
5734 | (item.Markup as TextControl).Angle = item.Angle; |
||
5735 | Canvas.SetLeft((item.Markup as TextControl), item.PointSet[0].X); |
||
5736 | Canvas.SetTop((item.Markup as TextControl), item.PointSet[0].Y); |
||
5737 | } |
||
5738 | else |
||
5739 | { |
||
5740 | (item.Markup as IPath).PointSet = item.PointSet; |
||
5741 | (item.Markup as IPath).updateControl(); |
||
5742 | } |
||
5743 | |||
5744 | comment.Add(item.Markup); |
||
5745 | } |
||
5746 | final = new AdornerFinal(comment); |
||
5747 | SelectLayer.Children.Add(final); |
||
5748 | ReleaseAdorner(); |
||
5749 | } |
||
5750 | break; |
||
5751 | case (Event_Type.Select): |
||
5752 | { |
||
5753 | ReleaseAdorner(); |
||
5754 | List<CommentUserInfo> comment = new List<CommentUserInfo>(); |
||
5755 | |||
5756 | foreach (var item in undo.Markup_List) |
||
5757 | { |
||
5758 | ViewerDataModel.Instance.MarkupControls_USER.Remove((item.Markup)); |
||
5759 | |||
5760 | if ((item.Markup as IPath) != null) |
||
5761 | { |
||
5762 | (item.Markup as IPath).LineSize = item.LineSize; |
||
5763 | } |
||
5764 | if ((item.Markup as UIElement) != null) |
||
5765 | { |
||
5766 | (item.Markup as UIElement).Opacity = item.Opacity; |
||
5767 | } |
||
5768 | if ((item.Markup as IDashControl) != null) |
||
5769 | { |
||
5770 | (item.Markup as IDashControl).DashSize = item.DashSize; |
||
5771 | } |
||
5772 | if ((item.Markup as IShapeControl) != null) |
||
5773 | { |
||
5774 | (item.Markup as IShapeControl).Paint = item.paint; |
||
5775 | } |
||
5776 | |||
5777 | comment.Add(item.Markup); |
||
5778 | } |
||
5779 | |||
5780 | final = new AdornerFinal(comment); |
||
5781 | SelectLayer.Children.Add(final); |
||
5782 | } |
||
5783 | break; |
||
5784 | case (Event_Type.Option): |
||
5785 | { |
||
5786 | List<CommentUserInfo> comment = new List<CommentUserInfo>(); |
||
5787 | |||
5788 | foreach (var item in undo.Markup_List) |
||
5789 | { |
||
5790 | ViewerDataModel.Instance.MarkupControls_USER.Remove(item.Markup); |
||
5791 | |||
5792 | if (undo.LineSize != 0 && item.Markup as IPath != null) |
||
5793 | { |
||
5794 | (item.Markup as IPath).LineSize = undo.LineSize; |
||
5795 | } |
||
5796 | else if (undo.Opacity != 0 && item.Markup as UIElement != null) |
||
5797 | { |
||
5798 | (item.Markup as UIElement).Opacity = undo.Opacity; |
||
5799 | } |
||
5800 | else if (undo.DashSize != null && item.Markup as IDashControl != null) |
||
5801 | { |
||
5802 | (item.Markup as IDashControl).DashSize = undo.DashSize; |
||
5803 | } |
||
5804 | 5ce56a3a | KangIngu | else if (undo.Interval != 0 && item.Markup as LineControl != null) |
5805 | { |
||
5806 | (item.Markup as LineControl).Interval = undo.Interval; |
||
5807 | } |
||
5808 | 787a4489 | KangIngu | else if (item.Markup as IShapeControl != null) |
5809 | { |
||
5810 | (item.Markup as IShapeControl).Paint = undo.paint; |
||
5811 | } |
||
5812 | comment.Add(item.Markup); |
||
5813 | } |
||
5814 | final = new AdornerFinal(comment); |
||
5815 | SelectLayer.Children.Add(final); |
||
5816 | } |
||
5817 | break; |
||
5818 | } |
||
5819 | ViewerDataModel.Instance.UndoDataList.Where(data => data.EventTime == undo.EventTime).ToList().OrderByDescending(order => order.EventTime).ToList().ForEach(i => |
||
5820 | { |
||
5821 | i.IsUndo = true; |
||
5822 | }); |
||
5823 | } |
||
5824 | |||
5825 | 6707a5c7 | ljiyeon | |
5826 | |||
5827 | 787a4489 | KangIngu | public void Redo() |
5828 | { |
||
5829 | 4c8bb207 | djkim | if (ViewerDataModel.Instance.IsPressCtrl) |
5830 | { |
||
5831 | ViewerDataModel.Instance.IsPressCtrl = false; |
||
5832 | } |
||
5833 | 787a4489 | KangIngu | AdornerFinal final; |
5834 | Undo_data redo = new Undo_data(); |
||
5835 | redo = ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().OrderBy(order => order.EventTime).FirstOrDefault(); |
||
5836 | ReleaseAdorner(); |
||
5837 | if (redo == null) |
||
5838 | return; |
||
5839 | |||
5840 | switch (redo.Event) |
||
5841 | { |
||
5842 | case (Event_Type.Create): |
||
5843 | { |
||
5844 | foreach (var item in redo.Markup_List) |
||
5845 | { |
||
5846 | ViewerDataModel.Instance.MarkupControls_USER.Add(item.Markup); |
||
5847 | 6707a5c7 | ljiyeon | //temp.AddTemp(redo, pageNavigator.CurrentPage.PageNumber, 0, 0); |
5848 | 787a4489 | KangIngu | } |
5849 | } |
||
5850 | break; |
||
5851 | case (Event_Type.Delete): |
||
5852 | { |
||
5853 | foreach (var item in redo.Markup_List) |
||
5854 | { |
||
5855 | ViewerDataModel.Instance.MarkupControls_USER.Remove(item.Markup); |
||
5856 | } |
||
5857 | } |
||
5858 | break; |
||
5859 | case (Event_Type.Thumb): |
||
5860 | { |
||
5861 | List<CommentUserInfo> comment = new List<CommentUserInfo>(); |
||
5862 | |||
5863 | foreach (var item in redo.Markup_List) |
||
5864 | { |
||
5865 | ViewerDataModel.Instance.MarkupControls_USER.Remove((item.Markup as CommentUserInfo)); |
||
5866 | |||
5867 | if ((item.Markup as IViewBox) != null) |
||
5868 | { |
||
5869 | (item.Markup as IViewBox).Angle = item.Angle; |
||
5870 | } |
||
5871 | if ((item.Markup as TextControl) != null) |
||
5872 | { |
||
5873 | (item.Markup as TextControl).Angle = item.Angle; |
||
5874 | |||
5875 | Canvas.SetLeft((item.Markup as TextControl), item.PointSet[0].X); |
||
5876 | Canvas.SetTop((item.Markup as TextControl), item.PointSet[0].Y); |
||
5877 | } |
||
5878 | else |
||
5879 | { |
||
5880 | (item.Markup as IPath).PointSet = item.PointSet; |
||
5881 | (item.Markup as IPath).updateControl(); |
||
5882 | } |
||
5883 | comment.Add(item.Markup); |
||
5884 | } |
||
5885 | final = new AdornerFinal(comment); |
||
5886 | SelectLayer.Children.Add(final); |
||
5887 | ReleaseAdorner(); |
||
5888 | } |
||
5889 | break; |
||
5890 | case (Event_Type.Select): |
||
5891 | { |
||
5892 | List<CommentUserInfo> comment = new List<CommentUserInfo>(); |
||
5893 | |||
5894 | foreach (var item in redo.Markup_List) |
||
5895 | { |
||
5896 | ViewerDataModel.Instance.MarkupControls_USER.Remove(item.Markup); |
||
5897 | |||
5898 | if ((item.Markup as IPath) != null) |
||
5899 | { |
||
5900 | (item.Markup as IPath).LineSize = item.LineSize; |
||
5901 | } |
||
5902 | if ((item.Markup as UIElement) != null) |
||
5903 | { |
||
5904 | (item.Markup as UIElement).Opacity = item.Opacity; |
||
5905 | } |
||
5906 | if ((item.Markup as IDashControl) != null) |
||
5907 | { |
||
5908 | (item.Markup as IDashControl).DashSize = item.DashSize; |
||
5909 | } |
||
5910 | if ((item.Markup as IShapeControl) != null) |
||
5911 | { |
||
5912 | (item.Markup as IShapeControl).Paint = item.paint; |
||
5913 | } |
||
5914 | |||
5915 | comment.Add(item.Markup); |
||
5916 | } |
||
5917 | final = new AdornerFinal(comment); |
||
5918 | SelectLayer.Children.Add(final); |
||
5919 | } |
||
5920 | break; |
||
5921 | case (Event_Type.Option): |
||
5922 | { |
||
5923 | List<CommentUserInfo> comment = new List<CommentUserInfo>(); |
||
5924 | |||
5925 | foreach (var item in redo.Markup_List) |
||
5926 | { |
||
5927 | ViewerDataModel.Instance.MarkupControls_USER.Remove(item.Markup); |
||
5928 | if (redo.LineSize != 0 && item.Markup as IPath != null) |
||
5929 | { |
||
5930 | (item.Markup as IPath).LineSize = redo.LineSize; |
||
5931 | } |
||
5932 | else if (redo.Opacity != 0 && item.Markup as UIElement != null) |
||
5933 | { |
||
5934 | (item.Markup as UIElement).Opacity = redo.Opacity; |
||
5935 | } |
||
5936 | else if (redo.DashSize != null && item.Markup as IDashControl != null) |
||
5937 | { |
||
5938 | (item.Markup as IDashControl).DashSize = redo.DashSize; |
||
5939 | } |
||
5940 | a1716fa5 | KangIngu | else if (redo.Interval != 0 && item.Markup as LineControl != null) |
5941 | 5ce56a3a | KangIngu | { |
5942 | (item.Markup as LineControl).Interval = redo.Interval; |
||
5943 | } |
||
5944 | 787a4489 | KangIngu | else if (item.Markup as IShapeControl != null) |
5945 | { |
||
5946 | (item.Markup as IShapeControl).Paint = redo.paint; |
||
5947 | } |
||
5948 | comment.Add(item.Markup); |
||
5949 | } |
||
5950 | final = new AdornerFinal(comment); |
||
5951 | SelectLayer.Children.Add(final); |
||
5952 | } |
||
5953 | break; |
||
5954 | } |
||
5955 | |||
5956 | ViewerDataModel.Instance.UndoDataList.Where(data => data.EventTime == redo.EventTime).ToList().OrderByDescending(order => order.EventTime).ToList().ForEach(i => |
||
5957 | { |
||
5958 | i.IsUndo = false; |
||
5959 | }); |
||
5960 | } |
||
5961 | |||
5962 | private void Comment_Move(object sender, MouseButtonEventArgs e) |
||
5963 | { |
||
5964 | string Select_ID = (((e.Source as Telerik.Windows.Controls.RadButton).DataContext) as IKCOM.MarkupInfoItem).UserID; |
||
5965 | foreach (var items in ViewerDataModel.Instance._markupInfoRevList) |
||
5966 | { |
||
5967 | if (items.UserID == Select_ID) |
||
5968 | { |
||
5969 | foreach (var item in items.MarkupList) |
||
5970 | { |
||
5971 | if (item.PageNumber == pageNavigator.CurrentPage.PageNumber) |
||
5972 | { |
||
5973 | layerControl.markupParseEx(item.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, "#FFFF0000", "", items.MarkupInfoID, Save.shortGuid()); |
||
5974 | } |
||
5975 | } |
||
5976 | } |
||
5977 | } |
||
5978 | } |
||
5979 | 23a96932 | djkim | public void EmptyControlCheck() |
5980 | { |
||
5981 | for (var j = 0; j < (Common.ViewerDataModel.Instance.MarkupControls_USER).Count; j++) |
||
5982 | { |
||
5983 | if (((Common.ViewerDataModel.Instance.MarkupControls_USER)[j]).GetType().Name == "TextControl") |
||
5984 | { |
||
5985 | if (((MarkupToPDF.Controls.Text.TextControl)(Common.ViewerDataModel.Instance.MarkupControls_USER)[j]).Text == null |
||
5986 | || ((MarkupToPDF.Controls.Text.TextControl)(Common.ViewerDataModel.Instance.MarkupControls_USER)[j]).Text == "") |
||
5987 | { |
||
5988 | Common.ViewerDataModel.Instance.MarkupControls_USER.RemoveAt(j); |
||
5989 | } |
||
5990 | } |
||
5991 | else if (((Common.ViewerDataModel.Instance.MarkupControls_USER)[j]).GetType().Name == "ArrowTextControl") |
||
5992 | { |
||
5993 | if (((MarkupToPDF.Controls.Text.ArrowTextControl)(Common.ViewerDataModel.Instance.MarkupControls_USER)[j]).Base_TextBox.Text == null |
||
5994 | || ((MarkupToPDF.Controls.Text.ArrowTextControl)(Common.ViewerDataModel.Instance.MarkupControls_USER)[j]).Base_TextBox.Text == "") |
||
5995 | { |
||
5996 | Common.ViewerDataModel.Instance.MarkupControls_USER.RemoveAt(j); |
||
5997 | } |
||
5998 | } |
||
5999 | } |
||
6000 | } |
||
6001 | 787a4489 | KangIngu | public void InkControl_Convert() |
6002 | { |
||
6003 | if (inkBoard.Strokes.Count > 0) |
||
6004 | { |
||
6005 | inkBoard.Strokes.ToList().ForEach(stroke => |
||
6006 | { |
||
6007 | List<Stroke> removingStroke = new List<Stroke>(); |
||
6008 | StrokeCollection stC = new StrokeCollection(); |
||
6009 | |||
6010 | removingStroke.Add(stroke); |
||
6011 | |||
6012 | InkToPath ip = new InkToPath(); |
||
6013 | List<Point> inkPointSet = new List<Point>(); |
||
6014 | PolygonControl pc = null; |
||
6015 | pc = new PolygonControl() |
||
6016 | { |
||
6017 | Angle = 0, |
||
6018 | PointSet = new List<Point>(), |
||
6019 | ControlType = ControlType.Ink |
||
6020 | }; |
||
6021 | foreach (var item in removingStroke) |
||
6022 | { |
||
6023 | inkPointSet.AddRange(ip.StrokeGetPointsPlus(item)); |
||
6024 | inkBoard.Strokes.Remove(item); |
||
6025 | } |
||
6026 | if (inkPointSet.Count != 0) |
||
6027 | { |
||
6028 | //강인구 추가(PenControl Undo Redo 추가) |
||
6029 | UndoData = new Undo_data() |
||
6030 | { |
||
6031 | IsUndo = false, |
||
6032 | Event = Event_Type.Create, |
||
6033 | EventTime = DateTime.Now, |
||
6034 | Markup_List = new List<Multi_Undo_data>() |
||
6035 | }; |
||
6036 | |||
6037 | pc.StartPoint = inkPointSet[0]; |
||
6038 | pc.EndPoint = inkPointSet[inkPointSet.Count - 1]; |
||
6039 | pc.PointSet = inkPointSet; |
||
6040 | pc.LineSize = 3; |
||
6041 | pc.CommentID = Save.shortGuid(); |
||
6042 | pc.StrokeColor = new SolidColorBrush(Colors.Red); |
||
6043 | ViewerDataModel.Instance.MarkupControls_USER.Add(pc); |
||
6044 | pc.SetPolyPath(); |
||
6045 | |||
6046 | ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i => |
||
6047 | { |
||
6048 | ViewerDataModel.Instance.UndoDataList.Remove(i); |
||
6049 | }); |
||
6050 | multi_Undo_Data.Markup = pc as CommentUserInfo; |
||
6051 | UndoData.Markup_List.Add(multi_Undo_Data); |
||
6052 | ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
||
6053 | } |
||
6054 | }); |
||
6055 | } |
||
6056 | } |
||
6057 | 17a22987 | KangIngu | |
6058 | 4318fdeb | KangIngu | /// <summary> |
6059 | /// 정원, 정사각형, 정삼각형을 그리기 위한 EndPoint계산 |
||
6060 | /// </summary> |
||
6061 | /// <param name="StartP">StartPoint</param> |
||
6062 | /// <param name="EndP">EndPoint</param> |
||
6063 | /// <returns>Return_EndPoint</returns> |
||
6064 | private Point GetSquareEndPoint(Point StartP, Point EndP) |
||
6065 | 17a22987 | KangIngu | { |
6066 | ae56d52d | KangIngu | Point Return_Point = new Point(); |
6067 | 17a22987 | KangIngu | |
6068 | 4318fdeb | KangIngu | double dx = EndP.X - StartP.X; |
6069 | double dy = EndP.Y - StartP.Y; |
||
6070 | double length; |
||
6071 | 17a22987 | KangIngu | |
6072 | 4318fdeb | KangIngu | switch (controlType) |
6073 | { |
||
6074 | case ControlType.Triangle: |
||
6075 | { |
||
6076 | //삼각형의 StartPoint기준으로 반지름 만큼 증가하기 때문에 곱하기2 필요 |
||
6077 | length = Math.Max(Math.Abs(dx) * 2, Math.Abs(dy)); |
||
6078 | Return_Point = (dy < 0) ? new Point(StartP.X + length / 2, StartP.Y - length) : new Point(StartP.X + length / 2, StartP.Y + length); |
||
6079 | } |
||
6080 | break; |
||
6081 | default: |
||
6082 | { |
||
6083 | length = Math.Max(Math.Abs(dx), Math.Abs(dy)); |
||
6084 | Return_Point.X = (dx > 0) ? StartP.X + length : StartP.X - length; |
||
6085 | Return_Point.Y = (dy > 0) ? StartP.Y + length : StartP.Y - length; |
||
6086 | } |
||
6087 | break; |
||
6088 | } |
||
6089 | 17a22987 | KangIngu | |
6090 | return Return_Point; |
||
6091 | } |
||
6092 | e753423e | humkyung | |
6093 | /// <summary> |
||
6094 | /// 정삼각형을 그리기위한 두 포인트를 계산하여 넘겨줌 |
||
6095 | /// </summary> |
||
6096 | /// <author>humkyung</author> |
||
6097 | /// <date>2018.04.26</date> |
||
6098 | /// <param name="StartP"></param> |
||
6099 | /// <param name="EndP"></param> |
||
6100 | /// <returns></returns> |
||
6101 | 32e95118 | KangIngu | /// <history>humkyung 2018.05.11 apply axis lock</history> |
6102 | e54660e8 | KangIngu | private List<Point> GetRegularTrianglePoints(Point StartP, Point EndP, bool bCheckAxis = false) |
6103 | e753423e | humkyung | { |
6104 | List<Point> res = new List<Point>(); |
||
6105 | |||
6106 | double dx = EndP.X - StartP.X; |
||
6107 | double dy = EndP.Y - StartP.Y; |
||
6108 | double length = Math.Sqrt(dx * dx + dy * dy); |
||
6109 | e54660e8 | KangIngu | double baseLength = length * Math.Tan(30.0 * Math.PI / 180.0); |
6110 | e753423e | humkyung | dx /= length; |
6111 | dy /= length; |
||
6112 | double tmp = dx; |
||
6113 | dx = -dy; dy = tmp; /// rotate by 90 degree |
||
6114 | |||
6115 | res.Add(new Point(EndP.X + dx * baseLength, EndP.Y + dy * baseLength)); |
||
6116 | res.Add(new Point(EndP.X - dx * baseLength, EndP.Y - dy * baseLength)); |
||
6117 | |||
6118 | return res; |
||
6119 | } |
||
6120 | a1716fa5 | KangIngu | |
6121 | e66f22eb | KangIngu | /// <summary> |
6122 | /// 캔버스에 그릴때 모든 포인트가 캔버스를 벗어 났는지 체크하여 넘겨줌 |
||
6123 | /// </summary> |
||
6124 | /// <author>ingu</author> |
||
6125 | /// <date>2018.06.05</date> |
||
6126 | /// <param name="getPoint"></param> |
||
6127 | /// <returns></returns> |
||
6128 | private bool IsGetoutpoint(Point getPoint) |
||
6129 | 670a4be2 | humkyung | { |
6130 | e66f22eb | KangIngu | if (getPoint == new Point()) |
6131 | 670a4be2 | humkyung | { |
6132 | e66f22eb | KangIngu | ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl); |
6133 | currentControl = null; |
||
6134 | return true; |
||
6135 | 670a4be2 | humkyung | } |
6136 | |||
6137 | e66f22eb | KangIngu | return false; |
6138 | 670a4be2 | humkyung | } |
6139 | e66f22eb | KangIngu | |
6140 | 5b46312f | djkim | private void zoomAndPanControl_DragOver(object sender, DragEventArgs e) |
6141 | { |
||
6142 | e.Effects = DragDropEffects.Copy; |
||
6143 | } |
||
6144 | |||
6145 | private void zoomAndPanControl_DragEnter(object sender, DragEventArgs e) |
||
6146 | { |
||
6147 | e.Effects = DragDropEffects.Copy; |
||
6148 | } |
||
6149 | |||
6150 | private void zoomAndPanControl_DragLeave(object sender, DragEventArgs e) |
||
6151 | { |
||
6152 | e.Effects = DragDropEffects.None; |
||
6153 | } |
||
6154 | |||
6155 | private void zoomAndPanControl_Drop(object sender, DragEventArgs e) |
||
6156 | { |
||
6157 | if (e.Data.GetDataPresent(typeof(string))) |
||
6158 | { |
||
6159 | this.getCurrentPoint = e.GetPosition(drawingRotateCanvas); |
||
6160 | string dragData = e.Data.GetData(typeof(string)) as string; |
||
6161 | Move_Symbol(sender, dragData); |
||
6162 | } |
||
6163 | } |
||
6164 | |||
6165 | private void Move_Symbol(object sender, string dragData) |
||
6166 | { |
||
6167 | if (dragData.Contains("|DZ|")) |
||
6168 | { |
||
6169 | List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>(); |
||
6170 | |||
6171 | string[] delimiterChars = { "|DZ|" }; |
||
6172 | string[] data = dragData.Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries); |
||
6173 | |||
6174 | this.ParentOfType<MainWindow>().dzMainMenu.ReleaseAdorner(); |
||
6175 | |||
6176 | Multi_Undo_data multi_Undo_Data = new Multi_Undo_data(); |
||
6177 | |||
6178 | //강인구 Undo/Redo 보류 |
||
6179 | UndoData = new Undo_data() |
||
6180 | { |
||
6181 | IsUndo = false, |
||
6182 | Event = Event_Type.Create, |
||
6183 | EventTime = DateTime.Now, |
||
6184 | Markup_List = new List<Multi_Undo_data>() |
||
6185 | }; |
||
6186 | |||
6187 | ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i => |
||
6188 | { |
||
6189 | ViewerDataModel.Instance.UndoDataList.Remove(i); |
||
6190 | }); |
||
6191 | |||
6192 | foreach (string parse in data) |
||
6193 | { |
||
6194 | if (parse != "") |
||
6195 | { |
||
6196 | System.Windows.Controls.Control item = this.layerControl.markupParse_Paste(parse, ViewerDataModel.Instance.MarkupControls_USER); |
||
6197 | (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Events.Save.shortGuid(); |
||
6198 | |||
6199 | ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo); |
||
6200 | ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo); |
||
6201 | |||
6202 | adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo); |
||
6203 | |||
6204 | multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(item as MarkupToPDF.Common.CommentUserInfo); |
||
6205 | |||
6206 | UndoData.Markup_List.Add(multi_Undo_Data); |
||
6207 | ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
||
6208 | } |
||
6209 | } |
||
6210 | Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet); |
||
6211 | |||
6212 | /// move symbol to current mouse point |
||
6213 | double realPointX = this.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2); |
||
6214 | double realPointY = this.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2); |
||
6215 | final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY)); |
||
6216 | |||
6217 | if (final.MemberSet.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null) |
||
6218 | { |
||
6219 | final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(0.001, 0.001)); //dummy |
||
6220 | } |
||
6221 | /// up to here |
||
6222 | 6707a5c7 | ljiyeon | |
6223 | 5b46312f | djkim | ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Add(final); |
6224 | } |
||
6225 | } |
||
6226 | 787a4489 | KangIngu | } |
6227 | 5a6a5dd1 | humkyung | } |