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