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