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