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