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