프로젝트

일반

사용자정보

개정판 39f208de

ID39f208de84f77fa1b6143e3a4f39dd8517c6dd5b
상위 f3ab410f
하위 3dbace4e

김태성이(가) 4년 이상 전에 추가함

ArrowTextControl 수정
- 화살표 Mid 포인트가 가끔 잘못 나오는 경우가 있음

Change-Id: I4b5ff997e7d284eb37e2e1de01849f176d3ef7ea

차이점 보기:

FinalService/KCOM_FinalService/UploadFinal/UploadPDF.cs
95 95
                    //WriteLog(data);
96 96
                    webClient.Headers.Add(HttpRequestHeader.ContentType, "application/soap+xml; charset=utf-8");
97 97
                    webClient.Headers.Add("SOAPAction", "http://FinalPDFUpload/UploadFinalPDF");
98
                    webClient.Encoding = System.Text.Encoding.UTF8;
99

  
98 100
                    string _result = webClient.UploadString(new Uri(UploadServiceUrl), data);
99 101
                    XmlTextReader reader = new XmlTextReader(new System.IO.StringReader(_result));
100 102

  
......
147 149

  
148 150
                    webClient.Headers.Add(HttpRequestHeader.ContentType, "text/xml");
149 151
                    webClient.Headers.Add("SOAPAction", "http://EnsemblePlus.Webservice");
150

  
152
                    webClient.Encoding = System.Text.Encoding.UTF8;
151 153
                    var result = webClient.UploadString(new Uri(UploadServiceUrl), data);
152 154
                    XmlDocument xmlDoc = new XmlDocument();
153 155
                    xmlDoc.LoadXml(result);
KCOM/Common/MathHelper.cs
14 14
        public static Point RotatePoint(Point p1, Point p2, double angle)
15 15
        {
16 16

  
17
            double radians = ConvertToRadians(angle);
18
            double sin = Math.Sin(radians);
19
            double cos = Math.Cos(radians);
17
            //double radians = ConvertToRadians(angle);
18
            //double sin = Math.Sin(radians);
19
            //double cos = Math.Cos(radians);
20 20

  
21
            // Translate point back to origin
22
            p1.X -= p2.X;
23
            p1.Y -= p2.Y;
21
            //// Translate point back to origin
22
            //p1.X -= p2.X;
23
            //p1.Y -= p2.Y;
24 24

  
25
            // Rotate point
26
            double xnew = p1.X * cos - p1.Y * sin;
27
            double ynew = p1.X * sin + p1.Y * cos;
25
            //// Rotate point
26
            //double xnew = p1.X * cos - p1.Y * sin;
27
            //double ynew = p1.X * sin + p1.Y * cos;
28 28

  
29
            // Translate point back
30
            Point newPoint = new Point((int)xnew + p2.X, (int)ynew + p2.Y);
31
            return newPoint;
29
            //// Translate point back
30
            //Point newPoint = new Point((int)xnew + p2.X, (int)ynew + p2.Y);
31

  
32

  
33
            var transform = new RotateTransform() { Angle = angle, CenterX = p2.X, CenterY = p2.Y };
34
            var transformedPoint = transform.Transform(p1);
35

  
36
            return transformedPoint;
32 37
        }
33 38

  
34 39
        public static double ConvertToRadians(double angle)
......
39 44
        public static Rect RotateRect(Rect rect,Point Center,double angle)
40 45
        {
41 46
            Rect rotateRect = rect;
42

  
43
            var centerPoint = new Point(rect.X,rect.Y);
47
   
48
            var centerPoint = new Point(rect.X + rect.Width,rect.Y + rect.Height);
44 49
            var rotationCenter = RotatePoint(centerPoint, Center, angle);
45 50

  
46 51
            if (angle == 270 || angle == 90)
......
55 60
            rotateRect.X = rotationCenter.X;
56 61
            rotateRect.Y = rotationCenter.Y;
57 62

  
58
            return rotateRect;
63
            rect.Transform(RotateAroundPoint(angle, Center));
64

  
65
            //var points = RectToPoints(rect).Select(x=> RotateAroundPoint(x,Center,angle));
66

  
67
            //var newtest = PointsToRect(points);
68

  
69
            return rect;
70
        }
71

  
72
        private static Matrix RotateAroundPoint(double angle, Point center)
73
        {
74
            // Translate the point to the origin.
75
            Matrix result = new Matrix();
76
            result.RotateAt(angle, center.X, center.Y);
77
            return result;
78
        }
79

  
80
        private static IEnumerable<Point> RectToPoints(Rect rect)
81
        {
82
            return new [] { rect.TopLeft, rect.TopRight, rect.BottomLeft, rect.BottomRight };
83
        }
84

  
85
        private static Rect PointsToRect(IEnumerable<Point> points)
86
        {
87
            return new Rect(points.ToArray()[0],points.ToArray()[3]);
59 88
        }
60 89
    }
61 90
}
KCOM/Controls/AdornerFinal.xaml.cs
992 992
                        }
993 993
                    }
994 994
                }
995

  
996
                /// ArrowTextControl text box 화면 출력
995 997
                if (member.GetType().Name == "ArrowTextControl" && list[i] == list.Last())
996 998
                {
997 999
                    tm.Style = (Style)this.LayoutRoot.Resources["ThumbTextStyle"];
......
1077 1079
            double newHorizontalChange = e.HorizontalChange;
1078 1080
            double newVerticalChange = e.VerticalChange;
1079 1081

  
1080
            if (reSizePoint != new Point(0, 0))
1081
            {
1082
            //if (reSizePoint != new Point(0, 0))
1083
            //{
1082 1084
                //Point setPoint = Mouse.GetPosition(Common.ViewerDataModel.Instance.SystemMain.dzMainMenu.zoomAndPanCanvas);
1083 1085

  
1084
                Point setPoint = new Point(GetPosition(thumb).X, GetPosition(thumb).Y);
1086
                Point setPoint = GetPosition(thumb);
1085 1087

  
1086 1088
                //System.Diagnostics.Debug.WriteLine($"1. GetPoint : {GetPosition(thumb).X},{GetPosition(thumb).Y}  Change Value : {newHorizontalChange},{newVerticalChange}");
1087 1089

  
1088
                thumb.Translate(newHorizontalChange, newVerticalChange, this.AngleValue);
1089

  
1090 1090
                AdornerMember control = CurrentAdornerMember(thumb);
1091

  
1092 1091
                var commentInfo = (control.DrawingData) as CommentUserInfo;
1093 1092

  
1094
                // 페이지회전에 따른 화살표텍스트 박스의 이동 수정
1095
                var newpoint = MathHelper.RotatePoint(new Point(newHorizontalChange, newVerticalChange), new Point(), commentInfo.VisualPageAngle);
1096
                var thumbPoint = MathHelper.RotatePoint(new Point(thumb.RenderSize.Width, thumb.RenderSize.Height), new Point(), commentInfo.VisualPageAngle);
1093
                double ratatePointAngle = 0;
1097 1094

  
1098
                if ((setPoint.X + newpoint.X) < 0 || (setPoint.X + Math.Abs(thumbPoint.X) + newpoint.X) - ViewerDataModel.Instance.ImageViewWidth > 0)
1095
                if (commentInfo is ArrowTextControl)
1099 1096
                {
1100
                    newpoint.X = 0;
1101
                }
1097
                    var textControl = (commentInfo as ArrowTextControl);
1102 1098

  
1103
                if (setPoint.Y + newpoint.Y < 0 || (setPoint.Y + Math.Abs(thumbPoint.Y) + newpoint.Y) - ViewerDataModel.Instance.ImageViewHeight > 0)
1104
                {
1105
                    newpoint.Y = 0;
1099
                    if (textControl.EndPoint == MathSet.getNearPoint(textControl.PointSet, setPoint)) //(textControl.MidPoint == MathSet.getNearPoint(textControl.PointSet,setPoint) ||
1100

  
1101
                    {
1102
                    textControl.CommentAngle = 0;
1103
                    this.AngleValue = 0;
1104
                    ratatePointAngle = commentInfo.VisualPageAngle;
1105
                    }
1106
                    else
1107
                    {
1108
                        Point tempPoint = textControl.EndPoint;
1109
                        textControl.OnCreatingMouseMove(tempPoint, ViewerDataModel.Instance.IsPressShift);
1110
                        //textControl.CommentAngle = commentInfo.VisualPageAngle + MathSet.returnAngle(textControl.StartPoint, ref tempPoint, ViewerDataModel.Instance.IsPressShift);
1111
                        this.AngleValue = textControl.CommentAngle;
1112
                        commentInfo.CommentAngle = this.AngleValue;
1113
                    }
1114
                        //CommentAngle = MathSet.returnAngle(this.StartPoint, ref tempPoint, bAxisLocked);
1106 1115
                }
1116
                System.Diagnostics.Debug.WriteLine("## Angle : " + this.AngleValue + " ##");
1117
                thumb.Translate(newHorizontalChange, newVerticalChange, this.AngleValue);
1118

  
1119
                // 페이지회전에 따른 화살표텍스트 박스의 이동 수정
1120
                var newpoint = MathHelper.RotatePoint(new Point(newHorizontalChange, newVerticalChange), new Point(), ratatePointAngle);// commentInfo.VisualPageAngle);
1121
     
1122
                Point thumbPoint = MathHelper.RotatePoint(setPoint, new Point(), ratatePointAngle);// commentInfo.VisualPageAngle);
1123

  
1124
                //thumbPoint.X = Math.Abs(thumbPoint.X);
1125
                //thumbPoint.Y = Math.Abs(thumbPoint.Y);
1126

  
1127
                //if ((setPoint.X + newpoint.X) < 0 || (Math.Abs(thumbPoint.X) + newpoint.X) - ViewerDataModel.Instance.ImageViewWidth > 0)
1128
                //{
1129
                //    newpoint.X = 0;
1130
                //}
1131

  
1132
                //if (setPoint.Y + newpoint.Y < 0 || (Math.Abs(thumbPoint.Y) + newpoint.Y) - ViewerDataModel.Instance.ImageViewHeight > 0)
1133
                //{
1134
                //    newpoint.Y = 0;
1135
                //}
1107 1136

  
1108 1137
                commentInfo.OnMoveCtrlPoint(setPoint, newpoint.X, newpoint.Y, ViewerDataModel.Instance.IsAxisLock || ViewerDataModel.Instance.IsPressShift);
1109 1138

  
......
1114 1143
                this.BorderUpdate();
1115 1144

  
1116 1145
               //System.Diagnostics.Debug.WriteLine($"5. GetPoint : {GetPosition(thumb).X},{GetPosition(thumb).Y}");
1117
            }
1146
            //}
1118 1147
        }
1119 1148

  
1120 1149
        private AdornerMember CurrentAdornerMember(MyThumb thumb)
......
1265 1294
            try
1266 1295
            {
1267 1296
                DragThumb.Cursor = Cursors.SizeAll;
1268
                //System.Diagnostics.Debug.WriteLine($"TransItem : {horzChange}, {vertChange}");
1269
                //System.Diagnostics.Debug.WriteLine($"DragDeltaEventArgs : {e.HorizontalChange}, {e.VerticalChange}");
1297
                System.Diagnostics.Debug.WriteLine($"TransItem : {horzChange}, {vertChange}");
1298
                System.Diagnostics.Debug.WriteLine($"DragDeltaEventArgs : {e.HorizontalChange}, {e.VerticalChange}");
1270 1299

  
1271 1300

  
1272
                //var mainRect = ViewerDataModel.Instance.SystemMain.dzMainMenu.mainPanel.Rect();
1273
                
1274
                //var rect = (this.ContainerContent.FindChildByType<CommentUserInfo>() as CommentUserInfo).ItemRect; //this.AdornerBorder.Bounds(ViewerDataModel.Instance.SystemMain.dzMainMenu.mainPanel);
1275

  
1276
                //var rotationRect = MathHelper.RotateRect(rect,new Point(mainRect.Width/2, mainRect.Height/2), ViewerDataModel.Instance.PageAngle);
1301
                var mainRect = ViewerDataModel.Instance.SystemMain.dzMainMenu.mainPanel.Rect();
1277 1302

  
1278
                //if(ViewerDataModel.Instance.PageAngle == 270 || ViewerDataModel.Instance.PageAngle == 90)
1303
                //if (ViewerDataModel.Instance.PageAngle == 270 || ViewerDataModel.Instance.PageAngle == 90)
1279 1304
                //{
1280
                //    mainRect = new Rect(0,0, mainRect.Height, mainRect.Width);
1305
                //    mainRect = new Rect(0, 0, mainRect.Height, mainRect.Width);
1281 1306
                //}
1282 1307

  
1283
                //var moveDirection = mainRect.Movement(rotationRect);
1308
                mainRect = MathHelper.RotateRect(ViewerDataModel.Instance.SystemMain.dzMainMenu.mainPanel.Rect(), new Point(mainRect.Width / 2, mainRect.Height / 2), ViewerDataModel.Instance.PageAngle);
1309

  
1310
                var rect = (this.ContainerContent.FindChildByType<CommentUserInfo>() as CommentUserInfo).ItemRect; //this.AdornerBorder.Bounds(ViewerDataModel.Instance.SystemMain.dzMainMenu.mainPanel);
1311

  
1312
                var rotationRect = MathHelper.RotateRect(rect, new Point(mainRect.Width / 2, mainRect.Height / 2), ViewerDataModel.Instance.PageAngle);
1313
                
1314
                var moveDirection = mainRect.Movement(rotationRect);
1284 1315

  
1285
                //System.Diagnostics.Debug.WriteLine($"horzChange: {horzChange} , vertChange:{vertChange}");
1286
                ////System.Diagnostics.Debug.WriteLine($"DragDeltaEventArgs : Top:{rect.Top}, Left:{rect.Left}, Right:{rect.Right}, Bottom:{rect.Bottom} ,BottomLeft : {rect.BottomLeft} BottomRight : {rect.BottomRight}");
1316
                System.Diagnostics.Debug.WriteLine($"horzChange: {horzChange} , vertChange:{vertChange}");
1317
                //System.Diagnostics.Debug.WriteLine($"DragDeltaEventArgs : Top:{rect.Top}, Left:{rect.Left}, Right:{rect.Right}, Bottom:{rect.Bottom} ,BottomLeft : {rect.BottomLeft} BottomRight : {rect.BottomRight}");
1287 1318

  
1288
                //if (!mainRect.Contains(rotationRect) && Math.Abs(horzChange) > 0)
1319
                //if (Math.Abs(horzChange) > 0)
1289 1320
                //{
1290 1321
                //    if ((horzChange < 0 && !moveDirection.Left) || (horzChange > 0 && !moveDirection.Right))
1291 1322
                //    {
......
1296 1327
                //    }
1297 1328
                //}
1298 1329

  
1299
                //if (!mainRect.Contains(rotationRect) && Math.Abs(vertChange) > 0)
1330
                //if (Math.Abs(vertChange) > 0)
1300 1331
                //{
1301 1332
                //    if ((vertChange < 0 && !moveDirection.Up) || (vertChange > 0 && !moveDirection.Down))
1302 1333
                //    {
......
1354 1385

  
1355 1386
        private void resize_MouseMove(object sender, MouseEventArgs e)
1356 1387
        {
1357
            reSizePoint = e.GetPosition(this);
1388
            //reSizePoint = e.GetPosition(this);
1358 1389
        }
1359 1390

  
1360 1391
        /// <summary>
MarkupToPDF/Controls/Text/ArrowTextControl.cs
1382 1382
                CenterY = this.CenterY,
1383 1383
            };
1384 1384

  
1385
            System.Diagnostics.Debug.WriteLine($"base TextBox center X : {this.CenterX} Y : {this.CenterY} ");
1386

  
1387
            
1388

  
1389 1385
            Base_ArrowSubPath.RenderTransform = new RotateTransform
1390 1386
            {
1391 1387
                Angle = this.VisualPageAngle,
......
1741 1737
                double _dx = dx * cos - dy * sin;
1742 1738
                double _dy = dx * sin + dy * cos;
1743 1739

  
1740
                //var transform = new RotateTransform() { Angle = CommentAngle, CenterX = dx, CenterY = dy };
1741
                //var transformedPoint = transform.Transform(pt);
1742
                //selected = transformedPoint;
1743

  
1744 1744
                selected.X += _dx;
1745 1745
                selected.Y += _dy;
1746 1746
            }
......
1750 1750
                selected.Y += dy;
1751 1751
            }
1752 1752

  
1753
            int i = 0;
1753
    int i = 0;
1754 1754
            for (i = 0; i < (this as IPath).PointSet.Count; i++)
1755 1755
            {
1756 1756
                if (pt.Equals((this as IPath).PointSet[i])) break;

내보내기 Unified diff

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