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