markus / KCOM / Views / MainMenu.xaml.cs @ 038c77fd
이력 | 보기 | 이력해설 | 다운로드 (356 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 | 036650a0 | humkyung | using MarkupToPDF.Controls.Parsing; |
42 | 787a4489 | KangIngu | |
43 | namespace KCOM.Views |
||
44 | { |
||
45 | public static class ControlExtensions |
||
46 | { |
||
47 | public static T Clone<T>(this T controlToClone) |
||
48 | where T : System.Windows.Controls.Control |
||
49 | { |
||
50 | System.Reflection.PropertyInfo[] controlProperties = typeof(T).GetProperties(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance); |
||
51 | |||
52 | T instance = Activator.CreateInstance<T>(); |
||
53 | |||
54 | foreach (PropertyInfo propInfo in controlProperties) |
||
55 | { |
||
56 | if (propInfo.CanWrite) |
||
57 | { |
||
58 | if (propInfo.Name != "WindowTarget") |
||
59 | propInfo.SetValue(instance, propInfo.GetValue(controlToClone, null), null); |
||
60 | } |
||
61 | } |
||
62 | return instance; |
||
63 | } |
||
64 | } |
||
65 | |||
66 | a0bab669 | KangIngu | public class MyConsole |
67 | { |
||
68 | private readonly System.Threading.ManualResetEvent _readLineSignal; |
||
69 | private string _lastLine; |
||
70 | public MyConsole() |
||
71 | { |
||
72 | _readLineSignal = new System.Threading.ManualResetEvent(false); |
||
73 | Gui = new TextBox(); |
||
74 | Gui.AcceptsReturn = true; |
||
75 | Gui.KeyUp += OnKeyUp; |
||
76 | } |
||
77 | |||
78 | private void OnKeyUp(object sender, KeyEventArgs e) |
||
79 | { |
||
80 | // this is always fired on UI thread |
||
81 | if (e.Key == Key.Enter) |
||
82 | { |
||
83 | // quick and dirty, but that is not relevant to your question |
||
84 | _lastLine = Gui.Text.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries).Last(); |
||
85 | // now, when you detected that user typed a line, set signal |
||
86 | _readLineSignal.Set(); |
||
87 | } |
||
88 | } |
||
89 | |||
90 | public TextBox Gui { get; private set; } |
||
91 | |||
92 | public string ReadLine() |
||
93 | { |
||
94 | // that should always be called from non-ui thread |
||
95 | if (Gui.Dispatcher.CheckAccess()) |
||
96 | throw new Exception("Cannot be called on UI thread"); |
||
97 | // reset signal |
||
98 | _readLineSignal.Reset(); |
||
99 | // wait until signal is set. This call is blocking, but since we are on non-ui thread - there is no problem with that |
||
100 | _readLineSignal.WaitOne(); |
||
101 | // we got signalled - return line user typed. |
||
102 | return _lastLine; |
||
103 | } |
||
104 | |||
105 | public void WriteLine(string line) |
||
106 | { |
||
107 | if (!Gui.Dispatcher.CheckAccess()) |
||
108 | { |
||
109 | Gui.Dispatcher.Invoke(new Action(() => WriteLine(line))); |
||
110 | return; |
||
111 | } |
||
112 | |||
113 | Gui.Text += line + Environment.NewLine; |
||
114 | } |
||
115 | } |
||
116 | |||
117 | 787a4489 | KangIngu | /// <summary> |
118 | /// MainMenu.xaml에 대한 상호 작용 논리 |
||
119 | /// </summary> |
||
120 | public partial class MainMenu : UserControl |
||
121 | { |
||
122 | #region 프로퍼티 |
||
123 | public Undo_data UndoData { get; set; } |
||
124 | public CommentUserInfo currentControl { get; set; } |
||
125 | public ControlType controlType { get; set; } |
||
126 | private Move move; |
||
127 | private double[] rotateValue = { 0, 90, 180, 270 }; |
||
128 | public MouseHandlingMode mouseHandlingMode = MouseHandlingMode.None; |
||
129 | public MouseButton mouseButtonDown { get; set; } |
||
130 | private static readonly double DragThreshold = 5; |
||
131 | eb2b9248 | KangIngu | private System.Windows.Input.Cursor cursor { get; set; } |
132 | 787a4489 | KangIngu | private Point canvasDrawingMouseDownPoint; |
133 | public string filename { get; set; } |
||
134 | private Point canvasZoomPanningMouseDownPoint; |
||
135 | public Point getCurrentPoint; |
||
136 | private Point canvasZoommovingMouseDownPoint; |
||
137 | List<object> ControlList = new List<object>(); |
||
138 | private ListBox listBox = new ListBox(); |
||
139 | private Dictionary<Geometry, string> selected_item = new Dictionary<Geometry, string>(); |
||
140 | private bool isDraggingSelectionRect = false; |
||
141 | DrawingAttributes inkDA = new DrawingAttributes(); |
||
142 | private VPRevision CurrentRev { get; set; } |
||
143 | public RadRibbonButton btnConsolidate { get; set; } |
||
144 | public RadRibbonButton btnFinalPDF { get; set; } |
||
145 | public RadRibbonButton btnTeamConsolidate { get; set; } |
||
146 | 80458c15 | ljiyeon | public RadRibbonButton btnConsolidateFinalPDF { get; set; } |
147 | |||
148 | 787a4489 | KangIngu | public string Filename_ { get; set; } |
149 | public double L_Size = 0; |
||
150 | public AdornerFinal adorner_; |
||
151 | public Multi_Undo_data multi_Undo_Data; |
||
152 | 5ce56a3a | KangIngu | public string Symbol_ID = ""; |
153 | 787a4489 | KangIngu | /// <summary> |
154 | /// Set to 'true' when the left mouse-button is down. |
||
155 | /// </summary> |
||
156 | 9f473fb7 | KangIngu | public bool isLeftMouseButtonDownOnWindow = false; |
157 | 787a4489 | KangIngu | |
158 | public InkPresenter _InkBoard = null; |
||
159 | Stroke stroke; |
||
160 | Boolean IsDrawing = false; |
||
161 | StylusPointCollection strokePoints; |
||
162 | 53880c83 | ljiyeon | //StylusPointCollection erasePoints; |
163 | 787a4489 | KangIngu | RenderTargetBitmap canvasImage; |
164 | Point Sync_Offset_Point; |
||
165 | |||
166 | //강인구 테스트 |
||
167 | private Path _SelectionPath { get; set; } |
||
168 | public Path SelectionPath |
||
169 | { |
||
170 | get |
||
171 | { |
||
172 | return _SelectionPath; |
||
173 | } |
||
174 | set |
||
175 | { |
||
176 | if (_SelectionPath != value) |
||
177 | { |
||
178 | _SelectionPath = value; |
||
179 | RaisePropertyChanged("SelectionPath"); |
||
180 | |||
181 | } |
||
182 | } |
||
183 | } |
||
184 | |||
185 | private System.Windows.Controls.Image _imageViewer { get; set; } |
||
186 | public System.Windows.Controls.Image imageViewer |
||
187 | { |
||
188 | get |
||
189 | { |
||
190 | if (_imageViewer == null) |
||
191 | { |
||
192 | _imageViewer = new System.Windows.Controls.Image(); |
||
193 | return _imageViewer; |
||
194 | } |
||
195 | else |
||
196 | { |
||
197 | return _imageViewer; |
||
198 | } |
||
199 | } |
||
200 | set |
||
201 | { |
||
202 | if (_imageViewer != value) |
||
203 | { |
||
204 | _imageViewer = value; |
||
205 | } |
||
206 | } |
||
207 | } |
||
208 | |||
209 | public bool IsSyncPDFMode { get; set; } |
||
210 | |||
211 | private System.Windows.Controls.Image _imageViewer_Compare { get; set; } |
||
212 | public System.Windows.Controls.Image imageViewer_Compare |
||
213 | { |
||
214 | get |
||
215 | { |
||
216 | if (_imageViewer_Compare == null) |
||
217 | { |
||
218 | _imageViewer_Compare = new System.Windows.Controls.Image(); |
||
219 | return _imageViewer_Compare; |
||
220 | } |
||
221 | else |
||
222 | { |
||
223 | return _imageViewer_Compare; |
||
224 | } |
||
225 | } |
||
226 | set |
||
227 | { |
||
228 | if (_imageViewer_Compare != value) |
||
229 | { |
||
230 | _imageViewer_Compare = value; |
||
231 | } |
||
232 | } |
||
233 | } |
||
234 | |||
235 | #endregion |
||
236 | 90e7968d | ljiyeon | |
237 | 787a4489 | KangIngu | public MainMenu() |
238 | { |
||
239 | e0204db0 | djkim | //InitializeComponent(); |
240 | 90e7968d | ljiyeon | this.Loaded += MainMenu_Loaded; |
241 | 787a4489 | KangIngu | } |
242 | 6707a5c7 | ljiyeon | |
243 | public class TempDt |
||
244 | { |
||
245 | public int PageNumber { get; set; } |
||
246 | public string CommentID { get; set; } |
||
247 | public string ConvertData { get; set; } |
||
248 | public int DATA_TYPE { get; set; } |
||
249 | public string MarkupInfoID { get; set; } |
||
250 | public int IsUpdate { get; set; } |
||
251 | } |
||
252 | |||
253 | List<TempDt> tempDtList = new List<TempDt>(); |
||
254 | 90e7968d | ljiyeon | |
255 | 787a4489 | KangIngu | private void SetCursor() |
256 | { |
||
257 | this.Cursor = cursor; |
||
258 | } |
||
259 | |||
260 | private bool IsDrawingEnable(Point _canvasZoomPanningMouseDownPoint) |
||
261 | { |
||
262 | if ((_canvasZoomPanningMouseDownPoint.X > 0 && |
||
263 | ca40e004 | ljiyeon | zoomAndPanCanvas.ActualWidth > _canvasZoomPanningMouseDownPoint.X) && |
264 | (_canvasZoomPanningMouseDownPoint.Y > 0 && |
||
265 | zoomAndPanCanvas.ActualHeight > _canvasZoomPanningMouseDownPoint.Y)) |
||
266 | 787a4489 | KangIngu | { |
267 | return true; |
||
268 | } |
||
269 | |||
270 | return false; |
||
271 | } |
||
272 | |||
273 | ca40e004 | ljiyeon | private bool IsRotationDrawingEnable(Point _canvasZoomPanningMouseDownPoint) |
274 | { |
||
275 | if (rotate.Angle == 90 || rotate.Angle == 270) |
||
276 | { |
||
277 | if ((_canvasZoomPanningMouseDownPoint.X > 0 && |
||
278 | zoomAndPanCanvas.ActualHeight > _canvasZoomPanningMouseDownPoint.X) && |
||
279 | (_canvasZoomPanningMouseDownPoint.Y > 0 && |
||
280 | zoomAndPanCanvas.ActualWidth > _canvasZoomPanningMouseDownPoint.Y)) |
||
281 | { |
||
282 | return true; |
||
283 | } |
||
284 | } |
||
285 | else |
||
286 | { |
||
287 | if ((_canvasZoomPanningMouseDownPoint.X > 0 && |
||
288 | zoomAndPanCanvas.ActualWidth > _canvasZoomPanningMouseDownPoint.X) && |
||
289 | (_canvasZoomPanningMouseDownPoint.Y > 0 && |
||
290 | zoomAndPanCanvas.ActualHeight > _canvasZoomPanningMouseDownPoint.Y)) |
||
291 | { |
||
292 | return true; |
||
293 | } |
||
294 | 90e7968d | ljiyeon | } |
295 | ca40e004 | ljiyeon | |
296 | return false; |
||
297 | } |
||
298 | |||
299 | 90e7968d | ljiyeon | |
300 | 787a4489 | KangIngu | public void DeleteItem(MarkupInfoItem item) |
301 | { |
||
302 | if (PreviewUserMarkupInfoItem != null && item.Consolidate == 1 && item.AvoidConsolidate == 0) |
||
303 | { |
||
304 | App.Custom_ViewInfoId = PreviewUserMarkupInfoItem.MarkupInfoID; |
||
305 | } |
||
306 | |||
307 | ViewerDataModel.Instance._markupInfoList.Remove(item); |
||
308 | |||
309 | ViewerDataModel.Instance.MarkupControls.Where(data => data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(a => |
||
310 | { |
||
311 | ViewerDataModel.Instance.MarkupControls.Remove(a); |
||
312 | }); |
||
313 | |||
314 | ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(a => |
||
315 | { |
||
316 | ViewerDataModel.Instance.MarkupControls_USER.Remove(a); |
||
317 | }); |
||
318 | |||
319 | ViewerDataModel.Instance.MarkupList_USER.Where(data => data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(a => |
||
320 | { |
||
321 | ComingNewBieEnd = false; |
||
322 | ViewerDataModel.Instance.MarkupList_USER.Remove(a); |
||
323 | 6707a5c7 | ljiyeon | //임시파일에서도 삭제 |
324 | a20d338f | ljiyeon | TempFile.DelTemp(a.ID, this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber.ToString()); |
325 | 787a4489 | KangIngu | }); |
326 | |||
327 | gridViewMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoList; |
||
328 | if (PreviewUserMarkupInfoItem == null && gridViewMarkup.SelectedItems.Where(d => (d as MarkupInfoItem).UserID == App.ViewInfo.UserID).FirstOrDefault() == null) |
||
329 | { |
||
330 | if (gridViewMarkup.Items.Cast<MarkupInfoItem>().ToList().Where(d => d.UserID == App.ViewInfo.UserID).Count() == 0) |
||
331 | { |
||
332 | var infoId = Events.Save.shortGuid(); |
||
333 | PreviewUserMarkupInfoItem = new MarkupInfoItem |
||
334 | { |
||
335 | CreateTime = DateTime.Now, |
||
336 | Depatment = userData.DEPARTMENT, |
||
337 | 992a98b4 | KangIngu | UpdateTime = DateTime.Now, |
338 | 787a4489 | KangIngu | DisplayColor = "#FFFF0000", |
339 | UserID = userData.ID, |
||
340 | UserName = userData.NAME, |
||
341 | PageCount = 1, |
||
342 | Description = "", |
||
343 | MarkupInfoID = infoId, |
||
344 | MarkupList = null, |
||
345 | MarkupVersionID = Events.Save.shortGuid(), |
||
346 | Consolidate = 0, |
||
347 | PartConsolidate = 0, |
||
348 | userDelete = true, |
||
349 | AvoidConsolidate = 0, |
||
350 | IsPreviewUser = true |
||
351 | }; |
||
352 | App.Custom_ViewInfoId = infoId; |
||
353 | } |
||
354 | } |
||
355 | 0f065e57 | ljiyeon | Logger.sendReqLog("DeleteMarkupAsync", App.ViewInfo.ProjectNO + "," + item.MarkupInfoID, 1); |
356 | 787a4489 | KangIngu | BaseClient.DeleteMarkupAsync(App.ViewInfo.ProjectNO, item.MarkupInfoID); |
357 | } |
||
358 | |||
359 | public void DeleteCommentEvent(object sender, RoutedEventArgs e) |
||
360 | { |
||
361 | //선택된 어도너가 있을시 삭제가 되지 않음(강인구 추가) |
||
362 | this.ReleaseAdorner(); |
||
363 | |||
364 | Button content = (sender as Button); |
||
365 | MarkupInfoItem item = content.CommandParameter as MarkupInfoItem; |
||
366 | |||
367 | DeleteItem(item); |
||
368 | } |
||
369 | |||
370 | System.Windows.Media.Animation.DoubleAnimation da = new System.Windows.Media.Animation.DoubleAnimation(); |
||
371 | |||
372 | 6707a5c7 | ljiyeon | private static Timer timer; |
373 | private int InitInterval = KCOM.Properties.Settings.Default.InitInterval; |
||
374 | 787a4489 | KangIngu | private void MainMenu_Loaded(object sender, RoutedEventArgs e) |
375 | 90e7968d | ljiyeon | { |
376 | 510cbd2a | ljiyeon | InitializeComponent(); |
377 | 0c997b99 | ljiyeon | |
378 | 90e7968d | ljiyeon | //System.Diagnostics.Debug.WriteLine("MainMenu() : " + sw.ElapsedMilliseconds.ToString() + "ms"); |
379 | |||
380 | 787a4489 | KangIngu | if (App.ParameterMode) |
381 | 6707a5c7 | ljiyeon | { |
382 | this.pageNavigator.PageChanging += pageNavigator_PageChanging; |
||
383 | imageViewer_Compare = new Image(); |
||
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 | 90e7968d | ljiyeon | { |
393 | e0204db0 | djkim | this.SymbolPane.Visibility = Visibility.Collapsed; |
394 | this.FavoritePane.Visibility = Visibility.Collapsed; |
||
395 | this.drawingRotateCanvas.IsHitTestVisible = false; |
||
396 | 90e7968d | ljiyeon | } |
397 | 6707a5c7 | ljiyeon | } |
398 | 90e7968d | ljiyeon | 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 | 90e7968d | ljiyeon | Dispatcher.InvokeAsync(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 | 90e7968d | ljiyeon | ////GC.Collect(); |
417 | 6707a5c7 | ljiyeon | } |
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 | 036650a0 | humkyung | var root = MarkupParser.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 | a20d338f | ljiyeon | TempFile.WriteTemp(tempDtList); |
493 | 6707a5c7 | ljiyeon | 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 | a20d338f | ljiyeon | //public string FilePath = AppDomain.CurrentDomain.BaseDirectory + "Temp\\" + ; |
513 | public static string PathString = System.IO.Path.GetTempPath() + "\\MARKUS\\" + App.ViewInfo.DocumentItemID + ".tmp"; |
||
514 | ccf944bb | ljiyeon | |
515 | 6707a5c7 | ljiyeon | public void TempLoad() |
516 | { |
||
517 | 90e7968d | ljiyeon | if ((System.IO.File.Exists(FilePath)) == true) |
518 | 6707a5c7 | ljiyeon | { |
519 | XmlDocument xdoc = new XmlDocument(); |
||
520 | 90e7968d | ljiyeon | xdoc.Load(FilePath); |
521 | XmlNodeList nodes = xdoc.SelectNodes("/Root/CommentID"); |
||
522 | 6707a5c7 | ljiyeon | int PageNumber = 0; |
523 | 90e7968d | ljiyeon | if (nodes.Count > 0) |
524 | 6707a5c7 | ljiyeon | { |
525 | if (MessageBox.Show("저장하지 못한 데이터가 있습니다. 불러오시겠습니까?", "MARKUS", MessageBoxButton.OKCancel) == MessageBoxResult.OK) |
||
526 | ccf944bb | ljiyeon | { |
527 | 6707a5c7 | ljiyeon | foreach (XmlNode node in nodes) |
528 | ccf944bb | ljiyeon | { |
529 | 6707a5c7 | ljiyeon | string CommentID = node.Attributes["Value"].Value; |
530 | string ConvertData = node.SelectSingleNode("ConvertData").InnerText; |
||
531 | string DATA_TYPE = node.SelectSingleNode("DATA_TYPE").InnerText; |
||
532 | string MarkupInfoID = node.SelectSingleNode("MarkupInfoID").InnerText; |
||
533 | int IsUpdate = Convert.ToInt32(node.SelectSingleNode("IsUpdate").InnerText); |
||
534 | 90e7968d | ljiyeon | PageNumber = Convert.ToInt32(node.SelectSingleNode("PageNumber").InnerText); |
535 | |||
536 | 6707a5c7 | ljiyeon | tempLoadData.Add(new TempLoadData() |
537 | ccf944bb | ljiyeon | { |
538 | 6707a5c7 | ljiyeon | PageNumber = PageNumber, |
539 | CommentID = CommentID, |
||
540 | ConvertData = ConvertData, |
||
541 | DATA_TYPE = DATA_TYPE, |
||
542 | MarkupInfoID = MarkupInfoID, |
||
543 | IsUpdate = IsUpdate |
||
544 | ccf944bb | ljiyeon | }); |
545 | 6707a5c7 | ljiyeon | } |
546 | ccf944bb | ljiyeon | |
547 | 6707a5c7 | ljiyeon | if (PageNumber > 0) |
548 | { |
||
549 | this.pageNavigator.GotoPage(PageNumber); |
||
550 | } |
||
551 | ccf944bb | ljiyeon | |
552 | 6707a5c7 | ljiyeon | // Temp Object add |
553 | if (pageNavigator.CurrentPage.PageNumber == PageNumber) |
||
554 | { |
||
555 | TempControlLoad(); |
||
556 | } |
||
557 | tempLoadData.Clear(); |
||
558 | } |
||
559 | } |
||
560 | else //파일 삭제 |
||
561 | { |
||
562 | a20d338f | ljiyeon | TempFile.Remove(); |
563 | 6707a5c7 | ljiyeon | } |
564 | f714bef8 | djkim | } |
565 | ccf944bb | ljiyeon | } |
566 | 90e7968d | ljiyeon | |
567 | 787a4489 | KangIngu | |
568 | public void ReleaseAdorner() |
||
569 | { |
||
570 | 90e7968d | ljiyeon | try |
571 | 787a4489 | KangIngu | { |
572 | 90e7968d | ljiyeon | Logger.sendCheckLog("pageNavigator_PageChanging_ReleaseAdorner", 1); |
573 | if (SelectLayer.Children.Count > 0) |
||
574 | 787a4489 | KangIngu | { |
575 | 90e7968d | ljiyeon | foreach (var item in SelectLayer.Children) |
576 | 787a4489 | KangIngu | { |
577 | 90e7968d | ljiyeon | if (item.GetType().Name == "AdornerFinal") |
578 | 787a4489 | KangIngu | { |
579 | 90e7968d | ljiyeon | (item as AdornerFinal).unRegister(); |
580 | |||
581 | foreach (var InnerItem in (item as AdornerFinal).MemberSet.Cast<AdornerMember>()) |
||
582 | 787a4489 | KangIngu | { |
583 | 90e7968d | ljiyeon | if (!ViewerDataModel.Instance.MarkupControls_USER.Contains(InnerItem.DrawingData)) |
584 | 787a4489 | KangIngu | { |
585 | 90e7968d | ljiyeon | if (InnerItem.DrawingData.GetType().Name == "PolygonControl") |
586 | 787a4489 | KangIngu | { |
587 | 90e7968d | ljiyeon | if ((InnerItem.DrawingData as PolygonControl).CommentID == null) |
588 | { |
||
589 | (InnerItem.DrawingData as PolygonControl).CommentID = KCOM.Events.Save.shortGuid(); |
||
590 | } |
||
591 | 787a4489 | KangIngu | } |
592 | |||
593 | 90e7968d | ljiyeon | ViewerDataModel.Instance.MarkupControls_USER.Add(InnerItem.DrawingData as CommentUserInfo); |
594 | } |
||
595 | 787a4489 | KangIngu | } |
596 | } |
||
597 | } |
||
598 | 90e7968d | ljiyeon | SelectLayer.Children.Clear(); |
599 | 787a4489 | KangIngu | } |
600 | } |
||
601 | 90e7968d | ljiyeon | catch (Exception ex) |
602 | { |
||
603 | Logger.sendResLog("ReleaseAdorner", ex.ToString(), 0); |
||
604 | } |
||
605 | 787a4489 | KangIngu | } |
606 | |||
607 | public List<CommentUserInfo> AddAdorner() |
||
608 | { |
||
609 | List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>(); |
||
610 | |||
611 | if (SelectLayer.Children.Count > 0) |
||
612 | { |
||
613 | foreach (var item in SelectLayer.Children) |
||
614 | { |
||
615 | if (item.GetType().Name == "AdornerFinal") |
||
616 | { |
||
617 | (item as AdornerFinal).unRegister(); |
||
618 | |||
619 | foreach (var InnerItem in (item as AdornerFinal).MemberSet.Cast<AdornerMember>()) |
||
620 | { |
||
621 | if (!ViewerDataModel.Instance.MarkupControls_USER.Contains(InnerItem.DrawingData)) |
||
622 | { |
||
623 | adornerSet.Add(InnerItem.DrawingData as CommentUserInfo); |
||
624 | } |
||
625 | |||
626 | Control_Style(InnerItem.DrawingData as CommentUserInfo); |
||
627 | |||
628 | UndoData.Markup_List.Add(multi_Undo_Data); |
||
629 | multi_Undo_Data = new Multi_Undo_data(); |
||
630 | } |
||
631 | } |
||
632 | } |
||
633 | SelectLayer.Children.Clear(); |
||
634 | } |
||
635 | return adornerSet; |
||
636 | } |
||
637 | |||
638 | public void ChangeCommentReact() |
||
639 | { |
||
640 | 548c696e | ljiyeon | Logger.sendCheckLog("pageNavigator_PageChanging_ChangeCommentReact", 1); |
641 | 787a4489 | KangIngu | bool isComingNewBie = false; |
642 | |||
643 | if (ViewerDataModel.Instance.MarkupControls_USER.Count > 0) |
||
644 | { |
||
645 | foreach (var control in ViewerDataModel.Instance.MarkupControls_USER) |
||
646 | { |
||
647 | 036650a0 | humkyung | var root = MarkupParser.MarkupToString(control, App.ViewInfo.UserID); |
648 | 90e7968d | ljiyeon | |
649 | 6707a5c7 | ljiyeon | var existItem = ViewerDataModel.Instance.MarkupList_USER.Where(data => data.ID == root.CommentID).FirstOrDefault(); |
650 | if (existItem != null) //신규 추가 된 코멘트 |
||
651 | { |
||
652 | if (existItem.Data != root.ConvertData) //코멘트가 같은지 |
||
653 | 787a4489 | KangIngu | { |
654 | 6707a5c7 | ljiyeon | existItem.Data = root.ConvertData; |
655 | existItem.IsUpdate = true; |
||
656 | 69db7b26 | ljiyeon | ComingNewBieEnd = false; |
657 | d7548b21 | ljiyeon | } |
658 | 6707a5c7 | ljiyeon | } |
659 | else |
||
660 | { |
||
661 | if (root.CommentID != null) |
||
662 | d7548b21 | ljiyeon | { |
663 | 6707a5c7 | ljiyeon | isComingNewBie = true; |
664 | var currentCommentCheck = ViewerDataModel.Instance.MarkupList_USER.Where(dt => dt.ID == control.CommentID).FirstOrDefault(); |
||
665 | if (currentCommentCheck != null) |
||
666 | 787a4489 | KangIngu | { |
667 | 6707a5c7 | ljiyeon | currentCommentCheck.Data = root.ConvertData; |
668 | } |
||
669 | else |
||
670 | { |
||
671 | ViewerDataModel.Instance.MarkupList_USER.Add(new MarkupItemEx |
||
672 | 787a4489 | KangIngu | { |
673 | 6707a5c7 | ljiyeon | ID = control.CommentID, |
674 | Data = root.ConvertData, |
||
675 | Data_Type = root.DATA_TYPE, |
||
676 | MarkupInfoID = App.Custom_ViewInfoId, |
||
677 | PageNumber = this.pageNavigator.CurrentPage.PageNumber, |
||
678 | c8e9b3e4 | ljiyeon | Symbol_ID = control.SymbolID, |
679 | 53880c83 | ljiyeon | Group_ID = control.GroupID, |
680 | 6707a5c7 | ljiyeon | }); |
681 | 69db7b26 | ljiyeon | ComingNewBieEnd = false; |
682 | 787a4489 | KangIngu | } |
683 | } |
||
684 | 90e7968d | ljiyeon | } |
685 | 787a4489 | KangIngu | } |
686 | } |
||
687 | |||
688 | 6707a5c7 | ljiyeon | |
689 | 787a4489 | KangIngu | if (PreviewUserMarkupInfoItem != null && isComingNewBie && !ComingNewBieEnd) |
690 | { |
||
691 | if (ViewerDataModel.Instance._markupInfoList.Where(info => info.UserID == PreviewUserMarkupInfoItem.UserID).FirstOrDefault() == null) |
||
692 | { |
||
693 | ComingNewBieEnd = true; |
||
694 | ViewerDataModel.Instance._markupInfoList.Insert(0, PreviewUserMarkupInfoItem); |
||
695 | PreviewUserMarkupInfoItem.IsPreviewUser = false; |
||
696 | gridViewMarkup.ItemsSource = null; |
||
697 | gridViewMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoList; |
||
698 | gridViewMarkup.SelectedItem = PreviewUserMarkupInfoItem; |
||
699 | } |
||
700 | } |
||
701 | |||
702 | } |
||
703 | |||
704 | bool ComingNewBieEnd = false; |
||
705 | |||
706 | private void pageNavigator_PageChanging(object sender, Controls.Sample.PageChangeEventArgs e) |
||
707 | 548c696e | ljiyeon | { |
708 | Logger.sendCheckLog("pageNavigator_PageChanging_Start", 1); |
||
709 | 316d0f5c | KangIngu | if (ViewerDataModel.Instance.UndoDataList.Count > 0) |
710 | 548c696e | ljiyeon | { |
711 | Logger.sendCheckLog("pageNavigator_PageChanging_이전페이지Save", 1); |
||
712 | 316d0f5c | KangIngu | this.ParentOfType<MainWindow>().dzTopMenu.SaveEvent(null, null); |
713 | } |
||
714 | 548c696e | ljiyeon | Logger.sendCheckLog("pageNavigator_PageChanging_UndoDataListClear", 1); |
715 | 787a4489 | KangIngu | ViewerDataModel.Instance.UndoDataList.Clear(); |
716 | 90e7968d | ljiyeon | |
717 | 787a4489 | KangIngu | InkControl_Convert(); |
718 | |||
719 | ReleaseAdorner(); |
||
720 | ChangeCommentReact(); |
||
721 | 548c696e | ljiyeon | |
722 | Logger.sendCheckLog("pageNavigator_PageChanging_변수생성 및 값 설정", 1); |
||
723 | 787a4489 | KangIngu | CompareMode.IsChecked = false; |
724 | var BalancePoint = ViewerDataModel.Instance.PageBalanceMode == true ? e.PageNumber + ViewerDataModel.Instance.PageBalanceNumber : e.PageNumber; |
||
725 | |||
726 | |||
727 | #region 페이지가 벗어난 경우 |
||
728 | |||
729 | if (BalancePoint < 1) |
||
730 | { |
||
731 | BalancePoint = 1; |
||
732 | ViewerDataModel.Instance.PageBalanceNumber = 0; |
||
733 | } |
||
734 | |||
735 | if (pageNavigator.PageCount < BalancePoint) |
||
736 | { |
||
737 | BalancePoint = pageNavigator.PageCount; |
||
738 | ViewerDataModel.Instance.PageBalanceNumber = 0; |
||
739 | } |
||
740 | |||
741 | #endregion |
||
742 | |||
743 | ViewerDataModel.Instance.PageNumber = BalancePoint; |
||
744 | |||
745 | 548c696e | ljiyeon | Logger.sendCheckLog("pageNavigator_PageChanging_페이지 Image url 설정", 1); |
746 | a874198d | humkyung | string uri = ""; |
747 | a1716fa5 | KangIngu | if (userData.COMPANY != "EXT") |
748 | a874198d | humkyung | { |
749 | uri = String.Format(Properties.Settings.Default.mainServerImageWebPath, _ViewInfo.ProjectNO, (Convert.ToInt32(_ViewInfo.DocumentItemID) / 100).ToString(), _ViewInfo.DocumentItemID, e.PageNumber); |
||
750 | } |
||
751 | else |
||
752 | { |
||
753 | uri = String.Format(Properties.Settings.Default.subServerImageWebPath, _ViewInfo.ProjectNO, _ViewInfo.DocumentItemID, e.PageNumber); |
||
754 | } |
||
755 | 548c696e | ljiyeon | |
756 | 8a9f6742 | djkim | var defaultBitmapImage = new BitmapImage(); |
757 | defaultBitmapImage.BeginInit(); |
||
758 | defaultBitmapImage.CreateOptions = BitmapCreateOptions.IgnoreImageCache; |
||
759 | defaultBitmapImage.CacheOption = BitmapCacheOption.OnLoad; |
||
760 | defaultBitmapImage.UriSource = new Uri(uri); |
||
761 | defaultBitmapImage.EndInit(); |
||
762 | |||
763 | ViewerDataModel.Instance.ImageViewPath = null; |
||
764 | 548c696e | ljiyeon | GC.Collect(); |
765 | 787a4489 | KangIngu | |
766 | 548c696e | ljiyeon | Logger.sendCheckLog("pageNavigator_PageChanging_BitmapImage Downloading", 1); |
767 | 787a4489 | KangIngu | if (defaultBitmapImage.IsDownloading) |
768 | { |
||
769 | 122914ba | ljiyeon | Logger.sendCheckLog("pageNavigator_PageChanging_BitmapImage IsDownloading", 1); |
770 | 787a4489 | KangIngu | defaultBitmapImage.DownloadCompleted += (ex, arg) => |
771 | { |
||
772 | 8a9f6742 | djkim | defaultBitmapImage.Freeze(); |
773 | mainPanel.UpdateLayout(); |
||
774 | 90e7968d | ljiyeon | GC.Collect(); |
775 | 787a4489 | KangIngu | ViewerDataModel.Instance.ImageViewPath = defaultBitmapImage; |
776 | ViewerDataModel.Instance.ImageViewWidth = defaultBitmapImage.PixelWidth; |
||
777 | ViewerDataModel.Instance.ImageViewHeight = defaultBitmapImage.PixelHeight; |
||
778 | }; |
||
779 | } |
||
780 | |||
781 | zoomAndPanCanvas.Width = Convert.ToDouble(e.CurrentPage.PAGE_WIDTH); |
||
782 | zoomAndPanCanvas.Height = Convert.ToDouble(e.CurrentPage.PAGE_HEIGHT); |
||
783 | |||
784 | |||
785 | Common.ViewerDataModel.Instance.ContentWidth = zoomAndPanCanvas.Width; |
||
786 | Common.ViewerDataModel.Instance.ContentHeight = zoomAndPanCanvas.Height; |
||
787 | inkBoard.Width = zoomAndPanCanvas.Width; |
||
788 | inkBoard.Height = zoomAndPanCanvas.Height; |
||
789 | |||
790 | 90e7968d | ljiyeon | |
791 | 787a4489 | KangIngu | |
792 | if (!testPanel2.IsHidden) |
||
793 | { |
||
794 | 548c696e | ljiyeon | Logger.sendCheckLog("pageNavigator_PageChanging_!testPanel2.IsHidden 일 때", 1); |
795 | 787a4489 | KangIngu | //PDF모드일때 잠시 대기(강인구) |
796 | if (IsSyncPDFMode) |
||
797 | { |
||
798 | Get_FinalImage.Get_PdfImage get_PdfImage = new Get_FinalImage.Get_PdfImage(); |
||
799 | var pdfpath = new BitmapImage(new Uri(get_PdfImage.Run(CurrentRev.TO_VENDOR, App.ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber))); |
||
800 | |||
801 | 548c696e | ljiyeon | Logger.sendCheckLog("pageNavigator_PageChanging_pdfpath Image Downloading", 1); |
802 | 787a4489 | KangIngu | if (pdfpath.IsDownloading) |
803 | { |
||
804 | pdfpath.DownloadCompleted += (ex, arg) => |
||
805 | { |
||
806 | 548c696e | ljiyeon | Logger.sendCheckLog("pageNavigator_PageChanging_pdfpath Image DownloadCompleted", 1); |
807 | 787a4489 | KangIngu | ViewerDataModel.Instance.ImageViewPath_C = pdfpath; |
808 | ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth; |
||
809 | ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight; |
||
810 | zoomAndPanCanvas2.Width = pdfpath.PixelWidth; |
||
811 | zoomAndPanCanvas2.Height = pdfpath.PixelHeight; |
||
812 | }; |
||
813 | } |
||
814 | else |
||
815 | { |
||
816 | 548c696e | ljiyeon | Logger.sendCheckLog("pageNavigator_PageChanging_pdfpath Image Page Setting", 1); |
817 | 787a4489 | KangIngu | ViewerDataModel.Instance.ImageViewPath_C = pdfpath; |
818 | ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth; |
||
819 | ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight; |
||
820 | |||
821 | zoomAndPanCanvas2.Width = pdfpath.PixelWidth; |
||
822 | zoomAndPanCanvas2.Height = pdfpath.PixelHeight; |
||
823 | } |
||
824 | } |
||
825 | else |
||
826 | { |
||
827 | 548c696e | ljiyeon | Logger.sendCheckLog("pageNavigator_PageChanging_uri2 값 설정", 1); |
828 | a874198d | humkyung | string uri2 = ""; |
829 | a1716fa5 | KangIngu | if (userData.COMPANY != "EXT") |
830 | a874198d | humkyung | { |
831 | uri2 = String.Format(Properties.Settings.Default.mainServerImageWebPath, _ViewInfo.ProjectNO, (Convert.ToInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, BalancePoint); |
||
832 | } |
||
833 | else |
||
834 | { |
||
835 | uri2 = String.Format(Properties.Settings.Default.subServerImageWebPath, _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, BalancePoint); |
||
836 | } |
||
837 | a1716fa5 | KangIngu | |
838 | 548c696e | ljiyeon | Logger.sendCheckLog("pageNavigator_PageChanging_defaultBitmapImage_Compare BitmapImage 설정", 1); |
839 | 787a4489 | KangIngu | var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri2)); |
840 | |||
841 | 548c696e | ljiyeon | Logger.sendCheckLog("pageNavigator_PageChanging_zoomAndPanCanvas2 Page Setting", 1); |
842 | 787a4489 | KangIngu | ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare; |
843 | ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth; |
||
844 | ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight; |
||
845 | zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth; |
||
846 | zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight; |
||
847 | |||
848 | 548c696e | ljiyeon | Logger.sendCheckLog("pageNavigator_PageChanging_zoomAndPanControl ZoomTo 설정", 1); |
849 | 787a4489 | KangIngu | zoomAndPanControl.ZoomTo(new Rect |
850 | { |
||
851 | X = 0, |
||
852 | Y = 0, |
||
853 | Width = Math.Max(zoomAndPanCanvas.Width, zoomAndPanCanvas2.Width), |
||
854 | Height = Math.Max(zoomAndPanCanvas.Height, zoomAndPanCanvas2.Height), |
||
855 | }); |
||
856 | |||
857 | 548c696e | ljiyeon | Logger.sendCheckLog("pageNavigator_PageChanging_defaultBitmapImage_Compare Downloading", 1); |
858 | 787a4489 | KangIngu | if (defaultBitmapImage_Compare.IsDownloading) |
859 | { |
||
860 | defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) => |
||
861 | { |
||
862 | 548c696e | ljiyeon | Logger.sendCheckLog("pageNavigator_PageChanging_defaultBitmapImage_Compare DownloadCompleted", 1); |
863 | 787a4489 | KangIngu | ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare; |
864 | ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth; |
||
865 | ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight; |
||
866 | 90e7968d | ljiyeon | |
867 | 787a4489 | KangIngu | zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth; |
868 | zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight; |
||
869 | |||
870 | zoomAndPanControl.ZoomTo(new Rect |
||
871 | { |
||
872 | X = 0, |
||
873 | Y = 0, |
||
874 | Width = Math.Max(zoomAndPanCanvas.Width, zoomAndPanCanvas2.Width), |
||
875 | Height = Math.Max(zoomAndPanCanvas.Height, zoomAndPanCanvas2.Height), |
||
876 | }); |
||
877 | }; |
||
878 | } |
||
879 | } |
||
880 | tlSyncPageNum.Text = String.Format("Current Page : {0}", BalancePoint); |
||
881 | } |
||
882 | |||
883 | this.pageNavigator.SetNextPage(); |
||
884 | |||
885 | if (zoomAndPanCanvas2.Width.IsNaN()) |
||
886 | { |
||
887 | zoomAndPanControl.ZoomTo(new Rect { X = 0, Y = 0, Width = zoomAndPanCanvas.Width, Height = zoomAndPanCanvas.Height }); |
||
888 | } |
||
889 | 548c696e | ljiyeon | Logger.sendCheckLog("pageNavigator_PageChanging_ControlData Setting", 1); |
890 | 787a4489 | KangIngu | Common.ViewerDataModel.Instance.MarkupControls_USER.Clear(); //전체 제거 |
891 | Common.ViewerDataModel.Instance.MarkupControls.Clear(); //전체 제거 |
||
892 | |||
893 | List<MarkupInfoItem> gridSelectionItem = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); //선택 된 마크업 |
||
894 | 90e7968d | ljiyeon | |
895 | 787a4489 | KangIngu | foreach (var item in gridSelectionItem) |
896 | { |
||
897 | if (item.UserID == App.ViewInfo.UserID) |
||
898 | { |
||
899 | 6707a5c7 | ljiyeon | ViewerDataModel.Instance.current_page_commentcnt = ViewerDataModel.Instance.MarkupList_USER.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList().Count; |
900 | 787a4489 | KangIngu | ViewerDataModel.Instance.MarkupList_USER.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(delegate (MarkupItemEx markupitem) |
901 | { |
||
902 | 661b7416 | humkyung | MarkupParser.ParseEx(App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, item.DisplayColor, "", |
903 | item.MarkupInfoID, markupitem.ID); |
||
904 | 787a4489 | KangIngu | }); |
905 | 90e7968d | ljiyeon | |
906 | 787a4489 | KangIngu | } |
907 | else |
||
908 | { |
||
909 | ViewerDataModel.Instance.MarkupList_Pre.Where(data => data.PageNumber == pageNavigator.CurrentPage.PageNumber && data.MarkupInfoID == item.MarkupInfoID).ToList().ForEach(delegate (MarkupItemEx markupitem) |
||
910 | { |
||
911 | 661b7416 | humkyung | MarkupParser.ParseEx(App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls, item.DisplayColor, "", item.MarkupInfoID); |
912 | 787a4489 | KangIngu | }); |
913 | } |
||
914 | } |
||
915 | 90e7968d | ljiyeon | |
916 | 787a4489 | KangIngu | if (!testPanel2.IsHidden) |
917 | { |
||
918 | dd0ffcfb | KangIngu | ViewerDataModel.Instance.Sync_ContentOffsetX = zoomAndPanControl.ContentOffsetX; |
919 | ViewerDataModel.Instance.Sync_ContentOffsetY = zoomAndPanControl.ContentOffsetY; |
||
920 | ViewerDataModel.Instance.Sync_ContentScale = zoomAndPanControl.ContentScale; |
||
921 | |||
922 | 787a4489 | KangIngu | Common.ViewerDataModel.Instance.MarkupControls_Sync.Clear(); |
923 | List<MarkupInfoItem> gridSelectionRevItem = gridViewRevMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); |
||
924 | |||
925 | |||
926 | foreach (var item in gridSelectionRevItem) |
||
927 | { |
||
928 | item.MarkupList.Where(pageItem => pageItem.PageNumber == BalancePoint).ToList().ForEach(delegate (MarkupItem markupitem) |
||
929 | { |
||
930 | 661b7416 | humkyung | MarkupParser.ParseEx(App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync, item.DisplayColor, "", item.MarkupInfoID); |
931 | 787a4489 | KangIngu | }); |
932 | } |
||
933 | } |
||
934 | |||
935 | var instanceMain = this.ParentOfType<MainWindow>(); |
||
936 | instanceMain.dzTopMenu.tlcurrentPage.Text = e.CurrentPage.PAGE_NUMBER.ToString(); |
||
937 | 992a98b4 | KangIngu | instanceMain.dzTopMenu.tlcurrentPage_readonly.Text = e.CurrentPage.PAGE_NUMBER.ToString(); |
938 | 787a4489 | KangIngu | |
939 | instanceMain.dzTopMenu.rotateOffSet = 0; |
||
940 | var pageinfo = this.CurrentDoc.docInfo.DOCPAGE.Where(p => p.PAGE_NUMBER == e.CurrentPage.PAGE_NUMBER).FirstOrDefault(); |
||
941 | drawingPannelRotate(pageinfo.PAGE_ANGLE); |
||
942 | |||
943 | //} |
||
944 | SetCommentPages(true); |
||
945 | } |
||
946 | 90e7968d | ljiyeon | |
947 | 6707a5c7 | ljiyeon | |
948 | //Temp Control Load |
||
949 | public void TempControlLoad() |
||
950 | { |
||
951 | List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>(); |
||
952 | |||
953 | for (int k = 0; k < tempLoadData.Count; k++) |
||
954 | { |
||
955 | System.Windows.Controls.Control item = null; |
||
956 | Multi_Undo_data multi_Undo_Data; |
||
957 | 90e7968d | ljiyeon | |
958 | 6707a5c7 | ljiyeon | |
959 | switch (tempLoadData[k].IsUpdate) |
||
960 | { |
||
961 | case 0://추가 |
||
962 | var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.CommentID == tempLoadData[k].CommentID).FirstOrDefault(); |
||
963 | if (control != null) |
||
964 | { |
||
965 | ViewerDataModel.Instance.MarkupControls_USER.Remove(control); |
||
966 | var Item_ = ViewerDataModel.Instance.MarkupList_USER.Where(d => d.ID == (control as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault(); |
||
967 | ViewerDataModel.Instance.MarkupList_USER.Remove(Item_); |
||
968 | } |
||
969 | |||
970 | //Control |
||
971 | 661b7416 | humkyung | item = MarkupParser.ParseEx(App.ViewInfo.ProjectNO, tempLoadData[k].ConvertData, Common.ViewerDataModel.Instance.MarkupControls_USER, "#FFFF0000", "", tempLoadData[k].MarkupInfoID, tempLoadData[k].CommentID); |
972 | 90e7968d | ljiyeon | |
973 | 6707a5c7 | ljiyeon | UndoData = new Undo_data() |
974 | { |
||
975 | IsUndo = false, |
||
976 | Event = Event_Type.Create, |
||
977 | EventTime = DateTime.Now, |
||
978 | Opacity = ViewerDataModel.Instance.ControlOpacity, |
||
979 | Markup_List = new List<Multi_Undo_data>() |
||
980 | }; |
||
981 | |||
982 | multi_Undo_Data = new Multi_Undo_data(); |
||
983 | multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(item as MarkupToPDF.Common.CommentUserInfo); |
||
984 | UndoData.Markup_List.Add(multi_Undo_Data); |
||
985 | ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
||
986 | break; |
||
987 | case 1://수정 |
||
988 | control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.CommentID == tempLoadData[k].CommentID).FirstOrDefault(); |
||
989 | if (control != null) |
||
990 | { |
||
991 | ViewerDataModel.Instance.MarkupControls_USER.Remove(control); |
||
992 | var Item_ = ViewerDataModel.Instance.MarkupList_USER.Where(d => d.ID == (control as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault(); |
||
993 | ViewerDataModel.Instance.MarkupList_USER.Remove(Item_); |
||
994 | } |
||
995 | |||
996 | //Control |
||
997 | 661b7416 | humkyung | item = MarkupParser.ParseEx(App.ViewInfo.ProjectNO, tempLoadData[k].ConvertData, Common.ViewerDataModel.Instance.MarkupControls_USER, "#FFFF0000", "", tempLoadData[k].MarkupInfoID, tempLoadData[k].CommentID); |
998 | 6707a5c7 | ljiyeon | |
999 | UndoData = new Undo_data() |
||
1000 | { |
||
1001 | IsUndo = false, |
||
1002 | Event = Event_Type.Thumb, |
||
1003 | EventTime = DateTime.Now, |
||
1004 | Opacity = ViewerDataModel.Instance.ControlOpacity, |
||
1005 | Markup_List = new List<Multi_Undo_data>() |
||
1006 | }; |
||
1007 | |||
1008 | multi_Undo_Data = new Multi_Undo_data(); |
||
1009 | multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(item as MarkupToPDF.Common.CommentUserInfo); |
||
1010 | UndoData.Markup_List.Add(multi_Undo_Data); |
||
1011 | 90e7968d | ljiyeon | ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
1012 | 6707a5c7 | ljiyeon | break; |
1013 | case 2://삭제 |
||
1014 | |||
1015 | control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.CommentID == tempLoadData[k].CommentID).FirstOrDefault(); |
||
1016 | if (control != null) |
||
1017 | { |
||
1018 | ViewerDataModel.Instance.MarkupControls_USER.Remove(control); |
||
1019 | var Item_ = ViewerDataModel.Instance.MarkupList_USER.Where(d => d.ID == (control as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault(); |
||
1020 | 90e7968d | ljiyeon | ViewerDataModel.Instance.MarkupList_USER.Remove(Item_); |
1021 | 6707a5c7 | ljiyeon | } |
1022 | break; |
||
1023 | 90e7968d | ljiyeon | } |
1024 | } |
||
1025 | 6707a5c7 | ljiyeon | } |
1026 | 787a4489 | KangIngu | |
1027 | private void SetCommentPages(bool onlyMe = false) |
||
1028 | { |
||
1029 | 548c696e | ljiyeon | Logger.sendCheckLog("pageNavigator_PageChanging_SetCommentPages Setting", 1); |
1030 | 787a4489 | KangIngu | List<UsersCommentPagesMember> _pages = new List<UsersCommentPagesMember>(); |
1031 | foreach (var item in ViewerDataModel.Instance._markupInfoList) |
||
1032 | { |
||
1033 | UsersCommentPagesMember instance = new UsersCommentPagesMember(); |
||
1034 | instance.UserName = item.UserName; |
||
1035 | instance.Depart = item.Depatment; |
||
1036 | instance.MarkupInfoID = item.MarkupInfoID; |
||
1037 | instance.IsSelected = true; |
||
1038 | instance.isConSolidation = item.Consolidate; |
||
1039 | instance.SetColor = item.DisplayColor; |
||
1040 | if (item.UserID == App.ViewInfo.UserID && item.MarkupInfoID == item.MarkupInfoID) |
||
1041 | { |
||
1042 | instance.PageNumber = ViewerDataModel.Instance.MarkupList_USER.Select(d => d.PageNumber).ToList(); |
||
1043 | } |
||
1044 | else |
||
1045 | { |
||
1046 | instance.PageNumber = ViewerDataModel.Instance.MarkupList_Pre.Where(data => data.MarkupInfoID == item.MarkupInfoID).Select(d => d.PageNumber).ToList(); |
||
1047 | } |
||
1048 | _pages.Add(instance); |
||
1049 | } |
||
1050 | this.pageNavigator.SetCommentList(_pages.ToList()); |
||
1051 | } |
||
1052 | |||
1053 | private void zoomAndPanControl_MouseWheel(object sender, MouseWheelEventArgs e) |
||
1054 | { |
||
1055 | if (e.MiddleButton == MouseButtonState.Pressed) |
||
1056 | { |
||
1057 | |||
1058 | } |
||
1059 | e.Handled = true; |
||
1060 | if (e.Delta > 0) |
||
1061 | { |
||
1062 | Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas); |
||
1063 | ZoomIn(currentContentMousePoint); |
||
1064 | } |
||
1065 | else |
||
1066 | { |
||
1067 | Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas); |
||
1068 | ZoomOut(currentContentMousePoint); |
||
1069 | } |
||
1070 | } |
||
1071 | |||
1072 | a1716fa5 | KangIngu | private void zoomAndPanControl2_MouseWheel(object sender, MouseWheelEventArgs e) |
1073 | { |
||
1074 | e.Handled = true; |
||
1075 | if (e.Delta > 0) |
||
1076 | { |
||
1077 | Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas2); |
||
1078 | ZoomIn_Sync(currentContentMousePoint); |
||
1079 | } |
||
1080 | else |
||
1081 | { |
||
1082 | Point currentContentMousePoint = e.GetPosition(zoomAndPanCanvas2); |
||
1083 | ZoomOut_Sync(currentContentMousePoint); |
||
1084 | } |
||
1085 | } |
||
1086 | |||
1087 | 787a4489 | KangIngu | #region ZoomIn & ZoomOut |
1088 | |||
1089 | private void ZoomOut_Executed(object sender, ExecutedRoutedEventArgs e) |
||
1090 | { |
||
1091 | ZoomOut(new Point(zoomAndPanControl.ContentZoomFocusX, |
||
1092 | zoomAndPanControl.ContentZoomFocusY)); |
||
1093 | } |
||
1094 | |||
1095 | private void ZoomIn_Executed(object sender, ExecutedRoutedEventArgs e) |
||
1096 | { |
||
1097 | ZoomIn(new Point(zoomAndPanControl.ContentZoomFocusX, |
||
1098 | zoomAndPanControl.ContentZoomFocusY)); |
||
1099 | } |
||
1100 | |||
1101 | |||
1102 | //강인구 추가 (줌 인아웃 수치 변경) |
||
1103 | //큰해상도의 문서일 경우 줌 인 아웃시 사이즈 변동이 큼 |
||
1104 | private void ZoomOut(Point contentZoomCenter) |
||
1105 | { |
||
1106 | if (zoomAndPanControl.ContentScale > 0.39) |
||
1107 | { |
||
1108 | zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale - 0.2, contentZoomCenter); |
||
1109 | } |
||
1110 | else |
||
1111 | { |
||
1112 | zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale / 2, contentZoomCenter); |
||
1113 | } |
||
1114 | |||
1115 | 9cd2865b | KangIngu | if (zoomAndPanControl2 != null && Sync.IsChecked) |
1116 | 787a4489 | KangIngu | { |
1117 | 9cd2865b | KangIngu | zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl.ContentScale, contentZoomCenter); |
1118 | 787a4489 | KangIngu | } |
1119 | } |
||
1120 | |||
1121 | private void ZoomIn(Point contentZoomCenter) |
||
1122 | { |
||
1123 | if (zoomAndPanControl.ContentScale > 0.19) |
||
1124 | { |
||
1125 | zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale + 0.2, contentZoomCenter); |
||
1126 | } |
||
1127 | else |
||
1128 | { |
||
1129 | zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl.ContentScale * 2, contentZoomCenter); |
||
1130 | } |
||
1131 | |||
1132 | 9cd2865b | KangIngu | if (zoomAndPanControl2 != null && Sync.IsChecked) |
1133 | 787a4489 | KangIngu | { |
1134 | 9cd2865b | KangIngu | zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl.ContentScale, contentZoomCenter); |
1135 | 787a4489 | KangIngu | } |
1136 | a1716fa5 | KangIngu | |
1137 | } |
||
1138 | |||
1139 | private void ZoomOut_Sync(Point contentZoomCenter) |
||
1140 | { |
||
1141 | if (zoomAndPanControl2.ContentScale > 0.39) |
||
1142 | { |
||
1143 | zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale - 0.2, contentZoomCenter); |
||
1144 | } |
||
1145 | else |
||
1146 | { |
||
1147 | zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale / 2, contentZoomCenter); |
||
1148 | } |
||
1149 | |||
1150 | if (Sync.IsChecked) |
||
1151 | { |
||
1152 | zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl2.ContentScale, contentZoomCenter); |
||
1153 | } |
||
1154 | } |
||
1155 | |||
1156 | private void ZoomIn_Sync(Point contentZoomCenter) |
||
1157 | { |
||
1158 | if (zoomAndPanControl2.ContentScale > 0.19) |
||
1159 | { |
||
1160 | zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale + 0.2, contentZoomCenter); |
||
1161 | } |
||
1162 | else |
||
1163 | { |
||
1164 | zoomAndPanControl2.ZoomAboutPoint(zoomAndPanControl2.ContentScale * 2, contentZoomCenter); |
||
1165 | } |
||
1166 | |||
1167 | if (Sync.IsChecked) |
||
1168 | { |
||
1169 | zoomAndPanControl.ZoomAboutPoint(zoomAndPanControl2.ContentScale, contentZoomCenter); |
||
1170 | } |
||
1171 | 787a4489 | KangIngu | } |
1172 | |||
1173 | private void ZoomOut() |
||
1174 | { |
||
1175 | zoomAndPanControl.ContentScale -= 0.1; |
||
1176 | //if (zoomAndPanControl2 != null) |
||
1177 | //{ |
||
1178 | // zoomAndPanControl2.ContentScale -= 0.1; |
||
1179 | //} |
||
1180 | } |
||
1181 | |||
1182 | private void ZoomIn() |
||
1183 | { |
||
1184 | zoomAndPanControl.ContentScale += 0.1; |
||
1185 | //if (zoomAndPanControl2 != null) |
||
1186 | //{ |
||
1187 | // zoomAndPanControl2.ContentScale += 0.1; |
||
1188 | //} |
||
1189 | } |
||
1190 | |||
1191 | #endregion |
||
1192 | |||
1193 | private void init() |
||
1194 | { |
||
1195 | foreach (var item in ViewerDataModel.Instance.MarkupControls) |
||
1196 | { |
||
1197 | |||
1198 | ControlList.Clear(); |
||
1199 | listBox.Items.Clear(); |
||
1200 | selected_item.Clear(); |
||
1201 | |||
1202 | (item as IMarkupCommonData).IsSelected = false; |
||
1203 | } |
||
1204 | |||
1205 | } |
||
1206 | |||
1207 | private HitTestResultBehavior MyCallback(HitTestResult result) |
||
1208 | { |
||
1209 | //this.cursor = Cursors.UpArrow; |
||
1210 | var element = result.VisualHit; |
||
1211 | while (element != null && !(element is CommentUserInfo)) |
||
1212 | element = VisualTreeHelper.GetParent(element); |
||
1213 | |||
1214 | if (element == null) |
||
1215 | { |
||
1216 | return HitTestResultBehavior.Stop; |
||
1217 | } |
||
1218 | else |
||
1219 | { |
||
1220 | if (element is CommentUserInfo) |
||
1221 | { |
||
1222 | if (!hitList.Contains(element)) |
||
1223 | { |
||
1224 | hitList.Add((CommentUserInfo)element); |
||
1225 | } |
||
1226 | else |
||
1227 | { |
||
1228 | return HitTestResultBehavior.Stop; |
||
1229 | } |
||
1230 | //IntersectionDetail intersectionDetail = |
||
1231 | //((GeometryHitTestResult)result).IntersectionDetail; |
||
1232 | //switch (intersectionDetail) |
||
1233 | //{ |
||
1234 | // case IntersectionDetail.FullyContains: |
||
1235 | // // Add the hit test result to the list: |
||
1236 | // hitList.Add((CommentUserInfo)result.VisualHit); |
||
1237 | // return HitTestResultBehavior.Continue; |
||
1238 | // case IntersectionDetail.Intersects: |
||
1239 | // // Set the behavior to return visuals at all z-order levels: |
||
1240 | // return HitTestResultBehavior.Continue; |
||
1241 | // case IntersectionDetail.FullyInside: |
||
1242 | // // Set the behavior to return visuals at all z-order levels: |
||
1243 | // return HitTestResultBehavior.Continue; |
||
1244 | // default: |
||
1245 | // return HitTestResultBehavior.Stop; |
||
1246 | //} |
||
1247 | } |
||
1248 | } |
||
1249 | return HitTestResultBehavior.Continue; |
||
1250 | } |
||
1251 | |||
1252 | public void ReleaseSelectPath() |
||
1253 | { |
||
1254 | if (SelectionPath == null) |
||
1255 | { |
||
1256 | SelectionPath = new Path(); |
||
1257 | SelectionPath.Name = ""; |
||
1258 | } |
||
1259 | if (SelectionPath.Name != "") |
||
1260 | { |
||
1261 | SelectionPath.Name = "None"; |
||
1262 | } |
||
1263 | SelectionPath.Opacity = 0.01; |
||
1264 | SelectionPath.RenderTransform = null; |
||
1265 | SelectionPath.RenderTransformOrigin = new Point(0, 0); |
||
1266 | } |
||
1267 | |||
1268 | #region 컨트롤 초기화 |
||
1269 | public void Control_Init(object control) |
||
1270 | { |
||
1271 | if (L_Size != 0 && (control as IPath) != null) |
||
1272 | { |
||
1273 | (control as IPath).LineSize = L_Size; |
||
1274 | L_Size = 0; |
||
1275 | } |
||
1276 | |||
1277 | switch (control.GetType().Name) |
||
1278 | { |
||
1279 | case "RectangleControl": |
||
1280 | { |
||
1281 | (control as RectangleControl).StrokeColor = Brushes.Red; |
||
1282 | } |
||
1283 | break; |
||
1284 | case "CircleControl": |
||
1285 | { |
||
1286 | (control as CircleControl).StrokeColor = Brushes.Red; |
||
1287 | } |
||
1288 | break; |
||
1289 | case "TriControl": |
||
1290 | { |
||
1291 | (control as TriControl).StrokeColor = Brushes.Red; |
||
1292 | } |
||
1293 | break; |
||
1294 | case "RectCloudControl": |
||
1295 | { |
||
1296 | (control as RectCloudControl).StrokeColor = Brushes.Red; |
||
1297 | } |
||
1298 | break; |
||
1299 | case "CloudControl": |
||
1300 | { |
||
1301 | (control as CloudControl).StrokeColor = Brushes.Red; |
||
1302 | } |
||
1303 | break; |
||
1304 | case "PolygonControl": |
||
1305 | { |
||
1306 | (control as PolygonControl).StrokeColor = Brushes.Red; |
||
1307 | } |
||
1308 | break; |
||
1309 | case "ArcControl": |
||
1310 | { |
||
1311 | (control as ArcControl).StrokeColor = Brushes.Red; |
||
1312 | } |
||
1313 | break; |
||
1314 | 40b3ce25 | ljiyeon | case "ArrowArcControl": |
1315 | { |
||
1316 | (control as ArrowArcControl).StrokeColor = Brushes.Red; |
||
1317 | } |
||
1318 | break; |
||
1319 | 787a4489 | KangIngu | case "LineControl": |
1320 | { |
||
1321 | (control as LineControl).StrokeColor = Brushes.Red; |
||
1322 | } |
||
1323 | break; |
||
1324 | case "ArrowControl_Multi": |
||
1325 | { |
||
1326 | (control as ArrowControl_Multi).StrokeColor = Brushes.Red; |
||
1327 | } |
||
1328 | break; |
||
1329 | case "TextControl": |
||
1330 | { |
||
1331 | (control as TextControl).BackInnerColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.White.R, Colors.White.G, Colors.White.B)); |
||
1332 | } |
||
1333 | break; |
||
1334 | case "ArrowTextControl": |
||
1335 | { |
||
1336 | (control as ArrowTextControl).BackInnerColor = new SolidColorBrush(Color.FromArgb(Convert.ToByte(255 * 0.6), Colors.White.R, Colors.White.G, Colors.White.B)); |
||
1337 | } |
||
1338 | break; |
||
1339 | 684ef11c | ljiyeon | case "InsideWhiteControl": |
1340 | { |
||
1341 | (control as InsideWhiteControl).StrokeColor = Brushes.White; |
||
1342 | } |
||
1343 | break; |
||
1344 | case "OverlapWhiteControl": |
||
1345 | { |
||
1346 | (control as OverlapWhiteControl).StrokeColor = Brushes.White; |
||
1347 | } |
||
1348 | break; |
||
1349 | case "ClipWhiteControl": |
||
1350 | { |
||
1351 | (control as ClipWhiteControl).StrokeColor = Brushes.White; |
||
1352 | } |
||
1353 | break; |
||
1354 | case "CoordinateControl": |
||
1355 | { |
||
1356 | (control as CoordinateControl).StrokeColor = Brushes.Black; |
||
1357 | } |
||
1358 | break; |
||
1359 | 787a4489 | KangIngu | } |
1360 | } |
||
1361 | #endregion |
||
1362 | |||
1363 | public void firstCondition_MouseLeave(object sender, MouseEventArgs e) |
||
1364 | { |
||
1365 | //Control_Init(e.Source); |
||
1366 | } |
||
1367 | 53880c83 | ljiyeon | private Window _dragdropWindow = null; |
1368 | |||
1369 | [DllImport("user32.dll")] |
||
1370 | [return: MarshalAs(UnmanagedType.Bool)] |
||
1371 | internal static extern bool GetCursorPos(ref Win32Point pt); |
||
1372 | |||
1373 | [StructLayout(LayoutKind.Sequential)] |
||
1374 | internal struct Win32Point |
||
1375 | { |
||
1376 | public Int32 X; |
||
1377 | public Int32 Y; |
||
1378 | }; |
||
1379 | public string symbol_id = null; |
||
1380 | public long symbol_group_id; |
||
1381 | public int symbol_SelectedIndex; |
||
1382 | public ImageSource symbol_img; |
||
1383 | public string symbol_Data = null; |
||
1384 | public void symboldata(string id, long group_id, int SelectedIndex, string Data_, ImageSource img) |
||
1385 | { |
||
1386 | if (this._dragdropWindow != null) |
||
1387 | { |
||
1388 | this._dragdropWindow.Close(); |
||
1389 | this._dragdropWindow = null; |
||
1390 | } |
||
1391 | |||
1392 | symbol_id = id; |
||
1393 | symbol_group_id = group_id; |
||
1394 | symbol_SelectedIndex = SelectedIndex; |
||
1395 | symbol_Data = Data_; |
||
1396 | symbol_img = img; |
||
1397 | |||
1398 | |||
1399 | CreateDragDropWindow2(img); |
||
1400 | } |
||
1401 | |||
1402 | private void CreateDragDropWindow2(ImageSource image) |
||
1403 | { |
||
1404 | this._dragdropWindow = new Window(); |
||
1405 | _dragdropWindow.Cursor = new Cursor(MainWindow.CursorChange().StreamSource); |
||
1406 | _dragdropWindow.WindowStyle = WindowStyle.None; |
||
1407 | _dragdropWindow.AllowsTransparency = true; |
||
1408 | _dragdropWindow.AllowDrop = false; |
||
1409 | _dragdropWindow.Background = null; |
||
1410 | _dragdropWindow.IsHitTestVisible = false; |
||
1411 | _dragdropWindow.SizeToContent = SizeToContent.WidthAndHeight; |
||
1412 | _dragdropWindow.Topmost = true; |
||
1413 | _dragdropWindow.ShowInTaskbar = false; |
||
1414 | |||
1415 | Rectangle r = new Rectangle(); |
||
1416 | r.Width = image.Width; |
||
1417 | r.Height = image.Height; |
||
1418 | r.Opacity = 0.5; |
||
1419 | r.Fill = new ImageBrush(image); |
||
1420 | this._dragdropWindow.Content = r; |
||
1421 | |||
1422 | Win32Point w32Mouse = new Win32Point(); |
||
1423 | GetCursorPos(ref w32Mouse); |
||
1424 | |||
1425 | //w32Mouse.X = getCurrentPoint.X; |
||
1426 | this._dragdropWindow.Left = w32Mouse.X - (image.Width / 2); |
||
1427 | this._dragdropWindow.Top = w32Mouse.Y - (image.Height / 2); |
||
1428 | this._dragdropWindow.Show(); |
||
1429 | } |
||
1430 | 787a4489 | KangIngu | |
1431 | private void zoomAndPanControl_MouseMove(object sender, MouseEventArgs e) |
||
1432 | { |
||
1433 | if (Common.ViewerDataModel.Instance.SelectedControl == "Batch") |
||
1434 | { |
||
1435 | if (!floatingTip.IsOpen) { floatingTip.IsOpen = true; } |
||
1436 | |||
1437 | Point currentPos = e.GetPosition(rect); |
||
1438 | d71ee575 | djkim | |
1439 | 787a4489 | KangIngu | floatingTip.HorizontalOffset = currentPos.X + 20; |
1440 | floatingTip.VerticalOffset = currentPos.Y; |
||
1441 | |||
1442 | |||
1443 | //ToolTip tool = new System.Windows.Controls.ToolTip(); |
||
1444 | //tool.Content = "ToolTip"; |
||
1445 | //panel.ToolTip = tool; |
||
1446 | } |
||
1447 | |||
1448 | if (mouseHandlingMode != MouseHandlingMode.Drawing) |
||
1449 | { |
||
1450 | #region 마우스 오버 시 색상 변경 |
||
1451 | //var firstCondition = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseOver).FirstOrDefault(); |
||
1452 | //Color TempColor = MarkupToPDF.Controls.Common.ValueConverter.StringToColorConverter.Parse("FF07B4FF"); |
||
1453 | |||
1454 | //if (firstCondition != null) |
||
1455 | //{ |
||
1456 | // firstCondition.MouseLeave += new System.Windows.Input.MouseEventHandler(firstCondition_MouseLeave); |
||
1457 | |||
1458 | // if (firstCondition.GetType().Name == "TextControl") |
||
1459 | // { |
||
1460 | // (firstCondition as TextControl).BackInnerColor = new SolidColorBrush(TempColor); |
||
1461 | // return; |
||
1462 | // } |
||
1463 | // else if (firstCondition.GetType().Name == "ArrowTextControl") |
||
1464 | // { |
||
1465 | // (firstCondition as ArrowTextControl).BackInnerColor = new SolidColorBrush(TempColor); |
||
1466 | // return; |
||
1467 | // } |
||
1468 | |||
1469 | // if (L_Size == 0) |
||
1470 | // { |
||
1471 | // L_Size = (firstCondition as IPath).LineSize; |
||
1472 | // (firstCondition as IPath).LineSize *= 4; |
||
1473 | // } |
||
1474 | // switch (firstCondition.GetType().Name) |
||
1475 | // { |
||
1476 | // case "RectangleControl": |
||
1477 | // { |
||
1478 | // (firstCondition as RectangleControl).StrokeColor = new SolidColorBrush(TempColor); |
||
1479 | // } |
||
1480 | // break; |
||
1481 | // case "CircleControl": |
||
1482 | // { |
||
1483 | // (firstCondition as CircleControl).StrokeColor = new SolidColorBrush(TempColor); |
||
1484 | // } |
||
1485 | // break; |
||
1486 | // case "TriControl": |
||
1487 | // { |
||
1488 | // (firstCondition as TriControl).StrokeColor = new SolidColorBrush(TempColor); |
||
1489 | // } |
||
1490 | // break; |
||
1491 | // case "RectCloudControl": |
||
1492 | // { |
||
1493 | // (firstCondition as RectCloudControl).StrokeColor = new SolidColorBrush(TempColor); |
||
1494 | // } |
||
1495 | // break; |
||
1496 | // case "CloudControl": |
||
1497 | // { |
||
1498 | // (firstCondition as CloudControl).StrokeColor = new SolidColorBrush(TempColor); |
||
1499 | // } |
||
1500 | // break; |
||
1501 | // case "PolygonControl": |
||
1502 | // { |
||
1503 | // (firstCondition as PolygonControl).StrokeColor = new SolidColorBrush(TempColor); |
||
1504 | // } |
||
1505 | // break; |
||
1506 | // case "ArcControl": |
||
1507 | // { |
||
1508 | // (firstCondition as ArcControl).StrokeColor = new SolidColorBrush(TempColor); |
||
1509 | // } |
||
1510 | // break; |
||
1511 | // case "LineControl": |
||
1512 | // { |
||
1513 | // (firstCondition as LineControl).StrokeColor = new SolidColorBrush(TempColor); |
||
1514 | // } |
||
1515 | // break; |
||
1516 | // case "ArrowControl_Multi": |
||
1517 | // { |
||
1518 | // (firstCondition as ArrowControl_Multi).StrokeColor = new SolidColorBrush(TempColor); |
||
1519 | // } |
||
1520 | // break; |
||
1521 | |||
1522 | // default: |
||
1523 | // { |
||
1524 | |||
1525 | // } |
||
1526 | // break; |
||
1527 | // } |
||
1528 | //} |
||
1529 | #endregion |
||
1530 | } |
||
1531 | |||
1532 | getCurrentPoint = e.GetPosition(drawingRotateCanvas); |
||
1533 | 53880c83 | ljiyeon | #region 주석 |
1534 | 992a98b4 | KangIngu | //if (mouseButtonDown == MouseButton.Middle) |
1535 | //{ |
||
1536 | // SetCursor(); |
||
1537 | // Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas); |
||
1538 | // Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas); |
||
1539 | 9f473fb7 | KangIngu | |
1540 | 992a98b4 | KangIngu | // Vector dragOffset = currentCanvasZoomPanningMouseMovePoint - canvasZoommovingMouseDownPoint; |
1541 | // zoomAndPanControl.ContentOffsetX -= dragOffset.X; |
||
1542 | // zoomAndPanControl.ContentOffsetY -= dragOffset.Y; |
||
1543 | 9f473fb7 | KangIngu | |
1544 | 992a98b4 | KangIngu | // //SetCursor(); |
1545 | // //Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas); |
||
1546 | // //Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas); |
||
1547 | 787a4489 | KangIngu | |
1548 | 992a98b4 | KangIngu | // //Vector dragOffset = currentCanvasZoomPanningMouseMovePoint - canvasZoommovingMouseDownPoint; |
1549 | 787a4489 | KangIngu | |
1550 | 992a98b4 | KangIngu | // //zoomAndPanControl.ContentOffsetX += 1; |
1551 | // //zoomAndPanControl.ContentOffsetY += 1; |
||
1552 | 787a4489 | KangIngu | |
1553 | 992a98b4 | KangIngu | // //zoomAndPanControl.ContentOffsetX += dragOffset.X; |
1554 | // //zoomAndPanControl.ContentOffsetY += dragOffset.Y; |
||
1555 | //} |
||
1556 | 53880c83 | ljiyeon | #endregion |
1557 | |||
1558 | 992a98b4 | KangIngu | if ((mouseButtonDown == MouseButton.Middle) || (mouseButtonDown == MouseButton.Right)) |
1559 | 787a4489 | KangIngu | { |
1560 | e54660e8 | KangIngu | SetCursor(); |
1561 | 787a4489 | KangIngu | Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas); |
1562 | Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas); |
||
1563 | |||
1564 | Vector dragOffset = currentCanvasZoomPanningMouseMovePoint - canvasZoommovingMouseDownPoint; |
||
1565 | zoomAndPanControl.ContentOffsetX -= dragOffset.X; |
||
1566 | zoomAndPanControl.ContentOffsetY -= dragOffset.Y; |
||
1567 | 9cd2865b | KangIngu | |
1568 | a1716fa5 | KangIngu | if (Sync.IsChecked) |
1569 | 9cd2865b | KangIngu | { |
1570 | ViewerDataModel.Instance.Sync_ContentOffsetX = zoomAndPanControl.ContentOffsetX; |
||
1571 | ViewerDataModel.Instance.Sync_ContentOffsetY = zoomAndPanControl.ContentOffsetY; |
||
1572 | } |
||
1573 | 787a4489 | KangIngu | } |
1574 | 992a98b4 | KangIngu | |
1575 | if (mouseHandlingMode == MouseHandlingMode.Drawing && mouseButtonDown == MouseButton.Left) |
||
1576 | 787a4489 | KangIngu | { |
1577 | Point currentCanvasDrawingMouseMovePoint = e.GetPosition(drawingRotateCanvas); |
||
1578 | Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanCanvas); |
||
1579 | SetCursor(); |
||
1580 | |||
1581 | if (IsDrawing) |
||
1582 | { |
||
1583 | if (currentControl == null) |
||
1584 | { |
||
1585 | switch (controlType) |
||
1586 | { |
||
1587 | case ControlType.PenControl: |
||
1588 | { |
||
1589 | if (inkBoard.Tag.ToString() == "Ink") |
||
1590 | { |
||
1591 | stroke.StylusPoints.Add(new StylusPoint(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y)); |
||
1592 | } |
||
1593 | else if (inkBoard.Tag.ToString() == "EraseByPoint") |
||
1594 | { |
||
1595 | RemovePointStroke(currentCanvasDrawingMouseMovePoint); |
||
1596 | } |
||
1597 | else if (inkBoard.Tag.ToString() == "EraseByStroke") |
||
1598 | { |
||
1599 | RemoveLineStroke(currentCanvasDrawingMouseMovePoint); |
||
1600 | } |
||
1601 | |||
1602 | //inkBoard.Strokes.Add(stroke); |
||
1603 | } |
||
1604 | break; |
||
1605 | } |
||
1606 | return; |
||
1607 | } |
||
1608 | } |
||
1609 | |||
1610 | if (currentControl != null) |
||
1611 | { |
||
1612 | double moveX = currentCanvasDrawingMouseMovePoint.X - canvasDrawingMouseDownPoint.X; |
||
1613 | double moveY = currentCanvasDrawingMouseMovePoint.Y - canvasDrawingMouseDownPoint.Y; |
||
1614 | //강인구 추가 |
||
1615 | currentControl.Opacity = ViewerDataModel.Instance.ControlOpacity; |
||
1616 | |||
1617 | if ((currentControl as IPath) != null) |
||
1618 | { |
||
1619 | (currentControl as IPath).LineSize = ViewerDataModel.Instance.LineSize; |
||
1620 | } |
||
1621 | 5ce56a3a | KangIngu | if ((currentControl as LineControl) != null) |
1622 | { |
||
1623 | (currentControl as LineControl).Interval = ViewerDataModel.Instance.Interval; |
||
1624 | } |
||
1625 | |||
1626 | 787a4489 | KangIngu | if ((currentControl as IShapeControl) != null) |
1627 | { |
||
1628 | (currentControl as IShapeControl).Paint = ViewerDataModel.Instance.paintSet; |
||
1629 | } |
||
1630 | if ((currentControl as TextControl) != null) |
||
1631 | { |
||
1632 | if (this.ParentOfType<MainWindow>().dzTopMenu.btnItalic.IsChecked == true) |
||
1633 | { |
||
1634 | (currentControl as TextControl).TextStyle = FontStyles.Italic; |
||
1635 | } |
||
1636 | if (this.ParentOfType<MainWindow>().dzTopMenu.btnBold.IsChecked == true) |
||
1637 | { |
||
1638 | d4b0c723 | KangIngu | (currentControl as TextControl).TextWeight = FontWeights.Bold; |
1639 | 787a4489 | KangIngu | } |
1640 | if (this.ParentOfType<MainWindow>().dzTopMenu.btnUnderLine.IsChecked == true) |
||
1641 | { |
||
1642 | (currentControl as TextControl).UnderLine = TextDecorations.Underline; |
||
1643 | } |
||
1644 | } |
||
1645 | else if ((currentControl as ArrowTextControl) != null) |
||
1646 | { |
||
1647 | if (this.ParentOfType<MainWindow>().dzTopMenu.btnItalic.IsChecked == true) |
||
1648 | { |
||
1649 | (currentControl as ArrowTextControl).TextStyle = FontStyles.Italic; |
||
1650 | } |
||
1651 | if (this.ParentOfType<MainWindow>().dzTopMenu.btnBold.IsChecked == true) |
||
1652 | { |
||
1653 | d4b0c723 | KangIngu | (currentControl as ArrowTextControl).TextWeight = FontWeights.Bold; |
1654 | 787a4489 | KangIngu | } |
1655 | if (this.ParentOfType<MainWindow>().dzTopMenu.btnUnderLine.IsChecked == true) |
||
1656 | { |
||
1657 | (currentControl as ArrowTextControl).UnderLine = TextDecorations.Underline; |
||
1658 | } |
||
1659 | } |
||
1660 | 9f473fb7 | KangIngu | else if ((currentControl as RectCloudControl) != null) |
1661 | { |
||
1662 | (currentControl as RectCloudControl).ArcLength = ViewerDataModel.Instance.ArcLength; |
||
1663 | } |
||
1664 | else if ((currentControl as CloudControl) != null) |
||
1665 | { |
||
1666 | (currentControl as CloudControl).ArcLength = ViewerDataModel.Instance.ArcLength; |
||
1667 | } |
||
1668 | 787a4489 | KangIngu | |
1669 | switch (controlType) |
||
1670 | { |
||
1671 | 684ef11c | ljiyeon | case (ControlType.Coordinate): |
1672 | { |
||
1673 | var control = currentControl as CoordinateControl; |
||
1674 | |||
1675 | if (control != null) |
||
1676 | { |
||
1677 | if (move.mousemode == MouseMode.Drawing) |
||
1678 | { |
||
1679 | //move.control_Move(ControlList, true, moveX, moveY); |
||
1680 | } |
||
1681 | else |
||
1682 | { |
||
1683 | control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y); |
||
1684 | control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
1685 | control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y); |
||
1686 | control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
1687 | |||
1688 | |||
1689 | if (ViewerDataModel.Instance.IsPressShift) |
||
1690 | { |
||
1691 | Point setpoint = GetSquareEndPoint(control.StartPoint, control.EndPoint); |
||
1692 | control.LeftBottomPoint = new Point(control.LeftBottomPoint.X, setpoint.Y); |
||
1693 | control.TopRightPoint = new Point(setpoint.X, control.TopRightPoint.Y); |
||
1694 | control.EndPoint = new Point(setpoint.X, setpoint.Y); |
||
1695 | } |
||
1696 | |||
1697 | control.PointSet = new List<Point> |
||
1698 | { |
||
1699 | control.StartPoint, |
||
1700 | control.LeftBottomPoint, |
||
1701 | control.EndPoint, |
||
1702 | control.TopRightPoint, |
||
1703 | }; |
||
1704 | control.updateControl(); |
||
1705 | } |
||
1706 | |||
1707 | //강인구 추가 |
||
1708 | control.ControlType = controlType; |
||
1709 | control.DashSize = ViewerDataModel.Instance.DashSize; |
||
1710 | control.Paint = ViewerDataModel.Instance.paintSet; |
||
1711 | // control.Paint = PaintSet.Fill; |
||
1712 | } |
||
1713 | } |
||
1714 | break; |
||
1715 | case (ControlType.InsideWhite): |
||
1716 | { |
||
1717 | var control = currentControl as InsideWhiteControl; |
||
1718 | |||
1719 | if (control != null) |
||
1720 | { |
||
1721 | if (move.mousemode == MouseMode.Drawing) |
||
1722 | { |
||
1723 | //move.control_Move(ControlList, true, moveX, moveY); |
||
1724 | } |
||
1725 | else |
||
1726 | { |
||
1727 | control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y); |
||
1728 | control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
1729 | control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y); |
||
1730 | control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
1731 | |||
1732 | |||
1733 | if (ViewerDataModel.Instance.IsPressShift) |
||
1734 | { |
||
1735 | Point setpoint = GetSquareEndPoint(control.StartPoint, control.EndPoint); |
||
1736 | control.LeftBottomPoint = new Point(control.LeftBottomPoint.X, setpoint.Y); |
||
1737 | control.TopRightPoint = new Point(setpoint.X, control.TopRightPoint.Y); |
||
1738 | control.EndPoint = new Point(setpoint.X, setpoint.Y); |
||
1739 | } |
||
1740 | |||
1741 | control.PointSet = new List<Point> |
||
1742 | { |
||
1743 | control.StartPoint, |
||
1744 | control.LeftBottomPoint, |
||
1745 | control.EndPoint, |
||
1746 | control.TopRightPoint, |
||
1747 | }; |
||
1748 | control.updateControl(); |
||
1749 | } |
||
1750 | |||
1751 | //강인구 추가 |
||
1752 | control.ControlType = controlType; |
||
1753 | control.DashSize = ViewerDataModel.Instance.DashSize; |
||
1754 | control.Paint = ViewerDataModel.Instance.paintSet; |
||
1755 | control.Paint = PaintSet.Fill; |
||
1756 | } |
||
1757 | } |
||
1758 | break; |
||
1759 | case (ControlType.OverlapWhite): |
||
1760 | { |
||
1761 | var control = currentControl as OverlapWhiteControl; |
||
1762 | |||
1763 | if (control != null) |
||
1764 | { |
||
1765 | if (move.mousemode == MouseMode.Drawing) |
||
1766 | { |
||
1767 | //move.control_Move(ControlList, true, moveX, moveY); |
||
1768 | } |
||
1769 | else |
||
1770 | { |
||
1771 | control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y); |
||
1772 | control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
1773 | control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y); |
||
1774 | control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
1775 | |||
1776 | |||
1777 | if (ViewerDataModel.Instance.IsPressShift) |
||
1778 | { |
||
1779 | Point setpoint = GetSquareEndPoint(control.StartPoint, control.EndPoint); |
||
1780 | control.LeftBottomPoint = new Point(control.LeftBottomPoint.X, setpoint.Y); |
||
1781 | control.TopRightPoint = new Point(setpoint.X, control.TopRightPoint.Y); |
||
1782 | control.EndPoint = new Point(setpoint.X, setpoint.Y); |
||
1783 | } |
||
1784 | |||
1785 | control.PointSet = new List<Point> |
||
1786 | { |
||
1787 | control.StartPoint, |
||
1788 | control.LeftBottomPoint, |
||
1789 | control.EndPoint, |
||
1790 | control.TopRightPoint, |
||
1791 | }; |
||
1792 | control.updateControl(); |
||
1793 | } |
||
1794 | |||
1795 | //강인구 추가 |
||
1796 | control.ControlType = controlType; |
||
1797 | control.DashSize = ViewerDataModel.Instance.DashSize; |
||
1798 | control.Paint = ViewerDataModel.Instance.paintSet; |
||
1799 | control.Paint = PaintSet.Fill; |
||
1800 | } |
||
1801 | } |
||
1802 | break; |
||
1803 | case (ControlType.ClipWhite): |
||
1804 | { |
||
1805 | var control = currentControl as ClipWhiteControl; |
||
1806 | |||
1807 | if (control != null) |
||
1808 | { |
||
1809 | if (move.mousemode == MouseMode.Drawing) |
||
1810 | { |
||
1811 | //move.control_Move(ControlList, true, moveX, moveY); |
||
1812 | } |
||
1813 | else |
||
1814 | { |
||
1815 | control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y); |
||
1816 | control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
1817 | control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y); |
||
1818 | control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
1819 | |||
1820 | |||
1821 | if (ViewerDataModel.Instance.IsPressShift) |
||
1822 | { |
||
1823 | Point setpoint = GetSquareEndPoint(control.StartPoint, control.EndPoint); |
||
1824 | control.LeftBottomPoint = new Point(control.LeftBottomPoint.X, setpoint.Y); |
||
1825 | control.TopRightPoint = new Point(setpoint.X, control.TopRightPoint.Y); |
||
1826 | control.EndPoint = new Point(setpoint.X, setpoint.Y); |
||
1827 | } |
||
1828 | |||
1829 | control.PointSet = new List<Point> |
||
1830 | { |
||
1831 | control.StartPoint, |
||
1832 | control.LeftBottomPoint, |
||
1833 | control.EndPoint, |
||
1834 | control.TopRightPoint, |
||
1835 | }; |
||
1836 | control.updateControl(); |
||
1837 | } |
||
1838 | |||
1839 | //강인구 추가 |
||
1840 | control.ControlType = controlType; |
||
1841 | control.DashSize = ViewerDataModel.Instance.DashSize; |
||
1842 | control.Paint = ViewerDataModel.Instance.paintSet; |
||
1843 | control.Paint = PaintSet.Fill; |
||
1844 | } |
||
1845 | } |
||
1846 | break; |
||
1847 | 787a4489 | KangIngu | case ControlType.Rectangle: |
1848 | { |
||
1849 | var control = currentControl as RectangleControl; |
||
1850 | |||
1851 | if (control != null) |
||
1852 | { |
||
1853 | if (move.mousemode == MouseMode.Drawing) |
||
1854 | { |
||
1855 | //move.control_Move(ControlList, true, moveX, moveY); |
||
1856 | } |
||
1857 | else |
||
1858 | { |
||
1859 | 17a22987 | KangIngu | control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y); |
1860 | control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
1861 | control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y); |
||
1862 | control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
1863 | 787a4489 | KangIngu | |
1864 | |||
1865 | 17a22987 | KangIngu | if (ViewerDataModel.Instance.IsPressShift) |
1866 | { |
||
1867 | 4318fdeb | KangIngu | Point setpoint = GetSquareEndPoint(control.StartPoint, control.EndPoint); |
1868 | 17a22987 | KangIngu | control.LeftBottomPoint = new Point(control.LeftBottomPoint.X, setpoint.Y); |
1869 | control.TopRightPoint = new Point(setpoint.X, control.TopRightPoint.Y); |
||
1870 | control.EndPoint = new Point(setpoint.X, setpoint.Y); |
||
1871 | } |
||
1872 | e54660e8 | KangIngu | |
1873 | 787a4489 | KangIngu | control.PointSet = new List<Point> |
1874 | { |
||
1875 | 17a22987 | KangIngu | control.StartPoint, |
1876 | control.LeftBottomPoint, |
||
1877 | control.EndPoint, |
||
1878 | control.TopRightPoint, |
||
1879 | 787a4489 | KangIngu | }; |
1880 | control.updateControl(); |
||
1881 | } |
||
1882 | |||
1883 | //강인구 추가 |
||
1884 | control.ControlType = controlType; |
||
1885 | control.DashSize = ViewerDataModel.Instance.DashSize; |
||
1886 | control.Paint = ViewerDataModel.Instance.paintSet; |
||
1887 | } |
||
1888 | } |
||
1889 | break; |
||
1890 | |||
1891 | case ControlType.RectCloud: |
||
1892 | { |
||
1893 | var control = currentControl as RectCloudControl; |
||
1894 | |||
1895 | if (control != null) |
||
1896 | { |
||
1897 | if (move.mousemode == MouseMode.Drawing) |
||
1898 | { |
||
1899 | //move.control_Move(ControlList, true, moveX, moveY); |
||
1900 | } |
||
1901 | else |
||
1902 | { |
||
1903 | control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y); |
||
1904 | control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
1905 | control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y); |
||
1906 | control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
1907 | |||
1908 | 17a22987 | KangIngu | if (ViewerDataModel.Instance.IsPressShift) |
1909 | { |
||
1910 | 4318fdeb | KangIngu | Point setpoint = GetSquareEndPoint(control.StartPoint, control.EndPoint); |
1911 | 17a22987 | KangIngu | control.LeftBottomPoint = new Point(control.LeftBottomPoint.X, setpoint.Y); |
1912 | control.TopRightPoint = new Point(setpoint.X, control.TopRightPoint.Y); |
||
1913 | control.EndPoint = new Point(setpoint.X, setpoint.Y); |
||
1914 | } |
||
1915 | |||
1916 | 787a4489 | KangIngu | control.PointSet = new List<Point> |
1917 | { |
||
1918 | control.StartPoint, |
||
1919 | control.LeftBottomPoint, |
||
1920 | control.EndPoint, |
||
1921 | control.TopRightPoint, |
||
1922 | }; |
||
1923 | } |
||
1924 | d71ee575 | djkim | |
1925 | 787a4489 | KangIngu | control.DashSize = ViewerDataModel.Instance.DashSize; |
1926 | control.Paint = ViewerDataModel.Instance.paintSet; |
||
1927 | } |
||
1928 | } |
||
1929 | break; |
||
1930 | |||
1931 | case ControlType.SingleLine: |
||
1932 | { |
||
1933 | d71ee575 | djkim | var control = currentControl as LineControl; |
1934 | if (control != null) |
||
1935 | 787a4489 | KangIngu | { |
1936 | control.LineStyleSet = LineStyleSet.SingleLine; |
||
1937 | control.ControlType = controlType; |
||
1938 | d71ee575 | djkim | control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y); |
1939 | control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
1940 | Point tempPoint = control.EndPoint; |
||
1941 | 5ce56a3a | KangIngu | |
1942 | d71ee575 | djkim | if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift) |
1943 | { |
||
1944 | //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
||
1945 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
||
1946 | control.EndPoint = tempPoint; |
||
1947 | } |
||
1948 | else |
||
1949 | { |
||
1950 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false); |
||
1951 | } |
||
1952 | 5ce56a3a | KangIngu | |
1953 | d71ee575 | djkim | control.PointSet = new List<Point> |
1954 | 5ce56a3a | KangIngu | { |
1955 | control.StartPoint, |
||
1956 | control.EndPoint, |
||
1957 | }; |
||
1958 | d71ee575 | djkim | |
1959 | control.DashSize = ViewerDataModel.Instance.DashSize; |
||
1960 | 787a4489 | KangIngu | } |
1961 | |||
1962 | } |
||
1963 | break; |
||
1964 | |||
1965 | case ControlType.CancelLine: |
||
1966 | { |
||
1967 | d71ee575 | djkim | var control = currentControl as LineControl; |
1968 | if (control != null) |
||
1969 | 787a4489 | KangIngu | { |
1970 | control.LineStyleSet = LineStyleSet.CancelLine; |
||
1971 | //control.LineStyle = LineControl.LineStyleSet.MultiLine; |
||
1972 | control.ControlType = controlType; |
||
1973 | d71ee575 | djkim | control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y); |
1974 | control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
1975 | Point tempPoint = control.EndPoint; |
||
1976 | 787a4489 | KangIngu | |
1977 | d71ee575 | djkim | if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift) |
1978 | { |
||
1979 | //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
||
1980 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
||
1981 | control.EndPoint = tempPoint; |
||
1982 | } |
||
1983 | else |
||
1984 | { |
||
1985 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false); |
||
1986 | } |
||
1987 | 787a4489 | KangIngu | |
1988 | |||
1989 | d71ee575 | djkim | control.PointSet = new List<Point> |
1990 | 787a4489 | KangIngu | { |
1991 | control.StartPoint, |
||
1992 | control.EndPoint, |
||
1993 | }; |
||
1994 | control.DashSize = ViewerDataModel.Instance.DashSize; |
||
1995 | } |
||
1996 | d71ee575 | djkim | |
1997 | |||
1998 | 787a4489 | KangIngu | } |
1999 | break; |
||
2000 | |||
2001 | case ControlType.ArrowLine: |
||
2002 | { |
||
2003 | d71ee575 | djkim | var control = currentControl as LineControl; |
2004 | if (control != null) |
||
2005 | 787a4489 | KangIngu | { |
2006 | control.LineStyleSet = LineStyleSet.ArrowLine; |
||
2007 | control.ControlType = controlType; |
||
2008 | d71ee575 | djkim | control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y); |
2009 | control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
2010 | Point tempPoint = control.EndPoint; |
||
2011 | 787a4489 | KangIngu | |
2012 | d71ee575 | djkim | if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift) |
2013 | { |
||
2014 | //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
||
2015 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
||
2016 | control.EndPoint = tempPoint; |
||
2017 | } |
||
2018 | else |
||
2019 | { |
||
2020 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false); |
||
2021 | } |
||
2022 | 787a4489 | KangIngu | |
2023 | |||
2024 | d71ee575 | djkim | control.PointSet = new List<Point> |
2025 | 787a4489 | KangIngu | { |
2026 | control.StartPoint, |
||
2027 | control.EndPoint, |
||
2028 | }; |
||
2029 | control.DashSize = ViewerDataModel.Instance.DashSize; |
||
2030 | } |
||
2031 | } |
||
2032 | break; |
||
2033 | |||
2034 | case ControlType.TwinLine: |
||
2035 | { |
||
2036 | d71ee575 | djkim | var control = currentControl as LineControl; |
2037 | if (control != null) |
||
2038 | 787a4489 | KangIngu | { |
2039 | control.LineStyleSet = LineStyleSet.TwinLine; |
||
2040 | control.ControlType = controlType; |
||
2041 | d71ee575 | djkim | control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y); |
2042 | control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
2043 | Point tempPoint = control.EndPoint; |
||
2044 | 787a4489 | KangIngu | |
2045 | d71ee575 | djkim | if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift) |
2046 | { |
||
2047 | //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
||
2048 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
||
2049 | control.EndPoint = tempPoint; |
||
2050 | } |
||
2051 | else |
||
2052 | { |
||
2053 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false); |
||
2054 | } |
||
2055 | 787a4489 | KangIngu | |
2056 | |||
2057 | d71ee575 | djkim | control.PointSet = new List<Point> |
2058 | 787a4489 | KangIngu | { |
2059 | control.StartPoint, |
||
2060 | control.EndPoint, |
||
2061 | }; |
||
2062 | control.DashSize = ViewerDataModel.Instance.DashSize; |
||
2063 | } |
||
2064 | } |
||
2065 | break; |
||
2066 | |||
2067 | case ControlType.DimLine: |
||
2068 | { |
||
2069 | d71ee575 | djkim | var control = currentControl as LineControl; |
2070 | if (control != null) |
||
2071 | 787a4489 | KangIngu | { |
2072 | control.LineStyleSet = LineStyleSet.DimLine; |
||
2073 | control.ControlType = controlType; |
||
2074 | d71ee575 | djkim | control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y); |
2075 | control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
2076 | Point tempPoint = control.EndPoint; |
||
2077 | 787a4489 | KangIngu | |
2078 | d71ee575 | djkim | if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift) |
2079 | { |
||
2080 | //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
||
2081 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
||
2082 | control.EndPoint = tempPoint; |
||
2083 | } |
||
2084 | else |
||
2085 | { |
||
2086 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false); |
||
2087 | } |
||
2088 | 787a4489 | KangIngu | |
2089 | d71ee575 | djkim | control.PointSet = new List<Point> |
2090 | 787a4489 | KangIngu | { |
2091 | control.StartPoint, |
||
2092 | control.EndPoint, |
||
2093 | }; |
||
2094 | control.DashSize = ViewerDataModel.Instance.DashSize; |
||
2095 | } |
||
2096 | } |
||
2097 | break; |
||
2098 | |||
2099 | case ControlType.ChainLine: |
||
2100 | { |
||
2101 | var control = currentControl as PolygonControl; |
||
2102 | |||
2103 | if (control != null) |
||
2104 | { |
||
2105 | 2eac4f76 | KangIngu | |
2106 | 787a4489 | KangIngu | control.PointSet.RemoveAt(control.PointSet.Count - 1); |
2107 | control.PointSet.Add(currentCanvasDrawingMouseMovePoint); |
||
2108 | 2eac4f76 | KangIngu | |
2109 | Point tempPoint = control.PointSet[control.PointSet.Count - 1]; |
||
2110 | |||
2111 | if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift) |
||
2112 | { |
||
2113 | //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
||
2114 | e54660e8 | KangIngu | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.PointSet[control.PointSet.Count - 2], ref tempPoint, true); |
2115 | 2eac4f76 | KangIngu | control.PointSet[control.PointSet.Count - 1] = tempPoint; |
2116 | //control.EndPoint = tempPoint; |
||
2117 | } |
||
2118 | else |
||
2119 | { |
||
2120 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false); |
||
2121 | } |
||
2122 | |||
2123 | 661b7416 | humkyung | ///control.SetPolyPath(); |
2124 | 787a4489 | KangIngu | |
2125 | control.DashSize = ViewerDataModel.Instance.DashSize; |
||
2126 | } |
||
2127 | } |
||
2128 | break; |
||
2129 | |||
2130 | case ControlType.ArcLine: |
||
2131 | { |
||
2132 | d71ee575 | djkim | var control = currentControl as ArcControl; |
2133 | if (control != null) |
||
2134 | 787a4489 | KangIngu | { |
2135 | control.isTransOn = false; |
||
2136 | control.ControlType = controlType; |
||
2137 | d71ee575 | djkim | control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y); |
2138 | control.MidPoint = new Point(0, 0); |
||
2139 | control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
2140 | Point tempPoint = control.EndPoint; |
||
2141 | 787a4489 | KangIngu | |
2142 | d71ee575 | djkim | if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift) |
2143 | 787a4489 | KangIngu | { |
2144 | d71ee575 | djkim | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
2145 | control.EndPoint = tempPoint; |
||
2146 | } |
||
2147 | else |
||
2148 | { |
||
2149 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false); |
||
2150 | } |
||
2151 | 787a4489 | KangIngu | |
2152 | |||
2153 | d71ee575 | djkim | control.PointSet = new List<Point> |
2154 | 787a4489 | KangIngu | { |
2155 | control.StartPoint, |
||
2156 | control.MidPoint, |
||
2157 | control.EndPoint, |
||
2158 | }; |
||
2159 | control.DashSize = ViewerDataModel.Instance.DashSize; |
||
2160 | } |
||
2161 | } |
||
2162 | break; |
||
2163 | |||
2164 | case ControlType.ArcArrow: |
||
2165 | { |
||
2166 | 40b3ce25 | ljiyeon | var control = currentControl as ArrowArcControl; |
2167 | d71ee575 | djkim | if (control != null) |
2168 | 787a4489 | KangIngu | { |
2169 | 40b3ce25 | ljiyeon | control.isTransOn = false; |
2170 | 787a4489 | KangIngu | control.ControlType = controlType; |
2171 | 40b3ce25 | ljiyeon | control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y); |
2172 | control.MidPoint = new Point(0, 0); |
||
2173 | control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
2174 | Point tempPoint = control.EndPoint; |
||
2175 | |||
2176 | if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift) |
||
2177 | 787a4489 | KangIngu | { |
2178 | 40b3ce25 | ljiyeon | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
2179 | control.EndPoint = tempPoint; |
||
2180 | d71ee575 | djkim | } |
2181 | else |
||
2182 | { |
||
2183 | 40b3ce25 | ljiyeon | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false); |
2184 | d71ee575 | djkim | } |
2185 | 787a4489 | KangIngu | |
2186 | 40b3ce25 | ljiyeon | |
2187 | d71ee575 | djkim | control.PointSet = new List<Point> |
2188 | 787a4489 | KangIngu | { |
2189 | control.StartPoint, |
||
2190 | control.MidPoint, |
||
2191 | control.EndPoint, |
||
2192 | }; |
||
2193 | control.DashSize = ViewerDataModel.Instance.DashSize; |
||
2194 | } |
||
2195 | } |
||
2196 | break; |
||
2197 | |||
2198 | case ControlType.ArrowMultiLine: |
||
2199 | { |
||
2200 | d71ee575 | djkim | var control = currentControl as ArrowControl_Multi; |
2201 | if (control != null) |
||
2202 | 787a4489 | KangIngu | { |
2203 | d71ee575 | djkim | control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y); |
2204 | Point tempPoint = control.EndPoint; |
||
2205 | if (control.MiddlePoint == new Point(0, 0)) |
||
2206 | 787a4489 | KangIngu | { |
2207 | d71ee575 | djkim | if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift) |
2208 | 787a4489 | KangIngu | { |
2209 | d71ee575 | djkim | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
2210 | //var AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
||
2211 | control.EndPoint = tempPoint; |
||
2212 | 787a4489 | KangIngu | } |
2213 | else |
||
2214 | { |
||
2215 | d71ee575 | djkim | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false); |
2216 | } |
||
2217 | } |
||
2218 | else |
||
2219 | { |
||
2220 | if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift) |
||
2221 | { |
||
2222 | //var AngleValue = MathSet.returnAngleString(control.MiddlePoint, ref tempPoint, true); |
||
2223 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.MiddlePoint, ref tempPoint, true); |
||
2224 | control.EndPoint = tempPoint; |
||
2225 | } |
||
2226 | else |
||
2227 | { |
||
2228 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.MiddlePoint, ref tempPoint, false); |
||
2229 | 787a4489 | KangIngu | } |
2230 | |||
2231 | d71ee575 | djkim | } |
2232 | |||
2233 | control.PointSet = new List<Point> |
||
2234 | 787a4489 | KangIngu | { |
2235 | control.StartPoint, |
||
2236 | control.MiddlePoint, |
||
2237 | control.EndPoint, |
||
2238 | }; |
||
2239 | control.DashSize = ViewerDataModel.Instance.DashSize; |
||
2240 | } |
||
2241 | } |
||
2242 | break; |
||
2243 | |||
2244 | case ControlType.Circle: |
||
2245 | { |
||
2246 | var control = currentControl as CircleControl; |
||
2247 | |||
2248 | if (control != null) |
||
2249 | { |
||
2250 | if (move.mousemode == MouseMode.Drawing) |
||
2251 | { |
||
2252 | //move.control_Move(ControlList, true, moveX, moveY); |
||
2253 | } |
||
2254 | else |
||
2255 | { |
||
2256 | control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y); |
||
2257 | control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
2258 | control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y); |
||
2259 | control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
2260 | |||
2261 | 17a22987 | KangIngu | if (ViewerDataModel.Instance.IsPressShift) |
2262 | { |
||
2263 | 4318fdeb | KangIngu | Point setpoint = GetSquareEndPoint(control.StartPoint, control.EndPoint); |
2264 | 17a22987 | KangIngu | control.LeftBottomPoint = new Point(control.LeftBottomPoint.X, setpoint.Y); |
2265 | control.TopRightPoint = new Point(setpoint.X, control.TopRightPoint.Y); |
||
2266 | control.EndPoint = new Point(setpoint.X, setpoint.Y); |
||
2267 | } |
||
2268 | |||
2269 | 787a4489 | KangIngu | control.PointSet = new List<Point> |
2270 | { |
||
2271 | control.StartPoint, |
||
2272 | control.LeftBottomPoint, |
||
2273 | control.EndPoint, |
||
2274 | control.TopRightPoint, |
||
2275 | }; |
||
2276 | } |
||
2277 | d71ee575 | djkim | |
2278 | 787a4489 | KangIngu | control.DashSize = ViewerDataModel.Instance.DashSize; |
2279 | control.Paint = ViewerDataModel.Instance.paintSet; |
||
2280 | |||
2281 | } |
||
2282 | } |
||
2283 | break; |
||
2284 | |||
2285 | case ControlType.PolygonCloud: |
||
2286 | { |
||
2287 | var control = currentControl as CloudControl; |
||
2288 | |||
2289 | if (control != null) |
||
2290 | { |
||
2291 | control.isTransOn = true; |
||
2292 | control.PointSet.RemoveAt(control.PointSet.Count - 1); |
||
2293 | |||
2294 | control.PointSet.Add(currentCanvasDrawingMouseMovePoint); |
||
2295 | |||
2296 | control.SetCloud(); |
||
2297 | //강인구 추가 |
||
2298 | control.DashSize = ViewerDataModel.Instance.DashSize; |
||
2299 | control.Paint = ViewerDataModel.Instance.paintSet; |
||
2300 | } |
||
2301 | } |
||
2302 | break; |
||
2303 | |||
2304 | case ControlType.Triangle: |
||
2305 | { |
||
2306 | var control = currentControl as TriControl; |
||
2307 | |||
2308 | if (control != null) |
||
2309 | { |
||
2310 | if (move.mousemode == MouseMode.Drawing) |
||
2311 | { |
||
2312 | //move.control_Move(ControlList, true, moveX, moveY); |
||
2313 | } |
||
2314 | else |
||
2315 | { |
||
2316 | control.Paint = ViewerDataModel.Instance.paintSet; |
||
2317 | control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
2318 | |||
2319 | 992a98b4 | KangIngu | if (ViewerDataModel.Instance.checkAxis) |
2320 | { |
||
2321 | Point tempPoint = control.EndPoint; |
||
2322 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
||
2323 | control.EndPoint = tempPoint; |
||
2324 | } |
||
2325 | |||
2326 | 4318fdeb | KangIngu | |
2327 | if (ViewerDataModel.Instance.IsPressShift) |
||
2328 | { |
||
2329 | e753423e | humkyung | List<Point> Points = GetRegularTrianglePoints(control.StartPoint, control.EndPoint); |
2330 | if (2 == Points.Count()) |
||
2331 | { |
||
2332 | control.MidPoint = Points[0]; |
||
2333 | control.EndPoint = Points[1]; |
||
2334 | } |
||
2335 | 4318fdeb | KangIngu | } |
2336 | |||
2337 | 787a4489 | KangIngu | control.PointSet = new List<Point> |
2338 | { |
||
2339 | control.StartPoint, |
||
2340 | control.MidPoint, |
||
2341 | control.EndPoint, |
||
2342 | }; |
||
2343 | } |
||
2344 | d71ee575 | djkim | |
2345 | 787a4489 | KangIngu | control.DashSize = ViewerDataModel.Instance.DashSize; |
2346 | control.Paint = ViewerDataModel.Instance.paintSet; |
||
2347 | } |
||
2348 | } |
||
2349 | break; |
||
2350 | |||
2351 | case ControlType.ImgControl: |
||
2352 | { |
||
2353 | var control = currentControl as ImgControl; |
||
2354 | |||
2355 | if (control != null) |
||
2356 | { |
||
2357 | control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y); |
||
2358 | control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
2359 | control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y); |
||
2360 | control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
2361 | |||
2362 | control.PointSet = new List<Point> |
||
2363 | { |
||
2364 | control.StartPoint, |
||
2365 | control.LeftBottomPoint, |
||
2366 | control.EndPoint, |
||
2367 | control.TopRightPoint, |
||
2368 | }; |
||
2369 | } |
||
2370 | } |
||
2371 | break; |
||
2372 | |||
2373 | case ControlType.Date: |
||
2374 | { |
||
2375 | var control = currentControl as DateControl; |
||
2376 | |||
2377 | if (control != null) |
||
2378 | { |
||
2379 | control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y); |
||
2380 | control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
2381 | control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y); |
||
2382 | control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
2383 | //control.Text = DateTime.Now.ToString("yyyy-MM-dd"); |
||
2384 | |||
2385 | control.PointSet = new List<Point> |
||
2386 | { |
||
2387 | control.StartPoint, |
||
2388 | control.LeftBottomPoint, |
||
2389 | control.EndPoint, |
||
2390 | control.TopRightPoint, |
||
2391 | }; |
||
2392 | } |
||
2393 | } |
||
2394 | break; |
||
2395 | |||
2396 | case ControlType.ArrowTextControl: |
||
2397 | { |
||
2398 | var control = currentControl as ArrowTextControl; |
||
2399 | |||
2400 | if (control != null) |
||
2401 | { |
||
2402 | control.EndPoint = currentCanvasDrawingMouseMovePoint; |
||
2403 | 5ce56a3a | KangIngu | Point tempPoint = control.EndPoint; |
2404 | 9f473fb7 | KangIngu | |
2405 | control.MidPoint = new Point(control.EndPoint.X - 100, control.EndPoint.Y - 100); |
||
2406 | |||
2407 | 5ce56a3a | KangIngu | if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift) |
2408 | { |
||
2409 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
||
2410 | control.EndPoint = tempPoint; |
||
2411 | } |
||
2412 | else |
||
2413 | { |
||
2414 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false); |
||
2415 | } |
||
2416 | 992a98b4 | KangIngu | control.MidPoint = MathSet.getMiddlePoint(control.StartPoint, control.EndPoint); |
2417 | 787a4489 | KangIngu | |
2418 | control.PointSet = new List<Point> |
||
2419 | { |
||
2420 | control.StartPoint, |
||
2421 | control.MidPoint, |
||
2422 | control.EndPoint, |
||
2423 | }; |
||
2424 | } |
||
2425 | } |
||
2426 | break; |
||
2427 | |||
2428 | case ControlType.ArrowTransTextControl: |
||
2429 | { |
||
2430 | var control = currentControl as ArrowTextControl; |
||
2431 | |||
2432 | if (control != null) |
||
2433 | { |
||
2434 | control.EndPoint = currentCanvasDrawingMouseMovePoint; |
||
2435 | 5ce56a3a | KangIngu | Point tempPoint = control.EndPoint; |
2436 | 01cbc243 | KangIngu | //control.MidPoint = currentCanvasDrawingMouseMovePoint; |
2437 | 9f473fb7 | KangIngu | |
2438 | 5ce56a3a | KangIngu | if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift) |
2439 | { |
||
2440 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
||
2441 | control.EndPoint = tempPoint; |
||
2442 | } |
||
2443 | else |
||
2444 | { |
||
2445 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false); |
||
2446 | } |
||
2447 | 01cbc243 | KangIngu | control.MidPoint = MathSet.getMiddlePoint(control.StartPoint, control.EndPoint); |
2448 | 787a4489 | KangIngu | control.isFixed = true; |
2449 | |||
2450 | control.PointSet = new List<Point> |
||
2451 | { |
||
2452 | control.StartPoint, |
||
2453 | control.MidPoint, |
||
2454 | control.EndPoint, |
||
2455 | }; |
||
2456 | } |
||
2457 | } |
||
2458 | break; |
||
2459 | |||
2460 | case ControlType.ArrowTextBorderControl: |
||
2461 | { |
||
2462 | var control = currentControl as ArrowTextControl; |
||
2463 | |||
2464 | if (control != null) |
||
2465 | { |
||
2466 | control.EndPoint = currentCanvasDrawingMouseMovePoint; |
||
2467 | 5ce56a3a | KangIngu | Point tempPoint = control.EndPoint; |
2468 | if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift) |
||
2469 | { |
||
2470 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
||
2471 | control.EndPoint = tempPoint; |
||
2472 | } |
||
2473 | else |
||
2474 | { |
||
2475 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false); |
||
2476 | } |
||
2477 | 992a98b4 | KangIngu | control.MidPoint = MathSet.getMiddlePoint(control.StartPoint, control.EndPoint); |
2478 | 787a4489 | KangIngu | control.PointSet = new List<Point> |
2479 | { |
||
2480 | control.StartPoint, |
||
2481 | control.MidPoint, |
||
2482 | control.EndPoint, |
||
2483 | }; |
||
2484 | } |
||
2485 | |||
2486 | } |
||
2487 | break; |
||
2488 | case ControlType.ArrowTransTextBorderControl: |
||
2489 | { |
||
2490 | var control = currentControl as ArrowTextControl; |
||
2491 | |||
2492 | if (control != null) |
||
2493 | { |
||
2494 | control.isFixed = true; |
||
2495 | control.EndPoint = currentCanvasDrawingMouseMovePoint; |
||
2496 | 5ce56a3a | KangIngu | Point tempPoint = control.EndPoint; |
2497 | if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift) |
||
2498 | { |
||
2499 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
||
2500 | control.EndPoint = tempPoint; |
||
2501 | } |
||
2502 | else |
||
2503 | { |
||
2504 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false); |
||
2505 | } |
||
2506 | 01cbc243 | KangIngu | |
2507 | control.MidPoint = MathSet.getMiddlePoint(control.StartPoint, control.EndPoint); |
||
2508 | 787a4489 | KangIngu | control.PointSet = new List<Point> |
2509 | { |
||
2510 | control.StartPoint, |
||
2511 | control.MidPoint, |
||
2512 | control.EndPoint, |
||
2513 | }; |
||
2514 | } |
||
2515 | |||
2516 | } |
||
2517 | break; |
||
2518 | case ControlType.ArrowTextCloudControl: |
||
2519 | { |
||
2520 | var control = currentControl as ArrowTextControl; |
||
2521 | |||
2522 | if (control != null) |
||
2523 | { |
||
2524 | control.EndPoint = currentCanvasDrawingMouseMovePoint; |
||
2525 | 5ce56a3a | KangIngu | Point tempPoint = control.EndPoint; |
2526 | if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift) |
||
2527 | { |
||
2528 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
||
2529 | control.EndPoint = tempPoint; |
||
2530 | } |
||
2531 | else |
||
2532 | { |
||
2533 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false); |
||
2534 | } |
||
2535 | 992a98b4 | KangIngu | control.MidPoint = MathSet.getMiddlePoint(control.StartPoint, control.EndPoint); |
2536 | 787a4489 | KangIngu | control.PointSet = new List<Point> |
2537 | { |
||
2538 | control.StartPoint, |
||
2539 | control.MidPoint, |
||
2540 | control.EndPoint, |
||
2541 | }; |
||
2542 | } |
||
2543 | |||
2544 | } |
||
2545 | break; |
||
2546 | case ControlType.ArrowTransTextCloudControl: |
||
2547 | { |
||
2548 | var control = currentControl as ArrowTextControl; |
||
2549 | |||
2550 | if (control != null) |
||
2551 | { |
||
2552 | control.isFixed = true; |
||
2553 | control.EndPoint = currentCanvasDrawingMouseMovePoint; |
||
2554 | 5ce56a3a | KangIngu | Point tempPoint = control.EndPoint; |
2555 | if (ViewerDataModel.Instance.checkAxis || ViewerDataModel.Instance.IsPressShift) |
||
2556 | { |
||
2557 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, true); |
||
2558 | control.EndPoint = tempPoint; |
||
2559 | } |
||
2560 | else |
||
2561 | { |
||
2562 | ViewerDataModel.Instance.AngleValue = MathSet.returnAngleString(control.StartPoint, ref tempPoint, false); |
||
2563 | } |
||
2564 | 01cbc243 | KangIngu | control.MidPoint = MathSet.getMiddlePoint(control.StartPoint, control.EndPoint); |
2565 | 787a4489 | KangIngu | control.PointSet = new List<Point> |
2566 | { |
||
2567 | control.StartPoint, |
||
2568 | control.MidPoint, |
||
2569 | control.EndPoint, |
||
2570 | }; |
||
2571 | } |
||
2572 | |||
2573 | } |
||
2574 | break; |
||
2575 | case ControlType.PolygonControl: |
||
2576 | { |
||
2577 | e54660e8 | KangIngu | |
2578 | 787a4489 | KangIngu | var control = currentControl as PolygonControl; |
2579 | |||
2580 | if (control != null) |
||
2581 | { |
||
2582 | control.PointSet.RemoveAt(control.PointSet.Count - 1); |
||
2583 | control.PointSet.Add(currentCanvasDrawingMouseMovePoint); |
||
2584 | control.Paint = ViewerDataModel.Instance.paintSet; |
||
2585 | 661b7416 | humkyung | ///control.SetPolyPath(); |
2586 | 787a4489 | KangIngu | //강인구 추가 |
2587 | control.DashSize = ViewerDataModel.Instance.DashSize; |
||
2588 | control.Paint = ViewerDataModel.Instance.paintSet; |
||
2589 | } |
||
2590 | } |
||
2591 | break; |
||
2592 | //강인구 추가 |
||
2593 | case ControlType.Sign: |
||
2594 | { |
||
2595 | var control = currentControl as SignControl; |
||
2596 | |||
2597 | if (control != null) |
||
2598 | { |
||
2599 | control.StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y); |
||
2600 | control.LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
2601 | control.TopRightPoint = new Point(currentCanvasDrawingMouseMovePoint.X, canvasDrawingMouseDownPoint.Y); |
||
2602 | control.EndPoint = new Point(currentCanvasDrawingMouseMovePoint.X, currentCanvasDrawingMouseMovePoint.Y); |
||
2603 | |||
2604 | if (control.StartPoint != control.EndPoint && control.SignImage == null) |
||
2605 | { |
||
2606 | 661b7416 | humkyung | var _sign = GetUserSign.GetSign(App.ViewInfo.UserID, App.ViewInfo.ProjectNO); |
2607 | 787a4489 | KangIngu | 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 | 90e7968d | ljiyeon | //GC.Collect(); |
3102 | 53880c83 | ljiyeon | |
3103 | if (defaultBitmapImage.IsDownloading) |
||
3104 | { |
||
3105 | defaultBitmapImage.DownloadCompleted += (ex, arg) => |
||
3106 | { |
||
3107 | defaultBitmapImage.Freeze(); |
||
3108 | 90e7968d | ljiyeon | //GC.Collect(); |
3109 | 53880c83 | ljiyeon | 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 | c73426a9 | ljiyeon | |
4650 | 787a4489 | KangIngu | string extension = System.IO.Path.GetExtension(filename).ToUpper(); |
4651 | 53880c83 | ljiyeon | if (extension == ".PNG" || extension == ".JPEG" || extension == ".GIF" || extension == ".BMP" || extension == ".JPG" || extension == ".SVG") |
4652 | 787a4489 | KangIngu | { |
4653 | Image img = new Image(); |
||
4654 | 53880c83 | ljiyeon | //img.Source = new BitmapImage(new Uri(filename)); |
4655 | if (filename.Contains(".svg")) |
||
4656 | { |
||
4657 | byte[] imageData = null; |
||
4658 | DrawingImage image = null; |
||
4659 | using (System.Net.WebClient web = new System.Net.WebClient()) |
||
4660 | { |
||
4661 | imageData = web.DownloadData(new Uri(filename)); |
||
4662 | System.IO.Stream stream = new System.IO.MemoryStream(imageData); |
||
4663 | image = SvgReader.Load(stream); |
||
4664 | } |
||
4665 | img.Source = image; |
||
4666 | } |
||
4667 | else |
||
4668 | { |
||
4669 | img.Source = new BitmapImage(new Uri(filename)); |
||
4670 | } |
||
4671 | 787a4489 | KangIngu | |
4672 | currentControl = new ImgControl |
||
4673 | { |
||
4674 | 53880c83 | ljiyeon | Background = new SolidColorBrush(Colors.Black), |
4675 | PointSet = new List<Point>(), |
||
4676 | FilePath = filename, |
||
4677 | ImageData = img.Source, |
||
4678 | StartPoint = canvasDrawingMouseDownPoint, |
||
4679 | EndPoint = new Point(canvasDrawingMouseDownPoint.X + 100, canvasDrawingMouseDownPoint.Y + 100), |
||
4680 | TopRightPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y + 100), |
||
4681 | LeftBottomPoint = new Point(canvasDrawingMouseDownPoint.X + 100, canvasDrawingMouseDownPoint.Y), |
||
4682 | ControlType = ControlType.ImgControl |
||
4683 | }; |
||
4684 | |||
4685 | |||
4686 | currentControl.CommentID = Save.shortGuid(); |
||
4687 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
4688 | currentControl.IsNew = true; |
||
4689 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
4690 | |||
4691 | //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
||
4692 | (currentControl as ImgControl).Angle -= rotate.Angle; |
||
4693 | } |
||
4694 | 787a4489 | KangIngu | } |
4695 | e66f22eb | KangIngu | //} |
4696 | 787a4489 | KangIngu | } |
4697 | } |
||
4698 | break; |
||
4699 | case ControlType.Date: |
||
4700 | { |
||
4701 | if (mouseButtonDown == MouseButton.Left) |
||
4702 | { |
||
4703 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
4704 | //{ |
||
4705 | 787a4489 | KangIngu | if (currentControl is DateControl) |
4706 | { |
||
4707 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
4708 | if (IsGetoutpoint((currentControl as DateControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
4709 | e66f22eb | KangIngu | { |
4710 | return; |
||
4711 | } |
||
4712 | |||
4713 | 787a4489 | KangIngu | CreateControl(); |
4714 | (currentControl as DateControl).ApplyOverViewData(); |
||
4715 | currentControl = null; |
||
4716 | |||
4717 | if (Common.ViewerDataModel.Instance.SelectedControl == "Batch") |
||
4718 | { |
||
4719 | controlType = ControlType.None; |
||
4720 | IsSwingMode = false; |
||
4721 | Common.ViewerDataModel.Instance.SelectedControl = ""; |
||
4722 | Common.ViewerDataModel.Instance.ControlTag = null; |
||
4723 | mouseHandlingMode = MouseHandlingMode.None; |
||
4724 | this.ParentOfType<MainWindow>().dzTopMenu.btn_Batch.IsChecked = false; |
||
4725 | txtBatch.Visibility = Visibility.Collapsed; |
||
4726 | |||
4727 | } |
||
4728 | } |
||
4729 | else |
||
4730 | { |
||
4731 | currentControl = new DateControl |
||
4732 | { |
||
4733 | Background = new SolidColorBrush(Colors.Black) |
||
4734 | }; |
||
4735 | currentControl.CommentID = Save.shortGuid(); |
||
4736 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
4737 | currentControl.IsNew = true; |
||
4738 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
4739 | ca40e004 | ljiyeon | |
4740 | //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
||
4741 | (currentControl as DateControl).Angle -= rotate.Angle; |
||
4742 | } |
||
4743 | e66f22eb | KangIngu | //} |
4744 | 787a4489 | KangIngu | } |
4745 | } |
||
4746 | break; |
||
4747 | case ControlType.TextControl: |
||
4748 | { |
||
4749 | if (mouseButtonDown == MouseButton.Left) |
||
4750 | { |
||
4751 | if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
||
4752 | { |
||
4753 | currentControl = new TextControl |
||
4754 | { |
||
4755 | ControlType = controlType |
||
4756 | }; |
||
4757 | 610a4b86 | KangIngu | (currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize; |
4758 | 8742caa5 | humkyung | currentControl.CommentID = Save.shortGuid(); |
4759 | currentControl.IsNew = true; |
||
4760 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
4761 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
4762 | currentControl.SetValue(Canvas.ZIndexProperty, 2); |
||
4763 | currentControl.SetValue(TextControl.CanvasXProperty, canvasDrawingMouseDownPoint.X); |
||
4764 | currentControl.SetValue(TextControl.CanvasYProperty, canvasDrawingMouseDownPoint.Y); |
||
4765 | 6b5d33c6 | djkim | |
4766 | 8742caa5 | humkyung | (currentControl as TextControl).ControlType_No = 0; |
4767 | (currentControl as TextControl).Angle -= rotate.Angle; |
||
4768 | (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape; |
||
4769 | 6b5d33c6 | djkim | (currentControl as TextControl).ApplyTemplate(); |
4770 | (currentControl as TextControl).Base_TextBox.Focus(); |
||
4771 | 787a4489 | KangIngu | |
4772 | 8742caa5 | humkyung | CreateControl(); |
4773 | 787a4489 | KangIngu | |
4774 | } |
||
4775 | } |
||
4776 | } |
||
4777 | break; |
||
4778 | case ControlType.TextBorder: |
||
4779 | { |
||
4780 | if (mouseButtonDown == MouseButton.Left) |
||
4781 | { |
||
4782 | if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
||
4783 | { |
||
4784 | currentControl = new TextControl |
||
4785 | { |
||
4786 | ControlType = controlType |
||
4787 | }; |
||
4788 | |||
4789 | 610a4b86 | KangIngu | (currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize; |
4790 | 787a4489 | KangIngu | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
4791 | currentControl.CommentID = Save.shortGuid(); |
||
4792 | currentControl.IsNew = true; |
||
4793 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
4794 | currentControl.SetValue(Canvas.ZIndexProperty, 3); |
||
4795 | currentControl.SetValue(TextControl.CanvasXProperty, canvasDrawingMouseDownPoint.X); |
||
4796 | currentControl.SetValue(TextControl.CanvasYProperty, canvasDrawingMouseDownPoint.Y); |
||
4797 | 6b5d33c6 | djkim | |
4798 | 787a4489 | KangIngu | (currentControl as TextControl).ControlType_No = 1; |
4799 | (currentControl as TextControl).Angle = Ang; |
||
4800 | (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape; |
||
4801 | 6b5d33c6 | djkim | (currentControl as TextControl).ApplyTemplate(); |
4802 | (currentControl as TextControl).Base_TextBox.Focus(); |
||
4803 | 787a4489 | KangIngu | CreateControl(); |
4804 | |||
4805 | 49b217ad | humkyung | //currentControl = null; |
4806 | 787a4489 | KangIngu | } |
4807 | } |
||
4808 | } |
||
4809 | break; |
||
4810 | case ControlType.TextCloud: |
||
4811 | { |
||
4812 | if (mouseButtonDown == MouseButton.Left) |
||
4813 | { |
||
4814 | if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
||
4815 | { |
||
4816 | currentControl = new TextControl |
||
4817 | { |
||
4818 | ControlType = controlType |
||
4819 | }; |
||
4820 | 610a4b86 | KangIngu | |
4821 | (currentControl as TextControl).TextSize = ViewerDataModel.Instance.TextSize; |
||
4822 | 787a4489 | KangIngu | currentControl.CommentID = Save.shortGuid(); |
4823 | currentControl.IsNew = true; |
||
4824 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
4825 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
4826 | |||
4827 | currentControl.SetValue(Canvas.ZIndexProperty, 3); |
||
4828 | currentControl.SetValue(TextControl.CanvasXProperty, canvasDrawingMouseDownPoint.X); |
||
4829 | 6b5d33c6 | djkim | currentControl.SetValue(TextControl.CanvasYProperty, canvasDrawingMouseDownPoint.Y); |
4830 | 787a4489 | KangIngu | |
4831 | (currentControl as TextControl).Angle = Ang; |
||
4832 | (currentControl as TextControl).ControlType_No = 2; |
||
4833 | (currentControl as TextControl).IsHighLight = ViewerDataModel.Instance.checkHighShape; |
||
4834 | 6b5d33c6 | djkim | (currentControl as TextControl).ApplyTemplate(); |
4835 | (currentControl as TextControl).Base_TextBox.Focus(); |
||
4836 | 787a4489 | KangIngu | CreateControl(); |
4837 | 49b217ad | humkyung | //currentControl = null; |
4838 | 787a4489 | KangIngu | } |
4839 | } |
||
4840 | } |
||
4841 | break; |
||
4842 | case ControlType.ArrowTextControl: |
||
4843 | ca40e004 | ljiyeon | { |
4844 | 787a4489 | KangIngu | if (mouseButtonDown == MouseButton.Left) |
4845 | { |
||
4846 | if (currentControl is ArrowTextControl) |
||
4847 | { |
||
4848 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
4849 | if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
4850 | e66f22eb | KangIngu | { |
4851 | return; |
||
4852 | ca40e004 | ljiyeon | } |
4853 | e66f22eb | KangIngu | |
4854 | 787a4489 | KangIngu | CreateControl(); |
4855 | |||
4856 | (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
||
4857 | (currentControl as ArrowTextControl).IsEditing = false; |
||
4858 | (currentControl as ArrowTextControl).EnableEditing = false; |
||
4859 | 49b217ad | humkyung | (currentControl as ArrowTextControl).IsNew = false; |
4860 | 787a4489 | KangIngu | currentControl = null; |
4861 | } |
||
4862 | else |
||
4863 | { |
||
4864 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
4865 | //{ |
||
4866 | 787a4489 | KangIngu | currentControl = new ArrowTextControl(); |
4867 | currentControl.CommentID = Save.shortGuid(); |
||
4868 | currentControl.IsNew = true; |
||
4869 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
4870 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
4871 | |||
4872 | currentControl.SetValue(Canvas.ZIndexProperty, 3); |
||
4873 | currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint); |
||
4874 | currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint); |
||
4875 | 610a4b86 | KangIngu | (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize; |
4876 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape; |
4877 | |||
4878 | ca40e004 | ljiyeon | //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
4879 | (currentControl as ArrowTextControl).Angle -= rotate.Angle; |
||
4880 | 787a4489 | KangIngu | |
4881 | ca40e004 | ljiyeon | (currentControl as ArrowTextControl).ApplyTemplate(); |
4882 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).Base_TextBox.Focus(); |
4883 | 5ce56a3a | KangIngu | this.MainAngle.Visibility = Visibility.Visible; |
4884 | ca40e004 | ljiyeon | |
4885 | |||
4886 | e66f22eb | KangIngu | //} |
4887 | 787a4489 | KangIngu | } |
4888 | } |
||
4889 | } |
||
4890 | break; |
||
4891 | case ControlType.ArrowTransTextControl: |
||
4892 | { |
||
4893 | if (mouseButtonDown == MouseButton.Left) |
||
4894 | { |
||
4895 | if (currentControl is ArrowTextControl) |
||
4896 | { |
||
4897 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
4898 | if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
4899 | e66f22eb | KangIngu | { |
4900 | return; |
||
4901 | ca40e004 | ljiyeon | } |
4902 | e66f22eb | KangIngu | |
4903 | 787a4489 | KangIngu | CreateControl(); |
4904 | (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
||
4905 | 49b217ad | humkyung | currentControl.IsNew = false; |
4906 | 787a4489 | KangIngu | currentControl = null; |
4907 | 5ce56a3a | KangIngu | this.MainAngle.Visibility = Visibility.Collapsed; |
4908 | 787a4489 | KangIngu | } |
4909 | else |
||
4910 | { |
||
4911 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
4912 | //{ |
||
4913 | ca40e004 | ljiyeon | currentControl = new ArrowTextControl(); |
4914 | 787a4489 | KangIngu | currentControl.CommentID = Save.shortGuid(); |
4915 | currentControl.IsNew = true; |
||
4916 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
4917 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
4918 | currentControl.SetValue(Canvas.ZIndexProperty, 3); |
||
4919 | currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint); |
||
4920 | ca40e004 | ljiyeon | currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint); |
4921 | 610a4b86 | KangIngu | (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize; |
4922 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).isFixed = true; |
4923 | (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape; |
||
4924 | |||
4925 | ca40e004 | ljiyeon | //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
4926 | (currentControl as ArrowTextControl).Angle -= rotate.Angle; |
||
4927 | |||
4928 | (currentControl as ArrowTextControl).ApplyTemplate(); |
||
4929 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).Base_TextBox.Focus(); |
4930 | ca40e004 | ljiyeon | (currentControl as ArrowTextControl).isTrans = true; |
4931 | 787a4489 | KangIngu | } |
4932 | } |
||
4933 | } |
||
4934 | break; |
||
4935 | case ControlType.ArrowTextBorderControl: |
||
4936 | ca40e004 | ljiyeon | { |
4937 | 787a4489 | KangIngu | if (mouseButtonDown == MouseButton.Left) |
4938 | { |
||
4939 | if (currentControl is ArrowTextControl) |
||
4940 | { |
||
4941 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
4942 | if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
4943 | e66f22eb | KangIngu | { |
4944 | return; |
||
4945 | } |
||
4946 | |||
4947 | 787a4489 | KangIngu | CreateControl(); |
4948 | (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
||
4949 | 49b217ad | humkyung | currentControl.IsNew = false; |
4950 | 787a4489 | KangIngu | currentControl = null; |
4951 | 5ce56a3a | KangIngu | this.MainAngle.Visibility = Visibility.Collapsed; |
4952 | 787a4489 | KangIngu | } |
4953 | else |
||
4954 | { |
||
4955 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
4956 | //{ |
||
4957 | 787a4489 | KangIngu | currentControl = new ArrowTextControl() |
4958 | { |
||
4959 | ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Rect |
||
4960 | }; |
||
4961 | currentControl.CommentID = Save.shortGuid(); |
||
4962 | currentControl.IsNew = true; |
||
4963 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
4964 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
4965 | |||
4966 | currentControl.SetValue(Canvas.ZIndexProperty, 3); |
||
4967 | |||
4968 | currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint); |
||
4969 | |||
4970 | currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint); |
||
4971 | (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape; |
||
4972 | 610a4b86 | KangIngu | (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize; |
4973 | 787a4489 | KangIngu | |
4974 | ca40e004 | ljiyeon | //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
4975 | (currentControl as ArrowTextControl).Angle -= rotate.Angle; |
||
4976 | (currentControl as ArrowTextControl).ApplyTemplate(); |
||
4977 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).Base_TextBox.Focus(); |
4978 | ca40e004 | ljiyeon | this.MainAngle.Visibility = Visibility.Visible; |
4979 | e66f22eb | KangIngu | //} |
4980 | 787a4489 | KangIngu | } |
4981 | } |
||
4982 | } |
||
4983 | break; |
||
4984 | case ControlType.ArrowTransTextBorderControl: |
||
4985 | { |
||
4986 | if (mouseButtonDown == MouseButton.Left) |
||
4987 | { |
||
4988 | if (currentControl is ArrowTextControl) |
||
4989 | { |
||
4990 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
4991 | if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
4992 | e66f22eb | KangIngu | { |
4993 | return; |
||
4994 | } |
||
4995 | 787a4489 | KangIngu | CreateControl(); |
4996 | (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
||
4997 | 49b217ad | humkyung | currentControl.IsNew = false; |
4998 | 787a4489 | KangIngu | currentControl = null; |
4999 | 5ce56a3a | KangIngu | this.MainAngle.Visibility = Visibility.Collapsed; |
5000 | 787a4489 | KangIngu | } |
5001 | else |
||
5002 | { |
||
5003 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
5004 | //{ |
||
5005 | ca40e004 | ljiyeon | |
5006 | |||
5007 | currentControl = new ArrowTextControl() |
||
5008 | 787a4489 | KangIngu | { |
5009 | ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Rect |
||
5010 | }; |
||
5011 | currentControl.CommentID = Save.shortGuid(); |
||
5012 | currentControl.IsNew = true; |
||
5013 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
5014 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
5015 | |||
5016 | currentControl.SetValue(Canvas.ZIndexProperty, 3); |
||
5017 | |||
5018 | currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint); |
||
5019 | ca40e004 | ljiyeon | currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint); |
5020 | 610a4b86 | KangIngu | (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize; |
5021 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).isFixed = true; |
5022 | (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape; |
||
5023 | ca40e004 | ljiyeon | |
5024 | //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
||
5025 | (currentControl as ArrowTextControl).Angle -= rotate.Angle; |
||
5026 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).ApplyTemplate(); |
5027 | |||
5028 | ca40e004 | ljiyeon | (currentControl as ArrowTextControl).Base_TextBox.Focus(); |
5029 | 5ce56a3a | KangIngu | this.MainAngle.Visibility = Visibility.Visible; |
5030 | ca40e004 | ljiyeon | |
5031 | //20180911 LJY |
||
5032 | (currentControl as ArrowTextControl).isTrans = true; |
||
5033 | |||
5034 | |||
5035 | e66f22eb | KangIngu | //} |
5036 | 787a4489 | KangIngu | } |
5037 | } |
||
5038 | } |
||
5039 | break; |
||
5040 | case ControlType.ArrowTextCloudControl: |
||
5041 | { |
||
5042 | if (mouseButtonDown == MouseButton.Left) |
||
5043 | { |
||
5044 | if (currentControl is ArrowTextControl) |
||
5045 | { |
||
5046 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
5047 | if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
5048 | e66f22eb | KangIngu | { |
5049 | return; |
||
5050 | } |
||
5051 | 787a4489 | KangIngu | CreateControl(); |
5052 | (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
||
5053 | 49b217ad | humkyung | currentControl.IsNew = false; |
5054 | 787a4489 | KangIngu | currentControl = null; |
5055 | 5ce56a3a | KangIngu | this.MainAngle.Visibility = Visibility.Collapsed; |
5056 | 787a4489 | KangIngu | } |
5057 | else |
||
5058 | { |
||
5059 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
5060 | //{ |
||
5061 | 787a4489 | KangIngu | currentControl = new ArrowTextControl() |
5062 | { |
||
5063 | ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Cloud |
||
5064 | }; |
||
5065 | currentControl.CommentID = Save.shortGuid(); |
||
5066 | currentControl.IsNew = true; |
||
5067 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
5068 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
5069 | |||
5070 | currentControl.SetValue(Canvas.ZIndexProperty, 3); |
||
5071 | currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint); |
||
5072 | ca40e004 | ljiyeon | currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint); |
5073 | 610a4b86 | KangIngu | (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize; |
5074 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape; |
5075 | |||
5076 | ca40e004 | ljiyeon | //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
5077 | (currentControl as ArrowTextControl).Angle -= rotate.Angle; |
||
5078 | |||
5079 | (currentControl as ArrowTextControl).ApplyTemplate(); |
||
5080 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).Base_TextBox.Focus(); |
5081 | ca40e004 | ljiyeon | this.MainAngle.Visibility = Visibility.Visible; |
5082 | e66f22eb | KangIngu | //} |
5083 | 787a4489 | KangIngu | } |
5084 | } |
||
5085 | } |
||
5086 | break; |
||
5087 | case ControlType.ArrowTransTextCloudControl: |
||
5088 | { |
||
5089 | if (mouseButtonDown == MouseButton.Left) |
||
5090 | { |
||
5091 | if (currentControl is ArrowTextControl) |
||
5092 | { |
||
5093 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
5094 | if (IsGetoutpoint((currentControl as ArrowTextControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
5095 | e66f22eb | KangIngu | { |
5096 | return; |
||
5097 | } |
||
5098 | 787a4489 | KangIngu | CreateControl(); |
5099 | (currentControl as ArrowTextControl).Base_TextBox.IsHitTestVisible = false; |
||
5100 | 49b217ad | humkyung | currentControl.IsNew = false; |
5101 | 787a4489 | KangIngu | currentControl = null; |
5102 | 5ce56a3a | KangIngu | this.MainAngle.Visibility = Visibility.Collapsed; |
5103 | 787a4489 | KangIngu | } |
5104 | else |
||
5105 | { |
||
5106 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
5107 | //{ |
||
5108 | 787a4489 | KangIngu | currentControl = new ArrowTextControl() |
5109 | { |
||
5110 | ArrowTextStyle = MarkupToPDF.Controls.Text.ArrowTextControl.ArrowTextStyleSet.Cloud |
||
5111 | }; |
||
5112 | currentControl.CommentID = Save.shortGuid(); |
||
5113 | ca40e004 | ljiyeon | currentControl.IsNew = true; |
5114 | 787a4489 | KangIngu | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
5115 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
5116 | currentControl.SetValue(Canvas.ZIndexProperty, 3); |
||
5117 | |||
5118 | currentControl.SetValue(ArrowTextControl.StartPointProperty, canvasDrawingMouseDownPoint); |
||
5119 | ca40e004 | ljiyeon | currentControl.SetValue(ArrowTextControl.EndPointProperty, canvasDrawingMouseDownPoint); |
5120 | 610a4b86 | KangIngu | (currentControl as ArrowTextControl).TextSize = ViewerDataModel.Instance.TextSize; |
5121 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).isFixed = true; |
5122 | (currentControl as ArrowTextControl).isHighLight = ViewerDataModel.Instance.checkHighShape; |
||
5123 | |||
5124 | ca40e004 | ljiyeon | //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
5125 | (currentControl as ArrowTextControl).Angle -= rotate.Angle; |
||
5126 | 787a4489 | KangIngu | |
5127 | ca40e004 | ljiyeon | (currentControl as ArrowTextControl).ApplyTemplate(); |
5128 | 787a4489 | KangIngu | (currentControl as ArrowTextControl).Base_TextBox.Focus(); |
5129 | ca40e004 | ljiyeon | this.MainAngle.Visibility = Visibility.Visible; |
5130 | |||
5131 | //20180911 LJY |
||
5132 | (currentControl as ArrowTextControl).isTrans = true; |
||
5133 | e66f22eb | KangIngu | //} |
5134 | 787a4489 | KangIngu | } |
5135 | } |
||
5136 | } |
||
5137 | break; |
||
5138 | case ControlType.PolygonControl: |
||
5139 | { |
||
5140 | if (currentControl is PolygonControl) |
||
5141 | { |
||
5142 | var control = currentControl as PolygonControl; |
||
5143 | |||
5144 | if (mouseButtonDown == MouseButton.Right) |
||
5145 | { |
||
5146 | control.IsCompleted = true; |
||
5147 | } |
||
5148 | |||
5149 | if (!control.IsCompleted) |
||
5150 | { |
||
5151 | control.PointSet.Add(control.EndPoint); |
||
5152 | } |
||
5153 | else |
||
5154 | { |
||
5155 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
5156 | if (IsGetoutpoint((currentControl as PolygonControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
5157 | e66f22eb | KangIngu | { |
5158 | return; |
||
5159 | } |
||
5160 | |||
5161 | 787a4489 | KangIngu | var firstPoint = control.PointSet.First(); |
5162 | control.DashSize = ViewerDataModel.Instance.DashSize; |
||
5163 | control.LineSize = ViewerDataModel.Instance.LineSize; |
||
5164 | control.PointSet.Add(firstPoint); |
||
5165 | |||
5166 | 661b7416 | humkyung | ///control.SetPolyPath(); |
5167 | 787a4489 | KangIngu | |
5168 | control.ApplyOverViewData(); |
||
5169 | |||
5170 | CreateControl(); |
||
5171 | |||
5172 | currentControl = null; |
||
5173 | } |
||
5174 | } |
||
5175 | else |
||
5176 | { |
||
5177 | if (mouseButtonDown == MouseButton.Left) |
||
5178 | { |
||
5179 | currentControl = new PolygonControl |
||
5180 | { |
||
5181 | PointSet = new List<Point>(), |
||
5182 | //PointC = new StylusPointSet() |
||
5183 | }; |
||
5184 | |||
5185 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
5186 | //{ |
||
5187 | 787a4489 | KangIngu | var polygonControl = (currentControl as PolygonControl); |
5188 | currentControl.CommentID = Save.shortGuid(); |
||
5189 | currentControl.IsNew = true; |
||
5190 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
5191 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
5192 | //currentControl.OnApplyTemplate(); |
||
5193 | polygonControl.PointSet.Add(canvasDrawingMouseDownPoint); |
||
5194 | polygonControl.PointSet.Add(canvasDrawingMouseDownPoint); |
||
5195 | e66f22eb | KangIngu | //} |
5196 | 787a4489 | KangIngu | } |
5197 | } |
||
5198 | } |
||
5199 | break; |
||
5200 | //강인구 추가 |
||
5201 | case ControlType.Sign: |
||
5202 | { |
||
5203 | if (mouseButtonDown == MouseButton.Left) |
||
5204 | { |
||
5205 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
5206 | //{ |
||
5207 | 661b7416 | humkyung | var _sign = GetUserSign.GetSign(App.ViewInfo.UserID, App.ViewInfo.ProjectNO); |
5208 | 992a98b4 | KangIngu | |
5209 | if (_sign == null) |
||
5210 | { |
||
5211 | txtBatch.Visibility = Visibility.Collapsed; |
||
5212 | mouseHandlingMode = IKCOM.MouseHandlingMode.None; |
||
5213 | controlType = ControlType.None; |
||
5214 | |||
5215 | this.ParentOfType<MainWindow>().DialogMessage_Alert("등록된 Sign이 없습니다.", "Alert"); |
||
5216 | this.ParentOfType<MainWindow>().ChildrenOfType<RadToggleButton>().Where(data => data.IsChecked == true).FirstOrDefault().IsChecked = false; |
||
5217 | return; |
||
5218 | } |
||
5219 | |||
5220 | 787a4489 | KangIngu | if (currentControl is SignControl) |
5221 | { |
||
5222 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
5223 | if (IsGetoutpoint((currentControl as SignControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
5224 | e66f22eb | KangIngu | { |
5225 | return; |
||
5226 | } |
||
5227 | |||
5228 | 787a4489 | KangIngu | CreateControl(); |
5229 | currentControl = null; |
||
5230 | if (Common.ViewerDataModel.Instance.SelectedControl == "Batch") |
||
5231 | { |
||
5232 | 999c9e40 | humkyung | txtBatch.Text = "Place Date"; |
5233 | 787a4489 | KangIngu | controlType = ControlType.Date; |
5234 | } |
||
5235 | } |
||
5236 | else |
||
5237 | { |
||
5238 | currentControl = new SignControl |
||
5239 | { |
||
5240 | Background = new SolidColorBrush(Colors.Black), |
||
5241 | UserNumber = App.ViewInfo.UserID, |
||
5242 | StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y), |
||
5243 | EndPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y), |
||
5244 | ControlType = ControlType.Sign |
||
5245 | }; |
||
5246 | |||
5247 | currentControl.CommentID = Save.shortGuid(); |
||
5248 | currentControl.IsNew = true; |
||
5249 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
5250 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
5251 | ca40e004 | ljiyeon | |
5252 | //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
||
5253 | (currentControl as SignControl).Angle -= rotate.Angle; |
||
5254 | } |
||
5255 | e66f22eb | KangIngu | //} |
5256 | 787a4489 | KangIngu | } |
5257 | } |
||
5258 | break; |
||
5259 | case ControlType.Mark: |
||
5260 | { |
||
5261 | if (mouseButtonDown == MouseButton.Left) |
||
5262 | { |
||
5263 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
5264 | //{ |
||
5265 | 787a4489 | KangIngu | if (currentControl is RectangleControl) |
5266 | { |
||
5267 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
5268 | if (IsGetoutpoint((currentControl as RectangleControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
5269 | e66f22eb | KangIngu | { |
5270 | return; |
||
5271 | } |
||
5272 | |||
5273 | 787a4489 | KangIngu | CreateControl(); |
5274 | (currentControl as RectangleControl).ApplyOverViewData(); |
||
5275 | currentControl = null; |
||
5276 | 510cbd2a | ljiyeon | |
5277 | this.cursor = new Cursor(MainWindow.CursorChange().StreamSource); |
||
5278 | 787a4489 | KangIngu | |
5279 | if (Common.ViewerDataModel.Instance.SelectedControl == "Batch") |
||
5280 | { |
||
5281 | 999c9e40 | humkyung | txtBatch.Text = "Place Signature"; |
5282 | 787a4489 | KangIngu | controlType = ControlType.Sign; |
5283 | } |
||
5284 | } |
||
5285 | else |
||
5286 | { |
||
5287 | currentControl = new RectangleControl |
||
5288 | { |
||
5289 | Background = new SolidColorBrush(Colors.Black), |
||
5290 | Paint = PaintSet.Fill |
||
5291 | }; |
||
5292 | |||
5293 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
5294 | currentControl.CommentID = Save.shortGuid(); |
||
5295 | currentControl.IsNew = true; |
||
5296 | (currentControl as RectangleControl).DashSize = ViewerDataModel.Instance.DashSize; |
||
5297 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
5298 | } |
||
5299 | e66f22eb | KangIngu | //} |
5300 | 787a4489 | KangIngu | } |
5301 | } |
||
5302 | break; |
||
5303 | case ControlType.Symbol: |
||
5304 | { |
||
5305 | if (mouseButtonDown == MouseButton.Left) |
||
5306 | { |
||
5307 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
5308 | //{ |
||
5309 | 787a4489 | KangIngu | if (currentControl is SymControl) |
5310 | { |
||
5311 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
5312 | if (IsGetoutpoint((currentControl as SymControl).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
5313 | e66f22eb | KangIngu | { |
5314 | return; |
||
5315 | } |
||
5316 | 787a4489 | KangIngu | CreateControl(); |
5317 | currentControl = null; |
||
5318 | 510cbd2a | ljiyeon | |
5319 | this.cursor = new Cursor(MainWindow.CursorChange().StreamSource); |
||
5320 | 787a4489 | KangIngu | } |
5321 | else |
||
5322 | { |
||
5323 | currentControl = new SymControl |
||
5324 | { |
||
5325 | StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y), |
||
5326 | Background = new SolidColorBrush(Colors.Black), |
||
5327 | ControlType = ControlType.Symbol |
||
5328 | }; |
||
5329 | |||
5330 | currentControl.IsNew = true; |
||
5331 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
5332 | currentControl.CommentID = Save.shortGuid(); |
||
5333 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
5334 | ca40e004 | ljiyeon | |
5335 | //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
||
5336 | (currentControl as SymControl).Angle -= rotate.Angle; |
||
5337 | } |
||
5338 | e66f22eb | KangIngu | //} |
5339 | 787a4489 | KangIngu | } |
5340 | } |
||
5341 | break; |
||
5342 | case ControlType.Stamp: |
||
5343 | { |
||
5344 | if (mouseButtonDown == MouseButton.Left) |
||
5345 | { |
||
5346 | e66f22eb | KangIngu | //if (IsDrawingEnable(canvasZoomPanningMouseDownPoint)) |
5347 | //{ |
||
5348 | 787a4489 | KangIngu | if (currentControl is SymControlN) |
5349 | { |
||
5350 | ca40e004 | ljiyeon | //20180906 LJY TEST IsRotationDrawingEnable |
5351 | if (IsGetoutpoint((currentControl as SymControlN).PointSet.Where(data => IsRotationDrawingEnable(data) == true).FirstOrDefault())) |
||
5352 | e66f22eb | KangIngu | { |
5353 | return; |
||
5354 | } |
||
5355 | |||
5356 | 787a4489 | KangIngu | CreateControl(); |
5357 | currentControl = null; |
||
5358 | 510cbd2a | ljiyeon | |
5359 | |||
5360 | this.cursor = new Cursor(MainWindow.CursorChange().StreamSource); |
||
5361 | 787a4489 | KangIngu | } |
5362 | else |
||
5363 | { |
||
5364 | currentControl = new SymControlN |
||
5365 | { |
||
5366 | StartPoint = new Point(canvasDrawingMouseDownPoint.X, canvasDrawingMouseDownPoint.Y), |
||
5367 | Background = new SolidColorBrush(Colors.Black), |
||
5368 | ControlType = ControlType.Stamp |
||
5369 | }; |
||
5370 | |||
5371 | currentControl.IsNew = true; |
||
5372 | currentControl.MarkupInfoID = App.Custom_ViewInfoId; |
||
5373 | currentControl.CommentID = Save.shortGuid(); |
||
5374 | ViewerDataModel.Instance.MarkupControls_USER.Add(currentControl); |
||
5375 | ca40e004 | ljiyeon | //20180903 LJY 회전된 방향으로 화면에 출력되지 않는 문제 수정 |
5376 | (currentControl as SymControlN).Angle -= rotate.Angle; |
||
5377 | } |
||
5378 | e66f22eb | KangIngu | //} |
5379 | 787a4489 | KangIngu | } |
5380 | } |
||
5381 | break; |
||
5382 | case ControlType.PenControl: |
||
5383 | { |
||
5384 | if (inkBoard.Tag.ToString() == "Ink") |
||
5385 | { |
||
5386 | inkBoard.IsEnabled = true; |
||
5387 | StartNewStroke(canvasDrawingMouseDownPoint); |
||
5388 | } |
||
5389 | else if (inkBoard.Tag.ToString() == "EraseByPoint") |
||
5390 | { |
||
5391 | RemovePointStroke(canvasDrawingMouseDownPoint); |
||
5392 | } |
||
5393 | else if (inkBoard.Tag.ToString() == "EraseByStroke") |
||
5394 | { |
||
5395 | RemoveLineStroke(canvasDrawingMouseDownPoint); |
||
5396 | } |
||
5397 | IsDrawing = true; |
||
5398 | return; |
||
5399 | } |
||
5400 | default: |
||
5401 | if (currentControl != null) |
||
5402 | { |
||
5403 | currentControl.CommentID = null; |
||
5404 | currentControl.IsNew = false; |
||
5405 | } |
||
5406 | break; |
||
5407 | } |
||
5408 | } |
||
5409 | if (mouseHandlingMode != MouseHandlingMode.None && mouseButtonDown == MouseButton.Left) |
||
5410 | { |
||
5411 | if (mouseHandlingMode == MouseHandlingMode.Adorner && SelectLayer.Children.Count > 0) |
||
5412 | { |
||
5413 | bool mouseOff = false; |
||
5414 | foreach (var item in SelectLayer.Children) |
||
5415 | { |
||
5416 | if (item is AdornerFinal) |
||
5417 | { |
||
5418 | |||
5419 | var over = (item as AdornerFinal).MemberSet.Where(data => data.DrawingData.IsMouseOver).FirstOrDefault(); |
||
5420 | if (over != null) |
||
5421 | { |
||
5422 | mouseOff = true; |
||
5423 | } |
||
5424 | } |
||
5425 | } |
||
5426 | |||
5427 | if (!mouseOff) |
||
5428 | { |
||
5429 | ReleaseAdorner(); |
||
5430 | } |
||
5431 | } |
||
5432 | zoomAndPanControl.CaptureMouse(); |
||
5433 | e.Handled = true; |
||
5434 | } |
||
5435 | } |
||
5436 | e54660e8 | KangIngu | |
5437 | a1716fa5 | KangIngu | private void zoomAndPanControl2_MouseDown(object sender, MouseButtonEventArgs e) |
5438 | { |
||
5439 | mouseButtonDown = e.ChangedButton; |
||
5440 | canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanCanvas2); |
||
5441 | } |
||
5442 | |||
5443 | 787a4489 | KangIngu | private void RemoveLineStroke(Point P) |
5444 | { |
||
5445 | var control = ViewerDataModel.Instance.MarkupControls_USER.Where(data => data.IsMouseOver).FirstOrDefault(); |
||
5446 | if (control != null) |
||
5447 | { |
||
5448 | UndoData = new Undo_data() |
||
5449 | { |
||
5450 | IsUndo = false, |
||
5451 | Event = Event_Type.Delete, |
||
5452 | EventTime = DateTime.Now, |
||
5453 | Markup_List = new List<Multi_Undo_data>() |
||
5454 | }; |
||
5455 | |||
5456 | |||
5457 | multi_Undo_Data.Markup = control as MarkupToPDF.Common.CommentUserInfo; |
||
5458 | UndoData.Markup_List.Add(multi_Undo_Data); |
||
5459 | multi_Undo_Data = new Multi_Undo_data(); |
||
5460 | |||
5461 | ViewerDataModel.Instance.MarkupControls_USER.Remove(control); |
||
5462 | var Item_ = ViewerDataModel.Instance.MarkupList_USER.Where(d => d.ID == (control as MarkupToPDF.Common.CommentUserInfo).CommentID).FirstOrDefault(); |
||
5463 | ViewerDataModel.Instance.MarkupList_USER.Remove(Item_); |
||
5464 | 6707a5c7 | ljiyeon | |
5465 | //임시파일에서도 삭제한다. |
||
5466 | a20d338f | ljiyeon | TempFile.DelTemp((control as MarkupToPDF.Common.CommentUserInfo).CommentID, this.ParentOfType<MainWindow>().dzMainMenu.pageNavigator.CurrentPage.PageNumber.ToString()); |
5467 | 6707a5c7 | ljiyeon | |
5468 | 787a4489 | KangIngu | ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i => |
5469 | { |
||
5470 | ViewerDataModel.Instance.UndoDataList.Remove(i); |
||
5471 | }); |
||
5472 | ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
||
5473 | e54660e8 | KangIngu | |
5474 | 787a4489 | KangIngu | } |
5475 | } |
||
5476 | |||
5477 | private void RemovePointStroke(Point P) |
||
5478 | { |
||
5479 | foreach (Stroke hits in inkBoard.Strokes) |
||
5480 | { |
||
5481 | foreach (StylusPoint sty in hits.StylusPoints) |
||
5482 | { |
||
5483 | |||
5484 | } |
||
5485 | if (hits.HitTest(P)) |
||
5486 | { |
||
5487 | inkBoard.Strokes.Remove(hits); |
||
5488 | return; |
||
5489 | } |
||
5490 | } |
||
5491 | } |
||
5492 | |||
5493 | private void StartNewStroke(Point P) |
||
5494 | { |
||
5495 | strokePoints = new StylusPointCollection(); |
||
5496 | StylusPoint segment1Start = new StylusPoint(P.X, P.Y); |
||
5497 | strokePoints.Add(segment1Start); |
||
5498 | stroke = new Stroke(strokePoints); |
||
5499 | |||
5500 | stroke.DrawingAttributes.Color = Colors.Red; |
||
5501 | stroke.DrawingAttributes.Width = 4; |
||
5502 | stroke.DrawingAttributes.Height = 4; |
||
5503 | |||
5504 | inkBoard.Strokes.Add(stroke); |
||
5505 | |||
5506 | } |
||
5507 | |||
5508 | private void btnConsolidate_Click(object sender, RoutedEventArgs e) |
||
5509 | { |
||
5510 | ConsolidationMethod(); |
||
5511 | } |
||
5512 | |||
5513 | 04a7385a | djkim | public void TeamConsolidationMethod() |
5514 | { |
||
5515 | ChangeCommentReact(); |
||
5516 | if (this.gridViewMarkup.SelectedItems.Count == 0) |
||
5517 | { |
||
5518 | this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert"); |
||
5519 | } |
||
5520 | else |
||
5521 | { |
||
5522 | foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems) |
||
5523 | { |
||
5524 | if (!this.userData.DEPARTMENT.Equals(item.Depatment)) |
||
5525 | { |
||
5526 | this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at your department", "Alert"); |
||
5527 | return; |
||
5528 | } |
||
5529 | } |
||
5530 | ViewerDataModel.Instance.IsConsolidate = true; |
||
5531 | this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null); |
||
5532 | List<KCOMDataModel.DataModel.MARKUP_DATA> instanceDataSet = new List<KCOMDataModel.DataModel.MARKUP_DATA>(); |
||
5533 | |||
5534 | string project_no = App.ViewInfo.ProjectNO; |
||
5535 | string doc_id = _DocInfo.ID; |
||
5536 | string user_id = App.ViewInfo.UserID; |
||
5537 | List<MarkupInfoItem> markupInfoItems = new List<MarkupInfoItem>(); |
||
5538 | foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems) |
||
5539 | 90e7968d | ljiyeon | { |
5540 | 04a7385a | djkim | markupInfoItems.Add(item); |
5541 | } |
||
5542 | 0f065e57 | ljiyeon | Logger.sendReqLog("TeamConsolidate", project_no + "," + user_id + "," + doc_id + "," + markupInfoItems, 1); |
5543 | Logger.sendResLog("TeamConsolidate", this.BaseClient.TeamConsolidate(project_no, user_id, doc_id, markupInfoItems).ToString(), 1); |
||
5544 | //this.BaseClient.TeamConsolidate(project_no, user_id, doc_id, markupInfoItems); |
||
5545 | 04a7385a | djkim | |
5546 | 90e7968d | ljiyeon | Logger.sendReqLog("GetMarkupInfoItemsAsync", App.ViewInfo.ProjectNO + "," + _DocInfo.ID, 1); |
5547 | 04a7385a | djkim | this.BaseClient.GetMarkupInfoItemsAsync(App.ViewInfo.ProjectNO, _DocInfo.ID); |
5548 | } |
||
5549 | } |
||
5550 | 787a4489 | KangIngu | public void ConsolidationMethod() |
5551 | { |
||
5552 | ChangeCommentReact(); |
||
5553 | |||
5554 | if (this.gridViewMarkup.SelectedItems.Count == 0) |
||
5555 | { |
||
5556 | this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert"); |
||
5557 | } |
||
5558 | else |
||
5559 | 90e7968d | ljiyeon | { |
5560 | 787a4489 | KangIngu | ViewerDataModel.Instance.IsConsolidate = true; |
5561 | 7b312426 | KangIngu | this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null); |
5562 | 787a4489 | KangIngu | List<KCOMDataModel.DataModel.MARKUP_DATA> instanceDataSet = new List<KCOMDataModel.DataModel.MARKUP_DATA>(); |
5563 | |||
5564 | 6c781c0c | djkim | string project_no = App.ViewInfo.ProjectNO; |
5565 | string doc_id = _DocInfo.ID; |
||
5566 | string user_id = App.ViewInfo.UserID; |
||
5567 | List<MarkupInfoItem> markupInfoItems = new List<MarkupInfoItem>(); |
||
5568 | foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems) |
||
5569 | { |
||
5570 | markupInfoItems.Add(item); |
||
5571 | 787a4489 | KangIngu | } |
5572 | 0f065e57 | ljiyeon | Logger.sendReqLog("Consolidate", project_no + "," + user_id + "," + doc_id + "," + markupInfoItems, 1); |
5573 | Logger.sendResLog("Consolidate", this.BaseClient.Consolidate(project_no, user_id, doc_id, markupInfoItems).ToString(), 1); |
||
5574 | //this.BaseClient.Consolidate(project_no, user_id, doc_id, markupInfoItems); |
||
5575 | |||
5576 | Logger.sendReqLog("GetMarkupInfoItemsAsync", App.ViewInfo.ProjectNO + "," + _DocInfo.ID, 1); |
||
5577 | 6c781c0c | djkim | this.BaseClient.GetMarkupInfoItemsAsync(App.ViewInfo.ProjectNO, _DocInfo.ID); |
5578 | 90e7968d | ljiyeon | |
5579 | 787a4489 | KangIngu | } |
5580 | } |
||
5581 | |||
5582 | private void btnConsolidate_Loaded(object sender, RoutedEventArgs e) |
||
5583 | { |
||
5584 | if (App.ViewInfo != null) |
||
5585 | { |
||
5586 | btnConsolidate = (sender as RadRibbonButton); |
||
5587 | if (!App.ViewInfo.NewCommentPermission) |
||
5588 | { |
||
5589 | (sender as RadRibbonButton).Visibility = System.Windows.Visibility.Collapsed; |
||
5590 | } |
||
5591 | } |
||
5592 | } |
||
5593 | |||
5594 | private void btnTeamConsolidate_Click(object sender, RoutedEventArgs e) |
||
5595 | { |
||
5596 | 04a7385a | djkim | TeamConsolidationMethod(); |
5597 | 787a4489 | KangIngu | } |
5598 | |||
5599 | private void btnTeamConsolidate_Loaded(object sender, RoutedEventArgs e) |
||
5600 | { |
||
5601 | btnTeamConsolidate = sender as RadRibbonButton; |
||
5602 | if (App.ViewInfo != null) |
||
5603 | { |
||
5604 | if (!App.ViewInfo.CreateFinalPDFPermission) //파이널이 True가 아니면 |
||
5605 | { |
||
5606 | if (btnConsolidate != null) |
||
5607 | { |
||
5608 | btnConsolidate.Visibility = Visibility.Collapsed; |
||
5609 | } |
||
5610 | |||
5611 | if (!App.ViewInfo.NewCommentPermission) |
||
5612 | { |
||
5613 | btnTeamConsolidate.Visibility = Visibility.Collapsed; |
||
5614 | } |
||
5615 | } |
||
5616 | else |
||
5617 | { |
||
5618 | btnTeamConsolidate.Visibility = Visibility.Collapsed; |
||
5619 | } |
||
5620 | } |
||
5621 | } |
||
5622 | |||
5623 | private void FinalPDFEvent(object sender, RoutedEventArgs e) |
||
5624 | { |
||
5625 | var item = gridViewMarkup.Items.Cast<MarkupInfoItem>().Where(d => d.Consolidate == 1 && d.AvoidConsolidate == 0).FirstOrDefault(); |
||
5626 | if (item != null) |
||
5627 | { |
||
5628 | 90e7968d | ljiyeon | Logger.sendReqLog("SetFinalPDFAsync", _ViewInfo.ProjectNO + "," + _DocInfo.ID + "," + item.MarkupInfoID + "," + _ViewInfo.UserID, 1); |
5629 | 0f065e57 | ljiyeon | |
5630 | 787a4489 | KangIngu | BaseClient.SetFinalPDFAsync(_ViewInfo.ProjectNO, _DocInfo.ID, item.MarkupInfoID, _ViewInfo.UserID); |
5631 | } |
||
5632 | else |
||
5633 | { |
||
5634 | DialogMessage_Alert("Consolidation 된 코멘트가 존재하지 않습니다", "안내"); |
||
5635 | } |
||
5636 | } |
||
5637 | |||
5638 | private void btnFinalPDF_Loaded(object sender, RoutedEventArgs e) |
||
5639 | { |
||
5640 | btnFinalPDF = sender as RadRibbonButton; |
||
5641 | if (App.ViewInfo != null) |
||
5642 | { |
||
5643 | if (!App.ViewInfo.CreateFinalPDFPermission) //파이널이 True가 아니면 |
||
5644 | { |
||
5645 | btnFinalPDF.Visibility = System.Windows.Visibility.Collapsed; |
||
5646 | if (btnConsolidate != null) |
||
5647 | { |
||
5648 | btnConsolidate.Visibility = Visibility.Collapsed; |
||
5649 | } |
||
5650 | } |
||
5651 | } |
||
5652 | } |
||
5653 | |||
5654 | 80458c15 | ljiyeon | private void ConsolidateFinalPDFEvent(object sender, RoutedEventArgs e) |
5655 | { |
||
5656 | ChangeCommentReact(); |
||
5657 | |||
5658 | if (this.gridViewMarkup.SelectedItems.Count == 0) |
||
5659 | { |
||
5660 | this.ParentOfType<MainWindow>().DialogMessage_Alert("Please select at least one user", "Alert"); |
||
5661 | } |
||
5662 | else |
||
5663 | { |
||
5664 | ViewerDataModel.Instance.IsConsolidate = true; |
||
5665 | this.ParentOfType<MainWindow>().dzTopMenu._SaveEvent(null, null); |
||
5666 | List<KCOMDataModel.DataModel.MARKUP_DATA> instanceDataSet = new List<KCOMDataModel.DataModel.MARKUP_DATA>(); |
||
5667 | |||
5668 | string project_no = App.ViewInfo.ProjectNO; |
||
5669 | string doc_id = _DocInfo.ID; |
||
5670 | string user_id = App.ViewInfo.UserID; |
||
5671 | List<MarkupInfoItem> markupInfoItems = new List<MarkupInfoItem>(); |
||
5672 | foreach (MarkupInfoItem item in this.gridViewMarkup.SelectedItems) |
||
5673 | { |
||
5674 | markupInfoItems.Add(item); |
||
5675 | } |
||
5676 | Logger.sendReqLog("Consolidate", project_no + "," + user_id + "," + doc_id + "," + markupInfoItems, 1); |
||
5677 | Logger.sendResLog("Consolidate", this.BaseClient.Consolidate(project_no, user_id, doc_id, markupInfoItems).ToString(), 1); |
||
5678 | Logger.sendReqLog("GetMarkupInfoItemsAsync", App.ViewInfo.ProjectNO + "," + _DocInfo.ID, 1); |
||
5679 | 1126281e | djkim | var items = this.BaseClient.GetMarkupInfoItems(App.ViewInfo.ProjectNO, _DocInfo.ID); |
5680 | 80458c15 | ljiyeon | |
5681 | 1126281e | djkim | var item2 = items.Where(d => d.Consolidate == 1 && d.AvoidConsolidate == 0).FirstOrDefault(); |
5682 | 80458c15 | ljiyeon | if (item2 != null) |
5683 | { |
||
5684 | Logger.sendReqLog("SetFinalPDFAsync", _ViewInfo.ProjectNO + "," + _DocInfo.ID + "," + item2.MarkupInfoID + "," + _ViewInfo.UserID, 1); |
||
5685 | |||
5686 | BaseClient.SetFinalPDFAsync(_ViewInfo.ProjectNO, _DocInfo.ID, item2.MarkupInfoID, _ViewInfo.UserID); |
||
5687 | 1126281e | djkim | BaseClient.GetMarkupInfoItemsAsync(App.ViewInfo.ProjectNO, _DocInfo.ID); |
5688 | 80458c15 | ljiyeon | } |
5689 | else |
||
5690 | { |
||
5691 | DialogMessage_Alert("Consolidation 된 코멘트가 존재하지 않습니다", "안내"); |
||
5692 | } |
||
5693 | 90e7968d | ljiyeon | } |
5694 | 80458c15 | ljiyeon | } |
5695 | |||
5696 | private void btnConsolidateFinalPDF_Loaded(object sender, RoutedEventArgs e) |
||
5697 | 90e7968d | ljiyeon | { |
5698 | 80458c15 | ljiyeon | btnConsolidateFinalPDF = (sender as RadRibbonButton); |
5699 | |||
5700 | if (App.ViewInfo != null) |
||
5701 | { |
||
5702 | if (!App.ViewInfo.NewCommentPermission || !App.ViewInfo.CreateFinalPDFPermission) |
||
5703 | { |
||
5704 | 90e7968d | ljiyeon | btnConsolidateFinalPDF.Visibility = System.Windows.Visibility.Collapsed; |
5705 | 80458c15 | ljiyeon | } |
5706 | 90e7968d | ljiyeon | } |
5707 | 80458c15 | ljiyeon | } |
5708 | |||
5709 | 787a4489 | KangIngu | private void SyncCompare_Click(object sender, RoutedEventArgs e) |
5710 | { |
||
5711 | if (CompareMode.IsChecked) |
||
5712 | { |
||
5713 | if (ViewerDataModel.Instance.PageBalanceMode && ViewerDataModel.Instance.PageBalanceNumber == 0) |
||
5714 | { |
||
5715 | ViewerDataModel.Instance.PageBalanceNumber = 1; |
||
5716 | } |
||
5717 | if (ViewerDataModel.Instance.PageNumber == 0) |
||
5718 | { |
||
5719 | ViewerDataModel.Instance.PageNumber = 1; |
||
5720 | } |
||
5721 | |||
5722 | 90e7968d | ljiyeon | Logger.sendReqLog("GetCompareRectAsync", _ViewInfo.ProjectNO + "," + _ViewInfo.DocumentItemID + "," + CurrentRev.DOCUMENT_ID + |
5723 | 0f065e57 | ljiyeon | "," + pageNavigator.CurrentPage.PageNumber.ToString() + "," + ViewerDataModel.Instance.PageNumber.ToString() + "," + |
5724 | 90e7968d | ljiyeon | userData.COMPANY != "EXT" ? "true" : "false", 1); |
5725 | 0f065e57 | ljiyeon | |
5726 | d9cf7d6e | djkim | BaseClient.GetCompareRectAsync(_ViewInfo.ProjectNO, _ViewInfo.DocumentItemID, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber.ToString(), ViewerDataModel.Instance.PageNumber.ToString(), userData.COMPANY != "EXT" ? "true" : "false"); |
5727 | 787a4489 | KangIngu | } |
5728 | else |
||
5729 | { |
||
5730 | da.From = 1; |
||
5731 | da.To = 1; |
||
5732 | da.Duration = new Duration(TimeSpan.FromSeconds(9999)); |
||
5733 | da.AutoReverse = false; |
||
5734 | canvas_compareBorder.Children.Clear(); |
||
5735 | canvas_compareBorder.BeginAnimation(OpacityProperty, da); |
||
5736 | } |
||
5737 | } |
||
5738 | |||
5739 | 9cd2865b | KangIngu | private void Sync_Click(object sender, RoutedEventArgs e) |
5740 | { |
||
5741 | a1716fa5 | KangIngu | if (Sync.IsChecked) |
5742 | 9cd2865b | KangIngu | { |
5743 | ViewerDataModel.Instance.Sync_ContentOffsetX = zoomAndPanControl.ContentOffsetX; |
||
5744 | ViewerDataModel.Instance.Sync_ContentOffsetY = zoomAndPanControl.ContentOffsetY; |
||
5745 | ViewerDataModel.Instance.Sync_ContentScale = zoomAndPanControl.ContentScale; |
||
5746 | } |
||
5747 | } |
||
5748 | |||
5749 | 787a4489 | KangIngu | private void SyncUserListExpender_Click(object sender, RoutedEventArgs e) |
5750 | { |
||
5751 | if (UserList.IsChecked) |
||
5752 | { |
||
5753 | this.gridViewRevMarkup.Visibility = Visibility.Visible; |
||
5754 | } |
||
5755 | else |
||
5756 | { |
||
5757 | this.gridViewRevMarkup.Visibility = Visibility.Collapsed; |
||
5758 | } |
||
5759 | } |
||
5760 | |||
5761 | private void SyncPageBalance_Click(object sender, RoutedEventArgs e) |
||
5762 | { |
||
5763 | |||
5764 | if (BalanceMode.IsChecked) |
||
5765 | { |
||
5766 | ViewerDataModel.Instance.PageBalanceMode = true; |
||
5767 | } |
||
5768 | else |
||
5769 | { |
||
5770 | ViewerDataModel.Instance.PageBalanceMode = false; |
||
5771 | ViewerDataModel.Instance.PageBalanceNumber = 0; |
||
5772 | } |
||
5773 | } |
||
5774 | |||
5775 | private void SyncExit_Click(object sender, RoutedEventArgs e) |
||
5776 | { |
||
5777 | //초기화 |
||
5778 | testPanel2.IsHidden = true; |
||
5779 | ViewerDataModel.Instance.PageBalanceMode = false; |
||
5780 | ViewerDataModel.Instance.PageBalanceNumber = 0; |
||
5781 | ViewerDataModel.Instance.PageNumber = 0; |
||
5782 | ViewerDataModel.Instance.MarkupControls_Sync.Clear(); |
||
5783 | this.gridViewRevMarkup.Visibility = Visibility.Collapsed; |
||
5784 | UserList.IsChecked = false; |
||
5785 | BalanceMode.IsChecked = false; |
||
5786 | } |
||
5787 | |||
5788 | private void SyncPageChange_Click(object sender, RoutedEventArgs e) |
||
5789 | { |
||
5790 | if ((sender as System.Windows.Controls.Control).Tag != null) |
||
5791 | { |
||
5792 | //Compare 초기화 |
||
5793 | CompareMode.IsChecked = false; |
||
5794 | var balancePoint = Convert.ToInt32((sender as System.Windows.Controls.Control).Tag); |
||
5795 | |||
5796 | if (ViewerDataModel.Instance.PageNumber == 0) |
||
5797 | { |
||
5798 | ViewerDataModel.Instance.PageNumber = 1; |
||
5799 | } |
||
5800 | |||
5801 | if (ViewerDataModel.Instance.PageBalanceNumber == pageNavigator.PageCount) |
||
5802 | { |
||
5803 | } |
||
5804 | else |
||
5805 | { |
||
5806 | ViewerDataModel.Instance.PageBalanceNumber += balancePoint; |
||
5807 | } |
||
5808 | |||
5809 | if (ViewerDataModel.Instance.PageNumber == pageNavigator.PageCount && balancePoint > 0) |
||
5810 | { |
||
5811 | |||
5812 | } |
||
5813 | else if ((ViewerDataModel.Instance.PageNumber + balancePoint) >= 1) |
||
5814 | { |
||
5815 | ViewerDataModel.Instance.PageNumber += balancePoint; |
||
5816 | } |
||
5817 | |||
5818 | if (!testPanel2.IsHidden) |
||
5819 | { |
||
5820 | if (IsSyncPDFMode) |
||
5821 | { |
||
5822 | Get_FinalImage.Get_PdfImage get_PdfImage = new Get_FinalImage.Get_PdfImage(); |
||
5823 | var pdfpath = new BitmapImage(new Uri(get_PdfImage.Run(CurrentRev.TO_VENDOR, App.ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber))); |
||
5824 | |||
5825 | if (pdfpath.IsDownloading) |
||
5826 | { |
||
5827 | pdfpath.DownloadCompleted += (ex, arg) => |
||
5828 | { |
||
5829 | ViewerDataModel.Instance.ImageViewPath_C = pdfpath; |
||
5830 | ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth; |
||
5831 | ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight; |
||
5832 | zoomAndPanCanvas2.Width = pdfpath.PixelWidth; |
||
5833 | zoomAndPanCanvas2.Height = pdfpath.PixelHeight; |
||
5834 | }; |
||
5835 | } |
||
5836 | else |
||
5837 | { |
||
5838 | ViewerDataModel.Instance.ImageViewPath_C = pdfpath; |
||
5839 | ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth; |
||
5840 | ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight; |
||
5841 | |||
5842 | zoomAndPanCanvas2.Width = pdfpath.PixelWidth; |
||
5843 | zoomAndPanCanvas2.Height = pdfpath.PixelHeight; |
||
5844 | } |
||
5845 | |||
5846 | } |
||
5847 | else |
||
5848 | { |
||
5849 | a874198d | humkyung | string uri = ""; |
5850 | |||
5851 | if (userData.COMPANY != "EXT") |
||
5852 | { |
||
5853 | 90e7968d | ljiyeon | uri = String.Format(Properties.Settings.Default.mainServerImageWebPath, _ViewInfo.ProjectNO, (Convert.ToUInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber); |
5854 | a874198d | humkyung | } |
5855 | else |
||
5856 | { |
||
5857 | uri = String.Format(Properties.Settings.Default.subServerImageWebPath, _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber); |
||
5858 | } |
||
5859 | 787a4489 | KangIngu | |
5860 | var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri)); |
||
5861 | |||
5862 | ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare; |
||
5863 | ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth; |
||
5864 | ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight; |
||
5865 | |||
5866 | zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth; |
||
5867 | zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight; |
||
5868 | |||
5869 | if (defaultBitmapImage_Compare.IsDownloading) |
||
5870 | { |
||
5871 | defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) => |
||
5872 | { |
||
5873 | ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare; |
||
5874 | ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth; |
||
5875 | ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight; |
||
5876 | |||
5877 | zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth; |
||
5878 | zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight; |
||
5879 | }; |
||
5880 | } |
||
5881 | } |
||
5882 | |||
5883 | //강인구 추가(페이지 이동시 코멘트 재 호출) |
||
5884 | ViewerDataModel.Instance.MarkupControls_Sync.Clear(); |
||
5885 | List<MarkupInfoItem> gridSelectionRevItem = gridViewRevMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); |
||
5886 | |||
5887 | foreach (var item in gridSelectionRevItem) |
||
5888 | { |
||
5889 | item.MarkupList.Where(pageItem => pageItem.PageNumber == ViewerDataModel.Instance.PageNumber).ToList().ForEach(delegate (MarkupItem markupitem) |
||
5890 | { |
||
5891 | 661b7416 | humkyung | MarkupParser.ParseEx(App.ViewInfo.ProjectNO, markupitem.Data, Common.ViewerDataModel.Instance.MarkupControls_Sync, item.DisplayColor, "", item.MarkupInfoID); |
5892 | 787a4489 | KangIngu | }); |
5893 | } |
||
5894 | e54660e8 | KangIngu | |
5895 | 787a4489 | KangIngu | //강인구 추가 |
5896 | zoomAndPanControl2.ZoomTo(new Rect |
||
5897 | { |
||
5898 | X = 0, |
||
5899 | Y = 0, |
||
5900 | Width = Math.Max(zoomAndPanCanvas.Width, zoomAndPanCanvas2.Width), |
||
5901 | Height = Math.Max(zoomAndPanCanvas.Height, zoomAndPanCanvas2.Height), |
||
5902 | }); |
||
5903 | ae56d52d | KangIngu | |
5904 | 787a4489 | KangIngu | tlSyncPageNum.Text = String.Format("Current Page : {0}", ViewerDataModel.Instance.PageNumber); |
5905 | |||
5906 | } |
||
5907 | } |
||
5908 | } |
||
5909 | |||
5910 | private void SyncChange_Click(object sender, RoutedEventArgs e) |
||
5911 | { |
||
5912 | if (MarkupMode.IsChecked) |
||
5913 | { |
||
5914 | IsSyncPDFMode = true; |
||
5915 | |||
5916 | var uri = CurrentRev.TO_VENDOR; |
||
5917 | ae56d52d | KangIngu | |
5918 | 787a4489 | KangIngu | if (ViewerDataModel.Instance.PageNumber == 0) |
5919 | { |
||
5920 | ViewerDataModel.Instance.PageNumber = 1; |
||
5921 | } |
||
5922 | |||
5923 | //PDF모드 잠시 대기(강인구) |
||
5924 | Get_FinalImage.Get_PdfImage get_PdfImage = new Get_FinalImage.Get_PdfImage(); |
||
5925 | var pdfpath = new BitmapImage(new Uri(get_PdfImage.Run(CurrentRev.TO_VENDOR, App.ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, ViewerDataModel.Instance.PageNumber))); |
||
5926 | |||
5927 | if (pdfpath.IsDownloading) |
||
5928 | { |
||
5929 | pdfpath.DownloadCompleted += (ex, arg) => |
||
5930 | { |
||
5931 | ViewerDataModel.Instance.ImageViewPath_C = pdfpath; |
||
5932 | ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth; |
||
5933 | ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight; |
||
5934 | zoomAndPanCanvas2.Width = pdfpath.PixelWidth; |
||
5935 | zoomAndPanCanvas2.Height = pdfpath.PixelHeight; |
||
5936 | }; |
||
5937 | } |
||
5938 | else |
||
5939 | { |
||
5940 | ViewerDataModel.Instance.ImageViewPath_C = pdfpath; |
||
5941 | ViewerDataModel.Instance.ImageViewWidth_C = pdfpath.PixelWidth; |
||
5942 | ViewerDataModel.Instance.ImageViewHeight_C = pdfpath.PixelHeight; |
||
5943 | |||
5944 | zoomAndPanCanvas2.Width = pdfpath.PixelWidth; |
||
5945 | zoomAndPanCanvas2.Height = pdfpath.PixelHeight; |
||
5946 | } |
||
5947 | } |
||
5948 | else |
||
5949 | { |
||
5950 | IsSyncPDFMode = false; |
||
5951 | a874198d | humkyung | string uri = ""; |
5952 | if (userData.COMPANY != "EXT") |
||
5953 | { |
||
5954 | 90e7968d | ljiyeon | uri = String.Format(Properties.Settings.Default.mainServerImageWebPath, _ViewInfo.ProjectNO, (Convert.ToUInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber); |
5955 | a874198d | humkyung | } |
5956 | else |
||
5957 | { |
||
5958 | uri = String.Format(Properties.Settings.Default.subServerImageWebPath, _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber); |
||
5959 | } |
||
5960 | 787a4489 | KangIngu | |
5961 | var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri)); |
||
5962 | |||
5963 | ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare; |
||
5964 | ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth; |
||
5965 | ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight; |
||
5966 | |||
5967 | if (defaultBitmapImage_Compare.IsDownloading) |
||
5968 | { |
||
5969 | defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) => |
||
5970 | { |
||
5971 | ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare; |
||
5972 | ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth; |
||
5973 | ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight; |
||
5974 | }; |
||
5975 | } |
||
5976 | zoomAndPanControl2.ApplyTemplate(); |
||
5977 | zoomAndPanControl2.UpdateLayout(); |
||
5978 | zoomAndPanCanvas2.Width = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentWidth); |
||
5979 | zoomAndPanCanvas2.Height = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentHeight); |
||
5980 | } |
||
5981 | } |
||
5982 | |||
5983 | private void RadButton_Click(object sender, RoutedEventArgs e) |
||
5984 | { |
||
5985 | gridViewHistory_Busy.IsBusy = true; |
||
5986 | |||
5987 | RadButton instance = sender as RadButton; |
||
5988 | if (instance.CommandParameter != null) |
||
5989 | { |
||
5990 | CurrentRev = instance.CommandParameter as VPRevision; |
||
5991 | BaseClient.GetSyncMarkupInfoItemsCompleted += (sen, ea) => |
||
5992 | { |
||
5993 | if (ea.Error == null && ea.Result != null) |
||
5994 | { |
||
5995 | testPanel2.IsHidden = false; |
||
5996 | |||
5997 | ViewerDataModel.Instance._markupInfoRevList = SetDisplayColor(ea.Result, _ViewInfo.UserID); |
||
5998 | gridViewRevMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoRevList; |
||
5999 | |||
6000 | a874198d | humkyung | string uri = ""; |
6001 | if (userData.COMPANY != "EXT") |
||
6002 | { |
||
6003 | 90e7968d | ljiyeon | uri = String.Format(Properties.Settings.Default.mainServerImageWebPath, _ViewInfo.ProjectNO, (Convert.ToUInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber); |
6004 | a874198d | humkyung | } |
6005 | else |
||
6006 | { |
||
6007 | uri = String.Format(Properties.Settings.Default.subServerImageWebPath, _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber); |
||
6008 | } |
||
6009 | 787a4489 | KangIngu | |
6010 | Sync_Offset_Point = new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY); |
||
6011 | |||
6012 | var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri)); |
||
6013 | |||
6014 | ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare; |
||
6015 | ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth; |
||
6016 | ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight; |
||
6017 | |||
6018 | if (defaultBitmapImage_Compare.IsDownloading) |
||
6019 | { |
||
6020 | defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) => |
||
6021 | { |
||
6022 | ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare; |
||
6023 | ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth; |
||
6024 | ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight; |
||
6025 | }; |
||
6026 | } |
||
6027 | |||
6028 | zoomAndPanCanvas2.Width = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentWidth); |
||
6029 | zoomAndPanCanvas2.Height = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentHeight); |
||
6030 | zoomAndPanControl2.RotationAngle = zoomAndPanControl.RotationAngle; |
||
6031 | zoomAndPanControl2.ApplyTemplate(); |
||
6032 | zoomAndPanControl2.UpdateLayout(); |
||
6033 | |||
6034 | if (Sync_Offset_Point != new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY)) |
||
6035 | { |
||
6036 | zoomAndPanControl.ContentOffsetX = Sync_Offset_Point.X; |
||
6037 | zoomAndPanControl.ContentOffsetY = Sync_Offset_Point.Y; |
||
6038 | } |
||
6039 | |||
6040 | 9cd2865b | KangIngu | ViewerDataModel.Instance.Sync_ContentOffsetX = Sync_Offset_Point.X; |
6041 | ViewerDataModel.Instance.Sync_ContentOffsetY = Sync_Offset_Point.Y; |
||
6042 | ViewerDataModel.Instance.Sync_ContentScale = zoomAndPanControl.ContentScale; |
||
6043 | |||
6044 | 787a4489 | KangIngu | tlSyncRev.Text = String.Format("Rev. {0}", CurrentRev.RevNo); |
6045 | tlSyncPageNum.Text = String.Format("Current Page : {0}", pageNavigator.CurrentPage.PageNumber); |
||
6046 | gridViewHistory_Busy.IsBusy = false; |
||
6047 | } |
||
6048 | 0f065e57 | ljiyeon | |
6049 | Logger.sendResLog("GetSyncMarkupInfoItemsCompleted", "UserState : " + ea.UserState + "\r Result :" + ea.Result + "\r Cancelled :" + ea.Cancelled + "\r Error :" + ea.Error, 1); |
||
6050 | 90e7968d | ljiyeon | }; |
6051 | 787a4489 | KangIngu | BaseClient.GetSyncMarkupInfoItemsAsync(_ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, _ViewInfo.UserID); |
6052 | 0f065e57 | ljiyeon | Logger.sendReqLog("GetSyncMarkupInfoItemsAsync", _ViewInfo.ProjectNO + "," + CurrentRev.DOCUMENT_ID + "," + _ViewInfo.UserID, 1); |
6053 | 787a4489 | KangIngu | } |
6054 | } |
||
6055 | |||
6056 | public void Sync_Event(VPRevision Currnet_Rev) |
||
6057 | { |
||
6058 | CurrentRev = Currnet_Rev; |
||
6059 | |||
6060 | BaseClient.GetSyncMarkupInfoItemsCompleted += (sen, ea) => |
||
6061 | { |
||
6062 | if (ea.Error == null && ea.Result != null) |
||
6063 | { |
||
6064 | testPanel2.IsHidden = false; |
||
6065 | |||
6066 | ViewerDataModel.Instance._markupInfoRevList = SetDisplayColor(ea.Result, _ViewInfo.UserID); |
||
6067 | gridViewRevMarkup.ItemsSource = ViewerDataModel.Instance._markupInfoRevList; |
||
6068 | |||
6069 | a874198d | humkyung | string uri = ""; |
6070 | a1716fa5 | KangIngu | if (userData.COMPANY != "EXT") |
6071 | a874198d | humkyung | { |
6072 | 90e7968d | ljiyeon | uri = String.Format(Properties.Settings.Default.mainServerImageWebPath, _ViewInfo.ProjectNO, (Convert.ToUInt32(CurrentRev.DOCUMENT_ID) / 100).ToString(), CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber); |
6073 | a874198d | humkyung | } |
6074 | else |
||
6075 | { |
||
6076 | uri = String.Format(Properties.Settings.Default.subServerImageWebPath, _ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber); |
||
6077 | } |
||
6078 | 787a4489 | KangIngu | |
6079 | Sync_Offset_Point = new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY); |
||
6080 | |||
6081 | var defaultBitmapImage_Compare = new BitmapImage(new Uri(uri)); |
||
6082 | |||
6083 | ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare; |
||
6084 | ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth; |
||
6085 | ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight; |
||
6086 | |||
6087 | if (defaultBitmapImage_Compare.IsDownloading) |
||
6088 | { |
||
6089 | defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) => |
||
6090 | { |
||
6091 | ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare; |
||
6092 | ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth; |
||
6093 | ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight; |
||
6094 | }; |
||
6095 | } |
||
6096 | 90e7968d | ljiyeon | |
6097 | |||
6098 | 787a4489 | KangIngu | zoomAndPanCanvas2.Width = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentWidth); |
6099 | zoomAndPanCanvas2.Height = Convert.ToDouble(Common.ViewerDataModel.Instance.ContentHeight); |
||
6100 | zoomAndPanControl2.ApplyTemplate(); |
||
6101 | zoomAndPanControl2.UpdateLayout(); |
||
6102 | |||
6103 | if (Sync_Offset_Point != new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY)) |
||
6104 | { |
||
6105 | zoomAndPanControl.ContentOffsetX = Sync_Offset_Point.X; |
||
6106 | zoomAndPanControl.ContentOffsetY = Sync_Offset_Point.Y; |
||
6107 | } |
||
6108 | //} |
||
6109 | |||
6110 | tlSyncRev.Text = String.Format("Rev. {0}", CurrentRev.RevNo); |
||
6111 | tlSyncPageNum.Text = String.Format("Current Page : {0}", pageNavigator.CurrentPage.PageNumber); |
||
6112 | 90e7968d | ljiyeon | gridViewHistory_Busy.IsBusy = false; |
6113 | 787a4489 | KangIngu | } |
6114 | 0f065e57 | ljiyeon | Logger.sendResLog("GetSyncMarkupInfoItemsCompleted", "UserState : " + ea.UserState + "\r Result :" + ea.Result + "\r Cancelled :" + ea.Cancelled + "\r Error :" + ea.Error, 1); |
6115 | 90e7968d | ljiyeon | |
6116 | 787a4489 | KangIngu | }; |
6117 | 0f065e57 | ljiyeon | Logger.sendReqLog("GetSyncMarkupInfoItemsAsync", _ViewInfo.ProjectNO + "," + CurrentRev.DOCUMENT_ID + "," + _ViewInfo.UserID, 1); |
6118 | 90e7968d | ljiyeon | BaseClient.GetSyncMarkupInfoItemsAsync(_ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, _ViewInfo.UserID); |
6119 | 787a4489 | KangIngu | } |
6120 | |||
6121 | private void PdfLink_ButtonDown(object sender, MouseButtonEventArgs e) |
||
6122 | { |
||
6123 | if (sender is Image) |
||
6124 | { |
||
6125 | if ((sender as Image).Tag != null) |
||
6126 | { |
||
6127 | var pdfUrl = (sender as Image).Tag.ToString(); |
||
6128 | System.Diagnostics.Process.Start(pdfUrl); |
||
6129 | } |
||
6130 | else |
||
6131 | { |
||
6132 | this.ParentOfType<MainWindow>().DialogMessage_Alert("문서 정보가 잘못 되었습니다", "안내"); |
||
6133 | } |
||
6134 | } |
||
6135 | } |
||
6136 | |||
6137 | private void Create_Symbol(object sender, RoutedEventArgs e) |
||
6138 | { |
||
6139 | 5529d2a2 | humkyung | MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn markupReturn = new MarkupToPDF.Controls.Parsing.MarkupParser.MarkupReturn(); |
6140 | 787a4489 | KangIngu | |
6141 | if (SelectLayer.Children.Count < 1) //선택된 것이 없으면 |
||
6142 | { |
||
6143 | DialogMessage_Alert("Please Select Controls", "Alert"); |
||
6144 | } |
||
6145 | else //선택된 것이 있으면 |
||
6146 | { |
||
6147 | string MarkupData = ""; |
||
6148 | adorner_ = new AdornerFinal(); |
||
6149 | |||
6150 | foreach (var item in SelectLayer.Children) |
||
6151 | { |
||
6152 | if (item.GetType().Name == "AdornerFinal") |
||
6153 | { |
||
6154 | adorner_ = (item as Controls.AdornerFinal); |
||
6155 | foreach (var InnerItem in (item as Controls.AdornerFinal).MemberSet.Cast<Controls.AdornerMember>()) |
||
6156 | { |
||
6157 | if (!ViewerDataModel.Instance.MarkupControls.Contains(InnerItem.DrawingData)) |
||
6158 | { |
||
6159 | 5529d2a2 | humkyung | markupReturn = MarkupParser.MarkupToString(InnerItem.DrawingData as MarkupToPDF.Common.CommentUserInfo, App.ViewInfo.UserID); |
6160 | 787a4489 | KangIngu | MarkupData += markupReturn.ConvertData; |
6161 | } |
||
6162 | } |
||
6163 | } |
||
6164 | } |
||
6165 | DialogParameters parameters = new DialogParameters() |
||
6166 | { |
||
6167 | b9b01f8e | ljiyeon | Owner = Application.Current.MainWindow, |
6168 | 787a4489 | KangIngu | Closed = (obj, args) => this.MarkupNamePromptClose(MarkupData, args), |
6169 | DefaultPromptResultValue = "Custom State", |
||
6170 | Content = "Name :", |
||
6171 | Header = "Insert Custom Symbol Name", |
||
6172 | Theme = new VisualStudio2013Theme(), |
||
6173 | ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 }, |
||
6174 | }; |
||
6175 | RadWindow.Prompt(parameters); |
||
6176 | } |
||
6177 | |||
6178 | } |
||
6179 | 53880c83 | ljiyeon | public int symbolselectindex = 0; |
6180 | private void SymbolMarkupNamePromptClose(byte[] Img_byte, string data, WindowClosedEventArgs args) |
||
6181 | { |
||
6182 | //Save save = new Save(); |
||
6183 | try |
||
6184 | { |
||
6185 | string svgfilename = null; |
||
6186 | if (symbolname != null) |
||
6187 | { |
||
6188 | if (symbolpng == true || symbolsvg == true) |
||
6189 | { |
||
6190 | kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload(); |
||
6191 | string guid = Save.shortGuid(); |
||
6192 | |||
6193 | fileUploader.RunAsync(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, guid + ".png", Img_byte); |
||
6194 | c73426a9 | ljiyeon | //Check_Uri.UriCheck(); |
6195 | 53880c83 | ljiyeon | fileUploader.RunCompleted += (ex, arg) => |
6196 | { |
||
6197 | filename = arg.Result; |
||
6198 | if (symbolpng == true) |
||
6199 | { |
||
6200 | if (filename != null) |
||
6201 | { |
||
6202 | if (symbolselectindex == 0) |
||
6203 | { |
||
6204 | SymbolSave(symbolname, filename, data); |
||
6205 | } |
||
6206 | else |
||
6207 | { |
||
6208 | SymbolSave_Public(symbolname, filename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT); |
||
6209 | } |
||
6210 | DataBind(); |
||
6211 | } |
||
6212 | } |
||
6213 | |||
6214 | if (symbolsvg == true) |
||
6215 | { |
||
6216 | c73426a9 | ljiyeon | try |
6217 | 53880c83 | ljiyeon | { |
6218 | c73426a9 | ljiyeon | var defaultBitmapImage = new BitmapImage(); |
6219 | defaultBitmapImage.BeginInit(); |
||
6220 | defaultBitmapImage.CreateOptions = BitmapCreateOptions.IgnoreImageCache; |
||
6221 | defaultBitmapImage.CacheOption = BitmapCacheOption.OnLoad; |
||
6222 | Check_Uri.UriCheck(filename); |
||
6223 | defaultBitmapImage.UriSource = new Uri(filename); |
||
6224 | defaultBitmapImage.EndInit(); |
||
6225 | 53880c83 | ljiyeon | |
6226 | c73426a9 | ljiyeon | System.Drawing.Bitmap image; |
6227 | 53880c83 | ljiyeon | |
6228 | c73426a9 | ljiyeon | if (defaultBitmapImage.IsDownloading) |
6229 | { |
||
6230 | defaultBitmapImage.DownloadCompleted += (ex2, arg2) => |
||
6231 | 53880c83 | ljiyeon | { |
6232 | c73426a9 | ljiyeon | defaultBitmapImage.Freeze(); |
6233 | image = GetBitmap(defaultBitmapImage); |
||
6234 | image.Save(@AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp", System.Drawing.Imaging.ImageFormat.Bmp); |
||
6235 | Process potrace = new Process |
||
6236 | 53880c83 | ljiyeon | { |
6237 | c73426a9 | ljiyeon | StartInfo = new ProcessStartInfo |
6238 | { |
||
6239 | FileName = @AppDomain.CurrentDomain.BaseDirectory + "potrace.exe", |
||
6240 | Arguments = "-b svg " + @AppDomain.CurrentDomain.BaseDirectory + "potrace.bmp", |
||
6241 | RedirectStandardInput = true, |
||
6242 | RedirectStandardOutput = true, |
||
6243 | RedirectStandardError = true, |
||
6244 | UseShellExecute = false, |
||
6245 | CreateNoWindow = true, |
||
6246 | WindowStyle = ProcessWindowStyle.Hidden |
||
6247 | }, |
||
6248 | }; |
||
6249 | 53880c83 | ljiyeon | |
6250 | c73426a9 | ljiyeon | StringBuilder svgBuilder = new StringBuilder(); |
6251 | potrace.OutputDataReceived += (object sender2, DataReceivedEventArgs e2) => |
||
6252 | 53880c83 | ljiyeon | { |
6253 | c73426a9 | ljiyeon | svgBuilder.AppendLine(e2.Data); |
6254 | }; |
||
6255 | |||
6256 | potrace.EnableRaisingEvents = true; |
||
6257 | potrace.Start(); |
||
6258 | potrace.Exited += (sender, e) => |
||
6259 | 53880c83 | ljiyeon | { |
6260 | c73426a9 | ljiyeon | byte[] bytes = System.IO.File.ReadAllBytes(@AppDomain.CurrentDomain.BaseDirectory + "potrace.svg"); |
6261 | svgfilename = fileUploader.Run(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, guid + ".svg", bytes); |
||
6262 | Check_Uri.UriCheck(svgfilename); |
||
6263 | if (symbolselectindex == 0) |
||
6264 | { |
||
6265 | SymbolSave(symbolname, svgfilename, data); |
||
6266 | } |
||
6267 | else |
||
6268 | { |
||
6269 | SymbolSave_Public(symbolname, svgfilename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT); |
||
6270 | } |
||
6271 | 53880c83 | ljiyeon | |
6272 | c73426a9 | ljiyeon | DataBind(); |
6273 | }; |
||
6274 | potrace.WaitForExit(); |
||
6275 | 53880c83 | ljiyeon | }; |
6276 | c73426a9 | ljiyeon | } |
6277 | else |
||
6278 | { |
||
6279 | //GC.Collect(); |
||
6280 | } |
||
6281 | 53880c83 | ljiyeon | } |
6282 | c73426a9 | ljiyeon | catch(Exception ee) |
6283 | 90e7968d | ljiyeon | { |
6284 | c73426a9 | ljiyeon | DialogMessage_Alert("" + ee, "Alert"); |
6285 | 90e7968d | ljiyeon | } |
6286 | 53880c83 | ljiyeon | } |
6287 | }; |
||
6288 | } |
||
6289 | } |
||
6290 | } |
||
6291 | catch (Exception e) |
||
6292 | { |
||
6293 | //DialogMessage_Alert(e + "", "Alert"); |
||
6294 | } |
||
6295 | } |
||
6296 | |||
6297 | public void SymbolSave(string Name, string Url, string Data) |
||
6298 | { |
||
6299 | try |
||
6300 | { |
||
6301 | SYMBOL_PRIVATE symbol_private = new SYMBOL_PRIVATE |
||
6302 | { |
||
6303 | ID = Events.Save.shortGuid(), |
||
6304 | MEMBER_USER_ID = App.ViewInfo.UserID, |
||
6305 | NAME = Name, |
||
6306 | IMAGE_URL = Url, |
||
6307 | DATA = Data |
||
6308 | }; |
||
6309 | |||
6310 | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolCompleted += BaseClient_SaveSymbolCompleted; |
||
6311 | Logger.sendReqLog("SaveSymbolAsync: ", symbol_private.ID + "," + symbol_private.MEMBER_USER_ID + "," + symbol_private.NAME + "," + symbol_private.IMAGE_URL + "," + symbol_private.DATA, 1); |
||
6312 | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.SaveSymbolAsync(symbol_private); |
||
6313 | } |
||
6314 | catch (Exception) |
||
6315 | { |
||
6316 | throw; |
||
6317 | } |
||
6318 | } |
||
6319 | |||
6320 | public void SymbolSave_Public(string Name, string Url, string Data, string Department) |
||
6321 | { |
||
6322 | try |
||
6323 | { |
||
6324 | SYMBOL_PUBLIC symbol_public = new SYMBOL_PUBLIC |
||
6325 | { |
||
6326 | ID = Events.Save.shortGuid(), |
||
6327 | DEPARTMENT = Department, |
||
6328 | NAME = Name, |
||
6329 | IMAGE_URL = Url, |
||
6330 | DATA = Data |
||
6331 | }; |
||
6332 | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddPublicSymbolCompleted += BaseClient_AddPublicSymbolCompleted; |
||
6333 | Logger.sendReqLog("AddPublicSymbol: ", symbol_public.ID + "," + symbol_public.DEPARTMENT + "," + symbol_public.NAME + "," + symbol_public.IMAGE_URL + "," + symbol_public.DATA, 1); |
||
6334 | Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.BaseClient.AddPublicSymbol(symbol_public); |
||
6335 | } |
||
6336 | catch (Exception) |
||
6337 | { |
||
6338 | throw; |
||
6339 | } |
||
6340 | } |
||
6341 | |||
6342 | private void BaseClient_AddPublicSymbolCompleted(object sender, ServiceDeepView.AddPublicSymbolCompletedEventArgs e) |
||
6343 | { |
||
6344 | Logger.sendResLog("AddPublicSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
||
6345 | DataBind(); |
||
6346 | } |
||
6347 | |||
6348 | private void BaseClient_SaveSymbolCompleted(object sender, ServiceDeepView.SaveSymbolCompletedEventArgs e) |
||
6349 | { |
||
6350 | Logger.sendResLog("RenameSymbolCompleted", "UserState : " + e.UserState + "\r Result :" + e.Result + "\r Cancelled :" + e.Cancelled + "\r Error :" + e.Error, 1); |
||
6351 | DataBind(); |
||
6352 | } |
||
6353 | private void DataBind() |
||
6354 | { |
||
6355 | try |
||
6356 | { |
||
6357 | Symbol_Custom Custom = new Symbol_Custom(); |
||
6358 | List<Symbol_Custom> Custom_List = new List<Symbol_Custom>(); |
||
6359 | ServiceDeepView.ServiceDeepViewClient client = new ServiceDeepView.ServiceDeepViewClient(App._binding, App._EndPoint); |
||
6360 | var symbol_Private = client.GetSymbolList(App.ViewInfo.UserID); |
||
6361 | foreach (var item in symbol_Private) |
||
6362 | { |
||
6363 | Custom.Name = item.NAME; |
||
6364 | Custom.ImageUri = item.IMAGE_URL; |
||
6365 | Custom.ID = item.ID; |
||
6366 | Custom_List.Add(Custom); |
||
6367 | Custom = new Symbol_Custom(); |
||
6368 | } |
||
6369 | symbolPanel_Instance.lstSymbolPrivate.ItemsSource = Custom_List; |
||
6370 | |||
6371 | Custom = new Symbol_Custom(); |
||
6372 | Custom_List = new List<Symbol_Custom>(); |
||
6373 | |||
6374 | symbolPanel_Instance.deptlist.ItemsSource = client.GetPublicSymbolDeptList(); |
||
6375 | |||
6376 | List<SYMBOL_PUBLIC> symbol_Public; |
||
6377 | 787a4489 | KangIngu | |
6378 | 53880c83 | ljiyeon | |
6379 | if (symbolPanel_Instance.deptlist.SelectedValue != null) |
||
6380 | { |
||
6381 | symbol_Public = client.GetPublicSymbolList(symbolPanel_Instance.deptlist.SelectedValue.ToString()); |
||
6382 | } |
||
6383 | else |
||
6384 | { |
||
6385 | symbol_Public = client.GetPublicSymbolList(null); |
||
6386 | } |
||
6387 | foreach (var item in symbol_Public) |
||
6388 | { |
||
6389 | Custom.Name = item.NAME; |
||
6390 | Custom.ImageUri = item.IMAGE_URL; |
||
6391 | Custom.ID = item.ID; |
||
6392 | Custom_List.Add(Custom); |
||
6393 | Custom = new Symbol_Custom(); |
||
6394 | } |
||
6395 | symbolPanel_Instance.lstSymbolPublic.ItemsSource = Custom_List; |
||
6396 | client.Close(); |
||
6397 | } |
||
6398 | catch(Exception e) |
||
6399 | { |
||
6400 | //DialogMessage_Alert("DataBind", "Alert"); |
||
6401 | } |
||
6402 | |||
6403 | } |
||
6404 | 787a4489 | KangIngu | private void MarkupNamePromptClose(string data, WindowClosedEventArgs args) |
6405 | { |
||
6406 | c73426a9 | ljiyeon | try |
6407 | 787a4489 | KangIngu | { |
6408 | c73426a9 | ljiyeon | Save save = new Save(); |
6409 | if (args.PromptResult != null) |
||
6410 | 53880c83 | ljiyeon | { |
6411 | c73426a9 | ljiyeon | if (args.DialogResult.Value) |
6412 | { |
||
6413 | PngBitmapEncoder _Encoder = symImage(data); |
||
6414 | 787a4489 | KangIngu | |
6415 | c73426a9 | ljiyeon | System.IO.MemoryStream fs = new System.IO.MemoryStream(); |
6416 | _Encoder.Save(fs); |
||
6417 | System.Drawing.Image ImgOut = System.Drawing.Image.FromStream(fs); |
||
6418 | 787a4489 | KangIngu | |
6419 | c73426a9 | ljiyeon | byte[] Img_byte = fs.ToArray(); |
6420 | 787a4489 | KangIngu | |
6421 | c73426a9 | ljiyeon | kr.co.devdoftech.cloud.FileUpload fileUploader = new kr.co.devdoftech.cloud.FileUpload(); |
6422 | filename = fileUploader.Run(App.ViewInfo.ProjectNO, _DocItem.DOCUMENT_NO, App.ViewInfo.UserID, Save.shortGuid() + ".png", Img_byte); |
||
6423 | Check_Uri.UriCheck(filename); |
||
6424 | if (symbolPanel_Instance.RadTab.SelectedIndex == 0) |
||
6425 | { |
||
6426 | save.SymbolSave(args.PromptResult, filename, data); |
||
6427 | } |
||
6428 | else |
||
6429 | { |
||
6430 | save.SymbolSave_Public(args.PromptResult, filename, data, ViewerDataModel.Instance.SystemMain.dzMainMenu.userData.DEPARTMENT); |
||
6431 | } |
||
6432 | DataBind(); |
||
6433 | 53880c83 | ljiyeon | } |
6434 | } |
||
6435 | 787a4489 | KangIngu | } |
6436 | c73426a9 | ljiyeon | catch(Exception ex) |
6437 | { |
||
6438 | DialogMessage_Alert("" + ex, "Alert"); |
||
6439 | } |
||
6440 | 787a4489 | KangIngu | } |
6441 | |||
6442 | public PngBitmapEncoder symImage(string data) |
||
6443 | { |
||
6444 | |||
6445 | Canvas _canvas = new Canvas(); |
||
6446 | _canvas.Background = Brushes.White; |
||
6447 | _canvas.Width = adorner_.BorderSize.Width; |
||
6448 | _canvas.Height = adorner_.BorderSize.Height; |
||
6449 | 5529d2a2 | humkyung | MarkupParser.Parse(App.ViewInfo.ProjectNO, data, _canvas, "#FFFF0000", ""); |
6450 | 787a4489 | KangIngu | |
6451 | BitmapEncoder encoder = new PngBitmapEncoder(); |
||
6452 | |||
6453 | |||
6454 | RenderTargetBitmap renderBitmap = new RenderTargetBitmap((int)_canvas.Width + 50, (int)_canvas.Height + 50, 96d, 96d, PixelFormats.Pbgra32); |
||
6455 | |||
6456 | DrawingVisual dv = new DrawingVisual(); |
||
6457 | |||
6458 | _canvas.Measure(new System.Windows.Size(adorner_.BorderSize.Width + 50, adorner_.BorderSize.Height + 50)); |
||
6459 | _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))); |
||
6460 | |||
6461 | using (DrawingContext ctx = dv.RenderOpen()) |
||
6462 | { |
||
6463 | VisualBrush vb = new VisualBrush(_canvas); |
||
6464 | 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))); |
||
6465 | } |
||
6466 | |||
6467 | try |
||
6468 | { |
||
6469 | renderBitmap.Render(dv); |
||
6470 | |||
6471 | 90e7968d | ljiyeon | //GC.Collect(); |
6472 | 787a4489 | KangIngu | GC.WaitForPendingFinalizers(); |
6473 | 90e7968d | ljiyeon | //GC.Collect(); |
6474 | 787a4489 | KangIngu | // encode png data |
6475 | PngBitmapEncoder pngEncoder = new PngBitmapEncoder(); |
||
6476 | // puch rendered bitmap into it |
||
6477 | pngEncoder.Interlace = PngInterlaceOption.Off; |
||
6478 | pngEncoder.Frames.Add(BitmapFrame.Create(renderBitmap)); |
||
6479 | return pngEncoder; |
||
6480 | |||
6481 | } |
||
6482 | 53880c83 | ljiyeon | catch //(Exception ex) |
6483 | 787a4489 | KangIngu | { |
6484 | return null; |
||
6485 | } |
||
6486 | |||
6487 | } |
||
6488 | |||
6489 | public void DialogMessage_Alert(string content, string header) |
||
6490 | { |
||
6491 | var box = new TextBlock(); |
||
6492 | box.MinWidth = 400; |
||
6493 | box.FontSize = 11; |
||
6494 | //box.FontSize = 12; |
||
6495 | box.Text = content; |
||
6496 | box.TextWrapping = System.Windows.TextWrapping.Wrap; |
||
6497 | |||
6498 | DialogParameters parameters = new DialogParameters() |
||
6499 | { |
||
6500 | b9b01f8e | ljiyeon | Owner = Application.Current.MainWindow, |
6501 | 787a4489 | KangIngu | Content = box, |
6502 | Header = header, |
||
6503 | Theme = new VisualStudio2013Theme(), |
||
6504 | ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 }, |
||
6505 | 90e7968d | ljiyeon | }; |
6506 | 787a4489 | KangIngu | RadWindow.Alert(parameters); |
6507 | } |
||
6508 | |||
6509 | #region 캡쳐 기능 |
||
6510 | |||
6511 | public BitmapSource CutAreaToImage(int x, int y, int width, int height) |
||
6512 | { |
||
6513 | if (x < 0) |
||
6514 | { |
||
6515 | width += x; |
||
6516 | x = 0; |
||
6517 | } |
||
6518 | if (y < 0) |
||
6519 | { |
||
6520 | height += y; |
||
6521 | y = 0; |
||
6522 | |||
6523 | width = (int)zoomAndPanCanvas.ActualWidth - x; |
||
6524 | } |
||
6525 | if (x + width > zoomAndPanCanvas.ActualWidth) |
||
6526 | { |
||
6527 | width = (int)zoomAndPanCanvas.ActualWidth - x; |
||
6528 | } |
||
6529 | if (y + height > zoomAndPanCanvas.ActualHeight) |
||
6530 | { |
||
6531 | height = (int)zoomAndPanCanvas.ActualHeight - y; |
||
6532 | } |
||
6533 | |||
6534 | byte[] pixels = CopyPixels(x, y, width, height); |
||
6535 | |||
6536 | int stride = (width * canvasImage.Format.BitsPerPixel + 7) / 8; |
||
6537 | |||
6538 | return BitmapSource.Create(width, height, 96, 96, PixelFormats.Pbgra32, null, pixels, stride); |
||
6539 | } |
||
6540 | |||
6541 | public byte[] CopyPixels(int x, int y, int width, int height) |
||
6542 | { |
||
6543 | byte[] pixels = new byte[width * height * 4]; |
||
6544 | int stride = (width * canvasImage.Format.BitsPerPixel + 7) / 8; |
||
6545 | |||
6546 | // Canvas 이미지에서 객체 역역만큼 픽셀로 복사 |
||
6547 | canvasImage.CopyPixels(new Int32Rect(x, y, width, height), pixels, stride, 0); |
||
6548 | |||
6549 | return pixels; |
||
6550 | } |
||
6551 | |||
6552 | public RenderTargetBitmap ConverterBitmapImage(FrameworkElement element) |
||
6553 | { |
||
6554 | DrawingVisual drawingVisual = new DrawingVisual(); |
||
6555 | DrawingContext drawingContext = drawingVisual.RenderOpen(); |
||
6556 | |||
6557 | // 해당 객체의 그래픽요소로 사각형의 그림을 그립니다. |
||
6558 | drawingContext.DrawRectangle(new VisualBrush(element), null, |
||
6559 | new Rect(new Point(0, 0), new Point(element.ActualWidth, element.ActualHeight))); |
||
6560 | drawingContext.Close(); |
||
6561 | |||
6562 | // 비트맵으로 변환합니다. |
||
6563 | RenderTargetBitmap target = |
||
6564 | new RenderTargetBitmap((int)element.ActualWidth, (int)element.ActualHeight, |
||
6565 | 96, 96, System.Windows.Media.PixelFormats.Pbgra32); |
||
6566 | |||
6567 | target.Render(drawingVisual); |
||
6568 | return target; |
||
6569 | } |
||
6570 | |||
6571 | 53880c83 | ljiyeon | System.Drawing.Bitmap GetBitmap(BitmapSource source) |
6572 | { |
||
6573 | System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(source.PixelWidth, source.PixelHeight, System.Drawing.Imaging.PixelFormat.Format32bppPArgb); |
||
6574 | 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); |
||
6575 | source.CopyPixels(Int32Rect.Empty, data.Scan0, data.Height * data.Stride, data.Stride); |
||
6576 | bmp.UnlockBits(data); |
||
6577 | return bmp; |
||
6578 | } |
||
6579 | public string symbolname = null; |
||
6580 | public bool symbolsvg = true; |
||
6581 | public bool symbolpng = true; |
||
6582 | |||
6583 | public void Save_Symbol_Capture(BitmapSource source, int x, int y, int width, int height) |
||
6584 | { |
||
6585 | System.Drawing.Bitmap image = GetBitmap(source); |
||
6586 | //흰색 제거 |
||
6587 | //image.MakeTransparent(System.Drawing.Color.White); |
||
6588 | |||
6589 | var imageStream = new System.IO.MemoryStream(); |
||
6590 | byte[] imageBytes = null; |
||
6591 | using (imageStream) |
||
6592 | { |
||
6593 | image.Save(imageStream, System.Drawing.Imaging.ImageFormat.Png); |
||
6594 | // test.Save(@"E:\test.png", System.Drawing.Imaging.ImageFormat.Png); |
||
6595 | imageStream.Position = 0; |
||
6596 | imageBytes = imageStream.ToArray(); |
||
6597 | } |
||
6598 | |||
6599 | SymbolPrompt symbolPrompt = new SymbolPrompt(); |
||
6600 | |||
6601 | RadWindow CheckPop = new RadWindow(); |
||
6602 | //Alert check = new Alert(Msg); |
||
6603 | |||
6604 | CheckPop = new RadWindow |
||
6605 | { |
||
6606 | MinWidth = 400, |
||
6607 | MinHeight = 100, |
||
6608 | // Closed = (obj, args) => this.SymbolMarkupNamePromptClose(imageBytes, "", args), |
||
6609 | Header = "Alert", |
||
6610 | Content = symbolPrompt, |
||
6611 | //DialogResult = |
||
6612 | ResizeMode = System.Windows.ResizeMode.NoResize, |
||
6613 | WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen, |
||
6614 | IsTopmost = true, |
||
6615 | }; |
||
6616 | CheckPop.Closed += (obj, args) => this.SymbolMarkupNamePromptClose(imageBytes, "", args); |
||
6617 | StyleManager.SetTheme(CheckPop, new Office2013Theme()); |
||
6618 | CheckPop.ShowDialog(); |
||
6619 | |||
6620 | /* |
||
6621 | DialogParameters parameters = new DialogParameters() |
||
6622 | { |
||
6623 | Owner = Application.Current.MainWindow, |
||
6624 | Closed = (obj, args) => this.SymbolMarkupNamePromptClose(imageBytes, "", args), |
||
6625 | DefaultPromptResultValue = "Custom State", |
||
6626 | Content = "Name :", |
||
6627 | Header = "Insert Custom Symbol Name", |
||
6628 | Theme = new VisualStudio2013Theme(), |
||
6629 | ModalBackground = new SolidColorBrush { Color = Colors.Black, Opacity = 0.6 }, |
||
6630 | }; |
||
6631 | RadWindow.Prompt(parameters); |
||
6632 | */ |
||
6633 | } |
||
6634 | |||
6635 | 787a4489 | KangIngu | public void Save_Capture(BitmapSource source, int x, int y, int width, int height) |
6636 | { |
||
6637 | KCOM.Common.Converter.FileStreamToBase64 streamToBase64 = new Common.Converter.FileStreamToBase64(); |
||
6638 | KCOMDataModel.DataModel.CHECK_LIST check_; |
||
6639 | string Result = streamToBase64.ImageToBase64(source); |
||
6640 | KCOMDataModel.DataModel.CHECK_LIST Item = new KCOMDataModel.DataModel.CHECK_LIST(); |
||
6641 | 6c781c0c | djkim | string projectno = App.ViewInfo.ProjectNO; |
6642 | string checklist_id = ViewerDataModel.Instance.CheckList_ID; |
||
6643 | 0f065e57 | ljiyeon | |
6644 | Logger.sendReqLog("GetCheckList", projectno + "," + checklist_id, 1); |
||
6645 | 6c781c0c | djkim | Item = this.BaseClient.GetCheckList(projectno, checklist_id); |
6646 | 90e7968d | ljiyeon | if (Item != null) |
6647 | 0f065e57 | ljiyeon | { |
6648 | Logger.sendResLog("GetCheckList", "TRUE", 1); |
||
6649 | } |
||
6650 | else |
||
6651 | { |
||
6652 | Logger.sendResLog("GetCheckList", "FALSE", 1); |
||
6653 | } |
||
6654 | 90e7968d | ljiyeon | |
6655 | 6c781c0c | djkim | if (Item == null) |
6656 | 787a4489 | KangIngu | { |
6657 | 6c781c0c | djkim | check_ = new KCOMDataModel.DataModel.CHECK_LIST |
6658 | 787a4489 | KangIngu | { |
6659 | 6c781c0c | djkim | ID = Save.shortGuid(), |
6660 | USER_ID = App.ViewInfo.UserID, |
||
6661 | IMAGE_URL = Result, |
||
6662 | IMAGE_ANCHOR = x + "," + y + "," + width + "," + height, |
||
6663 | PAGENUMBER = this.pageNavigator.CurrentPage.PageNumber, |
||
6664 | REVISION = ViewerDataModel.Instance.SystemMain.dzMainMenu.CurrentDoc.Revision, |
||
6665 | DOCUMENT_ID = App.ViewInfo.DocumentItemID, |
||
6666 | PROJECT_NO = App.ViewInfo.ProjectNO, |
||
6667 | STATUS = "False", |
||
6668 | CREATE_TIME = DateTime.Now, |
||
6669 | UPDATE_TIME = DateTime.Now, |
||
6670 | DOCUMENT_NO = _DocItem.DOCUMENT_NO, |
||
6671 | STATUS_DESC_OPEN = "Vendor 반영 필요", |
||
6672 | }; |
||
6673 | 0f065e57 | ljiyeon | Logger.sendReqLog("AddCheckList", projectno + "," + check_, 1); |
6674 | Logger.sendResLog("AddCheckList", this.BaseClient.AddCheckList(projectno, check_).ToString(), 1); |
||
6675 | //this.BaseClient.AddCheckList(projectno, check_); |
||
6676 | 787a4489 | KangIngu | } |
6677 | 6c781c0c | djkim | else |
6678 | { |
||
6679 | Item.IMAGE_URL = Result; |
||
6680 | Item.IMAGE_ANCHOR = x + "," + y + "," + width + "," + height; |
||
6681 | 90e7968d | ljiyeon | Item.PAGENUMBER = this.pageNavigator.CurrentPage.PageNumber; |
6682 | 0f065e57 | ljiyeon | Logger.sendReqLog("SaveCheckList", projectno + "," + checklist_id + "," + Item, 1); |
6683 | Logger.sendResLog("SaveCheckList", this.BaseClient.SaveCheckList(projectno, checklist_id, Item).ToString(), 1); |
||
6684 | //this.BaseClient.SaveCheckList(projectno, checklist_id, Item); |
||
6685 | 6c781c0c | djkim | } |
6686 | 90e7968d | ljiyeon | |
6687 | 787a4489 | KangIngu | } |
6688 | |||
6689 | public void Set_Capture() |
||
6690 | 90e7968d | ljiyeon | { |
6691 | 787a4489 | KangIngu | double x = canvasDrawingMouseDownPoint.X; |
6692 | double y = canvasDrawingMouseDownPoint.Y; |
||
6693 | double width = dragCaptureBorder.Width; |
||
6694 | double height = dragCaptureBorder.Height; |
||
6695 | |||
6696 | if (width > 5 || height > 5) |
||
6697 | { |
||
6698 | canvasImage = ConverterBitmapImage(zoomAndPanCanvas); |
||
6699 | BitmapSource source = CutAreaToImage((int)x, (int)y, (int)width, (int)height); |
||
6700 | Save_Capture(source, (int)x, (int)y, (int)width, (int)height); |
||
6701 | } |
||
6702 | } |
||
6703 | #endregion |
||
6704 | |||
6705 | 7cee8c20 | ljiyeon | TempFile temp = new TempFile(); |
6706 | d7548b21 | ljiyeon | //MarkupInfoItem |
6707 | 787a4489 | KangIngu | public void CreateControl() |
6708 | 90e7968d | ljiyeon | { |
6709 | |||
6710 | 787a4489 | KangIngu | ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i => |
6711 | { |
||
6712 | ViewerDataModel.Instance.UndoDataList.Remove(i); |
||
6713 | }); |
||
6714 | multi_Undo_Data.Markup = currentControl; |
||
6715 | UndoData.Markup_List.Add(multi_Undo_Data); |
||
6716 | 90e7968d | ljiyeon | |
6717 | 787a4489 | KangIngu | ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
6718 | d7548b21 | ljiyeon | |
6719 | //List<MarkupInfoItem> gridSelectionItem = gridViewMarkup.SelectedItems.Cast<MarkupInfoItem>().ToList(); |
||
6720 | 787a4489 | KangIngu | } |
6721 | 90e7968d | ljiyeon | |
6722 | 787a4489 | KangIngu | public Multi_Undo_data Control_Style(CommentUserInfo control) |
6723 | { |
||
6724 | multi_Undo_Data = new Multi_Undo_data(); |
||
6725 | |||
6726 | multi_Undo_Data.Markup = control; |
||
6727 | |||
6728 | if ((control as IShapeControl) != null) |
||
6729 | { |
||
6730 | multi_Undo_Data.paint = (control as IShapeControl).Paint; |
||
6731 | } |
||
6732 | if ((control as IDashControl) != null) |
||
6733 | { |
||
6734 | multi_Undo_Data.DashSize = (control as IDashControl).DashSize; |
||
6735 | } |
||
6736 | if ((control as IPath) != null) |
||
6737 | { |
||
6738 | multi_Undo_Data.LineSize = (control as IPath).LineSize; |
||
6739 | } |
||
6740 | if ((control as UIElement) != null) |
||
6741 | { |
||
6742 | multi_Undo_Data.Opacity = (control as UIElement).Opacity; |
||
6743 | } |
||
6744 | |||
6745 | return multi_Undo_Data; |
||
6746 | } |
||
6747 | |||
6748 | public void Undo() |
||
6749 | { |
||
6750 | 90e7968d | ljiyeon | // if (ViewerDataModel.Instance.IsPressCtrl) |
6751 | // { |
||
6752 | // ViewerDataModel.Instance.IsPressCtrl = false; |
||
6753 | // } |
||
6754 | 787a4489 | KangIngu | Undo_data undo = new Undo_data(); |
6755 | AdornerFinal final; |
||
6756 | ReleaseAdorner(); |
||
6757 | |||
6758 | undo = ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == false).ToList().OrderByDescending(order => order.EventTime).FirstOrDefault(); |
||
6759 | if (undo == null) |
||
6760 | return; |
||
6761 | |||
6762 | 90e7968d | ljiyeon | |
6763 | d7548b21 | ljiyeon | |
6764 | 787a4489 | KangIngu | switch (undo.Event) |
6765 | { |
||
6766 | case (Event_Type.Create): |
||
6767 | { |
||
6768 | foreach (var item in undo.Markup_List) |
||
6769 | { |
||
6770 | ViewerDataModel.Instance.MarkupControls_USER.Remove((item.Markup)); |
||
6771 | } |
||
6772 | } |
||
6773 | break; |
||
6774 | case (Event_Type.Delete): |
||
6775 | { |
||
6776 | foreach (var item in undo.Markup_List) |
||
6777 | { |
||
6778 | ViewerDataModel.Instance.MarkupControls_USER.Add(item.Markup); |
||
6779 | } |
||
6780 | } |
||
6781 | break; |
||
6782 | case (Event_Type.Thumb): |
||
6783 | { |
||
6784 | List<CommentUserInfo> comment = new List<CommentUserInfo>(); |
||
6785 | |||
6786 | foreach (var item in undo.Markup_List) |
||
6787 | { |
||
6788 | ViewerDataModel.Instance.MarkupControls_USER.Remove((item.Markup)); |
||
6789 | |||
6790 | if ((item.Markup as IViewBox) != null) |
||
6791 | { |
||
6792 | (item.Markup as IViewBox).Angle = item.Angle; |
||
6793 | } |
||
6794 | if ((item.Markup as TextControl) != null) |
||
6795 | { |
||
6796 | (item.Markup as TextControl).Angle = item.Angle; |
||
6797 | Canvas.SetLeft((item.Markup as TextControl), item.PointSet[0].X); |
||
6798 | Canvas.SetTop((item.Markup as TextControl), item.PointSet[0].Y); |
||
6799 | } |
||
6800 | else |
||
6801 | { |
||
6802 | (item.Markup as IPath).PointSet = item.PointSet; |
||
6803 | (item.Markup as IPath).updateControl(); |
||
6804 | } |
||
6805 | |||
6806 | comment.Add(item.Markup); |
||
6807 | } |
||
6808 | final = new AdornerFinal(comment); |
||
6809 | SelectLayer.Children.Add(final); |
||
6810 | ReleaseAdorner(); |
||
6811 | } |
||
6812 | break; |
||
6813 | case (Event_Type.Select): |
||
6814 | { |
||
6815 | ReleaseAdorner(); |
||
6816 | List<CommentUserInfo> comment = new List<CommentUserInfo>(); |
||
6817 | |||
6818 | foreach (var item in undo.Markup_List) |
||
6819 | { |
||
6820 | ViewerDataModel.Instance.MarkupControls_USER.Remove((item.Markup)); |
||
6821 | |||
6822 | if ((item.Markup as IPath) != null) |
||
6823 | { |
||
6824 | (item.Markup as IPath).LineSize = item.LineSize; |
||
6825 | } |
||
6826 | if ((item.Markup as UIElement) != null) |
||
6827 | { |
||
6828 | (item.Markup as UIElement).Opacity = item.Opacity; |
||
6829 | } |
||
6830 | if ((item.Markup as IDashControl) != null) |
||
6831 | { |
||
6832 | (item.Markup as IDashControl).DashSize = item.DashSize; |
||
6833 | } |
||
6834 | if ((item.Markup as IShapeControl) != null) |
||
6835 | { |
||
6836 | (item.Markup as IShapeControl).Paint = item.paint; |
||
6837 | } |
||
6838 | |||
6839 | comment.Add(item.Markup); |
||
6840 | } |
||
6841 | |||
6842 | final = new AdornerFinal(comment); |
||
6843 | SelectLayer.Children.Add(final); |
||
6844 | } |
||
6845 | break; |
||
6846 | case (Event_Type.Option): |
||
6847 | { |
||
6848 | List<CommentUserInfo> comment = new List<CommentUserInfo>(); |
||
6849 | |||
6850 | foreach (var item in undo.Markup_List) |
||
6851 | { |
||
6852 | ViewerDataModel.Instance.MarkupControls_USER.Remove(item.Markup); |
||
6853 | |||
6854 | if (undo.LineSize != 0 && item.Markup as IPath != null) |
||
6855 | { |
||
6856 | (item.Markup as IPath).LineSize = undo.LineSize; |
||
6857 | } |
||
6858 | else if (undo.Opacity != 0 && item.Markup as UIElement != null) |
||
6859 | { |
||
6860 | (item.Markup as UIElement).Opacity = undo.Opacity; |
||
6861 | } |
||
6862 | else if (undo.DashSize != null && item.Markup as IDashControl != null) |
||
6863 | { |
||
6864 | (item.Markup as IDashControl).DashSize = undo.DashSize; |
||
6865 | } |
||
6866 | 5ce56a3a | KangIngu | else if (undo.Interval != 0 && item.Markup as LineControl != null) |
6867 | { |
||
6868 | (item.Markup as LineControl).Interval = undo.Interval; |
||
6869 | } |
||
6870 | 787a4489 | KangIngu | else if (item.Markup as IShapeControl != null) |
6871 | { |
||
6872 | (item.Markup as IShapeControl).Paint = undo.paint; |
||
6873 | } |
||
6874 | comment.Add(item.Markup); |
||
6875 | } |
||
6876 | final = new AdornerFinal(comment); |
||
6877 | SelectLayer.Children.Add(final); |
||
6878 | } |
||
6879 | break; |
||
6880 | } |
||
6881 | ViewerDataModel.Instance.UndoDataList.Where(data => data.EventTime == undo.EventTime).ToList().OrderByDescending(order => order.EventTime).ToList().ForEach(i => |
||
6882 | 90e7968d | ljiyeon | { |
6883 | i.IsUndo = true; |
||
6884 | }); |
||
6885 | 787a4489 | KangIngu | } |
6886 | |||
6887 | 6707a5c7 | ljiyeon | |
6888 | 90e7968d | ljiyeon | |
6889 | 787a4489 | KangIngu | public void Redo() |
6890 | { |
||
6891 | 75448f5e | ljiyeon | //if (ViewerDataModel.Instance.IsPressCtrl) |
6892 | //{ |
||
6893 | // ViewerDataModel.Instance.IsPressCtrl = false; |
||
6894 | //} |
||
6895 | 787a4489 | KangIngu | AdornerFinal final; |
6896 | Undo_data redo = new Undo_data(); |
||
6897 | redo = ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().OrderBy(order => order.EventTime).FirstOrDefault(); |
||
6898 | ReleaseAdorner(); |
||
6899 | if (redo == null) |
||
6900 | return; |
||
6901 | |||
6902 | switch (redo.Event) |
||
6903 | { |
||
6904 | case (Event_Type.Create): |
||
6905 | { |
||
6906 | foreach (var item in redo.Markup_List) |
||
6907 | { |
||
6908 | ViewerDataModel.Instance.MarkupControls_USER.Add(item.Markup); |
||
6909 | 6707a5c7 | ljiyeon | //temp.AddTemp(redo, pageNavigator.CurrentPage.PageNumber, 0, 0); |
6910 | 787a4489 | KangIngu | } |
6911 | } |
||
6912 | break; |
||
6913 | case (Event_Type.Delete): |
||
6914 | { |
||
6915 | foreach (var item in redo.Markup_List) |
||
6916 | { |
||
6917 | ViewerDataModel.Instance.MarkupControls_USER.Remove(item.Markup); |
||
6918 | } |
||
6919 | } |
||
6920 | break; |
||
6921 | case (Event_Type.Thumb): |
||
6922 | { |
||
6923 | List<CommentUserInfo> comment = new List<CommentUserInfo>(); |
||
6924 | |||
6925 | foreach (var item in redo.Markup_List) |
||
6926 | { |
||
6927 | ViewerDataModel.Instance.MarkupControls_USER.Remove((item.Markup as CommentUserInfo)); |
||
6928 | |||
6929 | if ((item.Markup as IViewBox) != null) |
||
6930 | { |
||
6931 | (item.Markup as IViewBox).Angle = item.Angle; |
||
6932 | } |
||
6933 | if ((item.Markup as TextControl) != null) |
||
6934 | { |
||
6935 | (item.Markup as TextControl).Angle = item.Angle; |
||
6936 | |||
6937 | Canvas.SetLeft((item.Markup as TextControl), item.PointSet[0].X); |
||
6938 | Canvas.SetTop((item.Markup as TextControl), item.PointSet[0].Y); |
||
6939 | } |
||
6940 | else |
||
6941 | { |
||
6942 | (item.Markup as IPath).PointSet = item.PointSet; |
||
6943 | (item.Markup as IPath).updateControl(); |
||
6944 | } |
||
6945 | comment.Add(item.Markup); |
||
6946 | } |
||
6947 | final = new AdornerFinal(comment); |
||
6948 | SelectLayer.Children.Add(final); |
||
6949 | ReleaseAdorner(); |
||
6950 | } |
||
6951 | break; |
||
6952 | case (Event_Type.Select): |
||
6953 | { |
||
6954 | List<CommentUserInfo> comment = new List<CommentUserInfo>(); |
||
6955 | |||
6956 | foreach (var item in redo.Markup_List) |
||
6957 | { |
||
6958 | ViewerDataModel.Instance.MarkupControls_USER.Remove(item.Markup); |
||
6959 | |||
6960 | if ((item.Markup as IPath) != null) |
||
6961 | { |
||
6962 | (item.Markup as IPath).LineSize = item.LineSize; |
||
6963 | } |
||
6964 | if ((item.Markup as UIElement) != null) |
||
6965 | { |
||
6966 | (item.Markup as UIElement).Opacity = item.Opacity; |
||
6967 | } |
||
6968 | if ((item.Markup as IDashControl) != null) |
||
6969 | { |
||
6970 | (item.Markup as IDashControl).DashSize = item.DashSize; |
||
6971 | } |
||
6972 | if ((item.Markup as IShapeControl) != null) |
||
6973 | { |
||
6974 | (item.Markup as IShapeControl).Paint = item.paint; |
||
6975 | } |
||
6976 | |||
6977 | comment.Add(item.Markup); |
||
6978 | } |
||
6979 | final = new AdornerFinal(comment); |
||
6980 | SelectLayer.Children.Add(final); |
||
6981 | } |
||
6982 | break; |
||
6983 | case (Event_Type.Option): |
||
6984 | { |
||
6985 | List<CommentUserInfo> comment = new List<CommentUserInfo>(); |
||
6986 | |||
6987 | foreach (var item in redo.Markup_List) |
||
6988 | { |
||
6989 | ViewerDataModel.Instance.MarkupControls_USER.Remove(item.Markup); |
||
6990 | if (redo.LineSize != 0 && item.Markup as IPath != null) |
||
6991 | { |
||
6992 | (item.Markup as IPath).LineSize = redo.LineSize; |
||
6993 | } |
||
6994 | else if (redo.Opacity != 0 && item.Markup as UIElement != null) |
||
6995 | { |
||
6996 | (item.Markup as UIElement).Opacity = redo.Opacity; |
||
6997 | } |
||
6998 | else if (redo.DashSize != null && item.Markup as IDashControl != null) |
||
6999 | { |
||
7000 | (item.Markup as IDashControl).DashSize = redo.DashSize; |
||
7001 | } |
||
7002 | a1716fa5 | KangIngu | else if (redo.Interval != 0 && item.Markup as LineControl != null) |
7003 | 5ce56a3a | KangIngu | { |
7004 | (item.Markup as LineControl).Interval = redo.Interval; |
||
7005 | } |
||
7006 | 787a4489 | KangIngu | else if (item.Markup as IShapeControl != null) |
7007 | { |
||
7008 | (item.Markup as IShapeControl).Paint = redo.paint; |
||
7009 | } |
||
7010 | comment.Add(item.Markup); |
||
7011 | } |
||
7012 | final = new AdornerFinal(comment); |
||
7013 | SelectLayer.Children.Add(final); |
||
7014 | } |
||
7015 | break; |
||
7016 | } |
||
7017 | |||
7018 | ViewerDataModel.Instance.UndoDataList.Where(data => data.EventTime == redo.EventTime).ToList().OrderByDescending(order => order.EventTime).ToList().ForEach(i => |
||
7019 | { |
||
7020 | i.IsUndo = false; |
||
7021 | }); |
||
7022 | } |
||
7023 | |||
7024 | private void Comment_Move(object sender, MouseButtonEventArgs e) |
||
7025 | { |
||
7026 | string Select_ID = (((e.Source as Telerik.Windows.Controls.RadButton).DataContext) as IKCOM.MarkupInfoItem).UserID; |
||
7027 | foreach (var items in ViewerDataModel.Instance._markupInfoRevList) |
||
7028 | { |
||
7029 | if (items.UserID == Select_ID) |
||
7030 | { |
||
7031 | foreach (var item in items.MarkupList) |
||
7032 | { |
||
7033 | if (item.PageNumber == pageNavigator.CurrentPage.PageNumber) |
||
7034 | { |
||
7035 | 661b7416 | humkyung | MarkupParser.ParseEx(App.ViewInfo.ProjectNO, item.Data, Common.ViewerDataModel.Instance.MarkupControls_USER, "#FFFF0000", "", |
7036 | items.MarkupInfoID, Save.shortGuid()); |
||
7037 | 787a4489 | KangIngu | } |
7038 | } |
||
7039 | } |
||
7040 | } |
||
7041 | } |
||
7042 | 23a96932 | djkim | public void EmptyControlCheck() |
7043 | { |
||
7044 | for (var j = 0; j < (Common.ViewerDataModel.Instance.MarkupControls_USER).Count; j++) |
||
7045 | { |
||
7046 | if (((Common.ViewerDataModel.Instance.MarkupControls_USER)[j]).GetType().Name == "TextControl") |
||
7047 | { |
||
7048 | if (((MarkupToPDF.Controls.Text.TextControl)(Common.ViewerDataModel.Instance.MarkupControls_USER)[j]).Text == null |
||
7049 | || ((MarkupToPDF.Controls.Text.TextControl)(Common.ViewerDataModel.Instance.MarkupControls_USER)[j]).Text == "") |
||
7050 | { |
||
7051 | Common.ViewerDataModel.Instance.MarkupControls_USER.RemoveAt(j); |
||
7052 | } |
||
7053 | } |
||
7054 | else if (((Common.ViewerDataModel.Instance.MarkupControls_USER)[j]).GetType().Name == "ArrowTextControl") |
||
7055 | { |
||
7056 | if (((MarkupToPDF.Controls.Text.ArrowTextControl)(Common.ViewerDataModel.Instance.MarkupControls_USER)[j]).Base_TextBox.Text == null |
||
7057 | || ((MarkupToPDF.Controls.Text.ArrowTextControl)(Common.ViewerDataModel.Instance.MarkupControls_USER)[j]).Base_TextBox.Text == "") |
||
7058 | { |
||
7059 | Common.ViewerDataModel.Instance.MarkupControls_USER.RemoveAt(j); |
||
7060 | } |
||
7061 | } |
||
7062 | } |
||
7063 | } |
||
7064 | 787a4489 | KangIngu | public void InkControl_Convert() |
7065 | { |
||
7066 | 548c696e | ljiyeon | Logger.sendCheckLog("pageNavigator_PageChanging_InkControl_Convert", 1); |
7067 | 787a4489 | KangIngu | if (inkBoard.Strokes.Count > 0) |
7068 | { |
||
7069 | inkBoard.Strokes.ToList().ForEach(stroke => |
||
7070 | { |
||
7071 | List<Stroke> removingStroke = new List<Stroke>(); |
||
7072 | StrokeCollection stC = new StrokeCollection(); |
||
7073 | |||
7074 | removingStroke.Add(stroke); |
||
7075 | |||
7076 | InkToPath ip = new InkToPath(); |
||
7077 | List<Point> inkPointSet = new List<Point>(); |
||
7078 | PolygonControl pc = null; |
||
7079 | pc = new PolygonControl() |
||
7080 | { |
||
7081 | Angle = 0, |
||
7082 | PointSet = new List<Point>(), |
||
7083 | ControlType = ControlType.Ink |
||
7084 | }; |
||
7085 | foreach (var item in removingStroke) |
||
7086 | { |
||
7087 | inkPointSet.AddRange(ip.StrokeGetPointsPlus(item)); |
||
7088 | inkBoard.Strokes.Remove(item); |
||
7089 | } |
||
7090 | if (inkPointSet.Count != 0) |
||
7091 | { |
||
7092 | //강인구 추가(PenControl Undo Redo 추가) |
||
7093 | UndoData = new Undo_data() |
||
7094 | { |
||
7095 | IsUndo = false, |
||
7096 | Event = Event_Type.Create, |
||
7097 | EventTime = DateTime.Now, |
||
7098 | Markup_List = new List<Multi_Undo_data>() |
||
7099 | }; |
||
7100 | |||
7101 | pc.StartPoint = inkPointSet[0]; |
||
7102 | pc.EndPoint = inkPointSet[inkPointSet.Count - 1]; |
||
7103 | pc.PointSet = inkPointSet; |
||
7104 | pc.LineSize = 3; |
||
7105 | pc.CommentID = Save.shortGuid(); |
||
7106 | pc.StrokeColor = new SolidColorBrush(Colors.Red); |
||
7107 | ViewerDataModel.Instance.MarkupControls_USER.Add(pc); |
||
7108 | 661b7416 | humkyung | ///pc.SetPolyPath(); |
7109 | 787a4489 | KangIngu | |
7110 | ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i => |
||
7111 | { |
||
7112 | ViewerDataModel.Instance.UndoDataList.Remove(i); |
||
7113 | }); |
||
7114 | multi_Undo_Data.Markup = pc as CommentUserInfo; |
||
7115 | UndoData.Markup_List.Add(multi_Undo_Data); |
||
7116 | ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
||
7117 | } |
||
7118 | }); |
||
7119 | } |
||
7120 | } |
||
7121 | 17a22987 | KangIngu | |
7122 | 4318fdeb | KangIngu | /// <summary> |
7123 | /// 정원, 정사각형, 정삼각형을 그리기 위한 EndPoint계산 |
||
7124 | /// </summary> |
||
7125 | /// <param name="StartP">StartPoint</param> |
||
7126 | /// <param name="EndP">EndPoint</param> |
||
7127 | /// <returns>Return_EndPoint</returns> |
||
7128 | private Point GetSquareEndPoint(Point StartP, Point EndP) |
||
7129 | 17a22987 | KangIngu | { |
7130 | ae56d52d | KangIngu | Point Return_Point = new Point(); |
7131 | 17a22987 | KangIngu | |
7132 | 4318fdeb | KangIngu | double dx = EndP.X - StartP.X; |
7133 | double dy = EndP.Y - StartP.Y; |
||
7134 | double length; |
||
7135 | 17a22987 | KangIngu | |
7136 | 4318fdeb | KangIngu | switch (controlType) |
7137 | { |
||
7138 | case ControlType.Triangle: |
||
7139 | { |
||
7140 | //삼각형의 StartPoint기준으로 반지름 만큼 증가하기 때문에 곱하기2 필요 |
||
7141 | length = Math.Max(Math.Abs(dx) * 2, Math.Abs(dy)); |
||
7142 | Return_Point = (dy < 0) ? new Point(StartP.X + length / 2, StartP.Y - length) : new Point(StartP.X + length / 2, StartP.Y + length); |
||
7143 | } |
||
7144 | break; |
||
7145 | default: |
||
7146 | { |
||
7147 | length = Math.Max(Math.Abs(dx), Math.Abs(dy)); |
||
7148 | Return_Point.X = (dx > 0) ? StartP.X + length : StartP.X - length; |
||
7149 | Return_Point.Y = (dy > 0) ? StartP.Y + length : StartP.Y - length; |
||
7150 | } |
||
7151 | break; |
||
7152 | } |
||
7153 | 17a22987 | KangIngu | |
7154 | return Return_Point; |
||
7155 | } |
||
7156 | e753423e | humkyung | |
7157 | /// <summary> |
||
7158 | /// 정삼각형을 그리기위한 두 포인트를 계산하여 넘겨줌 |
||
7159 | /// </summary> |
||
7160 | /// <author>humkyung</author> |
||
7161 | /// <date>2018.04.26</date> |
||
7162 | /// <param name="StartP"></param> |
||
7163 | /// <param name="EndP"></param> |
||
7164 | /// <returns></returns> |
||
7165 | 32e95118 | KangIngu | /// <history>humkyung 2018.05.11 apply axis lock</history> |
7166 | e54660e8 | KangIngu | private List<Point> GetRegularTrianglePoints(Point StartP, Point EndP, bool bCheckAxis = false) |
7167 | e753423e | humkyung | { |
7168 | List<Point> res = new List<Point>(); |
||
7169 | |||
7170 | double dx = EndP.X - StartP.X; |
||
7171 | double dy = EndP.Y - StartP.Y; |
||
7172 | double length = Math.Sqrt(dx * dx + dy * dy); |
||
7173 | e54660e8 | KangIngu | double baseLength = length * Math.Tan(30.0 * Math.PI / 180.0); |
7174 | e753423e | humkyung | dx /= length; |
7175 | dy /= length; |
||
7176 | double tmp = dx; |
||
7177 | dx = -dy; dy = tmp; /// rotate by 90 degree |
||
7178 | |||
7179 | res.Add(new Point(EndP.X + dx * baseLength, EndP.Y + dy * baseLength)); |
||
7180 | res.Add(new Point(EndP.X - dx * baseLength, EndP.Y - dy * baseLength)); |
||
7181 | |||
7182 | return res; |
||
7183 | } |
||
7184 | a1716fa5 | KangIngu | |
7185 | e66f22eb | KangIngu | /// <summary> |
7186 | /// 캔버스에 그릴때 모든 포인트가 캔버스를 벗어 났는지 체크하여 넘겨줌 |
||
7187 | /// </summary> |
||
7188 | /// <author>ingu</author> |
||
7189 | /// <date>2018.06.05</date> |
||
7190 | /// <param name="getPoint"></param> |
||
7191 | /// <returns></returns> |
||
7192 | private bool IsGetoutpoint(Point getPoint) |
||
7193 | 670a4be2 | humkyung | { |
7194 | e66f22eb | KangIngu | if (getPoint == new Point()) |
7195 | 670a4be2 | humkyung | { |
7196 | e66f22eb | KangIngu | ViewerDataModel.Instance.MarkupControls_USER.Remove(currentControl); |
7197 | currentControl = null; |
||
7198 | return true; |
||
7199 | 670a4be2 | humkyung | } |
7200 | |||
7201 | e66f22eb | KangIngu | return false; |
7202 | 670a4be2 | humkyung | } |
7203 | e66f22eb | KangIngu | |
7204 | 5b46312f | djkim | private void zoomAndPanControl_DragOver(object sender, DragEventArgs e) |
7205 | { |
||
7206 | e.Effects = DragDropEffects.Copy; |
||
7207 | } |
||
7208 | |||
7209 | private void zoomAndPanControl_DragEnter(object sender, DragEventArgs e) |
||
7210 | { |
||
7211 | e.Effects = DragDropEffects.Copy; |
||
7212 | } |
||
7213 | |||
7214 | private void zoomAndPanControl_DragLeave(object sender, DragEventArgs e) |
||
7215 | { |
||
7216 | e.Effects = DragDropEffects.None; |
||
7217 | } |
||
7218 | |||
7219 | private void zoomAndPanControl_Drop(object sender, DragEventArgs e) |
||
7220 | { |
||
7221 | 90e7968d | ljiyeon | try |
7222 | 5b46312f | djkim | { |
7223 | 90e7968d | ljiyeon | if (e.Data.GetDataPresent(typeof(string))) |
7224 | { |
||
7225 | this.getCurrentPoint = e.GetPosition(drawingRotateCanvas); |
||
7226 | string dragData = e.Data.GetData(typeof(string)) as string; |
||
7227 | Move_Symbol(sender, dragData); |
||
7228 | } |
||
7229 | 5b46312f | djkim | } |
7230 | 90e7968d | ljiyeon | catch (Exception ex) |
7231 | { |
||
7232 | Logger.sendResLog("zoomAndPanControl_Drop", ex.ToString(), 0); |
||
7233 | } |
||
7234 | 5b46312f | djkim | } |
7235 | |||
7236 | private void Move_Symbol(object sender, string dragData) |
||
7237 | { |
||
7238 | 90e7968d | ljiyeon | try |
7239 | 5b46312f | djkim | { |
7240 | 90e7968d | ljiyeon | if (dragData.Contains("|DZ|")) |
7241 | { |
||
7242 | List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>(); |
||
7243 | 5b46312f | djkim | |
7244 | 90e7968d | ljiyeon | string[] delimiterChars = { "|DZ|" }; |
7245 | string[] data = dragData.Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries); |
||
7246 | 5b46312f | djkim | |
7247 | 90e7968d | ljiyeon | this.ParentOfType<MainWindow>().dzMainMenu.ReleaseAdorner(); |
7248 | 5b46312f | djkim | |
7249 | 90e7968d | ljiyeon | Multi_Undo_data multi_Undo_Data = new Multi_Undo_data(); |
7250 | 5b46312f | djkim | |
7251 | 90e7968d | ljiyeon | //강인구 Undo/Redo 보류 |
7252 | UndoData = new Undo_data() |
||
7253 | { |
||
7254 | IsUndo = false, |
||
7255 | Event = Event_Type.Create, |
||
7256 | EventTime = DateTime.Now, |
||
7257 | Markup_List = new List<Multi_Undo_data>() |
||
7258 | }; |
||
7259 | 5b46312f | djkim | |
7260 | 90e7968d | ljiyeon | ViewerDataModel.Instance.UndoDataList.Where(data1 => data1.IsUndo == true).ToList().ForEach(i => |
7261 | { |
||
7262 | ViewerDataModel.Instance.UndoDataList.Remove(i); |
||
7263 | }); |
||
7264 | 5b46312f | djkim | |
7265 | 90e7968d | ljiyeon | foreach (string parse in data) |
7266 | 5b46312f | djkim | { |
7267 | 90e7968d | ljiyeon | if (parse != "") |
7268 | { |
||
7269 | 5529d2a2 | humkyung | System.Windows.Controls.Control item = MarkupParser.ParseEx(App.ViewInfo.ProjectNO, parse, ViewerDataModel.Instance.MarkupControls_USER, string.Empty, string.Empty); |
7270 | 90e7968d | ljiyeon | (item as MarkupToPDF.Common.CommentUserInfo).CommentID = Events.Save.shortGuid(); |
7271 | 5b46312f | djkim | |
7272 | 90e7968d | ljiyeon | ViewerDataModel.Instance.MarkupControls.Remove(item as MarkupToPDF.Common.CommentUserInfo); |
7273 | ViewerDataModel.Instance.MarkupControls_USER.Remove(item as MarkupToPDF.Common.CommentUserInfo); |
||
7274 | 5b46312f | djkim | |
7275 | 90e7968d | ljiyeon | adornerSet.Add(item as MarkupToPDF.Common.CommentUserInfo); |
7276 | 5b46312f | djkim | |
7277 | 90e7968d | ljiyeon | multi_Undo_Data = this.ParentOfType<MainWindow>().dzMainMenu.Control_Style(item as MarkupToPDF.Common.CommentUserInfo); |
7278 | 5b46312f | djkim | |
7279 | 90e7968d | ljiyeon | UndoData.Markup_List.Add(multi_Undo_Data); |
7280 | ViewerDataModel.Instance.UndoDataList.Add(UndoData); |
||
7281 | } |
||
7282 | 5b46312f | djkim | } |
7283 | 90e7968d | ljiyeon | Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet); |
7284 | 5b46312f | djkim | |
7285 | 90e7968d | ljiyeon | /// move symbol to current mouse point |
7286 | double realPointX = this.getCurrentPoint.X - final.BorderSize.X - (final.BorderSize.Width / 2); |
||
7287 | double realPointY = this.getCurrentPoint.Y - final.BorderSize.Y - (final.BorderSize.Height / 2); |
||
7288 | final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(realPointX, realPointY)); |
||
7289 | 5b46312f | djkim | |
7290 | 90e7968d | ljiyeon | if (final.MemberSet.Where(type => type.Drawingtype == MarkupToPDF.Controls.Common.ControlType.TextControl).FirstOrDefault() != null) |
7291 | { |
||
7292 | final.MoveAdorner(new System.Windows.Controls.Primitives.DragDeltaEventArgs(0.001, 0.001)); //dummy |
||
7293 | } |
||
7294 | /// up to here |
||
7295 | 6707a5c7 | ljiyeon | |
7296 | 90e7968d | ljiyeon | ViewerDataModel.Instance.SystemMain.dzMainMenu.SelectLayer.Children.Add(final); |
7297 | } |
||
7298 | 5b46312f | djkim | } |
7299 | 90e7968d | ljiyeon | catch (Exception ex) |
7300 | { |
||
7301 | Logger.sendResLog("Move_Symbol", ex.ToString(), 0); |
||
7302 | } |
||
7303 | } |
||
7304 | 787a4489 | KangIngu | } |
7305 | 5a6a5dd1 | humkyung | } |