markus / MarkupToPDF / Controls / Polygon / CloudControl.cs @ fd452a01
이력 | 보기 | 이력해설 | 다운로드 (40.7 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.Collections.Generic; |
||
12 | using System.ComponentModel; |
||
13 | using MarkupToPDF.Controls.Common; |
||
14 | using MarkupToPDF.Common; |
||
15 | 036650a0 | humkyung | using MarkupToPDF.Serialize.Core; |
16 | using MarkupToPDF.Serialize.S_Control; |
||
17 | 661b7416 | humkyung | using System.Linq; |
18 | 787a4489 | KangIngu | |
19 | namespace MarkupToPDF.Controls.Polygon |
||
20 | { |
||
21 | public class CloudControl : CommentUserInfo, IDisposable, INotifyPropertyChanged, IPath, IShapeControl, ICloudControl, IDashControl |
||
22 | { |
||
23 | private const string PART_CloudPath = "PART_CloudPath"; |
||
24 | private const string PART_CloudSubPath = "PART_CloudSubPath"; |
||
25 | |||
26 | public Path Base_CloudPath = null; |
||
27 | public Path Base_CloudSubPath = null; |
||
28 | |||
29 | 43e1d368 | taeseongkim | private const double _CloudArcDepth =0.8; /// 2018.05.14 added by humkyung |
30 | 5a9353a9 | humkyung | |
31 | 787a4489 | KangIngu | static CloudControl() |
32 | { |
||
33 | DefaultStyleKeyProperty.OverrideMetadata(typeof(CloudControl), new FrameworkPropertyMetadata(typeof(CloudControl))); |
||
34 | //Application.Current.Resources.MergedDictionaries.Add(Application.LoadComponent(new Uri("/MarkupToPDF;Component/Themes/generic.xaml")) as ResourceDictionary); |
||
35 | a6f7f9b6 | djkim | //ResourceDictionary dictionary = new ResourceDictionary(); |
36 | //dictionary.Source = new Uri("/MarkupToPDF;component/themes/generic.xaml", UriKind.RelativeOrAbsolute); |
||
37 | //Application.Current.Resources.MergedDictionaries.Add(dictionary); |
||
38 | 787a4489 | KangIngu | } |
39 | public CloudControl() |
||
40 | { |
||
41 | a6f7f9b6 | djkim | //this.DefaultStyleKey = typeof(CloudControl); |
42 | 787a4489 | KangIngu | } |
43 | |||
44 | #region Dependency Properties |
||
45 | public static readonly DependencyProperty UserIDProperty = DependencyProperty.Register( |
||
46 | "UserID", typeof(string), typeof(CloudControl), new PropertyMetadata(null)); |
||
47 | public static readonly DependencyProperty LineSizeProperty = DependencyProperty.Register( |
||
48 | "LineSize", typeof(double), typeof(CloudControl), new PropertyMetadata((Double)3)); |
||
49 | //강인구 추가 |
||
50 | public static readonly DependencyProperty DashSizeProperty = DependencyProperty.Register( |
||
51 | "DashSize", typeof(DoubleCollection), typeof(CloudControl), new PropertyMetadata(new DoubleCollection { 99999999 }, PointValueChanged)); |
||
52 | public static readonly DependencyProperty FillColorProperty = DependencyProperty.Register( |
||
53 | "FillColor", typeof(SolidColorBrush), typeof(CloudControl), new PropertyMetadata(new SolidColorBrush(Colors.Red))); |
||
54 | |||
55 | public static readonly DependencyProperty IsCompletedProperty = DependencyProperty.Register( |
||
56 | "IsCompleted", typeof(bool), typeof(CloudControl), null); |
||
57 | //강인구 |
||
58 | public static readonly DependencyProperty PaintProperty = DependencyProperty.Register( |
||
59 | "Paint", typeof(PaintSet), typeof(CloudControl), new PropertyMetadata(PaintSet.None, PointValueChanged)); |
||
60 | |||
61 | public static readonly DependencyProperty StrokeColorProperty = DependencyProperty.Register( |
||
62 | "StrokeColor", typeof(SolidColorBrush), typeof(CloudControl), new PropertyMetadata(new SolidColorBrush(Colors.Red))); |
||
63 | |||
64 | 9f473fb7 | KangIngu | public static readonly DependencyProperty ArcLengthProperty = DependencyProperty.Register( |
65 | "ArcLength", typeof(double), typeof(CloudControl), new PropertyMetadata((Double)10, PointValueChanged)); |
||
66 | |||
67 | 787a4489 | KangIngu | public static readonly DependencyProperty PathDataProperty = DependencyProperty.Register( |
68 | "PathData", typeof(Geometry), typeof(CloudControl), null); |
||
69 | |||
70 | public static readonly DependencyProperty PathSubDataProperty = DependencyProperty.Register( |
||
71 | "PathSubData", typeof(Geometry), typeof(CloudControl), null); |
||
72 | |||
73 | public static readonly DependencyProperty EndPointProperty = DependencyProperty.Register( |
||
74 | "EndPoint", typeof(Point), typeof(CloudControl), new PropertyMetadata(new Point(0, 0), PointValueChanged)); |
||
75 | |||
76 | public static readonly DependencyProperty StartPointProperty = DependencyProperty.Register( |
||
77 | "StartPoint", typeof(Point), typeof(CloudControl), new PropertyMetadata(new Point(0, 0), PointValueChanged)); |
||
78 | |||
79 | public static readonly DependencyProperty PointSetProperty = DependencyProperty.Register( |
||
80 | "PointSet", typeof(List<Point>), typeof(CloudControl), new PropertyMetadata(new List<Point>(), PointValueChanged)); |
||
81 | public static readonly DependencyProperty isTransOnProperty = DependencyProperty.Register( |
||
82 | "isTransOn", typeof(bool), typeof(CloudControl), new PropertyMetadata(false)); |
||
83 | public static readonly DependencyProperty isChainProperty = DependencyProperty.Register( |
||
84 | "isChain", typeof(bool), typeof(CloudControl), new PropertyMetadata(false)); |
||
85 | |||
86 | /// <summary> |
||
87 | /// StylusPointSet을 List<Point>로 대체하면 PointValueChanged가 작동안한다. |
||
88 | /// </summary> |
||
89 | public static readonly DependencyProperty StylusPointSetProperty = DependencyProperty.Register( |
||
90 | "PointC", typeof(StylusPointSet), typeof(CloudControl), new PropertyMetadata(new StylusPointSet(), PointValueChanged)); |
||
91 | |||
92 | public static readonly DependencyProperty AngleProperty = DependencyProperty.Register("AngleValue", typeof(double), typeof(CloudControl), |
||
93 | new PropertyMetadata((double)0.0, new PropertyChangedCallback(AngleValueChanged))); |
||
94 | |||
95 | public static readonly DependencyProperty CenterXProperty = DependencyProperty.Register("CenterX", typeof(double), typeof(CloudControl), |
||
96 | new PropertyMetadata((double)0, OnCenterXYChanged)); |
||
97 | |||
98 | public static readonly DependencyProperty CenterYProperty = DependencyProperty.Register("CenterY", typeof(double), typeof(CloudControl), |
||
99 | new PropertyMetadata((double)0, OnCenterXYChanged)); |
||
100 | |||
101 | public static readonly DependencyProperty IsSelectedProperty = |
||
102 | DependencyProperty.Register("IsSelected", typeof(bool), typeof(CloudControl), new FrameworkPropertyMetadata(false, IsSelectedChanged)); |
||
103 | |||
104 | public static readonly DependencyProperty ControlTypeProperty = |
||
105 | DependencyProperty.Register("ControlType", typeof(ControlType), typeof(CloudControl), new FrameworkPropertyMetadata(ControlType.PolygonCloud)); |
||
106 | |||
107 | public static readonly DependencyProperty OverViewPathDataProperty = DependencyProperty.Register( |
||
108 | "OverViewPathData", typeof(Geometry), typeof(ControlType), null); |
||
109 | |||
110 | |||
111 | public static readonly DependencyProperty CanvasXProperty = DependencyProperty.Register( |
||
112 | "CanvasX", typeof(double), typeof(CloudControl), new PropertyMetadata((double)0, OnSetCansvasChanged)); |
||
113 | |||
114 | public static readonly DependencyProperty CanvasYProperty = DependencyProperty.Register( |
||
115 | "CanvasY", typeof(double), typeof(CloudControl), new PropertyMetadata((double)0, OnSetCansvasChanged)); |
||
116 | |||
117 | |||
118 | #endregion |
||
119 | #region PropertyChanged Method |
||
120 | |||
121 | public static void OnSetCansvasChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) |
||
122 | { |
||
123 | var instance = (CloudControl)sender; |
||
124 | |||
125 | if (e.OldValue != e.NewValue && instance != null) |
||
126 | { |
||
127 | instance.SetValue(e.Property, e.NewValue); |
||
128 | } |
||
129 | } |
||
130 | |||
131 | public static void PointValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) |
||
132 | { |
||
133 | var instance = (CloudControl)sender; |
||
134 | if (e.OldValue != e.NewValue && instance.Base_CloudPath != null) |
||
135 | { |
||
136 | instance.SetValue(e.Property, e.NewValue); |
||
137 | //강인구 추가 |
||
138 | instance.SetCloud(); |
||
139 | //주석처리 |
||
140 | } |
||
141 | } |
||
142 | public static void IsSelectedChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) |
||
143 | { |
||
144 | //var instance = (CloudControl)sender; |
||
145 | |||
146 | //if (e.OldValue != e.NewValue && instance.Base_CloudPath != null) |
||
147 | //{ |
||
148 | |||
149 | // instance.SetValue(e.Property, e.NewValue); |
||
150 | |||
151 | // if (instance.IsSelected) |
||
152 | // { |
||
153 | // instance.Base_CloudPath.Stroke = new SolidColorBrush(Colors.Blue); |
||
154 | // } |
||
155 | // else |
||
156 | // { |
||
157 | // instance.Base_CloudPath.Stroke = new SolidColorBrush(Colors.Red); |
||
158 | // } |
||
159 | //} |
||
160 | } |
||
161 | |||
162 | public static void OnCenterXYChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) |
||
163 | { |
||
164 | var instance = (CloudControl)sender; |
||
165 | if (e.OldValue != e.NewValue && instance.Base_CloudPath != null) |
||
166 | { |
||
167 | instance.SetValue(e.Property, e.NewValue); |
||
168 | instance.DrawingCloud(); |
||
169 | } |
||
170 | } |
||
171 | public static void AngleValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) |
||
172 | { |
||
173 | var instance = (CloudControl)sender; |
||
174 | if (e.OldValue != e.NewValue && instance.Base_CloudPath != null) |
||
175 | { |
||
176 | instance.SetValue(e.Property, e.NewValue); |
||
177 | instance.DrawingCloud(); |
||
178 | } |
||
179 | } |
||
180 | #endregion |
||
181 | #region Properties |
||
182 | |||
183 | |||
184 | public bool IsCompleted |
||
185 | { |
||
186 | get { return (bool)GetValue(IsCompletedProperty); } |
||
187 | set |
||
188 | { |
||
189 | SetValue(IsCompletedProperty, value); |
||
190 | } |
||
191 | } |
||
192 | |||
193 | public Geometry OverViewPathData |
||
194 | { |
||
195 | get { return (Geometry)GetValue(OverViewPathDataProperty); } |
||
196 | set |
||
197 | { |
||
198 | SetValue(OverViewPathDataProperty, value); |
||
199 | OnPropertyChanged("OverViewPathData"); |
||
200 | } |
||
201 | } |
||
202 | |||
203 | public double CanvasX |
||
204 | { |
||
205 | get { return (double)GetValue(CanvasXProperty); } |
||
206 | set |
||
207 | { |
||
208 | if (this.CanvasX != value) |
||
209 | { |
||
210 | SetValue(CanvasXProperty, value); |
||
211 | } |
||
212 | } |
||
213 | } |
||
214 | |||
215 | public double CanvasY |
||
216 | { |
||
217 | get { return (double)GetValue(CanvasYProperty); } |
||
218 | set |
||
219 | { |
||
220 | if (this.CanvasY != value) |
||
221 | { |
||
222 | SetValue(CanvasYProperty, value); |
||
223 | } |
||
224 | } |
||
225 | } |
||
226 | |||
227 | 959b3ef2 | humkyung | public override bool IsSelected |
228 | 787a4489 | KangIngu | { |
229 | get |
||
230 | { |
||
231 | return (bool)GetValue(IsSelectedProperty); |
||
232 | } |
||
233 | set |
||
234 | { |
||
235 | SetValue(IsSelectedProperty, value); |
||
236 | } |
||
237 | } |
||
238 | |||
239 | 5529d2a2 | humkyung | public override ControlType ControlType |
240 | 787a4489 | KangIngu | { |
241 | set |
||
242 | { |
||
243 | SetValue(ControlTypeProperty, value); |
||
244 | } |
||
245 | get |
||
246 | { |
||
247 | return (ControlType)GetValue(ControlTypeProperty); |
||
248 | } |
||
249 | } |
||
250 | |||
251 | public Double LineSize |
||
252 | { |
||
253 | get { return (Double)GetValue(LineSizeProperty); } |
||
254 | set |
||
255 | { |
||
256 | if (this.LineSize != value) |
||
257 | { |
||
258 | SetValue(LineSizeProperty, value); |
||
259 | } |
||
260 | } |
||
261 | } |
||
262 | public bool isChain |
||
263 | { |
||
264 | get { return (bool)GetValue(isChainProperty); } |
||
265 | set |
||
266 | { |
||
267 | SetValue(isChainProperty, value); |
||
268 | OnPropertyChanged("isChain"); |
||
269 | } |
||
270 | } |
||
271 | public bool isTransOn |
||
272 | { |
||
273 | get { return (bool)GetValue(isTransOnProperty); } |
||
274 | set |
||
275 | { |
||
276 | SetValue(isTransOnProperty, value); |
||
277 | OnPropertyChanged("isTransOn"); |
||
278 | } |
||
279 | } |
||
280 | public DoubleCollection DashSize |
||
281 | { |
||
282 | get { return (DoubleCollection)GetValue(DashSizeProperty); } |
||
283 | set |
||
284 | { |
||
285 | if (this.DashSize != value) |
||
286 | { |
||
287 | SetValue(DashSizeProperty, value); |
||
288 | OnPropertyChanged("DashSize"); |
||
289 | } |
||
290 | } |
||
291 | } |
||
292 | public string UserID |
||
293 | { |
||
294 | get { return (string)GetValue(UserIDProperty); } |
||
295 | set |
||
296 | { |
||
297 | if (this.UserID != value) |
||
298 | { |
||
299 | SetValue(UserIDProperty, value); |
||
300 | OnPropertyChanged("UserID"); |
||
301 | } |
||
302 | } |
||
303 | } |
||
304 | public PaintSet Paint |
||
305 | { |
||
306 | get { return (PaintSet)GetValue(PaintProperty); } |
||
307 | set |
||
308 | { |
||
309 | if (this.Paint != value) |
||
310 | { |
||
311 | SetValue(PaintProperty, value); |
||
312 | OnPropertyChanged("Paint"); |
||
313 | } |
||
314 | } |
||
315 | } |
||
316 | |||
317 | public SolidColorBrush FillColor |
||
318 | { |
||
319 | get { return (SolidColorBrush)GetValue(FillColorProperty); } |
||
320 | set |
||
321 | { |
||
322 | if (this.FillColor != value) |
||
323 | { |
||
324 | SetValue(FillColorProperty, value); |
||
325 | OnPropertyChanged("FillColor"); |
||
326 | } |
||
327 | } |
||
328 | } |
||
329 | 4913851c | humkyung | public override SolidColorBrush StrokeColor |
330 | 787a4489 | KangIngu | { |
331 | get { return (SolidColorBrush)GetValue(StrokeColorProperty); } |
||
332 | set |
||
333 | { |
||
334 | if (this.StrokeColor != value) |
||
335 | { |
||
336 | SetValue(StrokeColorProperty, value); |
||
337 | OnPropertyChanged("StrokeColor"); |
||
338 | } |
||
339 | } |
||
340 | } |
||
341 | public Geometry PathData |
||
342 | { |
||
343 | get |
||
344 | { |
||
345 | return (Geometry)GetValue(PathDataProperty); |
||
346 | } |
||
347 | set |
||
348 | { |
||
349 | SetValue(PathDataProperty, value); |
||
350 | OnPropertyChanged("PathData"); |
||
351 | } |
||
352 | } |
||
353 | public Geometry PathSubData |
||
354 | { |
||
355 | get |
||
356 | { |
||
357 | return (Geometry)GetValue(PathSubDataProperty); |
||
358 | } |
||
359 | set |
||
360 | { |
||
361 | SetValue(PathSubDataProperty, value); |
||
362 | OnPropertyChanged("PathSubData"); |
||
363 | } |
||
364 | } |
||
365 | public Point EndPoint |
||
366 | { |
||
367 | get |
||
368 | { |
||
369 | return (Point)GetValue(EndPointProperty); |
||
370 | } |
||
371 | set |
||
372 | { |
||
373 | SetValue(EndPointProperty, value); |
||
374 | OnPropertyChanged("EndPoint"); |
||
375 | } |
||
376 | } |
||
377 | public Point StartPoint |
||
378 | { |
||
379 | get |
||
380 | { |
||
381 | return (Point)GetValue(StartPointProperty); |
||
382 | } |
||
383 | set |
||
384 | { |
||
385 | SetValue(StartPointProperty, value); |
||
386 | OnPropertyChanged("StartPoint"); |
||
387 | } |
||
388 | } |
||
389 | public List<Point> _pointSet; |
||
390 | |||
391 | public List<Point> PointSet |
||
392 | { |
||
393 | get |
||
394 | { |
||
395 | return (List<Point>)GetValue(PointSetProperty); |
||
396 | } |
||
397 | set |
||
398 | { |
||
399 | SetValue(PointSetProperty, value); |
||
400 | OnPropertyChanged("PointSet"); |
||
401 | } |
||
402 | } |
||
403 | |||
404 | public List<Point> pointSet |
||
405 | { |
||
406 | get |
||
407 | { |
||
408 | return _pointSet; |
||
409 | } |
||
410 | set |
||
411 | { |
||
412 | _pointSet = value; |
||
413 | OnPropertyChanged("pointSet"); |
||
414 | } |
||
415 | } |
||
416 | |||
417 | 9f473fb7 | KangIngu | public Double ArcLength |
418 | { |
||
419 | get { return (Double)GetValue(ArcLengthProperty); } |
||
420 | set |
||
421 | { |
||
422 | if (this.ArcLength != value) |
||
423 | { |
||
424 | SetValue(ArcLengthProperty, value); |
||
425 | OnPropertyChanged("ArcLength"); |
||
426 | } |
||
427 | } |
||
428 | } |
||
429 | |||
430 | 787a4489 | KangIngu | private double _toler = 1; |
431 | public double Toler |
||
432 | { |
||
433 | get { return _toler; } |
||
434 | set { _toler = value; } |
||
435 | } |
||
436 | 5ce56a3a | KangIngu | //강인구 수정 클라우드 사이즈 |
437 | 9f473fb7 | KangIngu | //private double _arcLength; |
438 | ////private double _arcLength = 30; |
||
439 | //public double ArcLength |
||
440 | //{ |
||
441 | // get { return _arcLength; } |
||
442 | // set { _arcLength = value; } |
||
443 | //} |
||
444 | 787a4489 | KangIngu | private bool _fill = false; |
445 | public bool Fill |
||
446 | { |
||
447 | get { return _fill; } |
||
448 | set { _fill = value; } |
||
449 | } |
||
450 | 168f8027 | taeseongkim | //public double Angle |
451 | //{ |
||
452 | // get { return (double)GetValue(AngleProperty); } |
||
453 | // set |
||
454 | // { |
||
455 | // if (this.Angle != value) |
||
456 | // { |
||
457 | // SetValue(AngleProperty, value); |
||
458 | // OnPropertyChanged("Angle"); |
||
459 | // } |
||
460 | // } |
||
461 | //} |
||
462 | 787a4489 | KangIngu | public StylusPointSet PointC |
463 | { |
||
464 | get { return (StylusPointSet)GetValue(StylusPointSetProperty); } |
||
465 | set |
||
466 | { |
||
467 | SetValue(StylusPointSetProperty, value); |
||
468 | OnPropertyChanged("PointC"); |
||
469 | } |
||
470 | } |
||
471 | public double CenterX |
||
472 | { |
||
473 | get |
||
474 | { |
||
475 | return (double)GetValue(CenterXProperty); |
||
476 | } |
||
477 | set |
||
478 | { |
||
479 | SetValue(CenterXProperty, value); |
||
480 | OnPropertyChanged("CenterX"); |
||
481 | } |
||
482 | } |
||
483 | public double CenterY |
||
484 | { |
||
485 | get |
||
486 | { |
||
487 | return (double)GetValue(CenterYProperty); |
||
488 | } |
||
489 | set |
||
490 | { |
||
491 | SetValue(CenterYProperty, value); |
||
492 | OnPropertyChanged("CenterY"); |
||
493 | } |
||
494 | } |
||
495 | public double AngleValue |
||
496 | { |
||
497 | get |
||
498 | { |
||
499 | return (double)GetValue(AngleProperty); |
||
500 | } |
||
501 | set |
||
502 | { |
||
503 | SetValue(AngleProperty, value); |
||
504 | OnPropertyChanged("AngleValue"); |
||
505 | } |
||
506 | } |
||
507 | #endregion |
||
508 | #region Data |
||
509 | private PathGeometry _pathGeometry = new PathGeometry(); |
||
510 | private PathGeometry _pathSubGeometry = new PathGeometry(); |
||
511 | #endregion |
||
512 | |||
513 | public override void OnApplyTemplate() |
||
514 | { |
||
515 | base.OnApplyTemplate(); |
||
516 | Base_CloudPath = GetTemplateChild(PART_CloudPath) as Path; |
||
517 | Base_CloudSubPath = GetTemplateChild(PART_CloudSubPath) as Path; |
||
518 | SetCloud(); |
||
519 | } |
||
520 | public void SetCloud() |
||
521 | { |
||
522 | //this.Width = this.Base_CloudPath.Width; |
||
523 | //this.Height = this.Base_CloudPath.Height; |
||
524 | |||
525 | this.ApplyTemplate(); |
||
526 | |||
527 | Generate(); |
||
528 | |||
529 | if (!isChain) |
||
530 | { |
||
531 | //ClosePath(); |
||
532 | } |
||
533 | } |
||
534 | public int Generate() |
||
535 | { |
||
536 | this._pathGeometry = null; |
||
537 | this._pathSubGeometry = null; |
||
538 | switch (this.Paint) |
||
539 | { |
||
540 | case PaintSet.None: |
||
541 | this.FillColor = null; |
||
542 | if (Base_CloudSubPath != null) |
||
543 | { |
||
544 | Base_CloudPath.Fill = null; |
||
545 | Base_CloudSubPath.Fill = null; |
||
546 | Base_CloudSubPath.Stroke = new SolidColorBrush(Colors.Transparent); |
||
547 | //Base_CloudSubPath.StrokeThickness = 3; |
||
548 | } |
||
549 | break; |
||
550 | case PaintSet.Fill: |
||
551 | this.FillColor = this.StrokeColor; |
||
552 | if (Base_CloudSubPath != null) |
||
553 | { |
||
554 | if (isChain) |
||
555 | { |
||
556 | Base_CloudPath.Fill = null; |
||
557 | Base_CloudSubPath.Fill = null; |
||
558 | Base_CloudSubPath.Stroke = new SolidColorBrush(Colors.Transparent); |
||
559 | //Base_CloudSubPath.StrokeThickness = 3; |
||
560 | } |
||
561 | else |
||
562 | { |
||
563 | Base_CloudSubPath.Stroke = this.StrokeColor; |
||
564 | //Base_CloudSubPath.Stroke = new SolidColorBrush(Colors.Transparent); |
||
565 | Base_CloudSubPath.StrokeThickness = 0.5; |
||
566 | Base_CloudPath.Stroke = this.StrokeColor; |
||
567 | //Base_CloudPath.StrokeThickness = 3; |
||
568 | Base_CloudPath.Fill = this.FillColor; |
||
569 | Base_CloudSubPath.Fill = this.FillColor; |
||
570 | } |
||
571 | } |
||
572 | break; |
||
573 | case PaintSet.Hatch: |
||
574 | if (Base_CloudSubPath != null && !isChain) |
||
575 | { |
||
576 | if (isChain) |
||
577 | { |
||
578 | Base_CloudPath.Fill = null; |
||
579 | Base_CloudSubPath.Fill = null; |
||
580 | Base_CloudSubPath.Stroke = new SolidColorBrush(Colors.Transparent); |
||
581 | //Base_CloudSubPath.StrokeThickness = 3; |
||
582 | } |
||
583 | else |
||
584 | { |
||
585 | 92c9cab8 | taeseongkim | var size = this.LineSize > 5 ? 5 : this.LineSize; |
586 | Base_CloudPath.Fill = HatchMake.CreateHatchBrush(this.StrokeColor, size * 0.1); |
||
587 | Base_CloudSubPath.Fill = HatchMake.CreateHatchBrush(this.StrokeColor, size * 0.1); |
||
588 | 787a4489 | KangIngu | Base_CloudSubPath.Stroke = new SolidColorBrush(Colors.Transparent); |
589 | } |
||
590 | } |
||
591 | break; |
||
592 | default: |
||
593 | break; |
||
594 | } |
||
595 | |||
596 | //강인구 추가 |
||
597 | if (Base_CloudPath != null) |
||
598 | { |
||
599 | Base_CloudPath.StrokeDashArray.Clear(); |
||
600 | Base_CloudSubPath.StrokeDashArray.Clear(); |
||
601 | foreach (var item in this.DashSize) |
||
602 | { |
||
603 | Base_CloudPath.StrokeDashArray.Add(item); |
||
604 | Base_CloudSubPath.StrokeDashArray.Add(item); |
||
605 | } |
||
606 | } |
||
607 | |||
608 | |||
609 | /// set reverse if area is greater 0 - 2012.07.04 added by humkyung |
||
610 | double area = MathSet.AreaOf(this.PointSet); |
||
611 | bool reverse = (area > 0); |
||
612 | /// up to here |
||
613 | |||
614 | 43e1d368 | taeseongkim | this._pathGeometry = new PathGeometry { FillRule = FillRule.Nonzero}; |
615 | this._pathSubGeometry = new PathGeometry { FillRule = FillRule.Nonzero }; |
||
616 | 787a4489 | KangIngu | |
617 | if (isTransOn) // true라면 클라우드 컨트롤 |
||
618 | { |
||
619 | 43e1d368 | taeseongkim | //PathFigure pathFigure = CloudControl.GeneratePolyWithCloud(this.PointSet, this.ArcLength, reverse); |
620 | //_pathGeometry.Figures.Add(pathFigure); |
||
621 | |||
622 | for (int i = 0; i < this.PointSet.Count - 1; i++) |
||
623 | 787a4489 | KangIngu | { |
624 | 43e1d368 | taeseongkim | var stPoint = this.PointSet[i]; |
625 | |||
626 | Point edPoint = this.PointSet[i + 1]; |
||
627 | |||
628 | //if (i < this.PointSet.Count() - 1) |
||
629 | //{ |
||
630 | // edPoint = this.PointSet[i + 1]; |
||
631 | //} |
||
632 | //else |
||
633 | //{ |
||
634 | // edPoint = this.PointSet[0]; |
||
635 | //} |
||
636 | |||
637 | PathFigure pathFigure = CloudControl.GenerateLineWithCloud(stPoint, edPoint, this.ArcLength, reverse); |
||
638 | 787a4489 | KangIngu | _pathGeometry.Figures.Add(pathFigure); |
639 | } |
||
640 | } |
||
641 | else |
||
642 | { |
||
643 | PathFigure fm = new PathFigure(); |
||
644 | fm.StartPoint = this.PointSet[0]; |
||
645 | 43e1d368 | taeseongkim | for (int i = 0; i < this.PointSet.Count() - 2; i++) |
646 | 787a4489 | KangIngu | { |
647 | fm.Segments.Add(new LineSegment { Point = this.PointSet[i] }); |
||
648 | } |
||
649 | _pathGeometry.Figures.Add(fm); |
||
650 | } |
||
651 | |||
652 | if (this.Paint == PaintSet.Fill || this.Paint == PaintSet.Hatch) |
||
653 | { |
||
654 | PointCollection pd = new PointCollection(); |
||
655 | foreach (var item in this.PointSet) |
||
656 | { |
||
657 | pd.Add(item); |
||
658 | } |
||
659 | _pathSubGeometry.Figures.Add(new PathFigure() |
||
660 | { |
||
661 | Segments = new PathSegmentCollection() |
||
662 | { |
||
663 | new PolyLineSegment() |
||
664 | { |
||
665 | Points = pd |
||
666 | }, |
||
667 | }, |
||
668 | StartPoint = this.PointSet[0] |
||
669 | }); |
||
670 | |||
671 | this.PathSubData = _pathSubGeometry; |
||
672 | } |
||
673 | StartPoint = PointSet[0]; |
||
674 | this.PathData = this._pathGeometry; |
||
675 | 43e1d368 | taeseongkim | |
676 | 787a4489 | KangIngu | this.OverViewPathData = PathData; |
677 | this.StrokeColor = StrokeColor; |
||
678 | this.LineSize = LineSize; |
||
679 | EndPoint = PointSet[PointSet.Count - 1]; |
||
680 | |||
681 | return 0; |
||
682 | } |
||
683 | |||
684 | /// <summary> |
||
685 | /// draw arcs between p1 and p2 |
||
686 | /// </summary> |
||
687 | /// <author>humkyung</author> |
||
688 | /// <param name="p1"></param> |
||
689 | /// <param name="p2"></param> |
||
690 | /// <param name="reverse"></param> |
||
691 | /// <returns></returns> |
||
692 | public static PathFigure GenerateLineWithCloud(Point p1, Point p2, double arcLength_, bool reverse) |
||
693 | { |
||
694 | PathFigure pathFigure = new PathFigure(); |
||
695 | 43e1d368 | taeseongkim | |
696 | var radius = arcLength_; |
||
697 | double overlap = 5.5D / 6D; |
||
698 | |||
699 | double delta = 2 * radius * overlap; |
||
700 | |||
701 | pathFigure.StartPoint = p1; |
||
702 | pathFigure.IsClosed = false; |
||
703 | pathFigure.IsFilled = false; |
||
704 | var prev = p2; |
||
705 | |||
706 | var curr = p1; |
||
707 | |||
708 | var dx = curr.X - prev.X; |
||
709 | var dy = curr.Y - prev.Y; |
||
710 | |||
711 | var len = Math.Sqrt(dx * dx + dy * dy); |
||
712 | |||
713 | dx = dx / len; |
||
714 | dy = dy / len; |
||
715 | |||
716 | var length = 0D; |
||
717 | |||
718 | for (int a = 0; a <= Math.Round(len / delta); a++) |
||
719 | { |
||
720 | if (length > len) |
||
721 | { |
||
722 | length = len; |
||
723 | } |
||
724 | |||
725 | ArcSegment arcSeg = new ArcSegment(); |
||
726 | |||
727 | var x = prev.X + length * dx; |
||
728 | var y = prev.Y + length * dy; |
||
729 | |||
730 | if(!double.IsNaN(x) && !double.IsNaN(y)) |
||
731 | { |
||
732 | arcSeg.Point = new Point(x, y); |
||
733 | arcSeg.Size = new Size(radius, radius); |
||
734 | arcSeg.IsLargeArc = true; |
||
735 | |||
736 | if(reverse) |
||
737 | { |
||
738 | arcSeg.SweepDirection = SweepDirection.Counterclockwise; |
||
739 | } |
||
740 | else |
||
741 | { |
||
742 | arcSeg.SweepDirection = SweepDirection.Clockwise; |
||
743 | } |
||
744 | |||
745 | if (length == 0) |
||
746 | { |
||
747 | pathFigure.StartPoint = arcSeg.Point; |
||
748 | } |
||
749 | pathFigure.Segments.Add(arcSeg); |
||
750 | |||
751 | } |
||
752 | |||
753 | length += delta; |
||
754 | } |
||
755 | pathFigure.IsFilled = false; |
||
756 | return pathFigure; |
||
757 | } |
||
758 | |||
759 | /// <summary> |
||
760 | /// draw arcs between p1 and p2 |
||
761 | /// </summary> |
||
762 | /// <author>humkyung</author> |
||
763 | /// <param name="p1"></param> |
||
764 | /// <param name="p2"></param> |
||
765 | /// <param name="reverse"></param> |
||
766 | /// <returns></returns> |
||
767 | public static PathFigure GeneratePolyWithCloud(List<Point> points,double arcLength_, bool reverse) |
||
768 | { |
||
769 | PathFigure pathFigure = new PathFigure(); |
||
770 | |||
771 | var radius = arcLength_; |
||
772 | double overlap = 5.5D / 6D; |
||
773 | |||
774 | double delta = 2 * radius * overlap; |
||
775 | |||
776 | if(points.Count() > 1) |
||
777 | { |
||
778 | pathFigure.StartPoint = points[0]; |
||
779 | pathFigure.IsClosed = false; |
||
780 | pathFigure.IsFilled = false; |
||
781 | Point prevArcPoint = points[0]; |
||
782 | |||
783 | for (int i = 0; i < points.Count -1; i++) |
||
784 | { |
||
785 | Point curr = points[i]; |
||
786 | Point prev = points[i + 1]; |
||
787 | |||
788 | |||
789 | var dx = curr.X - prev.X; |
||
790 | var dy = curr.Y - prev.Y; |
||
791 | |||
792 | var len = Math.Sqrt(dx * dx + dy * dy); |
||
793 | |||
794 | dx = dx / len; |
||
795 | dy = dy / len; |
||
796 | |||
797 | var length = 0D; |
||
798 | |||
799 | for (int a = 0; a <= Math.Round(len / delta); a++) |
||
800 | { |
||
801 | if (length > len) |
||
802 | { |
||
803 | length = len; |
||
804 | } |
||
805 | |||
806 | ArcSegment arcSeg = new ArcSegment(); |
||
807 | |||
808 | var x = prev.X + length * dx; |
||
809 | var y = prev.Y + length * dy; |
||
810 | |||
811 | if (!double.IsNaN(x) && !double.IsNaN(y)) |
||
812 | { |
||
813 | arcSeg.Point = new Point(x, y); |
||
814 | arcSeg.Size = new Size(radius, radius); |
||
815 | arcSeg.IsLargeArc = true; |
||
816 | |||
817 | |||
818 | if (reverse) |
||
819 | { |
||
820 | arcSeg.SweepDirection = SweepDirection.Counterclockwise; |
||
821 | } |
||
822 | else |
||
823 | { |
||
824 | arcSeg.SweepDirection = SweepDirection.Clockwise; |
||
825 | } |
||
826 | |||
827 | //if (length == 0) |
||
828 | //{ |
||
829 | // pathFigure.StartPoint = arcSeg.Point; |
||
830 | //} |
||
831 | |||
832 | |||
833 | |||
834 | pathFigure.Segments.Add(arcSeg); |
||
835 | |||
836 | System.Diagnostics.Debug.WriteLine($"{prevArcPoint} { arcSeg.Point}"); |
||
837 | prevArcPoint = arcSeg.Point; |
||
838 | |||
839 | } |
||
840 | |||
841 | length += delta; |
||
842 | } |
||
843 | |||
844 | } |
||
845 | } |
||
846 | |||
847 | pathFigure.IsFilled = false; |
||
848 | return pathFigure; |
||
849 | } |
||
850 | |||
851 | /// <summary> |
||
852 | /// draw arcs between p1 and p2 |
||
853 | /// </summary> |
||
854 | /// <author>humkyung</author> |
||
855 | /// <param name="p1"></param> |
||
856 | /// <param name="p2"></param> |
||
857 | /// <param name="reverse"></param> |
||
858 | /// <returns></returns> |
||
859 | public static PathFigure GenerateLineWithCloudOld(Point p1, Point p2, double arcLength_, bool reverse) |
||
860 | { |
||
861 | PathFigure pathFigure = new PathFigure(); |
||
862 | 787a4489 | KangIngu | pathFigure.StartPoint = p1; |
863 | |||
864 | double arcLength = arcLength_; |
||
865 | /// draw arcs which has arcLength between p1 and p2 - 2012.06.21 added by humkyung |
||
866 | double dx = p2.X - p1.X; |
||
867 | double dy = p2.Y - p1.Y; |
||
868 | double l = MathSet.DistanceTo(p1, p2); /// distance between p1 and p2 |
||
869 | double theta = Math.Atan2(Math.Abs(dy), Math.Abs(dx)) * 180 / Math.PI; |
||
870 | Point lastPt = new Point(p1.X, p1.Y); |
||
871 | double count = l / arcLength; |
||
872 | /// normalize |
||
873 | dx /= l; |
||
874 | dy /= l; |
||
875 | Double j = 1; |
||
876 | for (j = 1; j < (count - 1); j++) |
||
877 | { |
||
878 | ArcSegment arcSeg = new ArcSegment(); |
||
879 | 5a9353a9 | humkyung | arcSeg.Size = new Size(arcLength * CloudControl._CloudArcDepth, arcLength * CloudControl._CloudArcDepth); /// x size and y size of arc |
880 | 787a4489 | KangIngu | arcSeg.Point = new Point(p1.X + j * dx * arcLength, p1.Y + j * dy * arcLength); /// end point of arc |
881 | lastPt = arcSeg.Point; /// save last point |
||
882 | 43e1d368 | taeseongkim | //arcSeg.RotationAngle = theta + 90; |
883 | 787a4489 | KangIngu | if (true == reverse) arcSeg.SweepDirection = SweepDirection.Clockwise; |
884 | 43e1d368 | taeseongkim | |
885 | 787a4489 | KangIngu | pathFigure.Segments.Add(arcSeg); |
886 | } |
||
887 | |||
888 | /// draw arc between last point and end point |
||
889 | if ((count > j) || (count > 0)) |
||
890 | { |
||
891 | arcLength = MathSet.DistanceTo(lastPt, p2); |
||
892 | ArcSegment arcSeg = new ArcSegment(); |
||
893 | 5a9353a9 | humkyung | arcSeg.Size = new Size(arcLength * CloudControl._CloudArcDepth, arcLength * CloudControl._CloudArcDepth); /// x size and y size of arc |
894 | 43e1d368 | taeseongkim | arcSeg.Point = new Point(p2.X, p2.Y);/// end point of arc |
895 | //arcSeg.RotationAngle = theta; |
||
896 | 787a4489 | KangIngu | if (true == reverse) arcSeg.SweepDirection = SweepDirection.Clockwise; |
897 | pathFigure.Segments.Add(arcSeg); |
||
898 | |||
899 | } |
||
900 | |||
901 | 43e1d368 | taeseongkim | pathFigure.IsFilled = true; |
902 | 787a4489 | KangIngu | return pathFigure; |
903 | } |
||
904 | |||
905 | /// <summary> |
||
906 | /// close path if it's open |
||
907 | /// </summary> |
||
908 | /// <author>humkyung</author> |
||
909 | /// <returns></returns> |
||
910 | public int ClosePath() |
||
911 | { |
||
912 | if (this.PointSet.Count > 1) |
||
913 | { |
||
914 | double d = MathSet.DistanceTo(this.PointSet[0], this.PointSet[this.PointSet.Count - 1]); |
||
915 | if (d > _toler) |
||
916 | { |
||
917 | /// set reverse if area is greater 0 - 2012.07.04 added by humkyung |
||
918 | double area = MathSet.AreaOf(this.PointSet); |
||
919 | bool reverse = (area > 0); |
||
920 | /// up to here |
||
921 | |||
922 | int count = this.PointSet.Count; |
||
923 | |||
924 | if (isTransOn) // true라면 클라우드 컨트롤 |
||
925 | { |
||
926 | 53393bae | KangIngu | ArcLength = ArcLength == 0 ? 10 : ArcLength; |
927 | |||
928 | 787a4489 | KangIngu | PathFigure pathFigure = CloudControl.GenerateLineWithCloud(this.PointSet[count - 1], this.PointSet[0], this.ArcLength - 5, reverse); |
929 | |||
930 | if (this.Paint == PaintSet.Fill) |
||
931 | { |
||
932 | pathFigure.IsClosed = true; |
||
933 | } |
||
934 | |||
935 | _pathGeometry.Figures.Add(pathFigure); |
||
936 | } |
||
937 | else |
||
938 | { |
||
939 | |||
940 | PathFigure fm = new PathFigure(); |
||
941 | fm.StartPoint = this.PointSet[count - 1]; |
||
942 | |||
943 | //for (int i = 0; i < (count - 1); i++) |
||
944 | //{ |
||
945 | _pathGeometry.Figures[_pathGeometry.Figures.Count - 1].Segments.Add(new LineSegment { Point = this.PointSet[0] }); |
||
946 | _pathGeometry.Figures[_pathGeometry.Figures.Count - 1].Segments.Add(new LineSegment { Point = this.PointSet[1] }); |
||
947 | //fm.Segments.Add(new LineSegment { Point = this.PointSet[0] }); |
||
948 | //} |
||
949 | } |
||
950 | } |
||
951 | } |
||
952 | |||
953 | return 0; |
||
954 | } |
||
955 | public void DrawingCloud() |
||
956 | { |
||
957 | AnotherSetCloud(); |
||
958 | if (!isChain) |
||
959 | { |
||
960 | //ClosePath(); |
||
961 | } |
||
962 | } |
||
963 | public void AnotherSetCloud() |
||
964 | { |
||
965 | this.StrokeColor = StrokeColor; |
||
966 | this.LineSize = LineSize; |
||
967 | this.SetCloud(); |
||
968 | //Generate(); |
||
969 | this.Width = this.Base_CloudPath.Width; |
||
970 | this.Height = this.Base_CloudPath.Height; |
||
971 | } |
||
972 | public void Dispose() |
||
973 | { |
||
974 | a6f7f9b6 | djkim | //GC.Collect(); |
975 | 24c5e56c | taeseongkim | ////GC.SuppressFinalize(this); |
976 | a6f7f9b6 | djkim | this.Base_CloudPath = null; |
977 | this.Base_CloudSubPath = null; |
||
978 | 787a4489 | KangIngu | } |
979 | public event PropertyChangedEventHandler PropertyChanged; |
||
980 | protected void OnPropertyChanged(string propName) |
||
981 | { |
||
982 | if (PropertyChanged != null) |
||
983 | PropertyChanged(this, new PropertyChangedEventArgs(propName)); |
||
984 | } |
||
985 | 0d00f9c8 | humkyung | |
986 | public override void UpdateControl() |
||
987 | 787a4489 | KangIngu | { |
988 | var lastIndex = this.PointSet.Count - 1; |
||
989 | //this.StartPoint = this.PointSet[0]; |
||
990 | //this.EndPoint = this.PointSet[lastIndex]; |
||
991 | CenterX = MathSet.getMiddlePoint(this.PointSet[0], this.PointSet[lastIndex]).X; |
||
992 | CenterY = MathSet.getMiddlePoint(this.PointSet[0], this.PointSet[lastIndex]).Y; |
||
993 | } |
||
994 | public void ChangePaint(PaintSet state) |
||
995 | { |
||
996 | this.Paint = state; |
||
997 | this.SetCloud(); |
||
998 | |||
999 | } |
||
1000 | 036650a0 | humkyung | |
1001 | /// <summary> |
||
1002 | a6272c57 | humkyung | /// call when mouse is moving while drawing control |
1003 | /// </summary> |
||
1004 | /// <param name="pt"></param> |
||
1005 | /// <param name="bAxisLocked"></param> |
||
1006 | 233ef333 | taeseongkim | public override void OnCreatingMouseMove(Point pt, bool bAxisLocked) |
1007 | a6272c57 | humkyung | { |
1008 | this.isTransOn = true; |
||
1009 | this.PointSet.RemoveAt(this.PointSet.Count - 1); |
||
1010 | |||
1011 | Point tmp = pt; |
||
1012 | 168f8027 | taeseongkim | |
1013 | 233ef333 | taeseongkim | if (bAxisLocked) |
1014 | a6272c57 | humkyung | { |
1015 | 233ef333 | taeseongkim | CommentAngle = MathSet.returnAngle(this.StartPoint, ref tmp, bAxisLocked); |
1016 | a6272c57 | humkyung | } |
1017 | 168f8027 | taeseongkim | |
1018 | 7a3b7ef3 | swate0609 | if (this.PointSet.Count > 2 && StartPoint == tmp) |
1019 | { |
||
1020 | this.IsCompleted = true; |
||
1021 | a6272c57 | humkyung | |
1022 | 7a3b7ef3 | swate0609 | //var firstPoint = this.PointSet.First(); |
1023 | //this.PointSet.Add(firstPoint); |
||
1024 | |||
1025 | //this.ApplyOverViewData(); |
||
1026 | |||
1027 | this.SetCloud(); |
||
1028 | } |
||
1029 | else |
||
1030 | { |
||
1031 | this.PointSet.Add(tmp); |
||
1032 | |||
1033 | this.SetCloud(); |
||
1034 | } |
||
1035 | a6272c57 | humkyung | } |
1036 | |||
1037 | /// <summary> |
||
1038 | d2114d3b | humkyung | /// move control point has same location of given pt along given delta |
1039 | /// </summary> |
||
1040 | /// <author>humkyung</author> |
||
1041 | /// <date>2019.06.20</date> |
||
1042 | /// <param name="pt"></param> |
||
1043 | /// <param name="dx"></param> |
||
1044 | /// <param name="dy"></param> |
||
1045 | 233ef333 | taeseongkim | public override void OnMoveCtrlPoint(Point pt, double dx, double dy, bool bAxisLocked = false) |
1046 | d2114d3b | humkyung | { |
1047 | Point selected = MathSet.getNearPoint((this as IPath).PointSet, pt); |
||
1048 | selected.X += dx; |
||
1049 | selected.Y += dy; |
||
1050 | for (int i = 0; i < (this as IPath).PointSet.Count; i++) |
||
1051 | { |
||
1052 | if (pt.Equals((this as IPath).PointSet[i])) |
||
1053 | { |
||
1054 | (this as IPath).PointSet[i] = selected; |
||
1055 | break; |
||
1056 | } |
||
1057 | } |
||
1058 | 0d00f9c8 | humkyung | this.UpdateControl(); |
1059 | d2114d3b | humkyung | this.DrawingCloud(); |
1060 | } |
||
1061 | |||
1062 | /// <summary> |
||
1063 | 91efe37a | humkyung | /// return Cloud's area |
1064 | /// </summary> |
||
1065 | /// <author>humkyung</author> |
||
1066 | /// <date>2019.06.13</date> |
||
1067 | public override Rect ItemRect |
||
1068 | { |
||
1069 | get |
||
1070 | { |
||
1071 | double dMinX = double.MaxValue; |
||
1072 | double dMinY = double.MaxValue; |
||
1073 | double dMaxX = double.MinValue; |
||
1074 | double dMaxY = double.MinValue; |
||
1075 | foreach (Point pt in this.PointSet) |
||
1076 | { |
||
1077 | dMinX = Math.Min(dMinX, pt.X); |
||
1078 | dMinY = Math.Min(dMinY, pt.Y); |
||
1079 | dMaxX = Math.Max(dMaxX, pt.X); |
||
1080 | dMaxY = Math.Max(dMaxY, pt.Y); |
||
1081 | } |
||
1082 | |||
1083 | return new Rect(new Point(dMinX, dMinY), new Point(dMaxX, dMaxY)); |
||
1084 | } |
||
1085 | } |
||
1086 | |||
1087 | /// <summary> |
||
1088 | 036650a0 | humkyung | /// Serialize this |
1089 | /// </summary> |
||
1090 | /// <param name="sUserId"></param> |
||
1091 | /// <returns></returns> |
||
1092 | public override string Serialize() |
||
1093 | { |
||
1094 | using (S_CloudControl STemp = new S_CloudControl()) |
||
1095 | { |
||
1096 | STemp.TransformPoint = "0|0"; |
||
1097 | STemp.SizeSet = String.Format("{0}", this.LineSize); |
||
1098 | //STemp.StrokeColor = "#FF000FFF"; |
||
1099 | STemp.StrokeColor = this.StrokeColor.Color.ToString(); |
||
1100 | STemp.Name = this.GetType().Name.ToString(); |
||
1101 | STemp.Toler = this.Toler; |
||
1102 | STemp.PaintState = this.Paint; |
||
1103 | STemp.Opac = this.Opacity; |
||
1104 | STemp.UserID = this.UserID; |
||
1105 | STemp.IsTrans = this.isTransOn; |
||
1106 | STemp.IsChain = this.isChain; |
||
1107 | STemp.PointSet = new List<Point>(); |
||
1108 | STemp.DashSize = this.DashSize; |
||
1109 | STemp.StartPoint = this.StartPoint; |
||
1110 | STemp.EndPoint = this.EndPoint; |
||
1111 | STemp.ArcLength = this.ArcLength; |
||
1112 | foreach (var point in this.PointSet) |
||
1113 | { |
||
1114 | STemp.PointSet.Add(point); |
||
1115 | } |
||
1116 | |||
1117 | //STemp.CloudFill = this.Fill; |
||
1118 | STemp.ArcLength = this.ArcLength; |
||
1119 | ///강인구 추가(2017.11.02) |
||
1120 | ///Memo 추가 |
||
1121 | STemp.Memo = this.Memo; |
||
1122 | |||
1123 | return "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
||
1124 | } |
||
1125 | } |
||
1126 | |||
1127 | 661b7416 | humkyung | /// <summary> |
1128 | /// create a cloudcontrol from given string |
||
1129 | /// </summary> |
||
1130 | /// <param name="str"></param> |
||
1131 | /// <returns></returns> |
||
1132 | public static CloudControl FromString(string str, SolidColorBrush brush, string sProjectNo) |
||
1133 | { |
||
1134 | CloudControl instance = null; |
||
1135 | using (S_CloudControl s = JsonSerializerHelper.JsonDeserialize<S_CloudControl>(str)) |
||
1136 | { |
||
1137 | string[] data2 = s.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries); |
||
1138 | instance = new CloudControl |
||
1139 | { |
||
1140 | LineSize = Convert.ToDouble(data2.First()), |
||
1141 | Toler = s.Toler, |
||
1142 | PointSet = s.PointSet, |
||
1143 | ArcLength = s.ArcLength, |
||
1144 | Paint = s.PaintState, |
||
1145 | Opacity = s.Opac, |
||
1146 | StrokeColor = brush, |
||
1147 | isTransOn = s.IsTrans, |
||
1148 | isChain = s.IsChain, |
||
1149 | DashSize = s.DashSize, |
||
1150 | UserID = s.UserID, |
||
1151 | |||
1152 | StartPoint = s.StartPoint, |
||
1153 | EndPoint = s.EndPoint, |
||
1154 | Memo = s.Memo |
||
1155 | |||
1156 | //Fill = s.CloudFill, |
||
1157 | }; |
||
1158 | } |
||
1159 | |||
1160 | return instance; |
||
1161 | } |
||
1162 | |||
1163 | 787a4489 | KangIngu | #region Method |
1164 | f513c215 | humkyung | public override void ApplyOverViewData() |
1165 | 787a4489 | KangIngu | { |
1166 | this.OverViewPathData = this.PathData; |
||
1167 | } |
||
1168 | #endregion |
||
1169 | } |
||
1170 | |||
1171 | 5529d2a2 | humkyung | } |