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