markus / MarkupToPDF / Controls / Line / LineControl.cs @ a5b465dc
이력 | 보기 | 이력해설 | 다운로드 (21.6 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.S_Control; |
16 |
using MarkupToPDF.Serialize.Core; |
17 |
using System.Linq; |
18 |
|
19 |
namespace MarkupToPDF.Controls.Line |
20 |
{ |
21 |
[TemplatePart(Name = "PART_LinePath", Type = typeof(Path))] |
22 |
public class LineControl : CommentUserInfo, IDisposable, INotifyPropertyChanged, IMarkupCommonData, IDashControl |
23 |
{ |
24 |
public event PropertyChangedEventHandler PropertyChanged; |
25 |
|
26 |
private const string PART_LinePath = "PART_LinePath"; |
27 |
public Path Base_LinePath = null; |
28 |
|
29 |
static LineControl() |
30 |
{ |
31 |
DefaultStyleKeyProperty.OverrideMetadata(typeof(LineControl), new FrameworkPropertyMetadata(typeof(LineControl))); |
32 |
//Application.Current.Resources.MergedDictionaries.Add(Application.LoadComponent(new Uri("/MarkupToPDF;Component/Themes/generic.xaml")) as ResourceDictionary); |
33 |
ResourceDictionary dictionary = new ResourceDictionary(); |
34 |
|
35 |
dictionary.Source = new Uri("/MarkupToPDF;component/Themes/generic.xaml", UriKind.RelativeOrAbsolute); |
36 |
Application.Current.Resources.MergedDictionaries.Add(dictionary); |
37 |
//System.Diagnostics.Debug.WriteLine("resource Count :" + Application.Current.Resources.MergedDictionaries.Count); |
38 |
} |
39 |
|
40 |
public double DimSize |
41 |
{ |
42 |
get { return (double)GetValue(DimSizeProperty); } |
43 |
set |
44 |
{ |
45 |
if (this.DimSize != value) |
46 |
{ |
47 |
SetValue(DimSizeProperty, value); |
48 |
OnPropertyChanged("DimSize"); |
49 |
} |
50 |
} |
51 |
} |
52 |
|
53 |
public LineControl() |
54 |
{ |
55 |
this.DefaultStyleKey = typeof(LineControl); |
56 |
} |
57 |
|
58 |
public void Dispose() |
59 |
{ |
60 |
GC.Collect(); |
61 |
GC.SuppressFinalize(this); |
62 |
} |
63 |
protected void OnPropertyChanged(string propName) |
64 |
{ |
65 |
if (PropertyChanged != null) |
66 |
PropertyChanged(this, new PropertyChangedEventArgs(propName)); |
67 |
} |
68 |
#region Dependency Properties |
69 |
|
70 |
public static readonly DependencyProperty IsSelectedProperty = |
71 |
DependencyProperty.Register("IsSelected", typeof(bool), typeof(LineControl), new FrameworkPropertyMetadata(false, IsSelectedChanged)); |
72 |
|
73 |
public static readonly DependencyProperty ControlTypeProperty = |
74 |
DependencyProperty.Register("ControlType", typeof(ControlType), typeof(LineControl), new FrameworkPropertyMetadata(ControlType.SingleLine)); |
75 |
|
76 |
public static readonly DependencyProperty OverViewPathDataProperty = DependencyProperty.Register( |
77 |
"OverViewPathData", typeof(Geometry), typeof(LineControl), new PropertyMetadata(null)); |
78 |
|
79 |
public static readonly DependencyProperty UserIDProperty = DependencyProperty.Register( |
80 |
"UserID", typeof(string), typeof(LineControl), new PropertyMetadata(null)); |
81 |
|
82 |
public static readonly DependencyProperty LineSizeProperty = DependencyProperty.Register( |
83 |
"LineSize", typeof(double), typeof(LineControl), new PropertyMetadata((Double)3, PointValueChanged)); |
84 |
|
85 |
public static readonly DependencyProperty IntervalProperty = DependencyProperty.Register( |
86 |
"Interval", typeof(double), typeof(LineControl), new PropertyMetadata((Double)10, PointValueChanged)); |
87 |
|
88 |
//강인구 추가 |
89 |
public static readonly DependencyProperty DashSizeProperty = DependencyProperty.Register( |
90 |
"DashSize", typeof(DoubleCollection), typeof(LineControl), new PropertyMetadata(new DoubleCollection { 1, 1 }, PointValueChanged)); |
91 |
//public static readonly DependencyProperty DashSizeProperty = DependencyProperty.Register( |
92 |
// "DashSize", typeof(DoubleCollection), typeof(LineControl), new PropertyMetadata(new DoubleCollection { 1, 1 })); |
93 |
|
94 |
public static readonly DependencyProperty StrokeColorProperty = DependencyProperty.Register( |
95 |
"StrokeColor", typeof(SolidColorBrush), typeof(LineControl), new PropertyMetadata(new SolidColorBrush(Colors.Red))); |
96 |
|
97 |
public static readonly DependencyProperty PathDataProperty = DependencyProperty.Register( |
98 |
"PathData", typeof(Geometry), typeof(LineControl), null); |
99 |
|
100 |
public static readonly DependencyProperty LineStyleProperty = DependencyProperty.Register( |
101 |
"LineStyleSet", typeof(LineStyleSet), typeof(LineControl), new PropertyMetadata(LineStyleSet.SingleLine)); |
102 |
|
103 |
public static readonly DependencyProperty StartPointProperty = DependencyProperty.Register( |
104 |
"StartPoint", typeof(Point), typeof(LineControl), new PropertyMetadata(new Point(0, 0), PointValueChanged)); |
105 |
|
106 |
public static readonly DependencyProperty EndPointProperty = DependencyProperty.Register( |
107 |
"EndPoint", typeof(Point), typeof(LineControl), new PropertyMetadata(new Point(100, 100), PointValueChanged)); |
108 |
|
109 |
public static readonly DependencyProperty PointSetProperty = DependencyProperty.Register( |
110 |
"PointSet", typeof(List<Point>), typeof(LineControl), new PropertyMetadata(new List<Point>(), PointValueChanged)); |
111 |
|
112 |
|
113 |
public static readonly DependencyProperty MiddlePointProperty = DependencyProperty.Register( |
114 |
"MiddlePoint", typeof(Point), typeof(LineControl), new PropertyMetadata(new Point(0, 0))); |
115 |
public static readonly DependencyProperty DimSizeProperty = DependencyProperty.Register( |
116 |
"DimSize", typeof(double), typeof(LineControl), new PropertyMetadata((double)5)); |
117 |
|
118 |
public static readonly DependencyProperty AngleProperty = |
119 |
DependencyProperty.Register("AngleValue", typeof(double), typeof(LineControl), new PropertyMetadata((double)0.0, new PropertyChangedCallback(AngleValueChanged))); |
120 |
|
121 |
public static readonly DependencyProperty CenterXProperty = |
122 |
DependencyProperty.Register("CenterX", typeof(double), typeof(LineControl), new PropertyMetadata((double)0, OnCenterXYChanged)); |
123 |
|
124 |
public static readonly DependencyProperty CenterYProperty = |
125 |
DependencyProperty.Register("CenterY", typeof(double), typeof(LineControl), new PropertyMetadata((double)0, OnCenterXYChanged)); |
126 |
#endregion |
127 |
#region PropertyChanged Method |
128 |
|
129 |
public static void IsSelectedChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) |
130 |
{ |
131 |
//var instance = (LineControl)sender; |
132 |
|
133 |
//if (e.OldValue != e.NewValue && instance.Base_LinePath != null) |
134 |
//{ |
135 |
|
136 |
// instance.SetValue(e.Property, e.NewValue); |
137 |
|
138 |
// if (instance.IsSelected) |
139 |
// { |
140 |
// instance.Base_LinePath.Stroke = new SolidColorBrush(Colors.Blue); |
141 |
// } |
142 |
// else |
143 |
// { |
144 |
// instance.Base_LinePath.Stroke = new SolidColorBrush(Colors.Red); |
145 |
// } |
146 |
//} |
147 |
} |
148 |
|
149 |
public static void PointValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) |
150 |
{ |
151 |
var instance = (LineControl)sender; |
152 |
if (e.OldValue != e.NewValue && instance.Base_LinePath != null) |
153 |
{ |
154 |
instance.SetValue(e.Property, e.NewValue); |
155 |
instance.SetLinePath(); |
156 |
} |
157 |
} |
158 |
public static void AngleValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) |
159 |
{ |
160 |
var instance = (LineControl)sender; |
161 |
if (e.OldValue != e.NewValue && instance.Base_LinePath != null) |
162 |
{ |
163 |
instance.SetValue(e.Property, e.NewValue); |
164 |
instance.SetLinePath(); |
165 |
} |
166 |
} |
167 |
public static void OnCenterXYChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) |
168 |
{ |
169 |
var instance = (LineControl)sender; |
170 |
if (e.OldValue != e.NewValue && instance.Base_LinePath != null) |
171 |
{ |
172 |
instance.SetValue(e.Property, e.NewValue); |
173 |
instance.SetLinePath(); |
174 |
} |
175 |
} |
176 |
|
177 |
#endregion |
178 |
#region Properties |
179 |
public string UserID |
180 |
{ |
181 |
get { return (string)GetValue(UserIDProperty); } |
182 |
set |
183 |
{ |
184 |
if (this.UserID != value) |
185 |
{ |
186 |
SetValue(UserIDProperty, value); |
187 |
OnPropertyChanged("UserID"); |
188 |
} |
189 |
} |
190 |
} |
191 |
|
192 |
public Double Interval |
193 |
{ |
194 |
get { return (Double)GetValue(IntervalProperty); } |
195 |
set |
196 |
{ |
197 |
if (this.Interval != value) |
198 |
{ |
199 |
SetValue(IntervalProperty, value); |
200 |
OnPropertyChanged("Interval"); |
201 |
} |
202 |
} |
203 |
} |
204 |
public Double LineSize |
205 |
{ |
206 |
get { return (Double)GetValue(LineSizeProperty); } |
207 |
set |
208 |
{ |
209 |
if (this.LineSize != value) |
210 |
{ |
211 |
SetValue(LineSizeProperty, value); |
212 |
} |
213 |
} |
214 |
} |
215 |
public DoubleCollection DashSize |
216 |
{ |
217 |
get { return (DoubleCollection)GetValue(DashSizeProperty); } |
218 |
set |
219 |
{ |
220 |
if (this.DashSize != value) |
221 |
{ |
222 |
SetValue(DashSizeProperty, value); |
223 |
} |
224 |
} |
225 |
} |
226 |
public List<Point> PointSet |
227 |
{ |
228 |
get { return (List<Point>)GetValue(PointSetProperty); } |
229 |
set { SetValue(PointSetProperty, value); } |
230 |
} |
231 |
public double CenterX |
232 |
{ |
233 |
get { return (double)GetValue(CenterXProperty); } |
234 |
set { SetValue(CenterXProperty, value); } |
235 |
} |
236 |
public double CenterY |
237 |
{ |
238 |
get { return (double)GetValue(CenterYProperty); } |
239 |
set { SetValue(CenterYProperty, value); } |
240 |
} |
241 |
public SolidColorBrush StrokeColor |
242 |
{ |
243 |
get { return (SolidColorBrush)GetValue(StrokeColorProperty); } |
244 |
set |
245 |
{ |
246 |
if (this.StrokeColor != value) |
247 |
{ |
248 |
SetValue(StrokeColorProperty, value); |
249 |
} |
250 |
} |
251 |
} |
252 |
|
253 |
|
254 |
public Geometry PathData |
255 |
{ |
256 |
get { return (Geometry)GetValue(PathDataProperty); } |
257 |
set |
258 |
{ |
259 |
SetValue(PathDataProperty, value); |
260 |
OnPropertyChanged("PathData"); |
261 |
} |
262 |
} |
263 |
|
264 |
|
265 |
|
266 |
public Geometry OverViewPathData |
267 |
{ |
268 |
get |
269 |
{ |
270 |
return (Geometry)GetValue(OverViewPathDataProperty); |
271 |
} |
272 |
set |
273 |
{ |
274 |
SetValue(OverViewPathDataProperty, value); |
275 |
OnPropertyChanged("OverViewPathData"); |
276 |
} |
277 |
} |
278 |
|
279 |
public override bool IsSelected |
280 |
{ |
281 |
get |
282 |
{ |
283 |
return (bool)GetValue(IsSelectedProperty); |
284 |
} |
285 |
set |
286 |
{ |
287 |
SetValue(IsSelectedProperty, value); |
288 |
} |
289 |
} |
290 |
|
291 |
public LineStyleSet LineStyleSet |
292 |
{ |
293 |
get |
294 |
{ |
295 |
return (LineStyleSet)GetValue(LineStyleProperty); |
296 |
} |
297 |
set |
298 |
{ |
299 |
SetValue(LineStyleProperty, value); |
300 |
} |
301 |
} |
302 |
|
303 |
public override ControlType ControlType |
304 |
{ |
305 |
get |
306 |
{ |
307 |
return (ControlType)GetValue(ControlTypeProperty); |
308 |
} |
309 |
set |
310 |
{ |
311 |
SetValue(ControlTypeProperty, value); |
312 |
} |
313 |
} |
314 |
|
315 |
public double AngleValue |
316 |
{ |
317 |
get { return (double)GetValue(AngleProperty); } |
318 |
set { SetValue(AngleProperty, value); } |
319 |
} |
320 |
public double Angle |
321 |
{ |
322 |
get { return (double)GetValue(AngleProperty); } |
323 |
set |
324 |
{ |
325 |
if (this.Angle != value) |
326 |
{ |
327 |
SetValue(AngleProperty, value); |
328 |
} |
329 |
} |
330 |
} |
331 |
public Point EndPoint |
332 |
{ |
333 |
get { return (Point)GetValue(EndPointProperty); } |
334 |
set |
335 |
{ |
336 |
SetValue(EndPointProperty, value); |
337 |
OnPropertyChanged("EndPoint"); |
338 |
} |
339 |
} |
340 |
public Point StartPoint |
341 |
{ |
342 |
get { return (Point)GetValue(StartPointProperty); } |
343 |
set |
344 |
{ |
345 |
SetValue(StartPointProperty, value); |
346 |
OnPropertyChanged("StartPoint"); |
347 |
} |
348 |
} |
349 |
GeometryGroup instanceGroup = new GeometryGroup(); |
350 |
LineGeometry connectorGeometry = new LineGeometry(); |
351 |
|
352 |
#endregion |
353 |
public override void OnApplyTemplate() |
354 |
{ |
355 |
base.OnApplyTemplate(); |
356 |
Base_LinePath = GetTemplateChild("PART_LinePath") as Path; |
357 |
SetLinePath(); |
358 |
} |
359 |
|
360 |
public void updateControl() |
361 |
{ |
362 |
this.StartPoint = new Point(this.PointSet[0].X, this.PointSet[0].Y); |
363 |
this.EndPoint = new Point(this.PointSet[1].X, this.PointSet[1].Y); |
364 |
} |
365 |
|
366 |
public static List<LineGeometry> DimAllow(Point p1, Point p2, Double lineSize, double DimSize) |
367 |
{ |
368 |
//lineSize = 2; |
369 |
List<LineGeometry> GeometrySet = new List<LineGeometry>(); |
370 |
double theta = Math.Atan2((p2.Y - p1.Y), (p2.X - p1.X)) * 180 / Math.PI; |
371 |
|
372 |
|
373 |
LineGeometry ld = new LineGeometry(); |
374 |
//ld.StartPoint = new Point(p2.X + lineSize, p2.Y - lineSize * 4 - DimSize); |
375 |
//ld.EndPoint = new Point(p2.X + lineSize, p2.Y + lineSize * 4 + DimSize); |
376 |
ld.StartPoint = new Point(p2.X + lineSize, p2.Y - lineSize * 4); |
377 |
ld.EndPoint = new Point(p2.X + lineSize, p2.Y + lineSize * 4 + DimSize); |
378 |
|
379 |
RotateTransform transform3 = new RotateTransform(); |
380 |
transform3.Angle = theta; |
381 |
transform3.CenterX = p2.X; |
382 |
transform3.CenterY = p2.Y; |
383 |
ld.Transform = transform3; |
384 |
GeometrySet.Add(ld); |
385 |
|
386 |
LineGeometry ld1 = new LineGeometry(); |
387 |
//ld1.StartPoint = new Point(p1.X - lineSize, p1.Y - lineSize * 4 - DimSize); |
388 |
//ld1.EndPoint = new Point(p1.X - lineSize, p1.Y + lineSize * 4 + DimSize); |
389 |
ld1.StartPoint = new Point(p1.X - lineSize, p1.Y - lineSize * 4); |
390 |
ld1.EndPoint = new Point(p1.X - lineSize, p1.Y + lineSize * 4 + DimSize); |
391 |
|
392 |
RotateTransform transform4 = new RotateTransform(); |
393 |
transform4.Angle = theta; |
394 |
transform4.CenterX = p1.X; |
395 |
transform4.CenterY = p1.Y; |
396 |
ld1.Transform = transform4; |
397 |
GeometrySet.Add(ld1); |
398 |
return GeometrySet; |
399 |
} |
400 |
|
401 |
|
402 |
public void ApplyOverViewData() |
403 |
{ |
404 |
this.OverViewPathData = this.PathData; |
405 |
} |
406 |
|
407 |
private void SetLinePath() |
408 |
{ |
409 |
this.ApplyTemplate(); |
410 |
if (this.DashSize != null) |
411 |
{ |
412 |
Base_LinePath.StrokeDashArray.Clear(); |
413 |
foreach (var item in this.DashSize) |
414 |
{ |
415 |
Base_LinePath.StrokeDashArray.Add(item); |
416 |
} |
417 |
Base_LinePath.StrokeDashCap = PenLineCap.Square; |
418 |
} |
419 |
|
420 |
PathFigure pathFigure = new PathFigure(); |
421 |
pathFigure.StartPoint = this.StartPoint; |
422 |
LineSegment lineSegment0 = new LineSegment(); |
423 |
lineSegment0.Point = this.EndPoint; |
424 |
pathFigure.Segments.Add(lineSegment0); |
425 |
PathGeometry pathGeometry = new PathGeometry(); |
426 |
pathGeometry.Figures = new PathFigureCollection(); |
427 |
pathGeometry.Figures.Add(pathFigure); |
428 |
|
429 |
|
430 |
|
431 |
instanceGroup.Children.Clear(); |
432 |
switch (LineStyleSet) |
433 |
{ |
434 |
case LineStyleSet.ArrowLine: |
435 |
instanceGroup.Children.Add(DrawSet.DrawArrow(this.StartPoint, this.EndPoint, this.LineSize)); |
436 |
break; |
437 |
case LineStyleSet.TwinLine: |
438 |
instanceGroup.Children.Add(DrawSet.DrawArrow(this.StartPoint, this.EndPoint, this.LineSize)); |
439 |
instanceGroup.Children.Add(DrawSet.DrawArrow(this.EndPoint, this.StartPoint, this.LineSize)); |
440 |
break; |
441 |
case LineStyleSet.DimLine: |
442 |
List<LineGeometry> metrySet = DimAllow(this.StartPoint, this.EndPoint, this.LineSize, this.DimSize); |
443 |
instanceGroup.Children.Add(metrySet[0]); |
444 |
instanceGroup.Children.Add(metrySet[1]); |
445 |
instanceGroup.Children.Add(DrawSet.DrawArrow(this.StartPoint, this.EndPoint, this.LineSize)); |
446 |
instanceGroup.Children.Add(DrawSet.DrawArrow(this.EndPoint, this.StartPoint, this.LineSize)); |
447 |
break; |
448 |
case LineStyleSet.CancelLine: |
449 |
PathFigure pathFigure_Multi = new PathFigure(); |
450 |
LineSegment lineSegment1 = new LineSegment(); |
451 |
|
452 |
var x = Math.Abs((Math.Abs(this.StartPoint.X) - Math.Abs(this.EndPoint.X))); |
453 |
var y = Math.Abs((Math.Abs(this.StartPoint.Y) - Math.Abs(this.EndPoint.Y))); |
454 |
|
455 |
if (x > y) |
456 |
{ |
457 |
pathFigure_Multi.StartPoint = new Point(this.StartPoint.X, this.StartPoint.Y + (this.Interval)); |
458 |
lineSegment1.Point = new Point(this.EndPoint.X, this.EndPoint.Y + (this.Interval)); |
459 |
} |
460 |
else |
461 |
{ |
462 |
pathFigure_Multi.StartPoint = new Point(this.StartPoint.X + (this.Interval), this.StartPoint.Y); |
463 |
lineSegment1.Point = new Point(this.EndPoint.X + (this.Interval), this.EndPoint.Y); |
464 |
} |
465 |
pathFigure_Multi.Segments.Add(lineSegment1); |
466 |
pathGeometry.Figures.Add(pathFigure_Multi); |
467 |
|
468 |
this.PathData = pathGeometry; |
469 |
this.OverViewPathData = PathData; |
470 |
|
471 |
break; |
472 |
default: |
473 |
break; |
474 |
} |
475 |
|
476 |
|
477 |
if (PathData != pathGeometry) |
478 |
{ |
479 |
connectorGeometry.StartPoint = new Point(this.StartPoint.X, this.StartPoint.Y); |
480 |
connectorGeometry.EndPoint = new Point(this.EndPoint.X, this.EndPoint.Y); |
481 |
|
482 |
instanceGroup.Children.Add(connectorGeometry); |
483 |
|
484 |
this.PathData = instanceGroup; |
485 |
this.OverViewPathData = PathData; |
486 |
} |
487 |
} |
488 |
|
489 |
/// <summary> |
490 |
/// return linecontrols' area |
491 |
/// </summary> |
492 |
/// <author>humkyung</author> |
493 |
/// <date>2019.06.13</date> |
494 |
public override Rect ItemRect |
495 |
{ |
496 |
get |
497 |
{ |
498 |
double dMinX = Math.Min(this.StartPoint.X, this.EndPoint.X); |
499 |
double dMinY = Math.Min(this.StartPoint.Y, this.EndPoint.Y); |
500 |
double dMaxX = Math.Max(this.StartPoint.X, this.EndPoint.X); |
501 |
double dMaxY = Math.Max(this.StartPoint.Y, this.EndPoint.Y); |
502 |
|
503 |
return new Rect(new Point(dMinX, dMinY), new Point(dMaxX, dMaxY)); |
504 |
} |
505 |
} |
506 |
|
507 |
/// <summary> |
508 |
/// Serialize this |
509 |
/// </summary> |
510 |
/// <param name="sUserId"></param> |
511 |
/// <returns></returns> |
512 |
public override string Serialize() |
513 |
{ |
514 |
using (S_LineControl STemp = new S_LineControl()) |
515 |
{ |
516 |
STemp.TransformPoint = "0|0"; |
517 |
STemp.PointSet = this.PointSet; |
518 |
STemp.SizeSet = String.Format("{0}", this.LineSize); |
519 |
STemp.LineStyleSet = this.LineStyleSet; |
520 |
//STemp.StrokeColor = "#FF00FF00"; |
521 |
STemp.StrokeColor = this.StrokeColor.Color.ToString(); |
522 |
STemp.StartPoint = this.StartPoint; |
523 |
STemp.EndPoint = this.EndPoint; |
524 |
STemp.UserID = this.UserID; |
525 |
STemp.Opac = this.Opacity; |
526 |
STemp.DashSize = this.DashSize; |
527 |
STemp.Interval = this.Interval; |
528 |
STemp.DimSize = this.DimSize; |
529 |
STemp.Name = this.GetType().Name.ToString(); |
530 |
|
531 |
///강인구 추가(2017.11.02) |
532 |
///Memo 추가 |
533 |
STemp.Memo = this.Memo; |
534 |
|
535 |
return "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
536 |
} |
537 |
} |
538 |
|
539 |
/// <summary> |
540 |
/// create a linecontrol from given string |
541 |
/// </summary> |
542 |
/// <param name="str"></param> |
543 |
/// <returns></returns> |
544 |
public static LineControl FromString(string str, SolidColorBrush brush, string sProjectNo) |
545 |
{ |
546 |
LineControl instance = null; |
547 |
using (S_LineControl s = JsonSerializerHelper.JsonDeserialize<S_LineControl>(str)) |
548 |
{ |
549 |
string[] data2 = s.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries); |
550 |
instance = new LineControl() |
551 |
{ |
552 |
LineStyleSet = s.LineStyleSet, |
553 |
StartPoint = s.StartPoint, |
554 |
DimSize = s.DimSize, |
555 |
EndPoint = s.EndPoint, |
556 |
DashSize = s.DashSize, |
557 |
Interval = s.Interval, |
558 |
PointSet = s.PointSet, |
559 |
Opacity = s.Opac, |
560 |
StrokeColor = brush, |
561 |
UserID = s.UserID, |
562 |
LineSize = Convert.ToDouble(data2.First()), |
563 |
}; |
564 |
} |
565 |
|
566 |
return instance; |
567 |
} |
568 |
} |
569 |
} |