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