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