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