markus / MarkupToPDF / Controls / Shape / TriControl.cs @ 025ebf74
이력 | 보기 | 이력해설 | 다운로드 (20.9 KB)
1 |
using System; |
---|---|
2 |
using System.Net; |
3 |
using System.Windows; |
4 |
using System.Windows.Controls; |
5 |
using System.Windows.Documents; |
6 |
using System.Windows.Ink; |
7 |
using System.Windows.Input; |
8 |
using System.Windows.Media; |
9 |
using System.Windows.Media.Animation; |
10 |
using System.Windows.Shapes; |
11 |
using System.ComponentModel; |
12 |
using System.Collections.Generic; |
13 |
using MarkupToPDF.Controls.Common; |
14 |
using MarkupToPDF.Common; |
15 |
using MarkupToPDF.Serialize.Core; |
16 |
using MarkupToPDF.Serialize.S_Control; |
17 |
using System.Linq; |
18 |
|
19 |
namespace MarkupToPDF.Controls.Shape |
20 |
{ |
21 |
//[TemplatePart(Name = "PART_TriPath", Type = typeof(Path))] |
22 |
public class TriControl : CommentUserInfo, IDisposable, INotifyPropertyChanged, IPath, IMarkupCommonData, IShapeControl, IDashControl |
23 |
{ |
24 |
public Path Base_TriPath { get; set; } |
25 |
//public enum PaintSet { None, Fill, Hatch }; |
26 |
private const string PART_TriPath = "PART_TriPath"; |
27 |
|
28 |
//public Path Base_TriPath = null; |
29 |
|
30 |
static TriControl() |
31 |
{ |
32 |
DefaultStyleKeyProperty.OverrideMetadata(typeof(TriControl), new FrameworkPropertyMetadata(typeof(TriControl))); |
33 |
ResourceDictionary dictionary = new ResourceDictionary(); |
34 |
dictionary.Source = new Uri("/MarkupToPDF;component/themes/generic.xaml", UriKind.RelativeOrAbsolute); |
35 |
Application.Current.Resources.MergedDictionaries.Add(dictionary); |
36 |
} |
37 |
|
38 |
#region Dependency Properties |
39 |
|
40 |
public static readonly DependencyProperty OverViewPathDataProperty = DependencyProperty.Register( |
41 |
"OverViewPathData", typeof(Geometry), typeof(TriControl), new PropertyMetadata(null)); |
42 |
|
43 |
public static readonly DependencyProperty IsSelectedProperty = |
44 |
DependencyProperty.Register("IsSelected", typeof(bool), typeof(TriControl), new FrameworkPropertyMetadata(false, IsSelectedChanged)); |
45 |
|
46 |
public static readonly DependencyProperty ControlTypeProperty = |
47 |
DependencyProperty.Register("ControlType", typeof(ControlType), typeof(TriControl), new FrameworkPropertyMetadata(ControlType.Triangle)); |
48 |
|
49 |
public static readonly DependencyProperty LineSizeProperty = DependencyProperty.Register( |
50 |
"LineSize", typeof(double), typeof(TriControl), new PropertyMetadata((Double)3)); |
51 |
public static readonly DependencyProperty UserIDProperty = DependencyProperty.Register( |
52 |
"UserID", typeof(string), typeof(TriControl), new PropertyMetadata(null)); |
53 |
//강인구 추가 |
54 |
public static readonly DependencyProperty DashSizeProperty = DependencyProperty.Register( |
55 |
"DashSize", typeof(DoubleCollection), typeof(TriControl), new PropertyMetadata(new DoubleCollection { 1, 1 }, PointValueChanged)); |
56 |
public static readonly DependencyProperty PathDataProperty = DependencyProperty.Register( |
57 |
"PathData", typeof(Geometry), typeof(TriControl), null); |
58 |
public static readonly DependencyProperty StrokeColorProperty = DependencyProperty.Register( |
59 |
"StrokeColor", typeof(SolidColorBrush), typeof(TriControl), new PropertyMetadata(new SolidColorBrush(Colors.Red))); |
60 |
public static readonly DependencyProperty FillColorProperty = DependencyProperty.Register( |
61 |
"FillColor", typeof(SolidColorBrush), typeof(TriControl), new PropertyMetadata(new SolidColorBrush(Colors.Red))); |
62 |
public static readonly DependencyProperty EndPointProperty = DependencyProperty.Register( |
63 |
"EndPoint", typeof(Point), typeof(TriControl), new PropertyMetadata(new Point(0, 0), PointValueChanged)); |
64 |
public static readonly DependencyProperty MidPointProperty = DependencyProperty.Register( |
65 |
"MidPoint", typeof(Point), typeof(TriControl), new PropertyMetadata(new Point(0, 0), PointValueChanged)); |
66 |
public static readonly DependencyProperty StartPointProperty = DependencyProperty.Register( |
67 |
"StartPoint", typeof(Point), typeof(TriControl), new PropertyMetadata(new Point(0, 0), PointValueChanged)); |
68 |
//강인구 추가 |
69 |
public static readonly DependencyProperty PaintProperty = DependencyProperty.Register( |
70 |
"Paint", typeof(PaintSet), typeof(TriControl), new PropertyMetadata(PaintSet.None, PointValueChanged)); |
71 |
|
72 |
public static readonly DependencyProperty PointSetProperty = DependencyProperty.Register( |
73 |
"PointSet", typeof(List<Point>), typeof(TriControl), new PropertyMetadata(new List<Point>(), PointValueChanged)); |
74 |
public static readonly DependencyProperty AngleProperty = DependencyProperty.Register("Angle", typeof(double), typeof(TriControl), new |
75 |
PropertyMetadata((double)0.0, new PropertyChangedCallback(AngleValueChanged))); |
76 |
public static readonly DependencyProperty CenterXProperty = DependencyProperty.Register("CenterX", typeof(double), typeof(TriControl), |
77 |
new PropertyMetadata((double)0, OnCenterXYChanged)); |
78 |
|
79 |
public static readonly DependencyProperty CenterYProperty = DependencyProperty.Register("CenterY", typeof(double), typeof(TriControl), |
80 |
new PropertyMetadata((double)0, OnCenterXYChanged)); |
81 |
|
82 |
#endregion |
83 |
#region PropertyChanged Method |
84 |
|
85 |
public static void IsSelectedChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) |
86 |
{ |
87 |
//var instance = (TriControl)sender; |
88 |
|
89 |
//if (e.OldValue != e.NewValue && instance.Base_TriPath != null) |
90 |
//{ |
91 |
|
92 |
// instance.SetValue(e.Property, e.NewValue); |
93 |
|
94 |
// if (instance.IsSelected) |
95 |
// { |
96 |
// instance.Base_TriPath.Stroke = new SolidColorBrush(Colors.Blue); |
97 |
// } |
98 |
// else |
99 |
// { |
100 |
// instance.Base_TriPath.Stroke = new SolidColorBrush(Colors.Red); |
101 |
// } |
102 |
//} |
103 |
} |
104 |
|
105 |
public static void PointValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) |
106 |
{ |
107 |
var instance = (TriControl)sender; |
108 |
|
109 |
if (e.OldValue != e.NewValue && instance.Base_TriPath != null) |
110 |
{ |
111 |
instance.SetValue(e.Property, e.NewValue); |
112 |
instance.SetTri(); |
113 |
} |
114 |
} |
115 |
|
116 |
|
117 |
public static void OnCenterXYChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) |
118 |
{ |
119 |
var instance = (TriControl)sender; |
120 |
if (e.OldValue != e.NewValue && instance.Base_TriPath != null) |
121 |
{ |
122 |
instance.SetValue(e.Property, e.NewValue); |
123 |
instance.SetTri(); |
124 |
} |
125 |
} |
126 |
public static void AngleValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) |
127 |
{ |
128 |
var instance = (TriControl)sender; |
129 |
if (e.OldValue != e.NewValue && instance.Base_TriPath != null) |
130 |
{ |
131 |
instance.SetValue(e.Property, e.NewValue); |
132 |
instance.SetTri(); |
133 |
} |
134 |
} |
135 |
#endregion |
136 |
#region Properties |
137 |
|
138 |
public Double LineSize |
139 |
{ |
140 |
get { return (Double)GetValue(LineSizeProperty); } |
141 |
set |
142 |
{ |
143 |
if (this.LineSize != value) |
144 |
{ |
145 |
SetValue(LineSizeProperty, value); |
146 |
} |
147 |
} |
148 |
} |
149 |
public string UserID |
150 |
{ |
151 |
get { return (string)GetValue(UserIDProperty); } |
152 |
set |
153 |
{ |
154 |
if (this.UserID != value) |
155 |
{ |
156 |
SetValue(UserIDProperty, value); |
157 |
OnPropertyChanged("UserID"); |
158 |
} |
159 |
} |
160 |
} |
161 |
public SolidColorBrush FillColor |
162 |
{ |
163 |
get { return (SolidColorBrush)GetValue(FillColorProperty); } |
164 |
set |
165 |
{ |
166 |
if (this.FillColor != value) |
167 |
{ |
168 |
SetValue(FillColorProperty, value); |
169 |
} |
170 |
} |
171 |
} |
172 |
public DoubleCollection DashSize |
173 |
{ |
174 |
get { return (DoubleCollection)GetValue(DashSizeProperty); } |
175 |
set |
176 |
{ |
177 |
if (this.DashSize != value) |
178 |
{ |
179 |
SetValue(DashSizeProperty, value); |
180 |
} |
181 |
} |
182 |
} |
183 |
public PaintSet Paint |
184 |
{ |
185 |
get { return (PaintSet)GetValue(PaintProperty); } |
186 |
set |
187 |
{ |
188 |
if (this.Paint != value) |
189 |
{ |
190 |
SetValue(PaintProperty, value); |
191 |
} |
192 |
} |
193 |
} |
194 |
|
195 |
|
196 |
public override SolidColorBrush StrokeColor |
197 |
{ |
198 |
get { return (SolidColorBrush)GetValue(StrokeColorProperty); } |
199 |
set |
200 |
{ |
201 |
if (this.StrokeColor != value) |
202 |
{ |
203 |
SetValue(StrokeColorProperty, value); |
204 |
} |
205 |
} |
206 |
} |
207 |
public Geometry OverViewPathData |
208 |
{ |
209 |
get |
210 |
{ |
211 |
return (Geometry)GetValue(OverViewPathDataProperty); |
212 |
} |
213 |
set |
214 |
{ |
215 |
SetValue(OverViewPathDataProperty, value); |
216 |
OnPropertyChanged("OverViewPathData"); |
217 |
} |
218 |
} |
219 |
public Geometry PathData |
220 |
{ |
221 |
get { return (Geometry)GetValue(PathDataProperty); } |
222 |
set { SetValue(PathDataProperty, value); } |
223 |
} |
224 |
public Point EndPoint |
225 |
{ |
226 |
get { return (Point)GetValue(EndPointProperty); } |
227 |
set { SetValue(EndPointProperty, value); } |
228 |
} |
229 |
public Point StartPoint |
230 |
{ |
231 |
get { return (Point)GetValue(StartPointProperty); } |
232 |
set { SetValue(StartPointProperty, value); } |
233 |
} |
234 |
public Point MidPoint |
235 |
{ |
236 |
get { return (Point)GetValue(MidPointProperty); } |
237 |
set { SetValue(MidPointProperty, value); } |
238 |
} |
239 |
public List<Point> PointSet |
240 |
{ |
241 |
get { return (List<Point>)GetValue(PointSetProperty); } |
242 |
set { SetValue(PointSetProperty, value); } |
243 |
} |
244 |
|
245 |
public override bool IsSelected |
246 |
{ |
247 |
get |
248 |
{ |
249 |
return (bool)GetValue(IsSelectedProperty); |
250 |
} |
251 |
set |
252 |
{ |
253 |
SetValue(IsSelectedProperty, value); |
254 |
} |
255 |
} |
256 |
|
257 |
public override ControlType ControlType |
258 |
{ |
259 |
get |
260 |
{ |
261 |
return (ControlType)GetValue(ControlTypeProperty); |
262 |
} |
263 |
set |
264 |
{ |
265 |
SetValue(ControlTypeProperty, value); |
266 |
} |
267 |
} |
268 |
|
269 |
|
270 |
public double Angle |
271 |
{ |
272 |
get { return (double)GetValue(AngleProperty); } |
273 |
set |
274 |
{ |
275 |
if (this.Angle != value) |
276 |
{ |
277 |
SetValue(AngleProperty, value); |
278 |
} |
279 |
} |
280 |
} |
281 |
public double CenterX |
282 |
{ |
283 |
get { return (double)GetValue(CenterXProperty); } |
284 |
set { SetValue(CenterXProperty, value); } |
285 |
} |
286 |
public double CenterY |
287 |
{ |
288 |
get { return (double)GetValue(CenterYProperty); } |
289 |
set { SetValue(CenterYProperty, value); } |
290 |
} |
291 |
#endregion |
292 |
|
293 |
#region Dependency PropertyChanged |
294 |
//public static void IsSelectedChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) |
295 |
//{ |
296 |
// var instance = (TriControl)sender; |
297 |
|
298 |
// if (e.OldValue != e.NewValue && instance.Base_TriPath != null) |
299 |
// { |
300 |
|
301 |
// instance.SetValue(e.Property, e.NewValue); |
302 |
|
303 |
// if (instance.IsSelected) |
304 |
// { |
305 |
// instance.Base_TriPath.Stroke = new SolidColorBrush(Colors.Blue); |
306 |
// } |
307 |
// else |
308 |
// { |
309 |
// instance.Base_TriPath.Stroke = new SolidColorBrush(Colors.Red); |
310 |
// } |
311 |
// } |
312 |
//} |
313 |
|
314 |
#endregion Dependency PropertyChanged |
315 |
|
316 |
public override void OnApplyTemplate() |
317 |
{ |
318 |
base.OnApplyTemplate(); |
319 |
Base_TriPath = GetTemplateChild(PART_TriPath) as Path; |
320 |
|
321 |
if (Base_TriPath == null) |
322 |
{ |
323 |
return; |
324 |
} |
325 |
|
326 |
this.SetTri(); |
327 |
} |
328 |
|
329 |
private void SetTri() |
330 |
{ |
331 |
this.ApplyTemplate(); |
332 |
Base_TriPath.StrokeDashArray.Clear(); |
333 |
foreach (var item in this.DashSize) |
334 |
{ |
335 |
Base_TriPath.StrokeDashArray.Add(item); |
336 |
} |
337 |
Base_TriPath.StrokeDashCap = PenLineCap.Square; |
338 |
PathFigure pathFigure = new PathFigure(); |
339 |
|
340 |
//this.FillColor = this.StrokeColor; |
341 |
////Base_TriPath.Fill = this.FillColor; |
342 |
//Base_TriPath.Fill = Brushes.Red; |
343 |
//pathFigure.IsFilled = true; |
344 |
|
345 |
switch (this.Paint) |
346 |
{ |
347 |
case PaintSet.None: |
348 |
this.FillColor = null; |
349 |
pathFigure.IsFilled = false; |
350 |
break; |
351 |
case PaintSet.Fill: |
352 |
this.FillColor = this.StrokeColor; |
353 |
Base_TriPath.Fill = this.FillColor; |
354 |
pathFigure.IsFilled = true; |
355 |
break; |
356 |
case PaintSet.Hatch: |
357 |
Base_TriPath.Fill = HatchMake.CreateHatchBrush(this.StrokeColor); |
358 |
pathFigure.IsFilled = true; |
359 |
break; |
360 |
default: |
361 |
break; |
362 |
} |
363 |
pathFigure.StartPoint = this.StartPoint; |
364 |
|
365 |
List<Point> points = new List<Point>() { this.StartPoint }; |
366 |
if (MidPoint.X != 0 && MidPoint.Y != 0) points.Add(this.MidPoint); |
367 |
points.Add(this.EndPoint); |
368 |
|
369 |
PolyLineSegment polyline = new PolyLineSegment(points , true); |
370 |
pathFigure.Segments.Add(polyline); |
371 |
|
372 |
PathGeometry pathGeometry = new PathGeometry(); |
373 |
pathGeometry.Figures = new PathFigureCollection(); |
374 |
pathFigure.IsClosed = true; |
375 |
pathGeometry.Figures.Add(pathFigure); |
376 |
|
377 |
this.PathData = pathGeometry; |
378 |
ApplyOverViewData(); |
379 |
|
380 |
} |
381 |
public void Dispose() |
382 |
{ |
383 |
GC.Collect(); |
384 |
GC.SuppressFinalize(this); |
385 |
} |
386 |
public event PropertyChangedEventHandler PropertyChanged; |
387 |
protected void OnPropertyChanged(string propName) |
388 |
{ |
389 |
if (PropertyChanged != null) |
390 |
PropertyChanged(this, new PropertyChangedEventArgs(propName)); |
391 |
} |
392 |
|
393 |
public override void ApplyOverViewData() |
394 |
{ |
395 |
this.OverViewPathData = this.PathData; |
396 |
} |
397 |
|
398 |
public override void UpdateControl() |
399 |
{ |
400 |
this.StartPoint = new Point(this.PointSet[0].X, this.PointSet[0].Y); |
401 |
this.MidPoint = new Point(this.PointSet[1].X, this.PointSet[1].Y); |
402 |
this.EndPoint = new Point(this.PointSet[2].X, this.PointSet[2].Y); |
403 |
} |
404 |
|
405 |
/// <summary> |
406 |
/// call when mouse is moving while drawing control |
407 |
/// </summary> |
408 |
/// <param name="pt"></param> |
409 |
/// <param name="bAxisLocked"></param> |
410 |
public override void OnCreatingMouseMove(Point pt, bool bAxisLocked, bool bShiftKeyPressed) |
411 |
{ |
412 |
this.EndPoint = pt; |
413 |
|
414 |
if (bAxisLocked) |
415 |
{ |
416 |
Point tmp = this.EndPoint; |
417 |
string angle = MathSet.returnAngleString(this.StartPoint, ref tmp, true); |
418 |
this.EndPoint = tmp; |
419 |
} |
420 |
|
421 |
if (bShiftKeyPressed) |
422 |
{ |
423 |
List<Point> Points = this.GetRegularTrianglePoints(this.StartPoint, this.EndPoint); |
424 |
if (2 == Points.Count()) |
425 |
{ |
426 |
this.MidPoint = Points[0]; |
427 |
this.EndPoint = Points[1]; |
428 |
} |
429 |
} |
430 |
|
431 |
this.PointSet = new List<Point> |
432 |
{ |
433 |
this.StartPoint, |
434 |
this.MidPoint, |
435 |
this.EndPoint, |
436 |
}; |
437 |
} |
438 |
|
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); ///TODO: 위험 요소를 가지고 있음. |
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> |
462 |
/// return tricontrols' area |
463 |
/// </summary> |
464 |
/// <author>humkyung</author> |
465 |
/// <date>2019.06.13</date> |
466 |
public override Rect ItemRect |
467 |
{ |
468 |
get |
469 |
{ |
470 |
double dMinX = Math.Min(this.StartPoint.X, this.EndPoint.X); |
471 |
dMinX = Math.Min(this.MidPoint.X, dMinX); |
472 |
double dMinY = Math.Min(this.StartPoint.Y, this.EndPoint.Y); |
473 |
dMinY = Math.Min(this.MidPoint.Y, dMinY); |
474 |
double dMaxX = Math.Max(this.StartPoint.X, this.EndPoint.X); |
475 |
dMaxX = Math.Max(this.MidPoint.X, dMaxX); |
476 |
double dMaxY = Math.Max(this.StartPoint.Y, this.EndPoint.Y); |
477 |
dMaxY = Math.Max(this.MidPoint.Y, dMaxY); |
478 |
|
479 |
return new Rect(new Point(dMinX, dMinY), new Point(dMaxX, dMaxY)); |
480 |
} |
481 |
} |
482 |
|
483 |
/// <summary> |
484 |
/// Serialize this |
485 |
/// </summary> |
486 |
/// <param name="sUserId"></param> |
487 |
/// <returns></returns> |
488 |
public override string Serialize() |
489 |
{ |
490 |
using (S_TriControl STemp = new S_TriControl()) |
491 |
{ |
492 |
STemp.TransformPoint = "0|0"; |
493 |
STemp.Paint = this.Paint; |
494 |
STemp.SizeSet = String.Format("{0}", this.LineSize); |
495 |
//STemp.StrokeColor = "#FF00FF00"; |
496 |
STemp.StrokeColor = this.StrokeColor.Color.ToString(); |
497 |
if (this.FillColor != null) |
498 |
{ |
499 |
STemp.FillColor = this.FillColor.Color.ToString(); |
500 |
} |
501 |
STemp.StartPoint = this.StartPoint; |
502 |
STemp.EndPoint = this.EndPoint; |
503 |
STemp.MidPoint = this.MidPoint; |
504 |
STemp.Opac = this.Opacity; |
505 |
STemp.UserID = this.UserID; |
506 |
STemp.PointSet = this.PointSet; |
507 |
STemp.Angle = this.Angle; |
508 |
STemp.DashSize = this.DashSize; |
509 |
STemp.Name = this.GetType().Name.ToString(); |
510 |
///강인구 추가(2017.11.02) |
511 |
///Memo 추가 |
512 |
STemp.Memo = this.Memo; |
513 |
|
514 |
return "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
515 |
} |
516 |
} |
517 |
|
518 |
/// <summary> |
519 |
/// create a tricontrol from given string |
520 |
/// </summary> |
521 |
/// <param name="str"></param> |
522 |
/// <returns></returns> |
523 |
public static TriControl FromString(string str, SolidColorBrush brush, string sProjectNo) |
524 |
{ |
525 |
using (S_TriControl s = JsonSerializerHelper.JsonDeserialize<S_TriControl>(str)) |
526 |
{ |
527 |
string[] data2 = s.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries); |
528 |
return new TriControl |
529 |
{ |
530 |
LineSize = Convert.ToDouble(data2.First()), |
531 |
MidPoint = s.MidPoint, |
532 |
StartPoint = s.StartPoint, |
533 |
Paint = s.Paint, |
534 |
EndPoint = s.EndPoint, |
535 |
Opacity = s.Opac, |
536 |
Angle = s.Angle, |
537 |
DashSize = s.DashSize, |
538 |
PointSet = s.PointSet, |
539 |
StrokeColor = brush, |
540 |
UserID = s.UserID, |
541 |
Memo = s.Memo |
542 |
}; |
543 |
} |
544 |
} |
545 |
|
546 |
/// <summary> |
547 |
/// 정삼각형을 그리기위한 두 포인트를 계산하여 넘겨줌 |
548 |
/// </summary> |
549 |
/// <author>humkyung</author> |
550 |
/// <date>2018.04.26</date> |
551 |
/// <param name="StartP"></param> |
552 |
/// <param name="EndP"></param> |
553 |
/// <returns></returns> |
554 |
/// <history>humkyung 2018.05.11 apply axis lock</history> |
555 |
private List<Point> GetRegularTrianglePoints(Point StartP, Point EndP, bool bCheckAxis = false) |
556 |
{ |
557 |
List<Point> res = new List<Point>(); |
558 |
|
559 |
double dx = EndP.X - StartP.X; |
560 |
double dy = EndP.Y - StartP.Y; |
561 |
double length = Math.Sqrt(dx * dx + dy * dy); |
562 |
double baseLength = length * Math.Tan(30.0 * Math.PI / 180.0); |
563 |
dx /= length; |
564 |
dy /= length; |
565 |
double tmp = dx; |
566 |
dx = -dy; dy = tmp; /// rotate by 90 degree |
567 |
|
568 |
res.Add(new Point(EndP.X + dx * baseLength, EndP.Y + dy * baseLength)); |
569 |
res.Add(new Point(EndP.X - dx * baseLength, EndP.Y - dy * baseLength)); |
570 |
|
571 |
return res; |
572 |
} |
573 |
} |
574 |
} |