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