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