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