개정판 62b6bcde
issue #923: clean AdornerFinal file
Change-Id: I8d331acc55f77f07acc7567ff9d5435ac4a08994
KCOM/Controls/AdornerFinal.xaml.cs | ||
---|---|---|
289 | 289 |
this.Focus(); |
290 | 290 |
} |
291 | 291 |
|
292 |
#endregion |
|
293 |
#region 메서드 |
|
294 |
public Rect getAdornerSize() |
|
292 |
public Point Centeroid |
|
293 |
{ |
|
294 |
get |
|
295 |
{ |
|
296 |
List<Point> pts = new List<Point>(); |
|
297 |
|
|
298 |
#region 센터 포인트 구하기 (그룹핑) |
|
299 |
foreach (var item in this.Members) |
|
300 |
{ |
|
301 |
if (item.DrawingData.GetType().Name == "TextControl") |
|
302 |
{ |
|
303 |
if (AngleValue == 0) |
|
304 |
{ |
|
305 |
AngleValue = (item.DrawingData as TextControl).Angle; |
|
306 |
} |
|
307 |
double X = Canvas.GetLeft((item.DrawingData as TextControl)); |
|
308 |
double Y = Canvas.GetTop((item.DrawingData as TextControl)); |
|
309 |
pts.Add(new Point(X, Y)); |
|
310 |
} |
|
311 |
else |
|
312 |
{ |
|
313 |
pts.AddRange((item.DrawingData as IPath).PointSet); |
|
314 |
} |
|
315 |
} |
|
316 |
#endregion |
|
317 |
|
|
318 |
return MathSet.FindCentroid(pts); |
|
319 |
} |
|
320 |
} |
|
321 |
|
|
322 |
#endregion |
|
323 |
#region 메서드 |
|
324 |
public Rect getAdornerSize() |
|
295 | 325 |
{ |
296 | 326 |
return BorderSize; |
297 | 327 |
} |
... | ... | |
1137 | 1167 |
item.UpdateThumb(); |
1138 | 1168 |
} |
1139 | 1169 |
|
1140 |
public void Set_Rotate() |
|
1141 |
{ |
|
1142 |
double dDeltaAngle = 0; |
|
1143 |
List<Point> AllPointSet = new List<Point>(); |
|
1144 |
Point CenterPoint = new Point(); |
|
1145 |
|
|
1146 |
if (AngleValue >= 360) |
|
1147 |
{ |
|
1148 |
AngleValue -= 360; |
|
1149 |
} |
|
1150 |
else if (AngleValue <= -360) |
|
1151 |
{ |
|
1152 |
AngleValue += 360; |
|
1153 |
} |
|
1154 |
|
|
1155 |
#region 센터 포인트 구하기 (그룹핑) |
|
1156 |
foreach (var item in this.Members) |
|
1157 |
{ |
|
1158 |
if (item.DrawingData.GetType().Name == "TextControl") |
|
1159 |
{ |
|
1160 |
} |
|
1161 |
else |
|
1162 |
{ |
|
1163 |
foreach (Point itemP in (item.DrawingData as IPath).PointSet) |
|
1164 |
{ |
|
1165 |
AllPointSet.Add(itemP); |
|
1166 |
} |
|
1167 |
} |
|
1168 |
} |
|
1169 |
#endregion |
|
1170 |
|
|
1171 |
CenterPoint = MathSet.FindCentroid(AllPointSet); |
|
1172 |
|
|
1173 |
Dispatcher.BeginInvoke((Action)(() => |
|
1174 |
{ |
|
1175 |
foreach (var item in this.Members) |
|
1176 |
{ |
|
1177 |
foreach (var thumb in item.ThumbList) |
|
1178 |
{ |
|
1179 |
double x = Canvas.GetLeft(thumb); |
|
1180 |
double y = Canvas.GetTop(thumb); |
|
1181 |
|
|
1182 |
Point value = MathSet.RotateAbout(CenterPoint, new Point(x, y), dDeltaAngle); |
|
1183 |
Canvas.SetLeft(thumb, value.X); |
|
1184 |
Canvas.SetTop(thumb, value.Y); |
|
1185 |
|
|
1186 |
if (item.DrawingData.GetType().Name == "ArrowTextControl" && thumb == item.ThumbList.Last()) |
|
1187 |
{ |
|
1188 |
|
|
1189 |
Canvas.SetLeft(thumb, Canvas.GetLeft((item.DrawingData as ArrowTextControl).Base_TextBox)); |
|
1190 |
Canvas.SetTop(thumb, Canvas.GetTop((item.DrawingData as ArrowTextControl).Base_TextBox)); |
|
1191 |
if (!(item.DrawingData as ArrowTextControl).isTrans) |
|
1192 |
{ |
|
1193 |
List<Point> ps = new List<Point>(); |
|
1194 |
var temp = (this.Members.First() as AdornerMember).DrawingData as ArrowTextControl; |
|
1195 |
switch (Math.Abs(temp.Angle).ToString()) |
|
1196 |
{ |
|
1197 |
case "90": |
|
1198 |
{ |
|
1199 |
ps.Clear(); |
|
1200 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox))); //위 왼쪽 |
|
1201 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth / 2)); // 위 중간 |
|
1202 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth)); // 위 오른쪽 |
|
1203 |
|
|
1204 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox))); //왼쪽 중간 |
|
1205 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox))); //왼쪽 하단 |
|
1206 |
|
|
1207 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth / 2)); //중간 하단 |
|
1208 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth)); //오른쪽 하단 |
|
1209 |
|
|
1210 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox) - temp.BoxWidth)); //오른쪽 중간 |
|
1211 |
} |
|
1212 |
break; |
|
1213 |
case "270": |
|
1214 |
{ |
|
1215 |
ps.Clear(); |
|
1216 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox))); //위 왼쪽 |
|
1217 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth / 2)); // 위 중간 |
|
1218 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth)); // 위 오른쪽 |
|
1219 |
|
|
1220 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox))); //왼쪽 중간 |
|
1221 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox))); //왼쪽 하단 |
|
1222 |
|
|
1223 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth / 2)); //중간 하단 |
|
1224 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight, Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth)); //오른쪽 하단 |
|
1225 |
|
|
1226 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) - temp.BoxHeight / 2, Canvas.GetTop(temp.Base_TextBox) + temp.BoxWidth)); //오른쪽 중간 |
|
1227 |
} |
|
1228 |
break; |
|
1229 |
default: |
|
1230 |
{ |
|
1231 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox))); //상단 |
|
1232 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth / 2, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight)); // 하단 |
|
1233 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox), Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //좌단 |
|
1234 |
ps.Add(new Point(Canvas.GetLeft(temp.Base_TextBox) + temp.BoxWidth, Canvas.GetTop(temp.Base_TextBox) + temp.BoxHeight / 2)); //우단 |
|
1235 |
} |
|
1236 |
break; |
|
1237 |
} |
|
1238 |
|
|
1239 |
var endP = MathSet.getNearPoint(ps, temp.MidPoint); |
|
1240 |
var tempP = MathSet.getMiddlePoint(temp.StartPoint, endP); |
|
1241 |
Canvas.SetLeft((this.Members.First() as AdornerMember).ThumbList[1], tempP.X); |
|
1242 |
Canvas.SetTop((this.Members.First() as AdornerMember).ThumbList[1], tempP.Y); |
|
1243 |
} |
|
1244 |
} |
|
1245 |
} |
|
1246 |
|
|
1247 |
for (int i = 0; i < (item.DrawingData as IPath).PointSet.Count(); i++) |
|
1248 |
{ |
|
1249 |
(item.DrawingData as IPath).PointSet[i] = MathSet.RotateAbout(CenterPoint, (item.DrawingData as IPath).PointSet[i], dDeltaAngle); |
|
1250 |
} |
|
1251 |
} |
|
1252 |
#region 컨트롤 업데이트 |
|
1253 |
foreach (var item in this.Members) |
|
1254 |
{ |
|
1255 |
switch (item.Drawingtype) |
|
1256 |
{ |
|
1257 |
case ControlType.TextControl: |
|
1258 |
((TextControl)item.DrawingData).Angle = AngleValue; |
|
1259 |
|
|
1260 |
RectangleGeometry Data = new RectangleGeometry |
|
1261 |
{ |
|
1262 |
Rect = new Rect() |
|
1263 |
{ |
|
1264 |
X = Canvas.GetLeft((item.DrawingData as TextControl)), |
|
1265 |
Y = Canvas.GetTop((item.DrawingData as TextControl)), |
|
1266 |
Width = (item.DrawingData as TextControl).Base_TextBlock.ActualWidth / 2, |
|
1267 |
Height = (item.DrawingData as TextControl).Base_TextBlock.ActualHeight / 2, |
|
1268 |
} |
|
1269 |
}; |
|
1270 |
|
|
1271 |
Point endPointV = new Point(Data.Bounds.Right, Data.Bounds.Bottom); |
|
1272 |
Point middle = MathSet.getMiddlePoint((item.DrawingData as TextControl).StartPoint, endPointV); |
|
1273 |
|
|
1274 |
DragThumb.RenderTransformOrigin = new Point(0.0, 0.0); |
|
1275 |
DragThumb.RenderTransform = new RotateTransform() |
|
1276 |
{ |
|
1277 |
Angle = (item.DrawingData as TextControl).Angle, |
|
1278 |
|
|
1279 |
}; |
|
1280 |
|
|
1281 |
AdornerBorder.RenderTransformOrigin = new Point(0.0, 0.0); |
|
1282 |
AdornerBorder.RenderTransform = new RotateTransform() |
|
1283 |
{ |
|
1284 |
Angle = (item.DrawingData as TextControl).Angle, |
|
1285 |
|
|
1286 |
}; |
|
1287 |
|
|
1288 |
(item.DrawingData as TextControl).Base_Grid.RenderTransform = new RotateTransform() |
|
1289 |
{ |
|
1290 |
Angle = (item.DrawingData as TextControl).Angle, |
|
1291 |
}; |
|
1292 |
BorderUpdate(); |
|
1293 |
break; |
|
1294 |
|
|
1295 |
case ControlType.Date: |
|
1296 |
((DateControl)item.DrawingData).Angle = AngleValue; |
|
1297 |
(item.DrawingData as CommentUserInfo).UpdateControl(); |
|
1298 |
BorderUpdate(); |
|
1299 |
break; |
|
1300 |
case ControlType.ArrowMultiLine: |
|
1301 |
case ControlType.ArcLine: |
|
1302 |
case ControlType.ArcArrow: |
|
1303 |
case ControlType.SingleLine: |
|
1304 |
case ControlType.Triangle: |
|
1305 |
(item.DrawingData as CommentUserInfo).UpdateControl(); |
|
1306 |
BorderUpdate(); |
|
1307 |
break; |
|
1308 |
case ControlType.ArrowTextControl: |
|
1309 |
(item.DrawingData as CommentUserInfo).UpdateControl(); |
|
1310 |
BorderUpdate(); |
|
1311 |
break; |
|
1312 |
case ControlType.RectCloud: |
|
1313 |
((RectCloudControl)item.DrawingData).Angle = AngleValue; |
|
1314 |
(item.DrawingData as CommentUserInfo).UpdateControl(); |
|
1315 |
BorderUpdate(); |
|
1316 |
break; |
|
1317 |
case ControlType.Rectangle: |
|
1318 |
((RectangleControl)item.DrawingData).Angle = AngleValue; |
|
1319 |
(item.DrawingData as CommentUserInfo).UpdateControl(); |
|
1320 |
BorderUpdate(); |
|
1321 |
break; |
|
1322 |
case ControlType.ImgControl: |
|
1323 |
((ImgControl)item.DrawingData).Angle = AngleValue; |
|
1324 |
(item.DrawingData as CommentUserInfo).UpdateControl(); |
|
1325 |
BorderUpdate(); |
|
1326 |
break; |
|
1327 |
case ControlType.Sign: |
|
1328 |
((SignControl)item.DrawingData).Angle = AngleValue; |
|
1329 |
(item.DrawingData as CommentUserInfo).UpdateControl(); |
|
1330 |
BorderUpdate(); |
|
1331 |
break; |
|
1332 |
case ControlType.Symbol: |
|
1333 |
((SymControl)item.DrawingData).Angle = AngleValue; |
|
1334 |
(item.DrawingData as CommentUserInfo).UpdateControl(); |
|
1335 |
BorderUpdate(); |
|
1336 |
break; |
|
1337 |
case ControlType.Stamp: |
|
1338 |
((SymControlN)item.DrawingData).Angle = AngleValue; |
|
1339 |
(item.DrawingData as CommentUserInfo).UpdateControl(); |
|
1340 |
BorderUpdate(); |
|
1341 |
break; |
|
1342 |
case ControlType.PolygonControl: |
|
1343 |
(item.DrawingData as CommentUserInfo).UpdateControl(); |
|
1344 |
BorderUpdate(); |
|
1345 |
break; |
|
1346 |
case ControlType.PolygonCloud: |
|
1347 |
((ICloudControl)item.DrawingData).DrawingCloud(); |
|
1348 |
(item.DrawingData as CommentUserInfo).UpdateControl(); |
|
1349 |
BorderUpdate(); |
|
1350 |
break; |
|
1351 |
case ControlType.Circle: |
|
1352 |
((IShapeControl)item.DrawingData).Angle = AngleValue; |
|
1353 |
(item.DrawingData as CommentUserInfo).UpdateControl(); |
|
1354 |
((CircleControl)item.DrawingData).SetCenterXY(); |
|
1355 |
BorderUpdate(); |
|
1356 |
break; |
|
1357 |
case ControlType.Ink: |
|
1358 |
(item.DrawingData as CommentUserInfo).UpdateControl(); |
|
1359 |
BorderUpdate(); |
|
1360 |
break; |
|
1361 |
case ControlType.InsideWhite: |
|
1362 |
((InsideWhiteControl)item.DrawingData).Angle = AngleValue; |
|
1363 |
(item.DrawingData as CommentUserInfo).UpdateControl(); |
|
1364 |
BorderUpdate(); |
|
1365 |
break; |
|
1366 |
case ControlType.OverlapWhite: |
|
1367 |
((OverlapWhiteControl)item.DrawingData).Angle = AngleValue; |
|
1368 |
(item.DrawingData as CommentUserInfo).UpdateControl(); |
|
1369 |
BorderUpdate(); |
|
1370 |
break; |
|
1371 |
case ControlType.ClipWhite: |
|
1372 |
((ClipWhiteControl)item.DrawingData).Angle = AngleValue; |
|
1373 |
(item.DrawingData as CommentUserInfo).UpdateControl(); |
|
1374 |
BorderUpdate(); |
|
1375 |
break; |
|
1376 |
case ControlType.Coordinate: |
|
1377 |
((CoordinateControl)item.DrawingData).Angle = AngleValue; |
|
1378 |
(item.DrawingData as CommentUserInfo).UpdateControl(); |
|
1379 |
BorderUpdate(); |
|
1380 |
break; |
|
1381 |
default: |
|
1382 |
break; |
|
1383 |
} |
|
1384 |
} |
|
1385 |
#endregion |
|
1386 |
})); |
|
1387 |
} |
|
1388 |
|
|
1389 | 1170 |
private void resize_MouseMove(object sender, MouseEventArgs e) |
1390 | 1171 |
{ |
1391 | 1172 |
reSizePoint = e.GetPosition(this); |
... | ... | |
1411 | 1192 |
/// <param name="e"></param> |
1412 | 1193 |
public void MoveRotate(DragDeltaEventArgs e) |
1413 | 1194 |
{ |
1414 |
double dDeltaAngle = 0; |
|
1415 |
|
|
1416 |
List<Point> AllPointSet = new List<Point>(); |
|
1417 |
Point CenterPoint = new Point(); |
|
1418 |
|
|
1419 |
#region 센터 포인트 구하기 (그룹핑) |
|
1420 |
foreach (var item in this.Members) |
|
1421 |
{ |
|
1422 |
if (item.DrawingData.GetType().Name == "TextControl") |
|
1423 |
{ |
|
1424 |
if (AngleValue == 0) |
|
1425 |
{ |
|
1426 |
AngleValue = (item.DrawingData as TextControl).Angle; |
|
1427 |
} |
|
1428 |
double X = Canvas.GetLeft((item.DrawingData as TextControl)); |
|
1429 |
double Y = Canvas.GetTop((item.DrawingData as TextControl)); |
|
1430 |
AllPointSet.Add(new Point(X, Y)); |
|
1431 |
} |
|
1432 |
else |
|
1433 |
{ |
|
1434 |
foreach (Point itemP in (item.DrawingData as IPath).PointSet) |
|
1435 |
{ |
|
1436 |
AllPointSet.Add(itemP); |
|
1437 |
} |
|
1438 |
} |
|
1439 |
} |
|
1440 |
#endregion |
|
1441 |
CenterPoint = MathSet.FindCentroid(AllPointSet); |
|
1195 |
Point CenterPoint = this.Centeroid; |
|
1442 | 1196 |
Point pt = Mouse.GetPosition(this); |
1443 | 1197 |
|
1444 | 1198 |
Point vec1 = new Point(this.rotatePoint.X - CenterPoint.X, this.rotatePoint.Y - CenterPoint.Y); |
1445 | 1199 |
Point vec2 = new Point(pt.X - CenterPoint.X, pt.Y - CenterPoint.Y); |
1446 |
dDeltaAngle = (MathSet.getAngleBetweenVectors(vec1, vec2)); |
|
1200 |
double dDeltaAngle = (MathSet.getAngleBetweenVectors(vec1, vec2));
|
|
1447 | 1201 |
|
1448 | 1202 |
AngleValue += dDeltaAngle; |
1449 | 1203 |
if (AngleValue > 360) AngleValue -= 360; |
... | ... | |
1492 | 1246 |
Angle = (member.DrawingData as TextControl).Angle, |
1493 | 1247 |
}; |
1494 | 1248 |
|
1249 |
(member.DrawingData as CommentUserInfo).UpdateControl(); |
|
1495 | 1250 |
BorderUpdate(); |
1496 | 1251 |
break; |
1497 | 1252 |
|
... | ... | |
1534 | 1289 |
|
1535 | 1290 |
private void rotate_DragStarted(object sender, DragStartedEventArgs e) |
1536 | 1291 |
{ |
1537 |
|
|
1538 | 1292 |
this.rotatePoint = Mouse.GetPosition(this); /// 2018.05.09 added by humkyung |
1539 | 1293 |
rotateTop.Cursor = Cursors.SizeAll; |
1540 | 1294 |
|
... | ... | |
1545 | 1299 |
} |
1546 | 1300 |
/// up to here |
1547 | 1301 |
|
1548 |
|
|
1549 |
|
|
1550 | 1302 |
if (ViewerDataModel.Instance.UndoDataList == null) |
1551 | 1303 |
{ |
1552 | 1304 |
return; |
내보내기 Unified diff