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