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