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