프로젝트

일반

사용자정보

개정판 ea6f99ec

IDea6f99ec5c03b6e622a912c4ee77fdc0d5876266
상위 a5b465dc
하위 ec37912f, 2b282b13, 244b11c4

백흠경이(가) 5년 이상 전에 추가함

issue #534: Add UnSelect and SelectItemByRect method to SelectionSet

Change-Id: If006b652c6e29b07dab7db68213424a0ac2721dd

차이점 보기:

KCOM/Views/MainMenu.xaml.cs
364 364
        public void DeleteCommentEvent(object sender, RoutedEventArgs e)
365 365
        {
366 366
            //선택된 어도너가 있을시 삭제가 되지 않음(강인구 추가)
367
            this.ReleaseAdorner();
367
            SelectionSet.Instance.UnSelect(this);
368 368

  
369 369
            Button content = (sender as Button);
370 370
            MarkupInfoItem item = content.CommandParameter as MarkupInfoItem;
......
420 420

  
421 421
            ////GC.Collect();
422 422
        }
423

  
424
        public void ReleaseAdorner()
425
        {
426
            try
427
            {
428
                Logger.sendCheckLog("pageNavigator_PageChanging_ReleaseAdorner", 1);
429
                if (SelectLayer.Children.Count > 0)
430
                {
431
                    foreach (var item in SelectLayer.Children)
432
                    {
433
                        if (item.GetType().Name == "AdornerFinal")
434
                        {
435
                            (item as AdornerFinal).unRegister();
436

  
437
                            foreach (var InnerItem in (item as AdornerFinal).MemberSet.Cast<AdornerMember>())
438
                            {
439
                                if (!ViewerDataModel.Instance.MarkupControls_USER.Contains(InnerItem.DrawingData))
440
                                {
441
                                    if (InnerItem.DrawingData.GetType().Name == "PolygonControl")
442
                                    {
443
                                        if ((InnerItem.DrawingData as PolygonControl).CommentID == null)
444
                                        {
445
                                            (InnerItem.DrawingData as PolygonControl).CommentID = Commons.shortGuid();
446
                                        }
447
                                    }
448

  
449
                                    ViewerDataModel.Instance.MarkupControls_USER.Add(InnerItem.DrawingData as CommentUserInfo);
450
                                }
451
                            }
452
                        }
453
                    }
454
                    SelectLayer.Children.Clear();
455
                }
456
            }
457
            catch (Exception ex)
458
            {
459
                Logger.sendResLog("ReleaseAdorner", ex.ToString(), 0);
460
            }            
461
        }
462

  
423
        
463 424
        public List<CommentUserInfo> AddAdorner()
464 425
        {
465 426
            List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
......
572 533

  
573 534
            InkControl_Convert();
574 535

  
575
            ReleaseAdorner();
536
            SelectionSet.Instance.UnSelect(this);
576 537
            ChangeCommentReact();
577 538

  
578 539
            Logger.sendCheckLog("pageNavigator_PageChanging_변수생성 및 값 설정", 1);
......
2907 2868

  
2908 2869
        }
2909 2870

  
2910
        /// <summary>
2911
        /// select item which's bouding rectangle is equal to given rectangle
2912
        /// </summary>
2913
        /// <author>humkyung</author>
2914
        /// <date>2018.06.14</date>
2915
        /// <param name="rect"></param>
2916
        public void SelecteItemByRect(Rect rect)
2917
        {
2918
            multi_Undo_Data = new Multi_Undo_data();
2919

  
2920
            UndoData = new Undo_data()
2921
            {
2922
                IsUndo = false,
2923
                Event = Event_Type.Select,
2924
                EventTime = DateTime.Now,
2925
                Markup_List = new List<Multi_Undo_data>()
2926
            };
2927
           
2928
            var Items = ViewerDataModel.Instance.MarkupControls_USER.ToList();
2929

  
2930
            CommentUserInfo selected = null;
2931
            double dMinDiff = double.MaxValue;
2932
            foreach (var item in Items)
2933
            {
2934
                Rect boundingBox = item.ItemRect;
2935
                double dx = rect.X - boundingBox.X;
2936
                double dy = rect.Y - boundingBox.Y;
2937
                double dxx = rect.Right - boundingBox.Right;
2938
                double dyy = rect.Bottom - boundingBox.Bottom;
2939
                double dDiff = Math.Sqrt(dx * dx + dy * dy + dxx * dxx + dyy * dyy);
2940
                if (dDiff < dMinDiff)
2941
                {
2942
                    dMinDiff = dDiff;
2943
                    selected = item;
2944
                }
2945
            }
2946

  
2947
            if (selected != null)
2948
            {
2949
                this.ReleaseAdorner();
2950

  
2951
                List<MarkupToPDF.Common.CommentUserInfo> adornerSet = new List<MarkupToPDF.Common.CommentUserInfo>();
2952
                adornerSet.Add(selected);
2953
                ViewerDataModel.Instance.MarkupControls_USER.Remove(selected);
2954

  
2955
                Control_Style(selected);
2956
                UndoData.Markup_List.Add(multi_Undo_Data);
2957
                multi_Undo_Data = new Multi_Undo_data();
2958

  
2959
                ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().ForEach(i =>
2960
                {
2961
                    ViewerDataModel.Instance.UndoDataList.Remove(i);
2962
                });
2963
                ViewerDataModel.Instance.UndoDataList.Add(UndoData);
2964

  
2965
                Controls.AdornerFinal final = new Controls.AdornerFinal(adornerSet);
2966
                SelectLayer.Children.Add(final);
2967
            }
2968
        }
2969

  
2970 2871
        private void ApplyDragSelectionRect()
2971 2872
        {
2972 2873
            multi_Undo_Data = new Multi_Undo_data();
......
3372 3273

  
3373 3274
                if (!ViewerDataModel.Instance.IsPressCtrl)
3374 3275
                {
3375
                    ReleaseAdorner();
3276
                    SelectionSet.Instance.UnSelect(this);
3376 3277
                }
3377 3278
            }
3378 3279
            if (mouseButtonDown == MouseButton.Middle)
......
3458 3359

  
3459 3360
                    if (!ViewerDataModel.Instance.IsPressCtrl)
3460 3361
                    {
3461
                        ReleaseAdorner();
3362
                        SelectionSet.Instance.UnSelect(this);
3462 3363
                        final = new AdornerFinal(control);
3463 3364
                        //단일 컨트롤 언두 저장
3464 3365

  
......
5204 5105

  
5205 5106
                    if (!mouseOff)
5206 5107
                    {
5207
                        ReleaseAdorner();
5108
                        SelectionSet.Instance.UnSelect(this);
5208 5109
                    }
5209 5110
                }
5210 5111
                zoomAndPanControl.CaptureMouse();
......
6529 6430
            //   }
6530 6431
            Undo_data undo = new Undo_data();
6531 6432
            AdornerFinal final;
6532
            ReleaseAdorner();
6433
            SelectionSet.Instance.UnSelect(this);
6533 6434

  
6534 6435
            undo = ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == false).ToList().OrderByDescending(order => order.EventTime).FirstOrDefault();
6535 6436
            if (undo == null)
......
6583 6484
                        }
6584 6485
                        final = new AdornerFinal(comment);
6585 6486
                        SelectLayer.Children.Add(final);
6586
                        ReleaseAdorner();
6487
                        SelectionSet.Instance.UnSelect(this);
6587 6488
                    }
6588 6489
                    break;
6589 6490
                case (Event_Type.Select):
6590 6491
                    {
6591
                        ReleaseAdorner();
6492
                        SelectionSet.Instance.UnSelect(this);
6592 6493
                        List<CommentUserInfo> comment = new List<CommentUserInfo>();
6593 6494

  
6594 6495
                        foreach (var item in undo.Markup_List)
......
6671 6572
            AdornerFinal final;
6672 6573
            Undo_data redo = new Undo_data();
6673 6574
            redo = ViewerDataModel.Instance.UndoDataList.Where(data => data.IsUndo == true).ToList().OrderBy(order => order.EventTime).FirstOrDefault();
6674
            ReleaseAdorner();
6575
            SelectionSet.Instance.UnSelect(this);
6675 6576
            if (redo == null)
6676 6577
                return;
6677 6578

  
......
6722 6623
                        }
6723 6624
                        final = new AdornerFinal(comment);
6724 6625
                        SelectLayer.Children.Add(final);
6725
                        ReleaseAdorner();
6626
                        SelectionSet.Instance.UnSelect(this);
6726 6627
                    }
6727 6628
                    break;
6728 6629
                case (Event_Type.Select):
......
7020 6921
                    string[] delimiterChars = { "|DZ|" };
7021 6922
                    string[] data = dragData.Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);
7022 6923

  
7023
                    this.ParentOfType<MainWindow>().dzMainMenu.ReleaseAdorner();
6924
                    SelectionSet.Instance.UnSelect(this.ParentOfType<MainWindow>().dzMainMenu);
7024 6925

  
7025 6926
                    Multi_Undo_data multi_Undo_Data = new Multi_Undo_data();
7026 6927

  

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)