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