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