markus / MarkupToPDF / Controls / Line / ArrowArcControl.cs @ master
이력 | 보기 | 이력해설 | 다운로드 (23.4 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.Line |
20 |
{ |
21 |
|
22 |
public class ArrowArcControl : CommentUserInfo, IDisposable, INotifyPropertyChanged, IDashControl |
23 |
{ |
24 |
#region 초기선언 |
25 |
public event PropertyChangedEventHandler PropertyChanged; |
26 |
private const string PART_ArcPath = "PART_ArcPath"; |
27 |
public Path Base_ArcPath = null; |
28 |
#endregion |
29 |
static ArrowArcControl() |
30 |
{ |
31 |
DefaultStyleKeyProperty.OverrideMetadata(typeof(ArrowArcControl), new FrameworkPropertyMetadata(typeof(ArrowArcControl))); |
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 |
//System.Diagnostics.Debug.WriteLine("resource Count :" + Application.Current.Resources.MergedDictionaries.Count); |
37 |
} |
38 |
|
39 |
public ArrowArcControl() |
40 |
{ |
41 |
//this.DefaultStyleKey = typeof(ArrowArcControl); |
42 |
} |
43 |
|
44 |
public override void Copy(CommentUserInfo lhs) |
45 |
{ |
46 |
if (lhs is ArrowArcControl item) |
47 |
{ |
48 |
this.StartPoint = new Point(item.StartPoint.X, item.StartPoint.Y); |
49 |
this.EndPoint = new Point(item.EndPoint.X, item.EndPoint.Y); |
50 |
this.DashSize = item.DashSize; |
51 |
this.PointSet = item.PointSet.ConvertAll(x => new Point(x.X, x.Y)); |
52 |
this.isTransOn = item.isTransOn; |
53 |
this.MiddlePoint = new Point(item.MiddlePoint.X, item.MiddlePoint.Y); |
54 |
this.StrokeColor = item.StrokeColor; |
55 |
this.Opacity = item.Opacity; |
56 |
|
57 |
this.Clock = item.Clock; |
58 |
this.LineSize = item.LineSize; |
59 |
this.UserID = item.UserID; |
60 |
this.Memo = item.Memo; |
61 |
this.ZIndex = item.ZIndex; |
62 |
GroupID = item.GroupID; |
63 |
} |
64 |
} |
65 |
|
66 |
public override CommentUserInfo Clone() |
67 |
{ |
68 |
var clone = new ArrowArcControl(); |
69 |
clone.Copy(this); |
70 |
return clone; |
71 |
} |
72 |
|
73 |
public void Dispose() |
74 |
{ |
75 |
//GC.Collect(); |
76 |
////GC.SuppressFinalize(this); |
77 |
//Control control = new Control(); |
78 |
this.Base_ArcPath = null; |
79 |
} |
80 |
protected void OnPropertyChanged(string propName) |
81 |
{ |
82 |
if (PropertyChanged != null) |
83 |
PropertyChanged(this, new PropertyChangedEventArgs(propName)); |
84 |
} |
85 |
|
86 |
#region Dependency Properties |
87 |
|
88 |
|
89 |
|
90 |
public static readonly DependencyProperty IsSelectedProperty = |
91 |
DependencyProperty.Register("IsSelected", typeof(bool), typeof(ArrowArcControl), new FrameworkPropertyMetadata(false, IsSelectedChanged)); |
92 |
|
93 |
public static readonly DependencyProperty ControlTypeProperty = |
94 |
DependencyProperty.Register("ControlType", typeof(ControlType), typeof(ArrowArcControl), new FrameworkPropertyMetadata(ControlType.ArcArrow)); |
95 |
|
96 |
public static readonly DependencyProperty OverViewPathDataProperty = DependencyProperty.Register( |
97 |
"OverViewPathData", typeof(Geometry), typeof(ArrowArcControl), new PropertyMetadata(null)); |
98 |
|
99 |
public static readonly DependencyProperty UserIDProperty = DependencyProperty.Register( |
100 |
"UserID", typeof(string), typeof(ArrowArcControl), new PropertyMetadata(null)); |
101 |
|
102 |
public static readonly DependencyProperty LineSizeProperty = DependencyProperty.Register( |
103 |
"LineSize", typeof(double), typeof(ArrowArcControl), new PropertyMetadata((Double)3, PointValueChanged)); |
104 |
|
105 |
public static readonly DependencyProperty DashSizeProperty = DependencyProperty.Register( |
106 |
"DashSize", typeof(DoubleCollection), typeof(ArrowArcControl), new PropertyMetadata(new DoubleCollection { 99999999 }, PointValueChanged)); |
107 |
|
108 |
public static readonly DependencyProperty StrokeColorProperty = DependencyProperty.Register( |
109 |
"StrokeColor", typeof(SolidColorBrush), typeof(ArrowArcControl), new PropertyMetadata(new SolidColorBrush(Colors.Red))); |
110 |
|
111 |
public static readonly DependencyProperty PathDataProperty = DependencyProperty.Register( |
112 |
"PathData", typeof(Geometry), typeof(ArrowArcControl), null); |
113 |
|
114 |
//public static readonly DependencyProperty ClockProperty = DependencyProperty.Register( |
115 |
// "Clock", typeof(SweepDirection), typeof(ArrowArcControl), new PropertyMetadata(SweepDirection.Clockwise)); |
116 |
public static readonly DependencyProperty ClockProperty = DependencyProperty.Register( |
117 |
"Clock", typeof(bool), typeof(ArrowArcControl), new PropertyMetadata(false)); |
118 |
|
119 |
public static readonly DependencyProperty StartPointProperty = DependencyProperty.Register( |
120 |
"StartPoint", typeof(Point), typeof(ArrowArcControl), new PropertyMetadata(new Point(0, 0), PointValueChanged)); |
121 |
public static readonly DependencyProperty MidPointProperty = DependencyProperty.Register( |
122 |
"MidPoint", typeof(Point), typeof(ArrowArcControl), new PropertyMetadata(new Point(0, 0), PointValueChanged)); |
123 |
|
124 |
public static readonly DependencyProperty EndPointProperty = DependencyProperty.Register( |
125 |
"EndPoint", typeof(Point), typeof(ArrowArcControl), new PropertyMetadata(new Point(0, 0), PointValueChanged)); |
126 |
|
127 |
public static readonly DependencyProperty PointSetProperty = DependencyProperty.Register( |
128 |
"PointSet", typeof(List<Point>), typeof(ArrowArcControl), new PropertyMetadata(new List<Point>(), PointValueChanged)); |
129 |
|
130 |
public static readonly DependencyProperty isTransOnProperty = DependencyProperty.Register( |
131 |
"isTransOn", typeof(bool), typeof(ArrowArcControl), new PropertyMetadata(false)); |
132 |
|
133 |
public static readonly DependencyProperty AngleProperty = |
134 |
DependencyProperty.Register("AngleValue", typeof(double), typeof(ArrowArcControl), new PropertyMetadata((double)0.0, new PropertyChangedCallback |
135 |
(AngleValueChanged))); |
136 |
|
137 |
public static readonly DependencyProperty CenterXProperty = |
138 |
DependencyProperty.Register("CenterX", typeof(double), typeof(ArrowArcControl), new PropertyMetadata((double)0, OnCenterXYChanged)); |
139 |
|
140 |
public static readonly DependencyProperty CenterYProperty = |
141 |
DependencyProperty.Register("CenterY", typeof(double), typeof(ArrowArcControl), new PropertyMetadata((double)0, OnCenterXYChanged)); |
142 |
#endregion |
143 |
#region PropertyChanged Method |
144 |
|
145 |
public static void IsSelectedChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) |
146 |
{ |
147 |
//var instance = (ArrowArcControl)sender; |
148 |
|
149 |
//if (e.OldValue != e.NewValue && instance.Base_ArcPath != null) |
150 |
//{ |
151 |
|
152 |
// instance.SetValue(e.Property, e.NewValue); |
153 |
|
154 |
// if (instance.IsSelected) |
155 |
// { |
156 |
// instance.Base_ArcPath.Stroke = new SolidColorBrush(Colors.Blue); |
157 |
// } |
158 |
// else |
159 |
// { |
160 |
// instance.Base_ArcPath.Stroke = new SolidColorBrush(Colors.Red); |
161 |
// } |
162 |
//} |
163 |
} |
164 |
|
165 |
public static void PointValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) |
166 |
{ |
167 |
var instance = (ArrowArcControl)sender; |
168 |
if (e.OldValue != e.NewValue && instance.Base_ArcPath != null) |
169 |
{ |
170 |
instance.SetValue(e.Property, e.NewValue); |
171 |
instance.SetArcPath(); |
172 |
} |
173 |
} |
174 |
public static void AngleValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) |
175 |
{ |
176 |
var instance = (ArrowArcControl)sender; |
177 |
if (e.OldValue != e.NewValue && instance.Base_ArcPath != null) |
178 |
{ |
179 |
instance.SetValue(e.Property, e.NewValue); |
180 |
instance.SetArcPath(); |
181 |
} |
182 |
} |
183 |
public static void OnCenterXYChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) |
184 |
{ |
185 |
var instance = (ArrowArcControl)sender; |
186 |
if (e.OldValue != e.NewValue && instance.Base_ArcPath != null) |
187 |
{ |
188 |
instance.SetValue(e.Property, e.NewValue); |
189 |
instance.SetArcPath(); |
190 |
} |
191 |
} |
192 |
|
193 |
|
194 |
|
195 |
#endregion |
196 |
#region Properties |
197 |
public string UserID |
198 |
{ |
199 |
get { return (string)GetValue(UserIDProperty); } |
200 |
set |
201 |
{ |
202 |
if (this.UserID != value) |
203 |
{ |
204 |
SetValue(UserIDProperty, value); |
205 |
OnPropertyChanged("UserID"); |
206 |
} |
207 |
} |
208 |
} |
209 |
public Double LineSize |
210 |
{ |
211 |
get { return (Double)GetValue(LineSizeProperty); } |
212 |
set |
213 |
{ |
214 |
if (this.LineSize != value) |
215 |
{ |
216 |
SetValue(LineSizeProperty, value); |
217 |
} |
218 |
} |
219 |
} |
220 |
|
221 |
|
222 |
public bool Clock |
223 |
{ |
224 |
get { return (bool)GetValue(ClockProperty); } |
225 |
set |
226 |
{ |
227 |
if (this.Clock != value) |
228 |
{ |
229 |
SetValue(ClockProperty, value); |
230 |
OnPropertyChanged("Clock"); |
231 |
} |
232 |
} |
233 |
} |
234 |
|
235 |
//public SweepDirection Clock |
236 |
//{ |
237 |
// get { return (SweepDirection)GetValue(ClockProperty); } |
238 |
// set |
239 |
// { |
240 |
// if (this.Clock != value) |
241 |
// { |
242 |
// SetValue(ClockProperty, value); |
243 |
// OnPropertyChanged("Clock"); |
244 |
// } |
245 |
// } |
246 |
//} |
247 |
public DoubleCollection DashSize |
248 |
{ |
249 |
get { return (DoubleCollection)GetValue(DashSizeProperty); } |
250 |
set |
251 |
{ |
252 |
if (this.DashSize != value) |
253 |
{ |
254 |
SetValue(DashSizeProperty, value); |
255 |
} |
256 |
} |
257 |
} |
258 |
public List<Point> PointSet |
259 |
{ |
260 |
get { return (List<Point>)GetValue(PointSetProperty); } |
261 |
set { SetValue(PointSetProperty, value); } |
262 |
} |
263 |
public double CenterX |
264 |
{ |
265 |
get { return (double)GetValue(CenterXProperty); } |
266 |
set { SetValue(CenterXProperty, value); } |
267 |
} |
268 |
public double CenterY |
269 |
{ |
270 |
get { return (double)GetValue(CenterYProperty); } |
271 |
set { SetValue(CenterYProperty, value); } |
272 |
} |
273 |
public override SolidColorBrush StrokeColor |
274 |
{ |
275 |
get { return (SolidColorBrush)GetValue(StrokeColorProperty); } |
276 |
set |
277 |
{ |
278 |
if (this.StrokeColor != value) |
279 |
{ |
280 |
SetValue(StrokeColorProperty, value); |
281 |
} |
282 |
} |
283 |
} |
284 |
|
285 |
public Geometry OverViewPathData |
286 |
{ |
287 |
get |
288 |
{ |
289 |
return (Geometry)GetValue(OverViewPathDataProperty); |
290 |
} |
291 |
set |
292 |
{ |
293 |
SetValue(OverViewPathDataProperty, value); |
294 |
OnPropertyChanged("OverViewPathData"); |
295 |
} |
296 |
} |
297 |
|
298 |
public Geometry PathData |
299 |
{ |
300 |
get { return (Geometry)GetValue(PathDataProperty); } |
301 |
set |
302 |
{ |
303 |
SetValue(PathDataProperty, value); |
304 |
OnPropertyChanged("PathData"); |
305 |
} |
306 |
} |
307 |
public override bool IsSelected |
308 |
{ |
309 |
get |
310 |
{ |
311 |
return (bool)GetValue(IsSelectedProperty); |
312 |
} |
313 |
set |
314 |
{ |
315 |
SetValue(IsSelectedProperty, value); |
316 |
} |
317 |
} |
318 |
|
319 |
public override ControlType ControlType |
320 |
{ |
321 |
get |
322 |
{ |
323 |
return (ControlType)GetValue(ControlTypeProperty); |
324 |
} |
325 |
set |
326 |
{ |
327 |
SetValue(ControlTypeProperty, value); |
328 |
OnPropertyChanged("ControlType"); |
329 |
} |
330 |
} |
331 |
public double AngleValue |
332 |
{ |
333 |
get { return (double)GetValue(AngleProperty); } |
334 |
set { SetValue(AngleProperty, value); } |
335 |
} |
336 |
|
337 |
|
338 |
//public double Angle |
339 |
//{ |
340 |
// get { return (double)GetValue(AngleProperty); } |
341 |
// set |
342 |
// { |
343 |
// if (this.Angle != value) |
344 |
// { |
345 |
// SetValue(AngleProperty, value); |
346 |
// } |
347 |
// } |
348 |
//} |
349 |
|
350 |
public Point EndPoint |
351 |
{ |
352 |
get { return (Point)GetValue(EndPointProperty); } |
353 |
set |
354 |
{ |
355 |
SetValue(EndPointProperty, value); |
356 |
OnPropertyChanged("EndPoint"); |
357 |
} |
358 |
} |
359 |
public Point StartPoint |
360 |
{ |
361 |
get { return (Point)GetValue(StartPointProperty); } |
362 |
set |
363 |
{ |
364 |
SetValue(StartPointProperty, value); |
365 |
OnPropertyChanged("StartPoint"); |
366 |
} |
367 |
} |
368 |
public Point MiddlePoint |
369 |
{ |
370 |
get { return (Point)GetValue(MidPointProperty); } |
371 |
set |
372 |
{ |
373 |
SetValue(MidPointProperty, value); |
374 |
OnPropertyChanged("MiddlePoint"); |
375 |
} |
376 |
} |
377 |
public bool isTransOn |
378 |
{ |
379 |
get { return (bool)GetValue(isTransOnProperty); } |
380 |
set |
381 |
{ |
382 |
SetValue(isTransOnProperty, value); |
383 |
OnPropertyChanged("isTransOn"); |
384 |
} |
385 |
} |
386 |
|
387 |
#endregion |
388 |
#region Object & Variable |
389 |
PathGeometry pathGeometry = new PathGeometry(); |
390 |
GeometryGroup instanceGroup = new GeometryGroup(); |
391 |
#endregion |
392 |
public override void OnApplyTemplate() |
393 |
{ |
394 |
base.OnApplyTemplate(); |
395 |
Base_ArcPath = GetTemplateChild(PART_ArcPath) as Path; |
396 |
SetArcPath(); |
397 |
} |
398 |
|
399 |
public override void UpdateControl() |
400 |
{ |
401 |
this.StartPoint = new Point(this.PointSet[0].X, this.PointSet[0].Y); |
402 |
this.MiddlePoint = new Point(this.PointSet[1].X, this.PointSet[1].Y); |
403 |
this.EndPoint = new Point(this.PointSet[2].X, this.PointSet[2].Y); |
404 |
} |
405 |
|
406 |
public void setClock() |
407 |
{ |
408 |
if (Clock) |
409 |
{ |
410 |
this.Clock = false; |
411 |
} |
412 |
else |
413 |
{ |
414 |
this.Clock = true; |
415 |
} |
416 |
} |
417 |
|
418 |
//public void setClock() |
419 |
//{ |
420 |
// if(this.Clock == SweepDirection.Clockwise) |
421 |
// { |
422 |
// this.Clock = SweepDirection.Counterclockwise; |
423 |
// } |
424 |
// else |
425 |
// { |
426 |
// this.Clock =SweepDirection.Clockwise; |
427 |
// } |
428 |
//} |
429 |
public void SetArcPath() |
430 |
{ |
431 |
this.ApplyTemplate(); |
432 |
|
433 |
|
434 |
//강인구 추가 |
435 |
Base_ArcPath.StrokeDashArray.Clear(); |
436 |
if (this.DashSize != null) |
437 |
{ |
438 |
foreach (var item in this.DashSize) |
439 |
{ |
440 |
Base_ArcPath.StrokeDashArray.Add(item); |
441 |
} |
442 |
Base_ArcPath.StrokeDashCap = PenLineCap.Square; |
443 |
instanceGroup.Children.Clear(); |
444 |
} |
445 |
PathFigure pathFigure = new PathFigure(); |
446 |
|
447 |
pathFigure.StartPoint = this.StartPoint; |
448 |
QuadraticBezierSegment qb = new QuadraticBezierSegment(); |
449 |
|
450 |
if (MiddlePoint != null) |
451 |
{ |
452 |
if (MiddlePoint == new Point(0,0)) |
453 |
{ |
454 |
double xSharp = 0; |
455 |
double ySharp = 0; |
456 |
|
457 |
//Point t_start = new Point(0, 0); |
458 |
//Point t_end = new Point(30, 10); |
459 |
|
460 |
var midP = MathSet.getMiddlePoint(StartPoint, EndPoint); |
461 |
Point normalV = MathSet.GetNormVectorBetween(StartPoint, EndPoint); |
462 |
var dis = MathSet.DistanceTo(StartPoint, EndPoint); |
463 |
|
464 |
if (!this.Clock) |
465 |
{ |
466 |
xSharp = -normalV.Y; |
467 |
ySharp = normalV.X; |
468 |
} |
469 |
else |
470 |
{ |
471 |
xSharp = normalV.Y; |
472 |
ySharp = -normalV.X; |
473 |
} |
474 |
|
475 |
var pointN = new Point(xSharp * dis, ySharp * dis); |
476 |
MiddlePoint = new Point(pointN.X + midP.X, pointN.Y + midP.Y); |
477 |
} |
478 |
qb.Point1 = this.MiddlePoint; |
479 |
} |
480 |
|
481 |
qb.Point2 = this.EndPoint; |
482 |
pathFigure.Segments.Add(qb); |
483 |
pathGeometry.Figures = new PathFigureCollection(); |
484 |
pathGeometry.Figures.Add(pathFigure); |
485 |
pathFigure.IsFilled = false; |
486 |
pathFigure.IsClosed = false; |
487 |
instanceGroup.Children.Add(pathGeometry); |
488 |
|
489 |
instanceGroup.Children.Add(DrawSet.DrawArrow(this.MiddlePoint, this.StartPoint, this.LineSize)); |
490 |
instanceGroup.Children.Add(DrawSet.DrawArrow(this.MiddlePoint, this.EndPoint, this.LineSize)); |
491 |
this.Base_ArcPath.Fill = this.StrokeColor; |
492 |
|
493 |
instanceGroup.FillRule = FillRule.Nonzero; |
494 |
this.PathData = instanceGroup; |
495 |
this.OverViewPathData = PathData; |
496 |
|
497 |
} |
498 |
|
499 |
public override void ApplyOverViewData() |
500 |
{ |
501 |
this.OverViewPathData = this.PathData; |
502 |
} |
503 |
|
504 |
/// <summary> |
505 |
/// call when mouse is moving while drawing control |
506 |
/// </summary> |
507 |
/// <author>humkyung</author> |
508 |
/// <param name="pt"></param> |
509 |
/// <param name="bAxisLocked"></param> |
510 |
public override void OnCreatingMouseMove(Point pt, bool bAxisLocked) |
511 |
{ |
512 |
this.isTransOn = false; |
513 |
this.MiddlePoint = new Point(0, 0); |
514 |
this.EndPoint = pt; |
515 |
|
516 |
Point tmp = this.EndPoint; |
517 |
CommentAngle = MathSet.returnAngle(this.StartPoint, ref tmp, bAxisLocked); |
518 |
|
519 |
if (bAxisLocked) |
520 |
{ |
521 |
this.EndPoint = tmp; |
522 |
} |
523 |
|
524 |
this.PointSet = new List<Point> |
525 |
{ |
526 |
this.StartPoint, |
527 |
this.MiddlePoint, |
528 |
this.EndPoint, |
529 |
}; |
530 |
} |
531 |
|
532 |
/// <summary> |
533 |
/// move control point has same location of given pt along given delta |
534 |
/// </summary> |
535 |
/// <author>humkyung</author> |
536 |
/// <date>2019.06.20</date> |
537 |
/// <param name="pt"></param> |
538 |
/// <param name="dx"></param> |
539 |
/// <param name="dy"></param> |
540 |
public override void OnMoveCtrlPoint(Point pt, double dx, double dy, bool bAxisLocked = false) |
541 |
{ |
542 |
Point selected = MathSet.getNearPoint((this as IPath).PointSet, pt); |
543 |
|
544 |
var tmpPointSet = (this as IPath).PointSet.Where(x => !x.Equals(selected)); |
545 |
Point NearStartpoint = MathSet.getNearPoint(tmpPointSet.ToList(), pt); |
546 |
|
547 |
selected.X += dx; |
548 |
selected.Y += dy; |
549 |
|
550 |
Point tmp = selected; |
551 |
|
552 |
CommentAngle = MathSet.returnAngle(NearStartpoint, ref tmp, bAxisLocked); |
553 |
|
554 |
if (bAxisLocked) |
555 |
{ |
556 |
selected = tmp; |
557 |
} |
558 |
|
559 |
for (int i = 0; i < (this as IPath).PointSet.Count; i++) |
560 |
{ |
561 |
if (pt.Equals((this as IPath).PointSet[i])) |
562 |
{ |
563 |
(this as IPath).PointSet[i] = selected; |
564 |
} |
565 |
} |
566 |
this.UpdateControl(); |
567 |
} |
568 |
|
569 |
|
570 |
/// <summary> |
571 |
/// return ArrowControl_Multi's area |
572 |
/// </summary> |
573 |
/// <author>humkyung</author> |
574 |
/// <date>2019.06.13</date> |
575 |
public override Rect ItemRect |
576 |
{ |
577 |
get |
578 |
{ |
579 |
double dMinX = Math.Min(this.StartPoint.X, this.EndPoint.X); |
580 |
dMinX = Math.Min(this.MiddlePoint.X, dMinX); |
581 |
double dMinY = Math.Min(this.StartPoint.Y, this.EndPoint.Y); |
582 |
dMinY = Math.Min(this.MiddlePoint.Y, dMinY); |
583 |
double dMaxX = Math.Max(this.StartPoint.X, this.EndPoint.X); |
584 |
dMaxX = Math.Max(this.MiddlePoint.X, dMaxX); |
585 |
double dMaxY = Math.Max(this.StartPoint.Y, this.EndPoint.Y); |
586 |
dMaxY = Math.Max(this.MiddlePoint.Y, dMaxY); |
587 |
|
588 |
return new Rect(new Point(dMinX, dMinY), new Point(dMaxX, dMaxY)); |
589 |
} |
590 |
} |
591 |
|
592 |
/// <summary> |
593 |
/// Serialize this |
594 |
/// </summary> |
595 |
/// <param name="sUserId"></param> |
596 |
/// <returns></returns> |
597 |
public override string Serialize() |
598 |
{ |
599 |
using (S_ArrowArcControl ctrl = new S_ArrowArcControl()) |
600 |
{ |
601 |
ctrl.TransformPoint = "0|0"; |
602 |
ctrl.PointSet = this.PointSet; |
603 |
ctrl.SizeSet = String.Format("{0}", this.LineSize); |
604 |
//ctrl.StrokeColor = "#FF000FFF"; |
605 |
ctrl.StrokeColor = this.StrokeColor.Color.ToString(); |
606 |
ctrl.StartPoint = this.StartPoint; |
607 |
ctrl.UserID = this.UserID; |
608 |
ctrl.Opac = this.Opacity; |
609 |
ctrl.MidPoint = this.MiddlePoint; |
610 |
ctrl.EndPoint = this.EndPoint; |
611 |
ctrl.IsTransOn = this.isTransOn; |
612 |
ctrl.DashSize = this.DashSize; |
613 |
ctrl.Clock = this.Clock; |
614 |
//ctrl.ArcStyleSet = this.ControlType; |
615 |
ctrl.Name = this.GetType().Name.ToString(); |
616 |
|
617 |
///강인구 추가(2017.11.02) |
618 |
///Memo 추가 |
619 |
ctrl.Memo = this.Memo; |
620 |
ctrl.Index = this.Index; |
621 |
ctrl.ZIndex = this.ZIndex; |
622 |
ctrl.GroupID = this.GroupID; |
623 |
|
624 |
return "|DZ|" + JsonSerializerHelper.CompressString((ctrl.JsonSerialize())); |
625 |
} |
626 |
} |
627 |
|
628 |
/// <summary> |
629 |
/// create a arrowarccontrol from given string |
630 |
/// </summary> |
631 |
/// <param name="str"></param> |
632 |
/// <returns></returns> |
633 |
public static ArrowArcControl FromString(string str, SolidColorBrush brush, string sProjectNo) |
634 |
{ |
635 |
ArrowArcControl instance = null; |
636 |
using (S_ArrowArcControl s = JsonSerializerHelper.JsonDeserialize<S_ArrowArcControl>(str)) |
637 |
{ |
638 |
string[] data2 = s.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries); |
639 |
instance = new ArrowArcControl() |
640 |
{ |
641 |
StartPoint = s.StartPoint, |
642 |
EndPoint = s.EndPoint, |
643 |
DashSize = s.DashSize, |
644 |
PointSet = s.PointSet, |
645 |
isTransOn = s.IsTransOn, |
646 |
MiddlePoint = s.MidPoint, |
647 |
StrokeColor = brush, |
648 |
Opacity = s.Opac, |
649 |
|
650 |
Clock = s.Clock, |
651 |
LineSize = Convert.ToDouble(data2.First()), |
652 |
UserID = s.UserID, |
653 |
Memo = s.Memo, |
654 |
Index = s.Index, |
655 |
ZIndex = s.ZIndex, |
656 |
GroupID = s.GroupID |
657 |
}; |
658 |
} |
659 |
|
660 |
return instance; |
661 |
} |
662 |
} |
663 |
} |