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