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