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