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