프로젝트

일반

사용자정보

개정판 c7fde400

IDc7fde40037aa1a1a48d3e2ea5982182ef3dc9e71
상위 f35c95d8
하위 8e5a4a6a, 899ce5f0

김태성이(가) 약 5년 전에 추가함

Issue #0020 - Symbol추가시 위치가 다른곳으로 가는 현상 수정

Change-Id: I0f49fd5e529e079224d2eb0809850e952fe8cae2

차이점 보기:

KCOM/Controls/Sample.xaml.cs
853 853
                    MarkupInfoItemSmall gaza = clickButtonItem.CommandParameter as MarkupInfoItemSmall;
854 854
                    MarkupList.SelectedItem = gaza;
855 855

  
856
                    GotoMarkup(new[] { gaza.Id });
856
                    MarkupHelper.GotoMarkup(new[] { gaza.Id });
857 857
                }
858 858
                catch (Exception ex)
859 859
                {
......
862 862
            }
863 863
        }
864 864

  
865
        /// <summary>
866
        /// 선택된 마크업의 ID리스트를 받아 해당 페이지로 이동 후 GotoSelectedMarkup 호출
867
        /// </summary>
868
        /// <param name="CommentIdList"></param>
869
        private void GotoMarkup(IEnumerable<string> CommentIdList)
870
        {
871
            var instance = Common.ViewerDataModel.Instance;
872

  
873
            SelectionSet.Instance.UnSelect(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu);
874

  
875
            var commentList = instance._markupInfoList.Where(x => x.MarkupList != null).SelectMany(x => x.MarkupList).Where(f => f.ID == CommentIdList.First());
876

  
877
            if (commentList.Count() > 0)
878
            {
879
                //하단 그리드의 markup list에서 commentid가 포함된 markupinfo를 선택되게 한다.
880
                #region markup list grid select items
881

  
882
                var infoItem = instance._markupInfoList.Where(x => x.MarkupList != null).Where(f => f.MarkupList.Count(y => y == commentList.First()) > 0);
883

  
884
                if (infoItem.Count() > 0)
885
                {
886

  
887
                    var gridMarkup = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.gridViewMarkup;
888
                    gridMarkup.SelectedItems.Clear();
889
                    gridMarkup.SelectedItems.Add(infoItem.First());
890
                }
891

  
892
                #endregion
893

  
894
                var pageNavigator = instance.SystemMain.dzMainMenu.pageNavigator;
895

  
896
                if (pageNavigator.CurrentPage.PageNumber == commentList.First().PageNumber)
897
                {
898
                    GotoSelectedMarkup(CommentIdList);
899
                }
900
                else
901
                {
902
                    EventHandler<Sample.PageChangeEventArgs> handler = null;
903

  
904
                    handler = (snd, evt) =>
905
                    {
906
                        GotoSelectedMarkup(CommentIdList);
907
                        pageNavigator.PageChanged -= handler;
908
                    };
909

  
910
                    pageNavigator.PageChanged += handler;
911

  
912
                    pageNavigator.GotoPage(commentList.First().PageNumber);
913
                }
914
            }
915
        }
916

  
917
        /// <summary>
918
        /// 페이지 이동 후 마크업을 선택하고 Zoom을 한다.
919
        /// 마크업이 페이지보다 크면 Zoom을 하지 않음.
920
        /// </summary>
921
        /// <param name="CommentIdList"></param>
922
        private void GotoSelectedMarkup(IEnumerable<string> CommentIdList)
923
        {
924
            var instance = Common.ViewerDataModel.Instance;
925

  
926
            var selectOrderComments = instance.MarkupControls.Where(x => CommentIdList.Count(y => y == x.CommentID) > 0).ToList();
927
            var commentUserInfo = instance.MarkupControls_USER.Where(x => CommentIdList.Count(y => y == x.CommentID) > 0).ToList();
928

  
929
            if (commentUserInfo.Count() > 0 || selectOrderComments.Count() > 0)
930
            {
931
                commentUserInfo.ForEach(x => x.IsSelected = true);
932
                commentUserInfo.AddRange(selectOrderComments);
933

  
934
                if (commentUserInfo?.Count() > 0)
935
                {
936
                    var main = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu;
937

  
938
                    try
939
                    {
940
                        if(Common.ViewerDataModel.Instance.Angle != 0)
941
                        {
942
                            for (int i = 0; i < (Common.ViewerDataModel.Instance.Angle / 90); i++)
943
                            {
944
                                Common.ViewerDataModel.Instance.SystemMain.dzTopMenu.drawingPannelRotate(true);
945
                            } 
865
        ///// <summary>
866
        ///// 선택된 마크업의 ID리스트를 받아 해당 페이지로 이동 후 GotoSelectedMarkup 호출
867
        ///// </summary>
868
        ///// <param name="CommentIdList"></param>
869
        //private void GotoMarkup(IEnumerable<string> CommentIdList)
870
        //{
871
        //    var instance = Common.ViewerDataModel.Instance;
872

  
873
        //    SelectionSet.Instance.UnSelect(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu);
874

  
875
        //    var commentList = instance._markupInfoList.Where(x => x.MarkupList != null).SelectMany(x => x.MarkupList).Where(f => f.ID == CommentIdList.First());
876

  
877
        //    if (commentList.Count() > 0)
878
        //    {
879
        //        //하단 그리드의 markup list에서 commentid가 포함된 markupinfo를 선택되게 한다.
880
        //        #region markup list grid select items
881

  
882
        //        var infoItem = instance._markupInfoList.Where(x => x.MarkupList != null).Where(f => f.MarkupList.Count(y => y == commentList.First()) > 0);
883

  
884
        //        if (infoItem.Count() > 0)
885
        //        {
886

  
887
        //            var gridMarkup = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.gridViewMarkup;
888
        //            gridMarkup.SelectedItems.Clear();
889
        //            gridMarkup.SelectedItems.Add(infoItem.First());
890
        //        }
891

  
892
        //        #endregion
893

  
894
        //        var pageNavigator = instance.SystemMain.dzMainMenu.pageNavigator;
895

  
896
        //        if (pageNavigator.CurrentPage.PageNumber == commentList.First().PageNumber)
897
        //        {
898
        //            GotoSelectedMarkup(CommentIdList);
899
        //        }
900
        //        else
901
        //        {
902
        //            EventHandler<Sample.PageChangeEventArgs> handler = null;
903

  
904
        //            handler = (snd, evt) =>
905
        //            {
906
        //                GotoSelectedMarkup(CommentIdList);
907
        //                pageNavigator.PageChanged -= handler;
908
        //            };
909

  
910
        //            pageNavigator.PageChanged += handler;
911

  
912
        //            pageNavigator.GotoPage(commentList.First().PageNumber);
913
        //        }
914
        //    }
915
        //}
916

  
917
        ///// <summary>
918
        ///// 페이지 이동 후 마크업을 선택하고 Zoom을 한다.
919
        ///// 마크업이 페이지보다 크면 Zoom을 하지 않음.
920
        ///// </summary>
921
        ///// <param name="CommentIdList"></param>
922
        //private void GotoSelectedMarkup(IEnumerable<string> CommentIdList)
923
        //{
924
        //    var instance = Common.ViewerDataModel.Instance;
925

  
926
        //    var selectOrderComments = instance.MarkupControls.Where(x => CommentIdList.Count(y => y == x.CommentID) > 0).ToList();
927
        //    var commentUserInfo = instance.MarkupControls_USER.Where(x => CommentIdList.Count(y => y == x.CommentID) > 0).ToList();
928

  
929
        //    if (commentUserInfo.Count() > 0 || selectOrderComments.Count() > 0)
930
        //    {
931
        //        commentUserInfo.ForEach(x => x.IsSelected = true);
932
        //        commentUserInfo.AddRange(selectOrderComments);
933

  
934
        //        if (commentUserInfo?.Count() > 0)
935
        //        {
936
        //            var main = Common.ViewerDataModel.Instance.SystemMain.dzMainMenu;
937

  
938
        //            try
939
        //            {
940
        //                if(Common.ViewerDataModel.Instance.Angle != 0)
941
        //                {
942
        //                    for (int i = 0; i < (Common.ViewerDataModel.Instance.Angle / 90); i++)
943
        //                    {
944
        //                        Common.ViewerDataModel.Instance.SystemMain.dzTopMenu.drawingPannelRotate(true);
945
        //                    } 
946 946
                            
947
                            //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.rotate.Angle = 0;
948
                            //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.translate.X = 0;
949
                            //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.translate.Y = 0;
950
                        }
947
        //                    //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.rotate.Angle = 0;
948
        //                    //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.translate.X = 0;
949
        //                    //Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.translate.Y = 0;
950
        //                }
951 951

  
952
                        Rect rect = commentUserInfo.First().ItemRect;
952
        //                Rect rect = commentUserInfo.First().ItemRect;
953 953

  
954
                        foreach (var UserInfo in commentUserInfo)
955
                        {
956
                            rect = Rect.Union(rect, UserInfo.ItemRect);
957
                        }
954
        //                foreach (var UserInfo in commentUserInfo)
955
        //                {
956
        //                    rect = Rect.Union(rect, UserInfo.ItemRect);
957
        //                }
958 958

  
959
                        SelectionSet.Instance.SelectItemByRect(rect, main);
959
        //                SelectionSet.Instance.SelectItemByRect(rect, main);
960 960

  
961
                        var center = new Vector(Common.ViewerDataModel.Instance.ImageViewWidth / 2, Common.ViewerDataModel.Instance.ImageViewHeight / 2);
962
                        //var matrix = MatrixHelper.Rotation(Common.ViewerDataModel.Instance.Angle);
963
                        //rect.Transform(matrix);
961
        //                var center = new Vector(Common.ViewerDataModel.Instance.ImageViewWidth / 2, Common.ViewerDataModel.Instance.ImageViewHeight / 2);
962
        //                //var matrix = MatrixHelper.Rotation(Common.ViewerDataModel.Instance.Angle);
963
        //                //rect.Transform(matrix);
964 964

  
965
                        double scaleX = Common.ViewerDataModel.Instance.ImageViewWidth / rect.Width;
966
                        double scaleY = Common.ViewerDataModel.Instance.ImageViewHeight / rect.Height;
967
                        double newScale = main.zoomAndPanControl.ContentScale * Math.Min(scaleX, scaleY);
968
                        double positionX = 0;
969
                        double positionY = 0;
965
        //                double scaleX = Common.ViewerDataModel.Instance.ImageViewWidth / rect.Width;
966
        //                double scaleY = Common.ViewerDataModel.Instance.ImageViewHeight / rect.Height;
967
        //                double newScale = main.zoomAndPanControl.ContentScale * Math.Min(scaleX, scaleY);
968
        //                double positionX = 0;
969
        //                double positionY = 0;
970 970

  
971
                        if (Common.ViewerDataModel.Instance.Angle == 90)
972
                        {
973
                            positionX = Common.ViewerDataModel.Instance.ImageViewHeight + rect.X;
974
                            positionY = Common.ViewerDataModel.Instance.ImageViewWidth + rect.Y;
975
                        }
971
        //                if (Common.ViewerDataModel.Instance.Angle == 90)
972
        //                {
973
        //                    positionX = Common.ViewerDataModel.Instance.ImageViewHeight + rect.X;
974
        //                    positionY = Common.ViewerDataModel.Instance.ImageViewWidth + rect.Y;
975
        //                }
976 976

  
977
                        main.zoomAndPanControl.ContentScale = newScale;
978
                        main.zoomAndPanControl.ContentOffsetX = positionX;
979
                        main.zoomAndPanControl.ContentOffsetY = positionY;
977
        //                main.zoomAndPanControl.ContentScale = newScale;
978
        //                main.zoomAndPanControl.ContentOffsetX = positionX;
979
        //                main.zoomAndPanControl.ContentOffsetY = positionY;
980 980

  
981 981
              
982
                        var pageSize = new Size(main.pageNavigator.CurrentPage.Width, main.pageNavigator.CurrentPage.Height);
983

  
984
                        double pageAngle = Common.ViewerDataModel.Instance.Angle;
985

  
986
                        if (pageAngle == 90)
987
                        {
988
                            pageAngle = 270;
989
                        }
990
                        else
991
                        {
992
                            pageAngle = 90;
993
                        }
994

  
995
                        if ((rect.Size.Width + rect.Size.Height) > (pageSize.Width + pageSize.Height))
996
                        {
997
                            var matrix = MatrixHelper.Rotation(Common.ViewerDataModel.Instance.Angle);
998
                            rect.Transform(matrix);
999

  
1000
                            main.zoomAndPanControl.ZoomTo(rect);
1001
                        }
1002
                        else
1003
                        {
1004
                            rect.Inflate(rect.Width * 3, rect.Height * 3);
1005

  
1006
                            var matrix = MatrixHelper.Rotation(Common.ViewerDataModel.Instance.Angle);
1007
                            rect.Transform(matrix);
1008

  
1009

  
1010
                            main.zoomAndPanControl.ZoomTo(rect);
1011
                        }
1012
                    }
1013
                    catch (Exception ex)
1014
                    {
1015
                        main.DialogMessage_Alert(ex.Message, "Error");
1016
                    }
1017
                }
1018
            }
1019
        }
982
        //                var pageSize = new Size(main.pageNavigator.CurrentPage.Width, main.pageNavigator.CurrentPage.Height);
983

  
984
        //                double pageAngle = Common.ViewerDataModel.Instance.Angle;
985

  
986
        //                if (pageAngle == 90)
987
        //                {
988
        //                    pageAngle = 270;
989
        //                }
990
        //                else
991
        //                {
992
        //                    pageAngle = 90;
993
        //                }
994

  
995
        //                if ((rect.Size.Width + rect.Size.Height) > (pageSize.Width + pageSize.Height))
996
        //                {
997
        //                    var matrix = MatrixHelper.Rotation(Common.ViewerDataModel.Instance.Angle);
998
        //                    rect.Transform(matrix);
999

  
1000
        //                    main.zoomAndPanControl.ZoomTo(rect);
1001
        //                }
1002
        //                else
1003
        //                {
1004
        //                    rect.Inflate(rect.Width * 3, rect.Height * 3);
1005

  
1006
        //                    var matrix = MatrixHelper.Rotation(Common.ViewerDataModel.Instance.Angle);
1007
        //                    rect.Transform(matrix);
1008

  
1009

  
1010
        //                    main.zoomAndPanControl.ZoomTo(rect);
1011
        //                }
1012
        //            }
1013
        //            catch (Exception ex)
1014
        //            {
1015
        //                main.DialogMessage_Alert(ex.Message, "Error");
1016
        //            }
1017
        //        }
1018
        //    }
1019
        //}
1020 1020

  
1021 1021
        private void MarkupList_Loaded(object sender, RoutedEventArgs e)
1022 1022
        {

내보내기 Unified diff

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