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