개정판 661b7416
issue #999: Add FromString to all of controls
Change-Id: I64093e34a5f9e8d367cbed769ff4db8d7472cb7a
MarkupToPDF/Controls/Etc/SymControl.cs | ||
---|---|---|
14 | 14 |
using MarkupToPDF.Common; |
15 | 15 |
using MarkupToPDF.Serialize.Core; |
16 | 16 |
using MarkupToPDF.Serialize.S_Control; |
17 |
using System.Linq; |
|
17 | 18 |
|
18 | 19 |
namespace MarkupToPDF.Controls.Etc |
19 | 20 |
{ |
... | ... | |
297 | 298 |
Base_SymPath = GetTemplateChild(PART_SymPath) as Path; |
298 | 299 |
SetSymPath(); |
299 | 300 |
} |
300 |
public void SetSymPath() |
|
301 |
|
|
302 |
private void SetSymPath() |
|
301 | 303 |
{ |
302 | 304 |
this.ApplyTemplate(); |
303 | 305 |
switch (this.Paint) |
... | ... | |
396 | 398 |
return "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
397 | 399 |
} |
398 | 400 |
} |
401 |
|
|
402 |
/// <summary> |
|
403 |
/// create a symcontrol from given string |
|
404 |
/// </summary> |
|
405 |
/// <param name="str"></param> |
|
406 |
/// <returns></returns> |
|
407 |
public static SymControl FromString(string str, SolidColorBrush brush, string sProjectNo) |
|
408 |
{ |
|
409 |
SymControl instance = null; |
|
410 |
using (S_SymControl s = JsonSerializerHelper.JsonDeserialize<S_SymControl>(str)) |
|
411 |
{ |
|
412 |
string[] data2 = s.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries); |
|
413 |
Common.StringToPathConverter sm = new Common.StringToPathConverter(); |
|
414 |
instance = new SymControl |
|
415 |
{ |
|
416 |
LineSize = Convert.ToDouble(data2.First()), |
|
417 |
PointSet = s.PointSet, |
|
418 |
Paint = s.PaintState, |
|
419 |
StartPoint = s.StartPoint, |
|
420 |
StrokeColor = brush, |
|
421 |
EndPoint = s.EndPoint, |
|
422 |
Angle = s.Angle, |
|
423 |
UserID = s.UserID, |
|
424 |
LeftBottomPoint = s.LB, |
|
425 |
TopRightPoint = s.TR, |
|
426 |
PathData = sm.Convert(s.PathInfo.ToString()), |
|
427 |
Opacity = s.Opac, |
|
428 |
Memo = s.Memo |
|
429 |
}; |
|
430 |
} |
|
431 |
|
|
432 |
return instance; |
|
433 |
} |
|
399 | 434 |
} |
400 | 435 |
} |
내보내기 Unified diff