markus / MarkupToPDF / Controls / Etc / SymControlN.cs @ d2114d3b
이력 | 보기 | 이력해설 | 다운로드 (19.9 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.ComponentModel; |
||
12 | using System.Collections.Generic; |
||
13 | using MarkupToPDF.Controls.Common; |
||
14 | using MarkupToPDF.Common; |
||
15 | 036650a0 | humkyung | using MarkupToPDF.Serialize.Core; |
16 | using MarkupToPDF.Serialize.S_Control; |
||
17 | 787a4489 | KangIngu | |
18 | namespace MarkupToPDF.Controls.Etc |
||
19 | { |
||
20 | [TemplatePart(Name = "PART_ViewBox", Type = typeof(Viewbox))] |
||
21 | |||
22 | |||
23 | public class SymControlN : CommentUserInfo, INotifyPropertyChanged , IViewBox, IMarkupCommonData |
||
24 | { |
||
25 | private const string PART_ViewBox = "PART_ViewBox"; |
||
26 | public Viewbox Base_ViewBox = null; |
||
27 | a6272c57 | humkyung | public string STAMP { get; set; } |
28 | 787a4489 | KangIngu | |
29 | static SymControlN() |
||
30 | { |
||
31 | DefaultStyleKeyProperty.OverrideMetadata(typeof(SymControlN), new FrameworkPropertyMetadata(typeof(SymControlN))); |
||
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 event PropertyChangedEventHandler PropertyChanged; |
||
40 | protected void RaisePropertyChanged(string propName) |
||
41 | { |
||
42 | if (PropertyChanged != null) |
||
43 | PropertyChanged(this, new PropertyChangedEventArgs(propName)); |
||
44 | } |
||
45 | #region 내장 프로퍼티 |
||
46 | public static readonly DependencyProperty UserIDProperty = DependencyProperty.Register( |
||
47 | "UserID", typeof(string), typeof(SymControlN), new PropertyMetadata(null)); |
||
48 | public static readonly DependencyProperty PathXathDataProperty = DependencyProperty.Register( |
||
49 | "PathXathData", typeof(string), typeof(SymControlN), new PropertyMetadata(null)); |
||
50 | public static readonly DependencyProperty LineSizeProperty = DependencyProperty.Register( |
||
51 | "LineSize", typeof(double), typeof(SymControlN), new PropertyMetadata((Double)1)); |
||
52 | public static readonly DependencyProperty EndPointProperty = DependencyProperty.Register( |
||
53 | "EndPoint", typeof(Point), typeof(SymControlN), new PropertyMetadata(new Point(0, 0), PointValueChanged)); |
||
54 | public static readonly DependencyProperty StartPointProperty = DependencyProperty.Register( |
||
55 | "StartPoint", typeof(Point), typeof(SymControlN), new PropertyMetadata(new Point(0, 0), PointValueChanged)); |
||
56 | public static readonly DependencyProperty TopRightPointProperty = DependencyProperty.Register( |
||
57 | "TopRightPoint", typeof(Point), typeof(SymControlN), new PropertyMetadata(new Point(0, 0), PointValueChanged)); |
||
58 | public static readonly DependencyProperty StrokeColorProperty = DependencyProperty.Register( |
||
59 | "StrokeColor", typeof(SolidColorBrush), typeof(SymControlN), new PropertyMetadata(new SolidColorBrush(Colors.Red))); |
||
60 | public static readonly DependencyProperty LeftBottomPointProperty = DependencyProperty.Register( |
||
61 | "LeftBottomPoint", typeof(Point), typeof(SymControlN), new PropertyMetadata(new Point(0, 0), PointValueChanged)); |
||
62 | public static readonly DependencyProperty PointSetProperty = DependencyProperty.Register( |
||
63 | "PointSet", typeof(List<Point>), typeof(SymControlN), new PropertyMetadata(new List<Point>())); |
||
64 | public static readonly DependencyProperty PathDataProperty = DependencyProperty.Register( |
||
65 | "PathData", typeof(Geometry), typeof(SymControlN), null); |
||
66 | public static readonly DependencyProperty AngleProperty = DependencyProperty.Register("Angle", typeof(double), typeof(SymControlN), |
||
67 | new PropertyMetadata((double)0.0, new PropertyChangedCallback(AngleValueChanged))); |
||
68 | public static readonly DependencyProperty CenterXProperty = DependencyProperty.Register("CenterX", typeof(double), typeof(SymControlN), |
||
69 | new PropertyMetadata((double)0, OnCenterXYChanged)); |
||
70 | public static readonly DependencyProperty CenterYProperty = DependencyProperty.Register("CenterY", typeof(double), typeof(SymControlN), |
||
71 | new PropertyMetadata((double)0, OnCenterXYChanged)); |
||
72 | |||
73 | public static readonly DependencyProperty IsSelectedProperty = |
||
74 | DependencyProperty.Register("IsSelected", typeof(bool), typeof(SymControlN), new FrameworkPropertyMetadata(false, IsSelectedChanged)); |
||
75 | |||
76 | public static readonly DependencyProperty ControlTypeProperty = |
||
77 | d7123191 | KangIngu | DependencyProperty.Register("ControlType", typeof(ControlType), typeof(SymControlN), new FrameworkPropertyMetadata(ControlType.Stamp)); |
78 | 787a4489 | KangIngu | #endregion |
79 | |||
80 | #region PropertyChanged Method |
||
81 | |||
82 | public static void IsSelectedChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) |
||
83 | { |
||
84 | |||
85 | } |
||
86 | |||
87 | public static void PointValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) |
||
88 | { |
||
89 | var instance = (SymControlN)sender; |
||
90 | if (e.OldValue != e.NewValue && instance.Base_ViewBox != null) |
||
91 | { |
||
92 | instance.SetValue(e.Property, e.NewValue); |
||
93 | instance.SetViewBox(); |
||
94 | } |
||
95 | } |
||
96 | public static void OnCenterXYChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) |
||
97 | { |
||
98 | var instance = (SymControlN)sender; |
||
99 | if (e.OldValue != e.NewValue && instance.Base_ViewBox != null) |
||
100 | { |
||
101 | instance.SetValue(e.Property, e.NewValue); |
||
102 | instance.SetViewBox(); |
||
103 | } |
||
104 | } |
||
105 | public static void AngleValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) |
||
106 | { |
||
107 | var instance = (SymControlN)sender; |
||
108 | if (e.OldValue != e.NewValue && instance.Base_ViewBox != null) |
||
109 | { |
||
110 | instance.SetValue(e.Property, e.NewValue); |
||
111 | instance.SetViewBox(); |
||
112 | } |
||
113 | } |
||
114 | #endregion |
||
115 | |||
116 | #region Properties |
||
117 | public string UserID |
||
118 | { |
||
119 | get { return (string)GetValue(UserIDProperty); } |
||
120 | set |
||
121 | { |
||
122 | if (this.UserID != value) |
||
123 | { |
||
124 | SetValue(UserIDProperty, value); |
||
125 | RaisePropertyChanged("UserID"); |
||
126 | } |
||
127 | } |
||
128 | } |
||
129 | public SolidColorBrush StrokeColor |
||
130 | { |
||
131 | get { return (SolidColorBrush)GetValue(StrokeColorProperty); } |
||
132 | set |
||
133 | { |
||
134 | if (this.StrokeColor != value) |
||
135 | { |
||
136 | SetValue(StrokeColorProperty, value); |
||
137 | } |
||
138 | } |
||
139 | } |
||
140 | |||
141 | public string PathXathData |
||
142 | { |
||
143 | get |
||
144 | { |
||
145 | return (string)GetValue(PathXathDataProperty); |
||
146 | } |
||
147 | set |
||
148 | { |
||
149 | SetValue(PathXathDataProperty, value); |
||
150 | RaisePropertyChanged("PathXathData"); |
||
151 | } |
||
152 | |||
153 | } |
||
154 | public List<Point> PointSet |
||
155 | { |
||
156 | get { return (List<Point>)GetValue(PointSetProperty); } |
||
157 | set { SetValue(PointSetProperty, value); } |
||
158 | } |
||
159 | public Point TopRightPoint |
||
160 | { |
||
161 | get { return (Point)GetValue(TopRightPointProperty); } |
||
162 | set |
||
163 | { |
||
164 | SetValue(TopRightPointProperty, value); |
||
165 | RaisePropertyChanged("TopRightPoint"); |
||
166 | } |
||
167 | } |
||
168 | public Point LeftBottomPoint |
||
169 | { |
||
170 | get { return (Point)GetValue(LeftBottomPointProperty); } |
||
171 | set |
||
172 | { |
||
173 | SetValue(LeftBottomPointProperty, value); |
||
174 | RaisePropertyChanged("LeftBottomPoint"); |
||
175 | } |
||
176 | } |
||
177 | public Point EndPoint |
||
178 | { |
||
179 | get { return (Point)GetValue(EndPointProperty); } |
||
180 | set |
||
181 | { |
||
182 | SetValue(EndPointProperty, value); |
||
183 | RaisePropertyChanged("EndPoint"); |
||
184 | } |
||
185 | } |
||
186 | public Point StartPoint |
||
187 | { |
||
188 | get { return (Point)GetValue(StartPointProperty); } |
||
189 | set |
||
190 | { |
||
191 | SetValue(StartPointProperty, value); |
||
192 | RaisePropertyChanged("StartPoint"); |
||
193 | } |
||
194 | } |
||
195 | #endregion |
||
196 | |||
197 | public override void OnApplyTemplate() |
||
198 | { |
||
199 | base.OnApplyTemplate(); |
||
200 | Base_ViewBox = GetTemplateChild(PART_ViewBox) as Viewbox; |
||
201 | SetViewBox(); |
||
202 | } |
||
203 | |||
204 | public void SetViewBox() |
||
205 | { |
||
206 | this.ApplyTemplate(); |
||
207 | Point mid = MathSet.FindCentroid(new List<Point>() |
||
208 | { |
||
209 | this.StartPoint, |
||
210 | this.LeftBottomPoint, |
||
211 | this.EndPoint, |
||
212 | this.TopRightPoint, |
||
213 | }); |
||
214 | double AngleData = 0; |
||
215 | |||
216 | PathFigure pathFigure = new PathFigure(); |
||
217 | pathFigure.StartPoint = MathSet.RotateAbout(mid, this.StartPoint, AngleData); |
||
218 | |||
219 | LineSegment lineSegment0 = new LineSegment(); |
||
220 | lineSegment0.Point = MathSet.RotateAbout(mid, this.StartPoint, AngleData); |
||
221 | pathFigure.Segments.Add(lineSegment0); |
||
222 | |||
223 | LineSegment lineSegment1 = new LineSegment(); |
||
224 | lineSegment1.Point = MathSet.RotateAbout(mid, this.LeftBottomPoint, AngleData); |
||
225 | pathFigure.Segments.Add(lineSegment1); |
||
226 | |||
227 | LineSegment lineSegment2 = new LineSegment(); |
||
228 | lineSegment2.Point = MathSet.RotateAbout(mid, this.EndPoint, AngleData); |
||
229 | pathFigure.Segments.Add(lineSegment2); |
||
230 | |||
231 | LineSegment lineSegment3 = new LineSegment(); |
||
232 | lineSegment3.Point = MathSet.RotateAbout(mid, this.TopRightPoint, AngleData); |
||
233 | pathFigure.Segments.Add(lineSegment3); |
||
234 | |||
235 | PathGeometry pathGeometry = new PathGeometry(); |
||
236 | pathGeometry.Figures = new PathFigureCollection(); |
||
237 | pathFigure.IsClosed = true; |
||
238 | pathGeometry.Figures.Add(pathFigure); |
||
239 | this.Base_ViewBox.Width = pathGeometry.Bounds.Width; |
||
240 | this.Base_ViewBox.Height = pathGeometry.Bounds.Height; ; |
||
241 | this.Tag = pathGeometry; |
||
242 | |||
243 | if(Base_ViewBox.Child == null) |
||
244 | { |
||
245 | SetChild(); |
||
246 | } |
||
247 | |||
248 | Canvas.SetLeft(this, MathSet.RotateAbout(mid, mid, AngleData).X - this.Base_ViewBox.Width / 2); |
||
249 | Canvas.SetTop(this, MathSet.RotateAbout(mid, mid, AngleData).Y - this.Base_ViewBox.Height / 2); |
||
250 | } |
||
251 | |||
252 | public void SetChild() |
||
253 | { |
||
254 | b200de5a | KangIngu | //string appovalData = "eJyycS/KTFHwS8xNtVVKBAMlhYrcnLxiW6WMkpICK3394uSM1NzEYr3czOSi/OL8tBK95Pxc/fLMvLQKfSMDAzP9isTcHP2CotTi1LySxJLM/DwlOxuQqXpOicnZ6UX5pXkpdjbB+TmZKc75OflFTkWlxRkKYKatkrIbFCgp+BckJmeWVNoqGegZKino29noYxgSlJpckpiXnpOqEFxSlFqSnGGr5JaZk6ME4uZnp0KNMwACmFBIRmZydl5qMdA7pjAxn8y8VK/8zDxbpSCQsUpQ38MNV1IIz0wpAZptZADU45GamZ5RYqtkYamk4JyYVwYMCZ/UNKCArpGeKVwoJL8AJqIP8T00DILyy11S0zLzMkEBUwz0AjIfbrgWWBt2OWM9U3zSBviljfBJaiGFM7pDQ1IrSpxy8pOzFUAsWyXHgIAg/zBXFyUFt/y8knCoCa4VJUWJTvk5KRDh4MwqYEgaG4B4RamQaEOJFY/8oswqoMLEHMeczPS8XGCSsVVyBpKpRUoKYalFJZnJWKVgTrRVgqQNdNc5VSqkJKbmZOYS4TwjWjrPGBGkMAoAAAD//w=="; |
255 | 787a4489 | KangIngu | |
256 | b200de5a | KangIngu | //var xamlData = MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressString_NonPrefix(appovalData); |
257 | //xamlData = xamlData.Replace("daelim", "DAELIM"); |
||
258 | ////object obj = System.Windows.Markup.XamlReader.Load(xamlData); |
||
259 | 787a4489 | KangIngu | |
260 | b200de5a | KangIngu | //System.IO.MemoryStream stream = new System.IO.MemoryStream(); |
261 | //System.IO.StreamWriter writer = new System.IO.StreamWriter(stream); |
||
262 | //writer.Write(xamlData); |
||
263 | //writer.Flush(); |
||
264 | //stream.Position = 0; |
||
265 | 787a4489 | KangIngu | |
266 | b200de5a | KangIngu | //object obj = System.Windows.Markup.XamlReader.Load(stream); |
267 | //UIElement ob = obj as UIElement; |
||
268 | 787a4489 | KangIngu | |
269 | b200de5a | KangIngu | //PathXathData = appovalData; |
270 | //Base_ViewBox.Child = ob; |
||
271 | 787a4489 | KangIngu | } |
272 | |||
273 | 959b3ef2 | humkyung | public override bool IsSelected |
274 | 787a4489 | KangIngu | { |
275 | get |
||
276 | { |
||
277 | return (bool)GetValue(IsSelectedProperty); |
||
278 | } |
||
279 | set |
||
280 | { |
||
281 | SetValue(IsSelectedProperty, value); |
||
282 | } |
||
283 | } |
||
284 | |||
285 | 5529d2a2 | humkyung | public override ControlType ControlType |
286 | 787a4489 | KangIngu | { |
287 | set |
||
288 | { |
||
289 | SetValue(ControlTypeProperty, value); |
||
290 | } |
||
291 | get |
||
292 | { |
||
293 | return (ControlType)GetValue(ControlTypeProperty); |
||
294 | } |
||
295 | } |
||
296 | |||
297 | public double Angle |
||
298 | { |
||
299 | get { return (double)GetValue(AngleProperty); } |
||
300 | set |
||
301 | { |
||
302 | if (this.Angle != value) |
||
303 | { |
||
304 | SetValue(AngleProperty, value); |
||
305 | } |
||
306 | } |
||
307 | } |
||
308 | |||
309 | |||
310 | public Double LineSize |
||
311 | { |
||
312 | get { return (Double)GetValue(LineSizeProperty); } |
||
313 | set |
||
314 | { |
||
315 | if (this.LineSize != value) |
||
316 | { |
||
317 | SetValue(LineSizeProperty, value); |
||
318 | } |
||
319 | } |
||
320 | } |
||
321 | public Geometry PathData |
||
322 | { |
||
323 | get { return (Geometry)GetValue(PathDataProperty); } |
||
324 | set |
||
325 | { |
||
326 | SetValue(PathDataProperty, value); |
||
327 | RaisePropertyChanged("PathData"); |
||
328 | } |
||
329 | } |
||
330 | |||
331 | public void updateControl() |
||
332 | { |
||
333 | this.StartPoint = new Point(this.PointSet[0].X, this.PointSet[0].Y); |
||
334 | this.LeftBottomPoint = new Point(this.PointSet[1].X, this.PointSet[1].Y); |
||
335 | this.EndPoint = new Point(this.PointSet[2].X, this.PointSet[2].Y); |
||
336 | this.TopRightPoint = new Point(this.PointSet[3].X, this.PointSet[3].Y); |
||
337 | this.SetViewBox(); |
||
338 | } |
||
339 | 036650a0 | humkyung | |
340 | /// <summary> |
||
341 | a6272c57 | humkyung | /// call when mouse is moving while drawing control |
342 | /// </summary> |
||
343 | /// <author>humkyung</author> |
||
344 | /// <param name="pt"></param> |
||
345 | /// <param name="bAxisLocked"></param> |
||
346 | public override void OnCreatingMouseMove(Point pt, bool bAxisLocked, bool bShiftKeyPressed) |
||
347 | { |
||
348 | if (this.StartPoint == this.EndPoint) |
||
349 | { |
||
350 | var xamlData = MarkupToPDF.Serialize.Core.JsonSerializerHelper.UnCompressString_NonPrefix(this.STAMP); |
||
351 | xamlData = xamlData.Replace("daelim", "DAELIM"); |
||
352 | |||
353 | System.IO.MemoryStream stream = new System.IO.MemoryStream(); |
||
354 | System.IO.StreamWriter writer = new System.IO.StreamWriter(stream); |
||
355 | writer.Write(xamlData); |
||
356 | writer.Flush(); |
||
357 | stream.Position = 0; |
||
358 | |||
359 | this.StrokeColor = new SolidColorBrush(Colors.Red); |
||
360 | object obj = System.Windows.Markup.XamlReader.Load(stream); |
||
361 | UIElement ob = obj as UIElement; |
||
362 | |||
363 | this.SetViewBox(); |
||
364 | this.PathXathData = this.STAMP; |
||
365 | this.Base_ViewBox.Child = ob; |
||
366 | } |
||
367 | |||
368 | this.EndPoint = pt; |
||
369 | this.LeftBottomPoint = new Point(this.StartPoint.X, this.EndPoint.Y); |
||
370 | this.TopRightPoint = new Point(this.EndPoint.X, this.StartPoint.Y); |
||
371 | |||
372 | this.PointSet = new List<Point> |
||
373 | { |
||
374 | this.StartPoint, |
||
375 | this.LeftBottomPoint, |
||
376 | this.EndPoint, |
||
377 | this.TopRightPoint, |
||
378 | }; |
||
379 | } |
||
380 | |||
381 | /// <summary> |
||
382 | d2114d3b | humkyung | /// move control point has same location of given pt along given delta |
383 | /// </summary> |
||
384 | /// <author>humkyung</author> |
||
385 | /// <date>2019.06.20</date> |
||
386 | /// <param name="pt"></param> |
||
387 | /// <param name="dx"></param> |
||
388 | /// <param name="dy"></param> |
||
389 | public override void OnMoveCtrlPoint(Point pt, double dx, double dy) |
||
390 | { |
||
391 | IPath path = (this as IPath); |
||
392 | |||
393 | Point selected = MathSet.getNearPoint(path.PointSet, pt); |
||
394 | selected.X += dx; |
||
395 | selected.Y += dy; |
||
396 | int i = 0; |
||
397 | for (i = 0; i < (this as IPath).PointSet.Count; i++) |
||
398 | { |
||
399 | if (pt.Equals((this as IPath).PointSet[i])) |
||
400 | { |
||
401 | path.PointSet[i] = selected; |
||
402 | break; |
||
403 | } |
||
404 | } |
||
405 | |||
406 | var ReverseP = (i + path.PointSet.Count / 2) % path.PointSet.Count; |
||
407 | var PreviousP = (i + (path.PointSet.Count - 1)) % path.PointSet.Count; |
||
408 | var NextP = (i + 1) % path.PointSet.Count; |
||
409 | |||
410 | var distance = MathSet.DistanceTo(path.PointSet[ReverseP], path.PointSet[i]); |
||
411 | |||
412 | var PreviousV = MathSet.GetNormVectorBetween(path.PointSet[ReverseP], path.PointSet[PreviousP]); |
||
413 | var l = MathSet.DotProduct(PreviousV.X, PreviousV.Y, path.PointSet[i].X - path.PointSet[ReverseP].X, |
||
414 | path.PointSet[i].Y - path.PointSet[ReverseP].Y); |
||
415 | path.PointSet[PreviousP] = new Point(path.PointSet[ReverseP].X + PreviousV.X * l, path.PointSet[ReverseP].Y + PreviousV.Y * l); |
||
416 | |||
417 | var NextV = MathSet.GetNormVectorBetween(path.PointSet[ReverseP], path.PointSet[NextP]); |
||
418 | l = MathSet.DotProduct(NextV.X, NextV.Y, path.PointSet[i].X - path.PointSet[ReverseP].X, path.PointSet |
||
419 | [i].Y - path.PointSet[ReverseP].Y); |
||
420 | path.PointSet[NextP] = new Point(path.PointSet[ReverseP].X + NextV.X * l, path.PointSet[ReverseP].Y + NextV.Y * l); |
||
421 | |||
422 | this.updateControl(); |
||
423 | } |
||
424 | |||
425 | /// <summary> |
||
426 | 91efe37a | humkyung | /// return SymControlN's area |
427 | /// </summary> |
||
428 | /// <author>humkyung</author> |
||
429 | /// <date>2019.06.13</date> |
||
430 | public override Rect ItemRect |
||
431 | { |
||
432 | get |
||
433 | { |
||
434 | double dMinX = Math.Min(this.StartPoint.X, this.EndPoint.X); |
||
435 | double dMinY = Math.Min(this.StartPoint.Y, this.EndPoint.Y); |
||
436 | double dMaxX = Math.Max(this.StartPoint.X, this.EndPoint.X); |
||
437 | double dMaxY = Math.Max(this.StartPoint.Y, this.EndPoint.Y); |
||
438 | |||
439 | return new Rect(new Point(dMinX, dMinY), new Point(dMaxX, dMaxY)); |
||
440 | } |
||
441 | } |
||
442 | |||
443 | /// <summary> |
||
444 | 036650a0 | humkyung | /// Serialize this |
445 | /// </summary> |
||
446 | /// <param name="sUserId"></param> |
||
447 | /// <returns></returns> |
||
448 | public override string Serialize() |
||
449 | { |
||
450 | using (S_SymControlN STemp = new S_SymControlN()) |
||
451 | { |
||
452 | STemp.TransformPoint = "0|0"; |
||
453 | STemp.PointSet = this.PointSet; |
||
454 | //STemp.XamlData = this.PathXathData; |
||
455 | STemp.UserID = this.UserID; |
||
456 | STemp.DBData = this.PathXathData; |
||
457 | //STemp.StrokeColor = this.StrokeColor.Color.ToString(); |
||
458 | STemp.StartPoint = this.StartPoint; |
||
459 | STemp.Angle = this.Angle; |
||
460 | STemp.EndPoint = this.EndPoint; |
||
461 | STemp.LB = this.LeftBottomPoint; |
||
462 | STemp.TR = this.TopRightPoint; |
||
463 | STemp.Opac = this.Opacity; |
||
464 | STemp.Name = this.GetType().Name.ToString(); |
||
465 | |||
466 | return "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
||
467 | } |
||
468 | } |
||
469 | 661b7416 | humkyung | |
470 | /// <summary> |
||
471 | /// create a symcontroln from given string |
||
472 | /// </summary> |
||
473 | /// <param name="str"></param> |
||
474 | /// <returns></returns> |
||
475 | public static SymControlN FromString(string str, SolidColorBrush brush, string sProjectNo) |
||
476 | { |
||
477 | using (S_SymControlN s = JsonSerializerHelper.JsonDeserialize<S_SymControlN>(str)) |
||
478 | { |
||
479 | return new SymControlN() |
||
480 | { |
||
481 | PointSet = s.PointSet, |
||
482 | StartPoint = s.StartPoint, |
||
483 | EndPoint = s.EndPoint, |
||
484 | Angle = s.Angle, |
||
485 | LeftBottomPoint = s.LB, |
||
486 | TopRightPoint = s.TR, |
||
487 | Opacity = s.Opac, |
||
488 | PathXathData = s.DBData, |
||
489 | Memo = s.Memo |
||
490 | }; |
||
491 | } |
||
492 | } |
||
493 | 787a4489 | KangIngu | } |
494 | } |
||
495 |