markus / MarkupToPDF_Old / Controls / Shape / RectCloudControl.cs @ 9fa712a5
이력 | 보기 | 이력해설 | 다운로드 (20.4 KB)
1 | 787a4489 | KangIngu | 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 | |||
15 | namespace MarkupToPDF.Controls.Shape |
||
16 | { |
||
17 | public class RectCloudControl : Control, IDisposable, IPath, INotifyPropertyChanged, IMarkupCommonData, IShapeControl, IDashControl |
||
18 | { |
||
19 | #region 초기 선언 |
||
20 | private const string PART_ArcPath = "PART_ArcPath"; |
||
21 | private const string PART_BodyPath = "PART_BodyPath"; |
||
22 | public event PropertyChangedEventHandler PropertyChanged; |
||
23 | |||
24 | public Path Base_ArcPath = null; |
||
25 | public Path Base_BodyPath = null; |
||
26 | |||
27 | #endregion |
||
28 | |||
29 | static RectCloudControl() |
||
30 | { |
||
31 | DefaultStyleKeyProperty.OverrideMetadata(typeof(RectCloudControl), new FrameworkPropertyMetadata(typeof(RectCloudControl))); |
||
32 | //Application.Current.Resources.MergedDictionaries.Add(Application.LoadComponent(new Uri("/MarkupToPDF;Component/Themes/generic.xaml")) as ResourceDictionary); |
||
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 mousemodeProperty = |
||
41 | DependencyProperty.Register("mousemode", typeof(MouseMode), typeof(RectangleControl), new PropertyMetadata(MouseMode.None, PointValueChanged)); |
||
42 | public static readonly DependencyProperty IsSelectedProperty = |
||
43 | DependencyProperty.Register("IsSelected", typeof(bool), typeof(RectCloudControl), new FrameworkPropertyMetadata(false, IsSelectedChanged)); |
||
44 | |||
45 | public static readonly DependencyProperty ControlTypeProperty = |
||
46 | DependencyProperty.Register("ControlType", typeof(ControlType), typeof(RectCloudControl), new FrameworkPropertyMetadata(ControlType.RectCloud)); |
||
47 | |||
48 | public static readonly DependencyProperty OverViewPathDataProperty = DependencyProperty.Register( |
||
49 | "OverViewPathData", typeof(Geometry), typeof(RectCloudControl), new PropertyMetadata(null)); |
||
50 | |||
51 | public static readonly DependencyProperty LineSizeProperty = DependencyProperty.Register( |
||
52 | "LineSize", typeof(double), typeof(RectCloudControl), new PropertyMetadata((Double)1)); |
||
53 | |||
54 | public static readonly DependencyProperty UserIDProperty = DependencyProperty.Register( |
||
55 | "UserID", typeof(string), typeof(RectCloudControl), new PropertyMetadata(null)); |
||
56 | |||
57 | public static readonly DependencyProperty DashSizeProperty = DependencyProperty.Register( |
||
58 | "DashSize", typeof(DoubleCollection), typeof(RectCloudControl), new PropertyMetadata(new DoubleCollection { 99999999 }, PointValueChanged)); |
||
59 | |||
60 | public static readonly DependencyProperty FillColorProperty = DependencyProperty.Register( |
||
61 | "FillColor", typeof(SolidColorBrush), typeof(RectCloudControl), new PropertyMetadata(new SolidColorBrush(Colors.Red))); |
||
62 | |||
63 | public static readonly DependencyProperty PaintProperty = DependencyProperty.Register( |
||
64 | "Paint", typeof(PaintSet), typeof(RectCloudControl), new PropertyMetadata(PaintSet.None)); |
||
65 | |||
66 | public static readonly DependencyProperty StrokeColorProperty = DependencyProperty.Register( |
||
67 | "StrokeColor", typeof(SolidColorBrush), typeof(RectCloudControl), new PropertyMetadata(new SolidColorBrush(Colors.Red))); |
||
68 | |||
69 | public static readonly DependencyProperty PathDataProperty = DependencyProperty.Register( |
||
70 | "PathData", typeof(Geometry), typeof(RectCloudControl), null); |
||
71 | |||
72 | public static readonly DependencyProperty PathSubDataProperty = DependencyProperty.Register( |
||
73 | "PathSubData", typeof(Geometry), typeof(RectCloudControl), null); |
||
74 | |||
75 | public static readonly DependencyProperty EndPointProperty = DependencyProperty.Register( |
||
76 | "EndPoint", typeof(Point), typeof(RectCloudControl), new PropertyMetadata(new Point(0, 0), PointValueChanged)); |
||
77 | |||
78 | public static readonly DependencyProperty StartPointProperty = DependencyProperty.Register( |
||
79 | "StartPoint", typeof(Point), typeof(RectCloudControl), new PropertyMetadata(new Point(0, 0), PointValueChanged)); |
||
80 | |||
81 | public static readonly DependencyProperty TopRightPointProperty = DependencyProperty.Register( |
||
82 | "TopRightPoint", typeof(Point), typeof(RectCloudControl), new PropertyMetadata(new Point(0, 0), PointValueChanged)); |
||
83 | |||
84 | public static readonly DependencyProperty LeftBottomPointProperty = DependencyProperty.Register( |
||
85 | "LeftBottomPoint", typeof(Point), typeof(RectCloudControl), new PropertyMetadata(new Point(0, 0), PointValueChanged)); |
||
86 | |||
87 | public static readonly DependencyProperty PointSetProperty = DependencyProperty.Register( |
||
88 | "PointSet", typeof(List<Point>), typeof(RectCloudControl), new PropertyMetadata(new List<Point>(), PointValueChanged)); |
||
89 | |||
90 | public static readonly DependencyProperty AngleProperty = DependencyProperty.Register("AngleValue", typeof(double), typeof(RectCloudControl), |
||
91 | new PropertyMetadata((double)0.0, new PropertyChangedCallback(PointValueChanged))); |
||
92 | |||
93 | public static readonly DependencyProperty CenterXProperty = DependencyProperty.Register("CenterX", typeof(double), typeof(RectCloudControl), |
||
94 | new PropertyMetadata((double)0, PointValueChanged)); |
||
95 | |||
96 | public static readonly DependencyProperty CenterYProperty = DependencyProperty.Register("CenterY", typeof(double), typeof(RectCloudControl), |
||
97 | new PropertyMetadata((double)0, PointValueChanged)); |
||
98 | |||
99 | #endregion |
||
100 | |||
101 | #region PropertyChanged Method |
||
102 | public static void PointValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) |
||
103 | { |
||
104 | var instance = (RectCloudControl)sender; |
||
105 | if (e.OldValue != e.NewValue && instance.Base_ArcPath != null) |
||
106 | { |
||
107 | instance.SetValue(e.Property, e.NewValue); |
||
108 | instance.SetRectCloud(); |
||
109 | } |
||
110 | } |
||
111 | #endregion |
||
112 | |||
113 | #region Properties |
||
114 | |||
115 | public MouseMode mousemode |
||
116 | { |
||
117 | get |
||
118 | { |
||
119 | return (MouseMode)GetValue(mousemodeProperty); |
||
120 | } |
||
121 | set |
||
122 | { |
||
123 | SetValue(mousemodeProperty, value); |
||
124 | OnPropertyChanged("mousemode"); |
||
125 | } |
||
126 | } |
||
127 | public Double LineSize |
||
128 | { |
||
129 | get { return (Double)GetValue(LineSizeProperty); } |
||
130 | set |
||
131 | { |
||
132 | if (this.LineSize != value) |
||
133 | { |
||
134 | SetValue(LineSizeProperty, value); |
||
135 | } |
||
136 | } |
||
137 | } |
||
138 | public DoubleCollection DashSize |
||
139 | { |
||
140 | get { return (DoubleCollection)GetValue(DashSizeProperty); } |
||
141 | set |
||
142 | { |
||
143 | if (this.DashSize != value) |
||
144 | { |
||
145 | SetValue(DashSizeProperty, 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 PaintSet Paint |
||
162 | { |
||
163 | get { return (PaintSet)GetValue(PaintProperty); } |
||
164 | set |
||
165 | { |
||
166 | if (this.Paint != value) |
||
167 | { |
||
168 | SetValue(PaintProperty, value); |
||
169 | } |
||
170 | } |
||
171 | } |
||
172 | public SolidColorBrush FillColor |
||
173 | { |
||
174 | get { return (SolidColorBrush)GetValue(FillColorProperty); } |
||
175 | set |
||
176 | { |
||
177 | if (this.FillColor != value) |
||
178 | { |
||
179 | SetValue(FillColorProperty, value); |
||
180 | } |
||
181 | } |
||
182 | } |
||
183 | public SolidColorBrush StrokeColor |
||
184 | { |
||
185 | get { return (SolidColorBrush)GetValue(StrokeColorProperty); } |
||
186 | set |
||
187 | { |
||
188 | if (this.StrokeColor != value) |
||
189 | { |
||
190 | SetValue(StrokeColorProperty, value); |
||
191 | } |
||
192 | } |
||
193 | } |
||
194 | |||
195 | public Geometry OverViewPathData |
||
196 | { |
||
197 | get |
||
198 | { |
||
199 | return (Geometry)GetValue(OverViewPathDataProperty); |
||
200 | } |
||
201 | set |
||
202 | { |
||
203 | SetValue(OverViewPathDataProperty, value); |
||
204 | OnPropertyChanged("OverViewPathData"); |
||
205 | } |
||
206 | } |
||
207 | |||
208 | public Geometry PathData |
||
209 | { |
||
210 | get { return (Geometry)GetValue(PathDataProperty); } |
||
211 | set { SetValue(PathDataProperty, value); } |
||
212 | } |
||
213 | public Geometry PathSubData |
||
214 | { |
||
215 | get { return (Geometry)GetValue(PathSubDataProperty); } |
||
216 | set { SetValue(PathSubDataProperty, value); } |
||
217 | } |
||
218 | public Point EndPoint |
||
219 | { |
||
220 | get { return (Point)GetValue(EndPointProperty); } |
||
221 | set { SetValue(EndPointProperty, value); } |
||
222 | } |
||
223 | public Point StartPoint |
||
224 | { |
||
225 | get { return (Point)GetValue(StartPointProperty); } |
||
226 | set { SetValue(StartPointProperty, value); } |
||
227 | } |
||
228 | public List<Point> PointSet |
||
229 | { |
||
230 | get { return (List<Point>)GetValue(PointSetProperty); } |
||
231 | set { SetValue(PointSetProperty, value); } |
||
232 | } |
||
233 | public bool IsSelected |
||
234 | { |
||
235 | get |
||
236 | { |
||
237 | return (bool)GetValue(IsSelectedProperty); |
||
238 | } |
||
239 | set |
||
240 | { |
||
241 | SetValue(IsSelectedProperty, value); |
||
242 | } |
||
243 | } |
||
244 | public ControlType ControlType |
||
245 | { |
||
246 | get |
||
247 | { |
||
248 | return (ControlType)GetValue(ControlTypeProperty); |
||
249 | } |
||
250 | set |
||
251 | { |
||
252 | SetValue(ControlTypeProperty, value); |
||
253 | } |
||
254 | } |
||
255 | |||
256 | |||
257 | private double _toler = 1; |
||
258 | public double Toler |
||
259 | { |
||
260 | get { return _toler; } |
||
261 | set { _toler = value; } |
||
262 | } |
||
263 | private double _arcLength = 30; |
||
264 | public double ArcLength |
||
265 | { |
||
266 | get { return _arcLength; } |
||
267 | set { _arcLength = value; } |
||
268 | } |
||
269 | |||
270 | private bool _fill = false; |
||
271 | public bool Fill |
||
272 | { |
||
273 | get { return _fill; } |
||
274 | set { _fill = value; } |
||
275 | } |
||
276 | public double Angle |
||
277 | { |
||
278 | get { return (double)GetValue(AngleProperty); } |
||
279 | set |
||
280 | { |
||
281 | if (this.Angle != value) |
||
282 | { |
||
283 | SetValue(AngleProperty, value); |
||
284 | } |
||
285 | } |
||
286 | } |
||
287 | public double CenterX |
||
288 | { |
||
289 | get { return (double)GetValue(CenterXProperty); } |
||
290 | set { SetValue(CenterXProperty, value); } |
||
291 | } |
||
292 | public double CenterY |
||
293 | { |
||
294 | get { return (double)GetValue(CenterYProperty); } |
||
295 | set { SetValue(CenterYProperty, value); } |
||
296 | } |
||
297 | public Point LeftBottomPoint |
||
298 | { |
||
299 | get { return (Point)GetValue(LeftBottomPointProperty); } |
||
300 | set |
||
301 | { |
||
302 | SetValue(LeftBottomPointProperty, value); |
||
303 | OnPropertyChanged("LeftBottomPoint"); |
||
304 | } |
||
305 | } |
||
306 | public Point TopRightPoint |
||
307 | { |
||
308 | get { return (Point)GetValue(TopRightPointProperty); } |
||
309 | set |
||
310 | { |
||
311 | SetValue(TopRightPointProperty, value); |
||
312 | OnPropertyChanged("TopRightPoint"); |
||
313 | } |
||
314 | } |
||
315 | #endregion |
||
316 | |||
317 | #region Data |
||
318 | private PathGeometry _pathGeometry = new PathGeometry(); |
||
319 | #endregion |
||
320 | |||
321 | public override void OnApplyTemplate() |
||
322 | { |
||
323 | base.OnApplyTemplate(); |
||
324 | Base_ArcPath = GetTemplateChild(PART_ArcPath) as Path; |
||
325 | Base_BodyPath = GetTemplateChild(PART_BodyPath) as Path; |
||
326 | |||
327 | } |
||
328 | protected void OnPropertyChanged(string propName) |
||
329 | { |
||
330 | if (PropertyChanged != null) |
||
331 | PropertyChanged(this, new PropertyChangedEventArgs(propName)); |
||
332 | } |
||
333 | public void Dispose() |
||
334 | { |
||
335 | GC.Collect(); |
||
336 | GC.SuppressFinalize(this); |
||
337 | } |
||
338 | |||
339 | public static void IsSelectedChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) |
||
340 | { |
||
341 | var instance = (RectCloudControl)sender; |
||
342 | |||
343 | if (e.OldValue != e.NewValue && instance.Base_BodyPath != null) |
||
344 | { |
||
345 | |||
346 | instance.SetValue(e.Property, e.NewValue); |
||
347 | |||
348 | if (instance.IsSelected) |
||
349 | { |
||
350 | instance.Base_ArcPath.Stroke = new SolidColorBrush(Colors.Blue); |
||
351 | } |
||
352 | else |
||
353 | { |
||
354 | instance.Base_ArcPath.Stroke = new SolidColorBrush(Colors.Red); |
||
355 | } |
||
356 | } |
||
357 | } |
||
358 | |||
359 | public void SetRectCloud() |
||
360 | { |
||
361 | this.ApplyTemplate(); |
||
362 | PathFigure pathFigure = new PathFigure(); |
||
363 | |||
364 | Base_ArcPath.StrokeDashArray.Clear(); |
||
365 | Base_BodyPath.StrokeDashArray.Clear(); |
||
366 | |||
367 | foreach (var item in this.DashSize) |
||
368 | { |
||
369 | Base_ArcPath.StrokeDashArray.Add(item); |
||
370 | Base_BodyPath.StrokeDashArray.Add(item); |
||
371 | } |
||
372 | |||
373 | switch (this.Paint) |
||
374 | { |
||
375 | case PaintSet.None: |
||
376 | pathFigure.IsFilled = false; |
||
377 | break; |
||
378 | case PaintSet.Rect: |
||
379 | this.FillColor = this.StrokeColor; |
||
380 | Base_BodyPath.Fill = this.FillColor; |
||
381 | Base_ArcPath.Fill = this.FillColor; |
||
382 | |||
383 | Base_BodyPath.Stroke = this.StrokeColor; |
||
384 | Base_BodyPath.StrokeThickness = 2; |
||
385 | |||
386 | Base_ArcPath.Stroke = this.StrokeColor; |
||
387 | Base_ArcPath.StrokeThickness = 2; |
||
388 | |||
389 | pathFigure.IsFilled = true; |
||
390 | break; |
||
391 | case PaintSet.Cloud: |
||
392 | Base_BodyPath.Stroke = new SolidColorBrush(Colors.Transparent); |
||
393 | Base_BodyPath.StrokeThickness = 2; |
||
394 | Base_BodyPath.Fill = HatchMake.CreateHatchBrush(this.StrokeColor); |
||
395 | Base_ArcPath.Fill = HatchMake.CreateHatchBrush(this.StrokeColor); |
||
396 | pathFigure.IsFilled = true; |
||
397 | break; |
||
398 | default: |
||
399 | break; |
||
400 | } |
||
401 | |||
402 | #region 사각형 만들기 |
||
403 | pathFigure.StartPoint = this.StartPoint; |
||
404 | |||
405 | LineSegment lineSegment0 = new LineSegment(); |
||
406 | lineSegment0.Point = this.StartPoint; |
||
407 | pathFigure.Segments.Add(lineSegment0); |
||
408 | |||
409 | LineSegment lineSegment1 = new LineSegment(); |
||
410 | lineSegment1.Point = this.LeftBottomPoint; |
||
411 | pathFigure.Segments.Add(lineSegment1); |
||
412 | |||
413 | LineSegment lineSegment2 = new LineSegment(); |
||
414 | lineSegment2.Point = this.EndPoint; |
||
415 | pathFigure.Segments.Add(lineSegment2); |
||
416 | |||
417 | LineSegment lineSegment3 = new LineSegment(); |
||
418 | lineSegment3.Point = this.TopRightPoint; |
||
419 | pathFigure.Segments.Add(lineSegment3); |
||
420 | |||
421 | PathGeometry pathGeometry = new PathGeometry(); |
||
422 | pathGeometry.Figures = new PathFigureCollection(); |
||
423 | pathFigure.IsClosed = true; |
||
424 | pathGeometry.Figures.Add(pathFigure); |
||
425 | this.FillColor = new SolidColorBrush(Colors.Red); |
||
426 | this.PathSubData = pathGeometry; |
||
427 | #endregion |
||
428 | #region Cloud 만들기 |
||
429 | /// set reverse if area is greater 0 - 2012.07.04 added by humkyung |
||
430 | /// |
||
431 | |||
432 | double size = MathSet.DistanceTo(this.StartPoint, this.EndPoint); |
||
433 | ArcLength = (size * 0.08); |
||
434 | if (ArcLength <= 10) |
||
435 | { |
||
436 | ArcLength = 10; |
||
437 | } |
||
438 | |||
439 | System.Diagnostics.Debug.WriteLine(ArcLength); |
||
440 | double area = MathSet.AreaOf(new List<Point>() { this.StartPoint, this.LeftBottomPoint, this.EndPoint, this.TopRightPoint }); |
||
441 | bool reverse = (area > 0); |
||
442 | /// up to here |
||
443 | this._pathGeometry = new PathGeometry(); |
||
444 | int count = this.PointSet.Count; |
||
445 | |||
446 | |||
447 | PathFigure pathSubFigure = RectCloudControl.GenerateLineWithCloud(this.StartPoint, this.LeftBottomPoint, this.ArcLength, reverse); |
||
448 | _pathGeometry.Figures.Add(pathSubFigure); |
||
449 | |||
450 | pathSubFigure = RectCloudControl.GenerateLineWithCloud(this.LeftBottomPoint, this.EndPoint, this.ArcLength, reverse); |
||
451 | _pathGeometry.Figures.Add(pathSubFigure); |
||
452 | |||
453 | pathSubFigure = RectCloudControl.GenerateLineWithCloud(this.EndPoint, this.TopRightPoint, this.ArcLength, reverse); |
||
454 | _pathGeometry.Figures.Add(pathSubFigure); |
||
455 | |||
456 | pathSubFigure = RectCloudControl.GenerateLineWithCloud(this.TopRightPoint, this.StartPoint, this.ArcLength, reverse); |
||
457 | _pathGeometry.Figures.Add(pathSubFigure); |
||
458 | |||
459 | |||
460 | //for (int i = 0; i < (count - 1); i++) |
||
461 | //{ |
||
462 | // PathFigure pathSubFigure = CloudControl.GenerateLineWithCloud(this.PointSet[i], this.PointSet[i + 1], this.ArcLength, reverse); |
||
463 | // _pathGeometry.Figures.Add(pathSubFigure); |
||
464 | //} |
||
465 | |||
466 | this.PathData = _pathGeometry; |
||
467 | ApplyOverViewData(); |
||
468 | #endregion |
||
469 | } |
||
470 | |||
471 | public void ChangePaint(PaintSet state) |
||
472 | { |
||
473 | this.Paint = state; |
||
474 | this.SetRectCloud(); |
||
475 | } |
||
476 | |||
477 | public void CloseSettingPoint() |
||
478 | { |
||
479 | this.PointSet[0] = this.StartPoint; |
||
480 | this.PointSet[1] = this.LeftBottomPoint; |
||
481 | this.PointSet[2] = this.EndPoint; |
||
482 | this.PointSet[3] = this.TopRightPoint; |
||
483 | } |
||
484 | |||
485 | public void ApplyOverViewData() |
||
486 | { |
||
487 | this.OverViewPathData = this.PathData; |
||
488 | } |
||
489 | |||
490 | public void updateControl() |
||
491 | { |
||
492 | this.StartPoint = new Point(this.PointSet[0].X, this.PointSet[0].Y); |
||
493 | this.LeftBottomPoint = new Point(this.PointSet[1].X, this.PointSet[1].Y); |
||
494 | this.EndPoint = new Point(this.PointSet[2].X, this.PointSet[2].Y); |
||
495 | this.TopRightPoint = new Point(this.PointSet[3].X, this.PointSet[3].Y); |
||
496 | } |
||
497 | |||
498 | public static PathFigure GenerateLineWithCloud(Point p1, Point p2, double arcLength_, bool reverse) |
||
499 | { |
||
500 | PathFigure pathFigure = new PathFigure(); |
||
501 | pathFigure.StartPoint = p1; |
||
502 | |||
503 | double arcLength = arcLength_; |
||
504 | /// draw arcs which has arcLength between p1 and p2 - 2012.06.21 added by humkyung |
||
505 | double dx = p2.X - p1.X; |
||
506 | double dy = p2.Y - p1.Y; |
||
507 | double l = MathSet.DistanceTo(p1, p2); /// distance between p1 and p2 |
||
508 | double theta = Math.Atan2(Math.Abs(dy), Math.Abs(dx)) * 180 / Math.PI; |
||
509 | Point lastPt = new Point(p1.X, p1.Y); |
||
510 | double count = l / arcLength; |
||
511 | /// normalize |
||
512 | dx /= l; |
||
513 | dy /= l; |
||
514 | Double j = 1; |
||
515 | for (j = 1; j < (count - 1); j++) |
||
516 | { |
||
517 | ArcSegment arcSeg = new ArcSegment(); |
||
518 | arcSeg.Size = new Size(arcLength * 0.8, arcLength * 0.8); /// x size and y size of arc |
||
519 | arcSeg.Point = new Point(p1.X + j * dx * arcLength, p1.Y + j * dy * arcLength); /// end point of arc |
||
520 | lastPt = arcSeg.Point; /// save last point |
||
521 | arcSeg.RotationAngle = theta + 90; |
||
522 | if (true == reverse) arcSeg.SweepDirection = SweepDirection.Clockwise; |
||
523 | pathFigure.Segments.Add(arcSeg); |
||
524 | } |
||
525 | |||
526 | /// draw arc between last point and end point |
||
527 | if ((count > j) || (count > 0)) |
||
528 | { |
||
529 | arcLength = MathSet.DistanceTo(lastPt, p2); |
||
530 | ArcSegment arcSeg = new ArcSegment(); |
||
531 | arcSeg.Size = new Size(arcLength * 0.8, arcLength * 0.8); /// x size and y size of arc |
||
532 | arcSeg.Point = new Point(p2.X, p2.Y); /// end point of arc |
||
533 | arcSeg.RotationAngle = theta; |
||
534 | if (true == reverse) arcSeg.SweepDirection = SweepDirection.Clockwise; |
||
535 | pathFigure.Segments.Add(arcSeg); |
||
536 | } |
||
537 | /// up to here |
||
538 | pathFigure.IsFilled = false; |
||
539 | return pathFigure; |
||
540 | } |
||
541 | } |
||
542 | } |