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