개정판 d2114d3b
issue #923: add OnMoveCtrlPoint method to interface
Change-Id: If3b10f5b54eaecd8bd8fa299d702e70e05d4b97e
KCOM/Controls/AdornerFinal.xaml.cs | ||
---|---|---|
33 | 33 |
} |
34 | 34 |
|
35 | 35 |
/// <summary> |
36 |
/// translate thumb with given delta and angle |
|
37 |
/// </summary> |
|
38 |
/// <param name="e"></param> |
|
39 |
/// <param name="angle"></param> |
|
40 |
public void Translate(DragDeltaEventArgs e, double angle) |
|
41 |
{ |
|
42 |
double radian = angle * Math.PI / 180; |
|
43 |
double cos = Math.Cos(radian); |
|
44 |
double sin = Math.Sin(radian); |
|
45 |
|
|
46 |
double dx = e.HorizontalChange*cos -e.VerticalChange * sin; |
|
47 |
double dy = e.HorizontalChange*sin +e.VerticalChange * cos; |
|
48 |
Canvas.SetLeft(this, Canvas.GetLeft(this) + dx); |
|
49 |
Canvas.SetTop(this, Canvas.GetTop(this) + dy); |
|
50 |
} |
|
51 |
|
|
52 |
/// <summary> |
|
36 | 53 |
/// </summary> |
37 | 54 |
/// <param name="sender"></param> |
38 | 55 |
/// <param name="e"></param> |
... | ... | |
908 | 925 |
|
909 | 926 |
private void ResizeTm_DragDelta(object sender, DragDeltaEventArgs e) |
910 | 927 |
{ |
911 |
if (this.Members.Count > 1) |
|
912 |
return; |
|
928 |
if (this.Members.Count > 1) return; |
|
913 | 929 |
if (reSizePoint != new Point(0, 0)) |
914 | 930 |
{ |
915 |
Thumb thumb = sender as Thumb; |
|
916 |
|
|
917 |
if (AngleValue == -90) |
|
918 |
{ |
|
919 |
Canvas.SetLeft(thumb, Canvas.GetLeft(thumb) + e.VerticalChange); |
|
920 |
Canvas.SetTop(thumb, Canvas.GetTop(thumb) + (-e.HorizontalChange)); |
|
921 |
} |
|
922 |
else if (AngleValue == -180) |
|
923 |
{ |
|
924 |
Canvas.SetLeft(thumb, Canvas.GetLeft(thumb) + (-e.HorizontalChange)); |
|
925 |
Canvas.SetTop(thumb, Canvas.GetTop(thumb) + (-e.VerticalChange)); |
|
926 |
} |
|
927 |
else if (AngleValue == -270) |
|
928 |
{ |
|
929 |
Canvas.SetLeft(thumb, Canvas.GetLeft(thumb) + (-e.VerticalChange)); |
|
930 |
Canvas.SetTop(thumb, Canvas.GetTop(thumb) + e.HorizontalChange); |
|
931 |
} |
|
932 |
else //(AngleValue == 0) |
|
933 |
{ |
|
934 |
Canvas.SetLeft(thumb, Canvas.GetLeft(thumb) + e.HorizontalChange); |
|
935 |
Canvas.SetTop(thumb, Canvas.GetTop(thumb) + e.VerticalChange); |
|
936 |
} |
|
937 |
|
|
938 |
|
|
931 |
MyThumb thumb = sender as MyThumb; |
|
939 | 932 |
Point setPoint = new Point(Canvas.GetLeft(thumb), Canvas.GetTop(thumb)); |
933 |
thumb.Translate(e, this.AngleValue); |
|
940 | 934 |
|
941 | 935 |
AdornerMember control = (from userThumb in this.Members |
942 | 936 |
where userThumb.ThumbList.Contains(thumb) |
943 | 937 |
select userThumb).FirstOrDefault(); |
944 |
Point nearPoint = new Point(0, 0); |
|
945 |
IPath AllControl = control.DrawingData as IPath; |
|
946 |
if (ControlType.TextControl != control.Drawingtype) |
|
947 |
{ |
|
948 |
|
|
949 |
var temp = (this.Members.First() as AdornerMember).DrawingData as ArrowTextControl; |
|
950 |
List<Point> ps = new List<Point>(); |
|
951 |
|
|
952 |
nearPoint = MathSet.getNearPoint((control.DrawingData as IPath).PointSet, setPoint); |
|
953 |
|
|
954 |
|
|
955 |
} |
|
956 |
for (int i = 0; i < (control.DrawingData as IPath).PointSet.Count; i++) |
|
957 |
{ |
|
958 |
switch (control.Drawingtype) |
|
959 |
{ |
|
960 |
#region Arc + Line |
|
961 |
case ControlType.ArrowMultiLine: |
|
962 |
case ControlType.ArcLine: |
|
963 |
case ControlType.ArcArrow: |
|
964 |
case ControlType.SingleLine: |
|
965 |
case ControlType.Triangle: |
|
966 |
if (nearPoint.Equals(AllControl.PointSet[i])) |
|
967 |
{ |
|
968 |
AllControl.PointSet[i] = setPoint; |
|
969 |
AllControl.updateControl(); |
|
970 |
DynamicThumbUpdate(control); |
|
971 |
BorderUpdate(); |
|
972 |
|
|
973 |
} |
|
974 |
break; |
|
975 |
#endregion |
|
976 |
#region Shape |
|
977 |
case ControlType.RectCloud: |
|
978 |
case ControlType.Rectangle: |
|
979 |
if (nearPoint.Equals(AllControl.PointSet[i])) |
|
980 |
{ |
|
981 |
AllControl.PointSet[i] = setPoint; |
|
982 |
var ReverseP = (i + AllControl.PointSet.Count() / 2) % AllControl.PointSet.Count(); |
|
983 |
var PreviousP = (i + (AllControl.PointSet.Count() - 1)) % AllControl.PointSet.Count(); |
|
984 |
var NextP = (i + 1) % AllControl.PointSet.Count(); |
|
985 |
|
|
986 |
var distance = MathSet.DistanceTo(AllControl.PointSet[ReverseP], AllControl.PointSet[i]); |
|
987 |
|
|
988 |
var PreviousV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[PreviousP]); |
|
989 |
var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, |
|
990 |
AllControl.PointSet[i].Y - AllControl.PointSet[ReverseP].Y); |
|
991 |
AllControl.PointSet[PreviousP] = new Point(AllControl.PointSet[ReverseP].X + PreviousV.X * l, AllControl.PointSet |
|
992 |
[ReverseP].Y |
|
993 |
+ PreviousV.Y * l); |
|
994 |
|
|
995 |
var NextV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[NextP]); |
|
996 |
l = MathSet.DotProduct(NextV.X, NextV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, AllControl.PointSet |
|
997 |
[i].Y - AllControl.PointSet[ReverseP].Y); |
|
998 |
AllControl.PointSet[NextP] = new Point(AllControl.PointSet[ReverseP].X + NextV.X * l, AllControl.PointSet[ReverseP].Y + |
|
999 |
NextV.Y * l); |
|
1000 |
AllControl.updateControl(); |
|
1001 |
DynamicThumbUpdate(control); |
|
1002 |
BorderUpdate(); |
|
1003 |
} |
|
1004 |
break; |
|
1005 |
#endregion |
|
1006 |
#region Polygon |
|
1007 |
case ControlType.PolygonControl: |
|
1008 |
if (nearPoint.Equals(AllControl.PointSet[i])) |
|
1009 |
{ |
|
1010 |
AllControl.PointSet[i] = setPoint; |
|
1011 |
AllControl.updateControl(); |
|
1012 |
BorderUpdate(); |
|
1013 |
} |
|
1014 |
break; |
|
1015 |
#endregion |
|
1016 |
#region Cicle |
|
1017 |
case ControlType.Circle: |
|
1018 |
if (nearPoint.Equals(AllControl.PointSet[i])) |
|
1019 |
{ |
|
1020 |
AllControl.PointSet[i] = setPoint; |
|
1021 |
List<Point> newPointSet = new List<Point> { }; |
|
1022 |
Point middle = new Point(AllControl.PathData.Bounds.X + AllControl.PathData.Bounds.Width * 0.5, |
|
1023 |
AllControl.PathData.Bounds.Y + |
|
1024 |
AllControl.PathData.Bounds.Height * 0.5); |
|
1025 |
foreach (Point pt in AllControl.PointSet) |
|
1026 |
{ |
|
1027 |
newPointSet.Add(pt); |
|
1028 |
} |
|
1029 |
var ReverseP = (i + newPointSet.Count() / 2) % newPointSet.Count(); |
|
1030 |
var PreviousP = (i + (newPointSet.Count() - 1)) % newPointSet.Count(); |
|
1031 |
var NextP = (i + 1) % newPointSet.Count(); |
|
1032 |
var distance = MathSet.DistanceTo(newPointSet[ReverseP], newPointSet[i]); |
|
1033 |
var PreviousV = MathSet.GetNormVectorBetween(newPointSet[ReverseP], newPointSet[PreviousP]); |
|
1034 |
var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, newPointSet[i].X - newPointSet[ReverseP].X, |
|
1035 |
newPointSet[i].Y - newPointSet[ReverseP].Y); |
|
1036 |
newPointSet[PreviousP] = new Point(newPointSet[ReverseP].X + PreviousV.X * l, newPointSet[ReverseP].Y |
|
1037 |
+ PreviousV.Y * l); |
|
1038 |
|
|
1039 |
var NextV = MathSet.GetNormVectorBetween(newPointSet[ReverseP], newPointSet[NextP]); |
|
1040 |
l = MathSet.DotProduct(NextV.X, NextV.Y, newPointSet[i].X - newPointSet[ReverseP].X, newPointSet[i].Y |
|
1041 |
- newPointSet[ReverseP].Y); |
|
1042 |
newPointSet[NextP] = new Point(newPointSet[ReverseP].X + NextV.X * l, newPointSet[ReverseP].Y + NextV.Y * l); |
|
1043 |
|
|
1044 |
AllControl.PointSet = newPointSet; |
|
1045 |
DynamicThumbUpdate(control); |
|
1046 |
AllControl.updateControl(); |
|
1047 |
BorderUpdate(); |
|
1048 |
} |
|
1049 |
break; |
|
1050 |
#endregion |
|
1051 |
#region ArrowText |
|
1052 |
case ControlType.ArrowTextControl: |
|
1053 |
if (nearPoint.Equals(AllControl.PointSet[i])) |
|
1054 |
{ |
|
1055 | 938 |
|
1056 |
List<Point> GetPointSet = (control.DrawingData as ArrowTextControl).PointSet; |
|
1057 |
|
|
1058 |
if ((GetPointSet[0].X > GetPointSet[1].X && e.HorizontalChange > 0) || (GetPointSet[0].X < GetPointSet[1].X && e.HorizontalChange < 0)) |
|
1059 |
{ |
|
1060 |
GetPointSet[1] = new Point(GetPointSet[1].X + e.HorizontalChange, GetPointSet[1].Y); |
|
1061 |
} |
|
1062 |
if ((GetPointSet[0].Y > GetPointSet[1].Y && e.VerticalChange > 0) || (GetPointSet[0].Y < GetPointSet[1].Y && e.VerticalChange < 0)) |
|
1063 |
{ |
|
1064 |
GetPointSet[1] = new Point(GetPointSet[1].X, GetPointSet[1].Y + e.VerticalChange); |
|
1065 |
} |
|
1066 |
(control.DrawingData as ArrowTextControl).PointSet[1] = GetPointSet[1]; |
|
1067 |
|
|
1068 |
|
|
1069 |
//System.Diagnostics.Debug.WriteLine("MidPoint : " + (control.DrawingData as ArrowTextControl).MidPoint); |
|
1070 |
//System.Diagnostics.Debug.WriteLine("HorizontalChange : " + e.HorizontalChange); |
|
1071 |
//System.Diagnostics.Debug.WriteLine("VerticalChange : " + e.VerticalChange); |
|
1072 |
|
|
1073 |
AllControl.PointSet[i] = setPoint; |
|
1074 |
//System.Diagnostics.Debug.WriteLine("PointSet : " + AllControl.PointSet[i]); |
|
1075 |
|
|
1076 |
AllControl.updateControl(); |
|
1077 |
|
|
1078 |
DynamicThumbUpdate(control); |
|
1079 |
BorderUpdate(); |
|
1080 |
|
|
1081 |
} |
|
1082 |
break; |
|
1083 |
#endregion |
|
1084 |
#region Text |
|
1085 |
case ControlType.TextControl: |
|
1086 |
break; |
|
1087 |
#endregion |
|
1088 |
#region Image |
|
1089 |
case ControlType.ImgControl: |
|
1090 |
if (nearPoint.Equals(AllControl.PointSet[i])) |
|
1091 |
{ |
|
1092 |
AllControl.PointSet[i] = setPoint; |
|
1093 |
var ReverseP = (i + AllControl.PointSet.Count() / 2) % AllControl.PointSet.Count(); |
|
1094 |
var PreviousP = (i + (AllControl.PointSet.Count() - 1)) % AllControl.PointSet.Count(); |
|
1095 |
var NextP = (i + 1) % AllControl.PointSet.Count(); |
|
1096 |
|
|
1097 |
var distance = MathSet.DistanceTo(AllControl.PointSet[ReverseP], AllControl.PointSet[i]); |
|
1098 |
|
|
1099 |
var PreviousV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[PreviousP]); |
|
1100 |
var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, |
|
1101 |
AllControl.PointSet[i].Y - AllControl.PointSet[ReverseP].Y); |
|
1102 |
AllControl.PointSet[PreviousP] = new Point(AllControl.PointSet[ReverseP].X + PreviousV.X * l, AllControl.PointSet |
|
1103 |
[ReverseP].Y |
|
1104 |
+ PreviousV.Y * l); |
|
1105 |
|
|
1106 |
var NextV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[NextP]); |
|
1107 |
l = MathSet.DotProduct(NextV.X, NextV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, AllControl.PointSet |
|
1108 |
[i].Y - AllControl.PointSet[ReverseP].Y); |
|
1109 |
AllControl.PointSet[NextP] = new Point(AllControl.PointSet[ReverseP].X + NextV.X * l, AllControl.PointSet[ReverseP].Y + |
|
1110 |
NextV.Y * l); |
|
1111 |
AllControl.updateControl(); |
|
1112 |
DynamicThumbUpdate(control); |
|
1113 |
BorderUpdate(); |
|
1114 |
} |
|
1115 |
break; |
|
1116 |
#endregion |
|
1117 |
#region Sign |
|
1118 |
case ControlType.Sign: |
|
1119 |
if (nearPoint.Equals(AllControl.PointSet[i])) |
|
1120 |
{ |
|
1121 |
AllControl.PointSet[i] = setPoint; |
|
1122 |
var ReverseP = (i + AllControl.PointSet.Count() / 2) % AllControl.PointSet.Count(); |
|
1123 |
var PreviousP = (i + (AllControl.PointSet.Count() - 1)) % AllControl.PointSet.Count(); |
|
1124 |
var NextP = (i + 1) % AllControl.PointSet.Count(); |
|
1125 |
|
|
1126 |
var distance = MathSet.DistanceTo(AllControl.PointSet[ReverseP], AllControl.PointSet[i]); |
|
1127 |
|
|
1128 |
var PreviousV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[PreviousP]); |
|
1129 |
var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, |
|
1130 |
AllControl.PointSet[i].Y - AllControl.PointSet[ReverseP].Y); |
|
1131 |
AllControl.PointSet[PreviousP] = new Point(AllControl.PointSet[ReverseP].X + PreviousV.X * l, AllControl.PointSet |
|
1132 |
[ReverseP].Y |
|
1133 |
+ PreviousV.Y * l); |
|
1134 |
|
|
1135 |
var NextV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[NextP]); |
|
1136 |
l = MathSet.DotProduct(NextV.X, NextV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, AllControl.PointSet |
|
1137 |
[i].Y - AllControl.PointSet[ReverseP].Y); |
|
1138 |
AllControl.PointSet[NextP] = new Point(AllControl.PointSet[ReverseP].X + NextV.X * l, AllControl.PointSet[ReverseP].Y + |
|
1139 |
NextV.Y * l); |
|
1140 |
AllControl.updateControl(); |
|
1141 |
DynamicThumbUpdate(control); |
|
1142 |
BorderUpdate(); |
|
1143 |
} |
|
1144 |
break; |
|
1145 |
#endregion |
|
1146 |
#region Cloud |
|
1147 |
case ControlType.PolygonCloud: |
|
1148 |
if (nearPoint.Equals(AllControl.PointSet[i])) |
|
1149 |
{ |
|
1150 |
AllControl.PointSet[i] = setPoint; |
|
1151 |
AllControl.updateControl(); |
|
1152 |
((ICloudControl)AllControl).DrawingCloud(); |
|
1153 |
BorderUpdate(); |
|
1154 |
} |
|
1155 |
break; |
|
1156 |
#endregion |
|
1157 |
#region SymBol |
|
1158 |
case ControlType.Symbol: |
|
1159 |
if (nearPoint.Equals(AllControl.PointSet[i])) |
|
1160 |
{ |
|
1161 |
AllControl.PointSet[i] = setPoint; |
|
1162 |
var ReverseP = (i + AllControl.PointSet.Count() / 2) % AllControl.PointSet.Count(); |
|
1163 |
var PreviousP = (i + (AllControl.PointSet.Count() - 1)) % AllControl.PointSet.Count(); |
|
1164 |
var NextP = (i + 1) % AllControl.PointSet.Count(); |
|
1165 |
|
|
1166 |
var distance = MathSet.DistanceTo(AllControl.PointSet[ReverseP], AllControl.PointSet[i]); |
|
1167 |
|
|
1168 |
var PreviousV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[PreviousP]); |
|
1169 |
var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, |
|
1170 |
AllControl.PointSet[i].Y - AllControl.PointSet[ReverseP].Y); |
|
1171 |
AllControl.PointSet[PreviousP] = new Point(AllControl.PointSet[ReverseP].X + PreviousV.X * l, AllControl.PointSet |
|
1172 |
[ReverseP].Y |
|
1173 |
+ PreviousV.Y * l); |
|
1174 |
|
|
1175 |
var NextV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[NextP]); |
|
1176 |
l = MathSet.DotProduct(NextV.X, NextV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, AllControl.PointSet |
|
1177 |
[i].Y - AllControl.PointSet[ReverseP].Y); |
|
1178 |
AllControl.PointSet[NextP] = new Point(AllControl.PointSet[ReverseP].X + NextV.X * l, AllControl.PointSet[ReverseP].Y + |
|
1179 |
NextV.Y * l); |
|
1180 |
AllControl.updateControl(); |
|
1181 |
DynamicThumbUpdate(control); |
|
1182 |
BorderUpdate(); |
|
1183 |
} |
|
1184 |
break; |
|
1185 |
case ControlType.Stamp: |
|
1186 |
if (nearPoint.Equals(AllControl.PointSet[i])) |
|
1187 |
{ |
|
1188 |
AllControl.PointSet[i] = setPoint; |
|
1189 |
var ReverseP = (i + AllControl.PointSet.Count() / 2) % AllControl.PointSet.Count(); |
|
1190 |
var PreviousP = (i + (AllControl.PointSet.Count() - 1)) % AllControl.PointSet.Count(); |
|
1191 |
var NextP = (i + 1) % AllControl.PointSet.Count(); |
|
1192 |
|
|
1193 |
var distance = MathSet.DistanceTo(AllControl.PointSet[ReverseP], AllControl.PointSet[i]); |
|
1194 |
|
|
1195 |
var PreviousV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[PreviousP]); |
|
1196 |
var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, |
|
1197 |
AllControl.PointSet[i].Y - AllControl.PointSet[ReverseP].Y); |
|
1198 |
AllControl.PointSet[PreviousP] = new Point(AllControl.PointSet[ReverseP].X + PreviousV.X * l, AllControl.PointSet |
|
1199 |
[ReverseP].Y |
|
1200 |
+ PreviousV.Y * l); |
|
1201 |
|
|
1202 |
var NextV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[NextP]); |
|
1203 |
l = MathSet.DotProduct(NextV.X, NextV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, AllControl.PointSet |
|
1204 |
[i].Y - AllControl.PointSet[ReverseP].Y); |
|
1205 |
AllControl.PointSet[NextP] = new Point(AllControl.PointSet[ReverseP].X + NextV.X * l, AllControl.PointSet[ReverseP].Y + |
|
1206 |
NextV.Y * l); |
|
1207 |
AllControl.updateControl(); |
|
1208 |
DynamicThumbUpdate(control); |
|
1209 |
BorderUpdate(); |
|
1210 |
} |
|
1211 |
break; |
|
1212 |
case ControlType.Date: |
|
1213 |
if (nearPoint.Equals(AllControl.PointSet[i])) |
|
1214 |
{ |
|
1215 |
AllControl.PointSet[i] = setPoint; |
|
1216 |
var ReverseP = (i + AllControl.PointSet.Count() / 2) % AllControl.PointSet.Count(); |
|
1217 |
var PreviousP = (i + (AllControl.PointSet.Count() - 1)) % AllControl.PointSet.Count(); |
|
1218 |
var NextP = (i + 1) % AllControl.PointSet.Count(); |
|
1219 |
|
|
1220 |
var distance = MathSet.DistanceTo(AllControl.PointSet[ReverseP], AllControl.PointSet[i]); |
|
1221 |
|
|
1222 |
var PreviousV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[PreviousP]); |
|
1223 |
var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, |
|
1224 |
AllControl.PointSet[i].Y - AllControl.PointSet[ReverseP].Y); |
|
1225 |
AllControl.PointSet[PreviousP] = new Point(AllControl.PointSet[ReverseP].X + PreviousV.X * l, AllControl.PointSet |
|
1226 |
[ReverseP].Y |
|
1227 |
+ PreviousV.Y * l); |
|
1228 |
|
|
1229 |
var NextV = MathSet.GetNormVectorBetween(AllControl.PointSet[ReverseP], AllControl.PointSet[NextP]); |
|
1230 |
l = MathSet.DotProduct(NextV.X, NextV.Y, AllControl.PointSet[i].X - AllControl.PointSet[ReverseP].X, AllControl.PointSet |
|
1231 |
[i].Y - AllControl.PointSet[ReverseP].Y); |
|
1232 |
AllControl.PointSet[NextP] = new Point(AllControl.PointSet[ReverseP].X + NextV.X * l, AllControl.PointSet[ReverseP].Y + |
|
1233 |
NextV.Y * l); |
|
1234 |
AllControl.updateControl(); |
|
1235 |
DynamicThumbUpdate(control); |
|
1236 |
BorderUpdate(); |
|
1237 |
} |
|
1238 |
break; |
|
1239 |
#endregion |
|
1240 |
#region Ink |
|
1241 |
case ControlType.Ink: |
|
1242 |
if (nearPoint.Equals(AllControl.PointSet[i])) |
|
1243 |
{ |
|
1244 |
AllControl.PointSet[i] = setPoint; |
|
1245 |
AllControl.updateControl(); |
|
1246 |
BorderUpdate(); |
|
1247 |
} |
|
1248 |
break; |
|
1249 |
#endregion |
|
1250 |
default: |
|
1251 |
break; |
|
1252 |
} |
|
1253 |
} |
|
939 |
IPath AllControl = control.DrawingData as IPath; |
|
940 |
((control.DrawingData) as CommentUserInfo).OnMoveCtrlPoint(setPoint, e.HorizontalChange, e.VerticalChange); |
|
941 |
DynamicThumbUpdate(control); |
|
942 |
BorderUpdate(); |
|
1254 | 943 |
} |
1255 |
//} |
|
1256 | 944 |
} |
1257 | 945 |
|
1258 |
|
|
1259 |
|
|
1260 | 946 |
#endregion |
1261 | 947 |
#region 이벤트 |
1262 | 948 |
|
KCOM/Views/MainMenu.xaml.cs | ||
---|---|---|
5076 | 5076 |
/// </summary> |
5077 | 5077 |
public void ConvertInkControlToPolygon() |
5078 | 5078 |
{ |
5079 |
Logger.sendCheckLog("pageNavigator_PageChanging_ConvertInkControlToPolygon", 1); |
|
5080 | 5079 |
if (inkBoard.Strokes.Count > 0) |
5081 | 5080 |
{ |
5082 | 5081 |
inkBoard.Strokes.ToList().ForEach(stroke => |
MarkupToPDF/Common/CommentUserInfo.cs | ||
---|---|---|
14 | 14 |
public interface ICommentUserInfo |
15 | 15 |
{ |
16 | 16 |
void OnCreatingMouseMove(Point pt, bool bAxisLocked, bool bShiftKeyPressed); |
17 |
void OnMoveCtrlPoint(Point pt, double dx, double dy); |
|
17 | 18 |
} |
18 | 19 |
|
19 | 20 |
public class CommentUserInfo : System.Windows.Controls.Control, ICommentUserInfo |
... | ... | |
68 | 69 |
} |
69 | 70 |
|
70 | 71 |
public virtual void OnCreatingMouseMove(Point pt, bool bAxisLocked, bool bShiftKeyPressed) { } |
72 |
public virtual void OnMoveCtrlPoint(Point pt, double dx, double dy) { } |
|
71 | 73 |
|
72 | 74 |
/// <summary> |
73 | 75 |
/// subclass has to override this property |
MarkupToPDF/Controls/Etc/DateControl.cs | ||
---|---|---|
480 | 480 |
} |
481 | 481 |
|
482 | 482 |
/// <summary> |
483 |
/// move control point has same location of given pt along given delta |
|
484 |
/// </summary> |
|
485 |
/// <author>humkyung</author> |
|
486 |
/// <date>2019.06.20</date> |
|
487 |
/// <param name="pt"></param> |
|
488 |
/// <param name="dx"></param> |
|
489 |
/// <param name="dy"></param> |
|
490 |
public override void OnMoveCtrlPoint(Point pt, double dx, double dy) |
|
491 |
{ |
|
492 |
IPath path = (this as IPath); |
|
493 |
|
|
494 |
Point selected = MathSet.getNearPoint(path.PointSet, pt); |
|
495 |
selected.X += dx; |
|
496 |
selected.Y += dy; |
|
497 |
int i = 0; |
|
498 |
for (i = 0; i < (this as IPath).PointSet.Count; i++) |
|
499 |
{ |
|
500 |
if (pt.Equals((this as IPath).PointSet[i])) |
|
501 |
{ |
|
502 |
path.PointSet[i] = selected; |
|
503 |
break; |
|
504 |
} |
|
505 |
} |
|
506 |
|
|
507 |
var ReverseP = (i + path.PointSet.Count / 2) % path.PointSet.Count; |
|
508 |
var PreviousP = (i + (path.PointSet.Count - 1)) % path.PointSet.Count; |
|
509 |
var NextP = (i + 1) % path.PointSet.Count; |
|
510 |
|
|
511 |
var distance = MathSet.DistanceTo(path.PointSet[ReverseP], path.PointSet[i]); |
|
512 |
|
|
513 |
var PreviousV = MathSet.GetNormVectorBetween(path.PointSet[ReverseP], path.PointSet[PreviousP]); |
|
514 |
var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, path.PointSet[i].X - path.PointSet[ReverseP].X, |
|
515 |
path.PointSet[i].Y - path.PointSet[ReverseP].Y); |
|
516 |
path.PointSet[PreviousP] = new Point(path.PointSet[ReverseP].X + PreviousV.X * l, path.PointSet[ReverseP].Y + PreviousV.Y * l); |
|
517 |
|
|
518 |
var NextV = MathSet.GetNormVectorBetween(path.PointSet[ReverseP], path.PointSet[NextP]); |
|
519 |
l = MathSet.DotProduct(NextV.X, NextV.Y, path.PointSet[i].X - path.PointSet[ReverseP].X, path.PointSet |
|
520 |
[i].Y - path.PointSet[ReverseP].Y); |
|
521 |
path.PointSet[NextP] = new Point(path.PointSet[ReverseP].X + NextV.X * l, path.PointSet[ReverseP].Y + NextV.Y * l); |
|
522 |
|
|
523 |
this.updateControl(); |
|
524 |
} |
|
525 |
|
|
526 |
/// <summary> |
|
483 | 527 |
/// return DateControl's area |
484 | 528 |
/// </summary> |
485 | 529 |
/// <author>humkyung</author> |
MarkupToPDF/Controls/Etc/ImgControl.cs | ||
---|---|---|
366 | 366 |
} |
367 | 367 |
|
368 | 368 |
/// <summary> |
369 |
/// move control point has same location of given pt along given delta |
|
370 |
/// </summary> |
|
371 |
/// <author>humkyung</author> |
|
372 |
/// <date>2019.06.20</date> |
|
373 |
/// <param name="pt"></param> |
|
374 |
/// <param name="dx"></param> |
|
375 |
/// <param name="dy"></param> |
|
376 |
public override void OnMoveCtrlPoint(Point pt, double dx, double dy) |
|
377 |
{ |
|
378 |
IPath path = (this as IPath); |
|
379 |
|
|
380 |
Point selected = MathSet.getNearPoint(path.PointSet, pt); |
|
381 |
selected.X += dx; |
|
382 |
selected.Y += dy; |
|
383 |
int i = 0; |
|
384 |
for (i = 0; i < (this as IPath).PointSet.Count; i++) |
|
385 |
{ |
|
386 |
if (pt.Equals((this as IPath).PointSet[i])) |
|
387 |
{ |
|
388 |
path.PointSet[i] = selected; |
|
389 |
break; |
|
390 |
} |
|
391 |
} |
|
392 |
|
|
393 |
var ReverseP = (i + path.PointSet.Count() / 2) % path.PointSet.Count(); |
|
394 |
var PreviousP = (i + (path.PointSet.Count() - 1)) % path.PointSet.Count(); |
|
395 |
var NextP = (i + 1) % path.PointSet.Count(); |
|
396 |
|
|
397 |
var distance = MathSet.DistanceTo(path.PointSet[ReverseP], path.PointSet[i]); |
|
398 |
|
|
399 |
var PreviousV = MathSet.GetNormVectorBetween(path.PointSet[ReverseP], path.PointSet[PreviousP]); |
|
400 |
var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, path.PointSet[i].X - path.PointSet[ReverseP].X, |
|
401 |
path.PointSet[i].Y - path.PointSet[ReverseP].Y); |
|
402 |
path.PointSet[PreviousP] = new Point(path.PointSet[ReverseP].X + PreviousV.X * l, path.PointSet[ReverseP].Y + PreviousV.Y * l); |
|
403 |
|
|
404 |
var NextV = MathSet.GetNormVectorBetween(path.PointSet[ReverseP], path.PointSet[NextP]); |
|
405 |
l = MathSet.DotProduct(NextV.X, NextV.Y, path.PointSet[i].X - path.PointSet[ReverseP].X, path.PointSet |
|
406 |
[i].Y - path.PointSet[ReverseP].Y); |
|
407 |
path.PointSet[NextP] = new Point(path.PointSet[ReverseP].X + NextV.X * l, path.PointSet[ReverseP].Y + NextV.Y * l); |
|
408 |
|
|
409 |
this.updateControl(); |
|
410 |
} |
|
411 |
|
|
412 |
/// <summary> |
|
369 | 413 |
/// return ImgControl's area |
370 | 414 |
/// </summary> |
371 | 415 |
/// <author>humkyung</author> |
MarkupToPDF/Controls/Etc/SignControl.cs | ||
---|---|---|
337 | 337 |
} |
338 | 338 |
|
339 | 339 |
/// <summary> |
340 |
/// move control point has same location of given pt along given delta |
|
341 |
/// </summary> |
|
342 |
/// <author>humkyung</author> |
|
343 |
/// <date>2019.06.20</date> |
|
344 |
/// <param name="pt"></param> |
|
345 |
/// <param name="dx"></param> |
|
346 |
/// <param name="dy"></param> |
|
347 |
public override void OnMoveCtrlPoint(Point pt, double dx, double dy) |
|
348 |
{ |
|
349 |
IPath path = (this as IPath); |
|
350 |
|
|
351 |
Point selected = MathSet.getNearPoint(path.PointSet, pt); |
|
352 |
selected.X += dx; |
|
353 |
selected.Y += dy; |
|
354 |
int i = 0; |
|
355 |
for (i = 0; i < (this as IPath).PointSet.Count; i++) |
|
356 |
{ |
|
357 |
if (pt.Equals((this as IPath).PointSet[i])) |
|
358 |
{ |
|
359 |
path.PointSet[i] = selected; |
|
360 |
break; |
|
361 |
} |
|
362 |
} |
|
363 |
|
|
364 |
var ReverseP = (i + path.PointSet.Count() / 2) % path.PointSet.Count(); |
|
365 |
var PreviousP = (i + (path.PointSet.Count() - 1)) % path.PointSet.Count(); |
|
366 |
var NextP = (i + 1) % path.PointSet.Count(); |
|
367 |
|
|
368 |
var distance = MathSet.DistanceTo(path.PointSet[ReverseP], path.PointSet[i]); |
|
369 |
|
|
370 |
var PreviousV = MathSet.GetNormVectorBetween(path.PointSet[ReverseP], path.PointSet[PreviousP]); |
|
371 |
var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, path.PointSet[i].X - path.PointSet[ReverseP].X, |
|
372 |
path.PointSet[i].Y - path.PointSet[ReverseP].Y); |
|
373 |
path.PointSet[PreviousP] = new Point(path.PointSet[ReverseP].X + PreviousV.X * l, path.PointSet[ReverseP].Y + PreviousV.Y * l); |
|
374 |
|
|
375 |
var NextV = MathSet.GetNormVectorBetween(path.PointSet[ReverseP], path.PointSet[NextP]); |
|
376 |
l = MathSet.DotProduct(NextV.X, NextV.Y, path.PointSet[i].X - path.PointSet[ReverseP].X, path.PointSet |
|
377 |
[i].Y - path.PointSet[ReverseP].Y); |
|
378 |
path.PointSet[NextP] = new Point(path.PointSet[ReverseP].X + NextV.X * l, path.PointSet[ReverseP].Y + NextV.Y * l); |
|
379 |
|
|
380 |
this.updateControl(); |
|
381 |
} |
|
382 |
|
|
383 |
/// <summary> |
|
340 | 384 |
/// return SignControl's area |
341 | 385 |
/// </summary> |
342 | 386 |
/// <author>humkyung</author> |
MarkupToPDF/Controls/Etc/SymControl.cs | ||
---|---|---|
406 | 406 |
} |
407 | 407 |
|
408 | 408 |
/// <summary> |
409 |
/// move control point has same location of given pt along given delta |
|
410 |
/// </summary> |
|
411 |
/// <author>humkyung</author> |
|
412 |
/// <date>2019.06.20</date> |
|
413 |
/// <param name="pt"></param> |
|
414 |
/// <param name="dx"></param> |
|
415 |
/// <param name="dy"></param> |
|
416 |
public override void OnMoveCtrlPoint(Point pt, double dx, double dy) |
|
417 |
{ |
|
418 |
IPath path = (this as IPath); |
|
419 |
|
|
420 |
Point selected = MathSet.getNearPoint(path.PointSet, pt); |
|
421 |
selected.X += dx; |
|
422 |
selected.Y += dy; |
|
423 |
int i = 0; |
|
424 |
for (i = 0; i < (this as IPath).PointSet.Count; i++) |
|
425 |
{ |
|
426 |
if (pt.Equals((this as IPath).PointSet[i])) |
|
427 |
{ |
|
428 |
path.PointSet[i] = selected; |
|
429 |
break; |
|
430 |
} |
|
431 |
} |
|
432 |
|
|
433 |
var ReverseP = (i + path.PointSet.Count / 2) % path.PointSet.Count; |
|
434 |
var PreviousP = (i + (path.PointSet.Count - 1)) % path.PointSet.Count; |
|
435 |
var NextP = (i + 1) % path.PointSet.Count; |
|
436 |
|
|
437 |
var distance = MathSet.DistanceTo(path.PointSet[ReverseP], path.PointSet[i]); |
|
438 |
|
|
439 |
var PreviousV = MathSet.GetNormVectorBetween(path.PointSet[ReverseP], path.PointSet[PreviousP]); |
|
440 |
var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, path.PointSet[i].X - path.PointSet[ReverseP].X, |
|
441 |
path.PointSet[i].Y - path.PointSet[ReverseP].Y); |
|
442 |
path.PointSet[PreviousP] = new Point(path.PointSet[ReverseP].X + PreviousV.X * l, path.PointSet[ReverseP].Y + PreviousV.Y * l); |
|
443 |
|
|
444 |
var NextV = MathSet.GetNormVectorBetween(path.PointSet[ReverseP], path.PointSet[NextP]); |
|
445 |
l = MathSet.DotProduct(NextV.X, NextV.Y, path.PointSet[i].X - path.PointSet[ReverseP].X, path.PointSet |
|
446 |
[i].Y - path.PointSet[ReverseP].Y); |
|
447 |
path.PointSet[NextP] = new Point(path.PointSet[ReverseP].X + NextV.X * l, path.PointSet[ReverseP].Y + NextV.Y * l); |
|
448 |
|
|
449 |
this.updateControl(); |
|
450 |
} |
|
451 |
|
|
452 |
/// <summary> |
|
409 | 453 |
/// return SymControl's area |
410 | 454 |
/// </summary> |
411 | 455 |
/// <author>humkyung</author> |
MarkupToPDF/Controls/Etc/SymControlN.cs | ||
---|---|---|
379 | 379 |
} |
380 | 380 |
|
381 | 381 |
/// <summary> |
382 |
/// move control point has same location of given pt along given delta |
|
383 |
/// </summary> |
|
384 |
/// <author>humkyung</author> |
|
385 |
/// <date>2019.06.20</date> |
|
386 |
/// <param name="pt"></param> |
|
387 |
/// <param name="dx"></param> |
|
388 |
/// <param name="dy"></param> |
|
389 |
public override void OnMoveCtrlPoint(Point pt, double dx, double dy) |
|
390 |
{ |
|
391 |
IPath path = (this as IPath); |
|
392 |
|
|
393 |
Point selected = MathSet.getNearPoint(path.PointSet, pt); |
|
394 |
selected.X += dx; |
|
395 |
selected.Y += dy; |
|
396 |
int i = 0; |
|
397 |
for (i = 0; i < (this as IPath).PointSet.Count; i++) |
|
398 |
{ |
|
399 |
if (pt.Equals((this as IPath).PointSet[i])) |
|
400 |
{ |
|
401 |
path.PointSet[i] = selected; |
|
402 |
break; |
|
403 |
} |
|
404 |
} |
|
405 |
|
|
406 |
var ReverseP = (i + path.PointSet.Count / 2) % path.PointSet.Count; |
|
407 |
var PreviousP = (i + (path.PointSet.Count - 1)) % path.PointSet.Count; |
|
408 |
var NextP = (i + 1) % path.PointSet.Count; |
|
409 |
|
|
410 |
var distance = MathSet.DistanceTo(path.PointSet[ReverseP], path.PointSet[i]); |
|
411 |
|
|
412 |
var PreviousV = MathSet.GetNormVectorBetween(path.PointSet[ReverseP], path.PointSet[PreviousP]); |
|
413 |
var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, path.PointSet[i].X - path.PointSet[ReverseP].X, |
|
414 |
path.PointSet[i].Y - path.PointSet[ReverseP].Y); |
|
415 |
path.PointSet[PreviousP] = new Point(path.PointSet[ReverseP].X + PreviousV.X * l, path.PointSet[ReverseP].Y + PreviousV.Y * l); |
|
416 |
|
|
417 |
var NextV = MathSet.GetNormVectorBetween(path.PointSet[ReverseP], path.PointSet[NextP]); |
|
418 |
l = MathSet.DotProduct(NextV.X, NextV.Y, path.PointSet[i].X - path.PointSet[ReverseP].X, path.PointSet |
|
419 |
[i].Y - path.PointSet[ReverseP].Y); |
|
420 |
path.PointSet[NextP] = new Point(path.PointSet[ReverseP].X + NextV.X * l, path.PointSet[ReverseP].Y + NextV.Y * l); |
|
421 |
|
|
422 |
this.updateControl(); |
|
423 |
} |
|
424 |
|
|
425 |
/// <summary> |
|
382 | 426 |
/// return SymControlN's area |
383 | 427 |
/// </summary> |
384 | 428 |
/// <author>humkyung</author> |
MarkupToPDF/Controls/Line/ArcControl.cs | ||
---|---|---|
550 | 550 |
} |
551 | 551 |
|
552 | 552 |
/// <summary> |
553 |
/// move control point has same location of given pt along given delta |
|
554 |
/// </summary> |
|
555 |
/// <author>humkyung</author> |
|
556 |
/// <date>2019.06.20</date> |
|
557 |
/// <param name="pt"></param> |
|
558 |
/// <param name="dx"></param> |
|
559 |
/// <param name="dy"></param> |
|
560 |
public override void OnMoveCtrlPoint(Point pt, double dx, double dy) |
|
561 |
{ |
|
562 |
Point selected = MathSet.getNearPoint((this as IPath).PointSet, pt); |
|
563 |
selected.X += dx; |
|
564 |
selected.Y += dy; |
|
565 |
for (int i = 0; i < (this as IPath).PointSet.Count; i++) |
|
566 |
{ |
|
567 |
if (pt.Equals((this as IPath).PointSet[i])) |
|
568 |
{ |
|
569 |
(this as IPath).PointSet[i] = selected; |
|
570 |
} |
|
571 |
} |
|
572 |
this.updateControl(); |
|
573 |
} |
|
574 |
|
|
575 |
/// <summary> |
|
553 | 576 |
/// return Arc's area |
554 | 577 |
/// </summary> |
555 | 578 |
/// <author>humkyung</author> |
MarkupToPDF/Controls/Line/ArrowArcControl.cs | ||
---|---|---|
494 | 494 |
} |
495 | 495 |
|
496 | 496 |
/// <summary> |
497 |
/// move control point has same location of given pt along given delta |
|
498 |
/// </summary> |
|
499 |
/// <author>humkyung</author> |
|
500 |
/// <date>2019.06.20</date> |
|
501 |
/// <param name="pt"></param> |
|
502 |
/// <param name="dx"></param> |
|
503 |
/// <param name="dy"></param> |
|
504 |
public override void OnMoveCtrlPoint(Point pt, double dx, double dy) |
|
505 |
{ |
|
506 |
Point selected = MathSet.getNearPoint((this as IPath).PointSet, pt); |
|
507 |
selected.X += dx; |
|
508 |
selected.Y += dy; |
|
509 |
for (int i = 0; i < (this as IPath).PointSet.Count; i++) |
|
510 |
{ |
|
511 |
if (pt.Equals((this as IPath).PointSet[i])) |
|
512 |
{ |
|
513 |
(this as IPath).PointSet[i] = selected; |
|
514 |
} |
|
515 |
} |
|
516 |
this.updateControl(); |
|
517 |
} |
|
518 |
|
|
519 |
/// <summary> |
|
497 | 520 |
/// Serialize this |
498 | 521 |
/// </summary> |
499 | 522 |
/// <param name="sUserId"></param> |
MarkupToPDF/Controls/Line/ArrowControl_Multi.cs | ||
---|---|---|
18 | 18 |
|
19 | 19 |
namespace MarkupToPDF.Controls.Line |
20 | 20 |
{ |
21 |
|
|
22 | 21 |
public class ArrowControl_Multi : CommentUserInfo, IDisposable, INotifyPropertyChanged, IMarkupCommonData, IDashControl |
23 | 22 |
{ |
24 | 23 |
|
... | ... | |
387 | 386 |
} |
388 | 387 |
|
389 | 388 |
/// <summary> |
389 |
/// move control point has same location of given pt along given delta |
|
390 |
/// </summary> |
|
391 |
/// <author>humkyung</author> |
|
392 |
/// <date>2019.06.20</date> |
|
393 |
/// <param name="pt"></param> |
|
394 |
/// <param name="dx"></param> |
|
395 |
/// <param name="dy"></param> |
|
396 |
public override void OnMoveCtrlPoint(Point pt, double dx, double dy) |
|
397 |
{ |
|
398 |
Point selected = MathSet.getNearPoint((this as IPath).PointSet, pt); |
|
399 |
selected.X += dx; |
|
400 |
selected.Y += dy; |
|
401 |
for (int i = 0; i < (this as IPath).PointSet.Count; i++) |
|
402 |
{ |
|
403 |
if (pt.Equals((this as IPath).PointSet[i])) |
|
404 |
{ |
|
405 |
(this as IPath).PointSet[i] = selected; |
|
406 |
} |
|
407 |
} |
|
408 |
this.updateControl(); |
|
409 |
} |
|
410 |
|
|
411 |
/// <summary> |
|
390 | 412 |
/// return ArrowControl_Multi's area |
391 | 413 |
/// </summary> |
392 | 414 |
/// <author>humkyung</author> |
MarkupToPDF/Controls/Line/LineControl.cs | ||
---|---|---|
522 | 522 |
} |
523 | 523 |
|
524 | 524 |
/// <summary> |
525 |
/// move control point has same location of given pt along given delta |
|
526 |
/// </summary> |
|
527 |
/// <author>humkyung</author> |
|
528 |
/// <date>2019.06.20</date> |
|
529 |
/// <param name="pt"></param> |
|
530 |
/// <param name="dx"></param> |
|
531 |
/// <param name="dy"></param> |
|
532 |
public override void OnMoveCtrlPoint(Point pt, double dx, double dy) |
|
533 |
{ |
|
534 |
Point selected = MathSet.getNearPoint((this as IPath).PointSet, pt); |
|
535 |
selected.X += dx; |
|
536 |
selected.Y += dy; |
|
537 |
for (int i = 0; i < (this as IPath).PointSet.Count; i++) |
|
538 |
{ |
|
539 |
if (pt.Equals((this as IPath).PointSet[i])) |
|
540 |
{ |
|
541 |
(this as IPath).PointSet[i] = selected; |
|
542 |
} |
|
543 |
} |
|
544 |
this.updateControl(); |
|
545 |
} |
|
546 |
|
|
547 |
/// <summary> |
|
525 | 548 |
/// return linecontrols' area |
526 | 549 |
/// </summary> |
527 | 550 |
/// <author>humkyung</author> |
MarkupToPDF/Controls/Polygon/CloudControl.cs | ||
---|---|---|
832 | 832 |
} |
833 | 833 |
|
834 | 834 |
/// <summary> |
835 |
/// move control point has same location of given pt along given delta |
|
836 |
/// </summary> |
|
837 |
/// <author>humkyung</author> |
|
838 |
/// <date>2019.06.20</date> |
|
839 |
/// <param name="pt"></param> |
|
840 |
/// <param name="dx"></param> |
|
841 |
/// <param name="dy"></param> |
|
842 |
public override void OnMoveCtrlPoint(Point pt, double dx, double dy) |
|
843 |
{ |
|
844 |
Point selected = MathSet.getNearPoint((this as IPath).PointSet, pt); |
|
845 |
selected.X += dx; |
|
846 |
selected.Y += dy; |
|
847 |
for (int i = 0; i < (this as IPath).PointSet.Count; i++) |
|
848 |
{ |
|
849 |
if (pt.Equals((this as IPath).PointSet[i])) |
|
850 |
{ |
|
851 |
(this as IPath).PointSet[i] = selected; |
|
852 |
break; |
|
853 |
} |
|
854 |
} |
|
855 |
this.updateControl(); |
|
856 |
this.DrawingCloud(); |
|
857 |
} |
|
858 |
|
|
859 |
/// <summary> |
|
835 | 860 |
/// return Cloud's area |
836 | 861 |
/// </summary> |
837 | 862 |
/// <author>humkyung</author> |
MarkupToPDF/Controls/Polygon/InkControl.cs | ||
---|---|---|
539 | 539 |
} |
540 | 540 |
|
541 | 541 |
/// <summary> |
542 |
/// move control point has same location of given pt along given delta |
|
543 |
/// </summary> |
|
544 |
/// <author>humkyung</author> |
|
545 |
/// <date>2019.06.20</date> |
|
546 |
/// <param name="pt"></param> |
|
547 |
/// <param name="dx"></param> |
|
548 |
/// <param name="dy"></param> |
|
549 |
public override void OnMoveCtrlPoint(Point pt, double dx, double dy) |
|
550 |
{ |
|
551 |
Point selected = MathSet.getNearPoint((this as IPath).PointSet, pt); |
|
552 |
selected.X += dx; |
|
553 |
selected.Y += dy; |
|
554 |
for (int i = 0; i < (this as IPath).PointSet.Count; i++) |
|
555 |
{ |
|
556 |
if (pt.Equals((this as IPath).PointSet[i])) |
|
557 |
{ |
|
558 |
(this as IPath).PointSet[i] = selected; |
|
559 |
break; |
|
560 |
} |
|
561 |
} |
|
562 |
this.updateControl(); |
|
563 |
} |
|
564 |
|
|
565 |
/// <summary> |
|
542 | 566 |
/// Serialize this |
543 | 567 |
/// </summary> |
544 | 568 |
/// <param name="sUserId"></param> |
MarkupToPDF/Controls/Polygon/PolygonControl.cs | ||
---|---|---|
503 | 503 |
} |
504 | 504 |
|
505 | 505 |
/// <summary> |
506 |
/// move control point has same location of given pt along given delta |
|
507 |
/// </summary> |
|
508 |
/// <author>humkyung</author> |
|
509 |
/// <date>2019.06.20</date> |
|
510 |
/// <param name="pt"></param> |
|
511 |
/// <param name="dx"></param> |
|
512 |
/// <param name="dy"></param> |
|
513 |
public override void OnMoveCtrlPoint(Point pt, double dx, double dy) |
|
514 |
{ |
|
515 |
Point selected = MathSet.getNearPoint((this as IPath).PointSet, pt); |
|
516 |
selected.X += dx; |
|
517 |
selected.Y += dy; |
|
518 |
for (int i = 0; i < (this as IPath).PointSet.Count; i++) |
|
519 |
{ |
|
520 |
if (pt.Equals((this as IPath).PointSet[i])) |
|
521 |
{ |
|
522 |
(this as IPath).PointSet[i] = selected; |
|
523 |
break; |
|
524 |
} |
|
525 |
} |
|
526 |
this.updateControl(); |
|
527 |
} |
|
528 |
|
|
529 |
/// <summary> |
|
506 | 530 |
/// return Polygon's area |
507 | 531 |
/// </summary> |
508 | 532 |
/// <author>humkyung</author> |
MarkupToPDF/Controls/Shape/CircleControl.cs | ||
---|---|---|
458 | 458 |
} |
459 | 459 |
|
460 | 460 |
/// <summary> |
461 |
/// move control point has same location of given pt along given delta |
|
462 |
/// </summary> |
|
463 |
/// <author>humkyung</author> |
|
464 |
/// <date>2019.06.20</date> |
|
465 |
/// <param name="pt"></param> |
|
466 |
/// <param name="dx"></param> |
|
467 |
/// <param name="dy"></param> |
|
468 |
public override void OnMoveCtrlPoint(Point pt, double dx, double dy) |
|
469 |
{ |
|
470 |
IPath path = (this as IPath); |
|
471 |
Point selected = MathSet.getNearPoint(path.PointSet, pt); |
|
472 |
selected.X += dx; |
|
473 |
selected.Y += dy; |
|
474 |
int i = 0; |
|
475 |
for (i = 0; i < (this as IPath).PointSet.Count; i++) |
|
476 |
{ |
|
477 |
if (pt.Equals((this as IPath).PointSet[i])) |
|
478 |
{ |
|
479 |
(this as IPath).PointSet[i] = selected; |
|
480 |
break; |
|
481 |
} |
|
482 |
} |
|
483 |
|
|
484 |
List<Point> newPointSet = new List<Point> { }; |
|
485 |
Point middle = new Point(path.PathData.Bounds.X + path.PathData.Bounds.Width * 0.5, path.PathData.Bounds.Y + path.PathData.Bounds.Height * 0.5); |
|
486 |
foreach (Point _pt in path.PointSet) |
|
487 |
{ |
|
488 |
newPointSet.Add(_pt); |
|
489 |
} |
|
490 |
var ReverseP = (i + newPointSet.Count() / 2) % newPointSet.Count(); |
|
491 |
var PreviousP = (i + (newPointSet.Count() - 1)) % newPointSet.Count(); |
|
492 |
var NextP = (i + 1) % newPointSet.Count(); |
|
493 |
var distance = MathSet.DistanceTo(newPointSet[ReverseP], newPointSet[i]); |
|
494 |
var PreviousV = MathSet.GetNormVectorBetween(newPointSet[ReverseP], newPointSet[PreviousP]); |
|
495 |
var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, newPointSet[i].X - newPointSet[ReverseP].X, |
|
496 |
newPointSet[i].Y - newPointSet[ReverseP].Y); |
|
497 |
newPointSet[PreviousP] = new Point(newPointSet[ReverseP].X + PreviousV.X * l, newPointSet[ReverseP].Y |
|
498 |
+ PreviousV.Y * l); |
|
499 |
|
|
500 |
var NextV = MathSet.GetNormVectorBetween(newPointSet[ReverseP], newPointSet[NextP]); |
|
501 |
l = MathSet.DotProduct(NextV.X, NextV.Y, newPointSet[i].X - newPointSet[ReverseP].X, newPointSet[i].Y |
|
502 |
- newPointSet[ReverseP].Y); |
|
503 |
newPointSet[NextP] = new Point(newPointSet[ReverseP].X + NextV.X * l, newPointSet[ReverseP].Y + NextV.Y * l); |
|
504 |
|
|
505 |
path.PointSet = newPointSet; |
|
506 |
this.updateControl(); |
|
507 |
} |
|
508 |
|
|
509 |
/// <summary> |
|
461 | 510 |
/// return circlecontrols' area |
462 | 511 |
/// </summary> |
463 | 512 |
/// <author>humkyung</author> |
MarkupToPDF/Controls/Shape/RectCloudControl.cs | ||
---|---|---|
582 | 582 |
} |
583 | 583 |
|
584 | 584 |
/// <summary> |
585 |
/// move control point has same location of given pt along given delta |
|
586 |
/// </summary> |
|
587 |
/// <author>humkyung</author> |
|
588 |
/// <date>2019.06.20</date> |
|
589 |
/// <param name="pt"></param> |
|
590 |
/// <param name="dx"></param> |
|
591 |
/// <param name="dy"></param> |
|
592 |
public override void OnMoveCtrlPoint(Point pt, double dx, double dy) |
|
593 |
{ |
|
594 |
IPath path = (this as IPath); |
|
595 |
|
|
596 |
Point selected = MathSet.getNearPoint(path.PointSet, pt); |
|
597 |
selected.X += dx; |
|
598 |
selected.Y += dy; |
|
599 |
int i = 0; |
|
600 |
for (i = 0; i < (this as IPath).PointSet.Count; i++) |
|
601 |
{ |
|
602 |
if (pt.Equals((this as IPath).PointSet[i])) |
|
603 |
{ |
|
604 |
(this as IPath).PointSet[i] = selected; |
|
605 |
break; |
|
606 |
} |
|
607 |
} |
|
608 |
|
|
609 |
var ReverseP = (i + path.PointSet.Count() / 2) % path.PointSet.Count(); |
|
610 |
var PreviousP = (i + (path.PointSet.Count() - 1)) % path.PointSet.Count(); |
|
611 |
var NextP = (i + 1) % path.PointSet.Count(); |
|
612 |
|
|
613 |
var distance = MathSet.DistanceTo(path.PointSet[ReverseP], path.PointSet[i]); |
|
614 |
|
|
615 |
var PreviousV = MathSet.GetNormVectorBetween(path.PointSet[ReverseP], path.PointSet[PreviousP]); |
|
616 |
var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, path.PointSet[i].X - path.PointSet[ReverseP].X, |
|
617 |
path.PointSet[i].Y - path.PointSet[ReverseP].Y); |
|
618 |
path.PointSet[PreviousP] = new Point(path.PointSet[ReverseP].X + PreviousV.X * l, path.PointSet |
|
619 |
[ReverseP].Y + PreviousV.Y * l); |
|
620 |
|
|
621 |
var NextV = MathSet.GetNormVectorBetween(path.PointSet[ReverseP], path.PointSet[NextP]); |
|
622 |
l = MathSet.DotProduct(NextV.X, NextV.Y, path.PointSet[i].X - path.PointSet[ReverseP].X, path.PointSet |
|
623 |
[i].Y - path.PointSet[ReverseP].Y); |
|
624 |
path.PointSet[NextP] = new Point(path.PointSet[ReverseP].X + NextV.X * l, path.PointSet[ReverseP].Y + NextV.Y * l); |
|
625 |
|
|
626 |
this.updateControl(); |
|
627 |
} |
|
628 |
|
|
629 |
/// <summary> |
|
585 | 630 |
/// return rectcloudcontrols' area |
586 | 631 |
/// </summary> |
587 | 632 |
/// <author>humkyung</author> |
MarkupToPDF/Controls/Shape/RectangleControl.cs | ||
---|---|---|
571 | 571 |
} |
572 | 572 |
|
573 | 573 |
/// <summary> |
574 |
/// move control point has same location of given pt along given delta |
|
575 |
/// </summary> |
|
576 |
/// <author>humkyung</author> |
|
577 |
/// <date>2019.06.20</date> |
|
578 |
/// <param name="pt"></param> |
|
579 |
/// <param name="dx"></param> |
|
580 |
/// <param name="dy"></param> |
|
581 |
public override void OnMoveCtrlPoint(Point pt, double dx, double dy) |
|
582 |
{ |
|
583 |
IPath path = (this as IPath); |
|
584 |
|
|
585 |
Point selected = MathSet.getNearPoint(path.PointSet, pt); |
|
586 |
selected.X += dx; |
|
587 |
selected.Y += dy; |
|
588 |
int i = 0; |
|
589 |
for (i = 0; i < (this as IPath).PointSet.Count; i++) |
|
590 |
{ |
|
591 |
if (pt.Equals((this as IPath).PointSet[i])) |
|
592 |
{ |
|
593 |
(this as IPath).PointSet[i] = selected; |
|
594 |
break; |
|
595 |
} |
|
596 |
} |
|
597 |
|
|
598 |
var ReverseP = (i + path.PointSet.Count() / 2) % path.PointSet.Count(); |
|
599 |
var PreviousP = (i + (path.PointSet.Count() - 1)) % path.PointSet.Count(); |
|
600 |
var NextP = (i + 1) % path.PointSet.Count(); |
|
601 |
|
|
602 |
var distance = MathSet.DistanceTo(path.PointSet[ReverseP], path.PointSet[i]); |
|
603 |
|
|
604 |
var PreviousV = MathSet.GetNormVectorBetween(path.PointSet[ReverseP], path.PointSet[PreviousP]); |
|
605 |
var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, path.PointSet[i].X - path.PointSet[ReverseP].X, |
|
606 |
path.PointSet[i].Y - path.PointSet[ReverseP].Y); |
|
607 |
path.PointSet[PreviousP] = new Point(path.PointSet[ReverseP].X + PreviousV.X * l, path.PointSet |
|
608 |
[ReverseP].Y + PreviousV.Y * l); |
|
609 |
|
|
610 |
var NextV = MathSet.GetNormVectorBetween(path.PointSet[ReverseP], path.PointSet[NextP]); |
|
611 |
l = MathSet.DotProduct(NextV.X, NextV.Y, path.PointSet[i].X - path.PointSet[ReverseP].X, path.PointSet |
|
612 |
[i].Y - path.PointSet[ReverseP].Y); |
|
613 |
path.PointSet[NextP] = new Point(path.PointSet[ReverseP].X + NextV.X * l, path.PointSet[ReverseP].Y + NextV.Y * l); |
|
614 |
|
|
615 |
this.updateControl(); |
|
616 |
} |
|
617 |
|
|
618 |
/// <summary> |
|
574 | 619 |
/// return rectanglecontrols' area |
575 | 620 |
/// </summary> |
576 | 621 |
public override Rect ItemRect |
MarkupToPDF/Controls/Shape/TriControl.cs | ||
---|---|---|
437 | 437 |
} |
438 | 438 |
|
439 | 439 |
/// <summary> |
440 |
/// move control point has same location of given pt along given delta |
|
441 |
/// </summary> |
|
442 |
/// <author>humkyung</author> |
|
443 |
/// <date>2019.06.20</date> |
|
444 |
/// <param name="pt"></param> |
|
445 |
/// <param name="delta"></param> |
|
446 |
public override void OnMoveCtrlPoint(Point pt, double dx, double dy) |
|
447 |
{ |
|
448 |
Point selected = MathSet.getNearPoint((this as IPath).PointSet, pt); |
|
449 |
selected.X += dx; |
|
450 |
selected.Y += dy; |
|
451 |
for (int i = 0; i < (this as IPath).PointSet.Count; i++) |
|
452 |
{ |
|
453 |
if (pt.Equals((this as IPath).PointSet[i])) |
|
454 |
{ |
|
455 |
(this as IPath).PointSet[i] = selected; |
|
456 |
} |
|
457 |
} |
|
458 |
this.updateControl(); |
|
459 |
} |
|
460 |
|
|
461 |
/// <summary> |
|
440 | 462 |
/// return tricontrols' area |
441 | 463 |
/// </summary> |
442 | 464 |
/// <author>humkyung</author> |
MarkupToPDF/Controls/Text/ArrowTextControl.cs | ||
---|---|---|
1503 | 1503 |
} |
1504 | 1504 |
|
1505 | 1505 |
/// <summary> |
1506 |
/// move control point has same location of given pt along given delta |
|
1507 |
/// </summary> |
|
1508 |
/// <author>humkyung</author> |
|
1509 |
/// <date>2019.06.20</date> |
|
1510 |
/// <param name="pt"></param> |
|
1511 |
/// <param name="dx"></param> |
|
1512 |
/// <param name="dy"></param> |
|
1513 |
public override void OnMoveCtrlPoint(Point pt, double dx, double dy) |
|
1514 |
{ |
|
1515 |
IPath path = (this as IPath); |
|
1516 |
|
|
1517 |
Point selected = MathSet.getNearPoint(path.PointSet, pt); |
|
1518 |
selected.X += dx; |
|
1519 |
selected.Y += dy; |
|
1520 |
int i = 0; |
|
1521 |
for (i = 0; i < (this as IPath).PointSet.Count; i++) |
|
1522 |
{ |
|
1523 |
if (pt.Equals((this as IPath).PointSet[i])) break; |
|
1524 |
} |
|
1525 |
|
|
1526 |
List<Point> pts = path.PointSet; |
|
1527 |
if ((pts[0].X > pts[1].X && dx > 0) || (pts[0].X < pts[1].X && dx < 0)) |
|
1528 |
{ |
|
1529 |
pts[1] = new Point(pts[1].X + dx, pts[1].Y); |
|
1530 |
} |
|
1531 |
if ((pts[0].Y > pts[1].Y && dy > 0) || (pts[0].Y < pts[1].Y && dy < 0)) |
|
1532 |
{ |
|
1533 |
pts[1] = new Point(pts[1].X, pts[1].Y + dy); |
|
1534 |
} |
|
1535 |
path.PointSet[1] = pts[1]; |
|
1536 |
path.PointSet[i] = selected; |
|
1537 |
|
|
1538 |
this.updateControl(); |
|
1539 |
} |
|
1540 |
|
|
1541 |
/// <summary> |
|
1506 | 1542 |
/// return ArrowTextControl's area |
1507 | 1543 |
/// </summary> |
1508 | 1544 |
/// <author>humkyung</author> |
내보내기 Unified diff