Skip to content

Commit fbe1f5b

Browse files
committed
before
1 parent a48f4d8 commit fbe1f5b

20 files changed

+566
-352
lines changed

SimpleStateMachineNodeEditor/Helpers/Extensions/EnumExtension.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,7 @@ public static string Name(this Enum enumType)
1010
{
1111
return Enum.GetName(enumType.GetType(), enumType);
1212
}
13+
14+
1315
}
1416
}

SimpleStateMachineNodeEditor/Helpers/Extensions/PointExtensition.cs

Lines changed: 210 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,65 @@ namespace SimpleStateMachineNodeEditor.Helpers.Extensions
88
{
99
public static class PointExtensition
1010
{
11-
public static MyPoint ToMyPoint(this Point point)
11+
//public static MyPoint ToMyPoint(this Point point)
12+
//{
13+
// return MyPoint.CreateFromPoint(point);
14+
//}
15+
public static Point CreatePoint(Point point)
1216
{
13-
return MyPoint.CreateFromPoint(point);
17+
return new Point(point.X, point.Y);
18+
}
19+
public static Point CreatePoint(int value)
20+
{
21+
return new Point(value, value);
22+
}
23+
public static Point CreatePoint(double value)
24+
{
25+
return new Point(value, value);
26+
}
27+
public static Point CreatePoint(int x, int y)
28+
{
29+
return new Point(x, y);
30+
}
31+
public static Point CreatePoint(double x, double y)
32+
{
33+
return new Point(x, y);
34+
}
35+
public static Point CreatePoint(Size size)
36+
{
37+
return new Point(size.Width, size.Height);
1438
}
1539

16-
public static bool IsClear(this Point point)
40+
public static Point CreateNew(this Point point, Point point2)
1741
{
18-
return (point.X == 0) && (point.Y == 0);
42+
return new Point(point2.X, point2.Y);
43+
}
44+
public static Point CreateNew(this Point point, int value)
45+
{
46+
return new Point(value, value);
47+
}
48+
public static Point CreateNew(this Point point, double value)
49+
{
50+
return new Point(value, value);
51+
}
52+
public static Point CreateNew(this Point point, int x, int y)
53+
{
54+
return new Point(x, y);
55+
}
56+
public static Point CreateNew(this Point point, double x, double y)
57+
{
58+
return new Point(x, y);
1959
}
20-
public static Point Clear(this Point point)
60+
public static Point CreateNew(this Point point, Size size)
2161
{
22-
return new Point(0,0);
62+
return new Point(size.Width, size.Height);
2363
}
64+
65+
public static bool IsClear(this Point point)
66+
{
67+
return (point.X == 0) && (point.Y == 0);
68+
}
69+
2470
public static Point Mirror(this Point point, bool onX = true, bool onY = true)
2571
{
2672
return new Point(onX ? -point.X : point.X, onY ? -point.Y : point.Y);
@@ -31,35 +77,86 @@ public static Point Copy(this Point point)
3177
return new Point(point.X, point.Y);
3278
}
3379

34-
80+
/// <summary>
81+
/// Operation +
82+
/// </summary>
83+
/// <param name="point1"></param>
84+
/// <param name="point2"></param>
85+
/// <returns></returns>
3586
public static Point Addition(this Point point1, Point point2)
3687
{
3788
return new Point(point1.X + point2.X, point1.Y + point2.Y);
3889
}
90+
/// <summary>
91+
/// Operation +
92+
/// </summary>
93+
/// <param name="point1"></param>
94+
/// <param name="number"></param>
95+
/// <returns></returns>
3996
public static Point Addition(this Point point1, int number)
4097
{
4198
return new Point(point1.X + number, point1.Y + number);
4299
}
100+
/// <summary>
101+
/// Operation +
102+
/// </summary>
103+
/// <param name="point1"></param>
104+
/// <param name="x"></param>
105+
/// <param name="y"></param>
106+
/// <returns></returns>
43107
public static Point Addition(this Point point1, int x, int y)
44108
{
45109
return new Point(point1.X + x, point1.Y + y);
46110
}
111+
/// <summary>
112+
/// Operation +
113+
/// </summary>
114+
/// <param name="point1"></param>
115+
/// <param name="number"></param>
116+
/// <returns></returns>
47117
public static Point Addition(this Point point1, double number)
48118
{
49119
return new Point(point1.X + number, point1.Y + number);
50120
}
121+
/// <summary>
122+
/// Operation +
123+
/// </summary>
124+
/// <param name="point1"></param>
125+
/// <param name="x"></param>
126+
/// <param name="y"></param>
127+
/// <returns></returns>
51128
public static Point Addition(this Point point1, double x, double y)
52129
{
53130
return new Point(point1.X + x, point1.Y + y);
54131
}
132+
/// <summary>
133+
/// Operation +
134+
/// </summary>
135+
/// <param name="point1"></param>
136+
/// <param name="x"></param>
137+
/// <param name="y"></param>
138+
/// <returns></returns>
139+
public static Point Addition(this Point point1, Size size)
140+
{
141+
return new Point(point1.X + size.Width, point1.Y + size.Height);
142+
}
55143

56-
57-
144+
/// <summary>
145+
/// Operation -
146+
/// </summary>
147+
/// <param name="point1"></param>
148+
/// <param name="point2"></param>
149+
/// <returns></returns>
58150
public static Point Subtraction(this Point point1, Point point2)
59151
{
60152
return new Point(point1.X - point2.X, point1.Y - point2.Y);
61153
}
62-
154+
/// <summary>
155+
/// Operation -
156+
/// </summary>
157+
/// <param name="point1"></param>
158+
/// <param name="number"></param>
159+
/// <returns></returns>
63160
public static Point Subtraction(this Point point1, int number)
64161
{
65162
return new Point(point1.X - number, point1.Y - number);
@@ -68,21 +165,55 @@ public static Point Subtraction(this Point point1, int x, int y)
68165
{
69166
return new Point(point1.X - x, point1.Y - y);
70167
}
71-
168+
/// <summary>
169+
/// Operation -
170+
/// </summary>
171+
/// <param name="point1"></param>
172+
/// <param name="number"></param>
173+
/// <returns></returns>
72174
public static Point Subtraction(this Point point1, double number)
73175
{
74176
return new Point(point1.X - number, point1.Y - number);
75177
}
178+
/// <summary>
179+
/// Operation -
180+
/// </summary>
181+
/// <param name="point1"></param>
182+
/// <param name="x"></param>
183+
/// <param name="y"></param>
184+
/// <returns></returns>
76185
public static Point Subtraction(this Point point1, double x, double y)
77186
{
78187
return new Point(point1.X - x, point1.Y - y);
79188
}
189+
/// <summary>
190+
/// Operation -
191+
/// </summary>
192+
/// <param name="point1"></param>
193+
/// <param name="x"></param>
194+
/// <param name="y"></param>
195+
/// <returns></returns>
196+
public static Point Subtraction(this Point point1, Size size)
197+
{
198+
return new Point(point1.X - size.Width, point1.Y - size.Height);
199+
}
80200

81-
201+
/// <summary>
202+
/// Operation /
203+
/// </summary>
204+
/// <param name="point1"></param>
205+
/// <param name="point2"></param>
206+
/// <returns></returns>
82207
public static Point Division(this Point point1, Point point2)
83208
{
84209
return new Point(point1.X / point1.X, point1.Y / point1.Y);
85210
}
211+
/// <summary>
212+
/// Operation /
213+
/// </summary>
214+
/// <param name="point1"></param>
215+
/// <param name="number"></param>
216+
/// <returns></returns>
86217
public static Point Division(this Point point1, int number)
87218
{
88219
return new Point(point1.X / number, point1.Y / number);
@@ -91,35 +222,101 @@ public static Point Division(this Point point1, int x, int y)
91222
{
92223
return new Point(point1.X / x, point1.Y / y);
93224
}
225+
/// <summary>
226+
/// Operation /
227+
/// </summary>
228+
/// <param name="point1"></param>
229+
/// <param name="number"></param>
230+
/// <returns></returns>
94231
public static Point Division(this Point point1, double number)
95232
{
96233
return new Point(point1.X / number, point1.Y / number);
97234
}
235+
/// <summary>
236+
/// Operation /
237+
/// </summary>
238+
/// <param name="point1"></param>
239+
/// <param name="x"></param>
240+
/// <param name="y"></param>
241+
/// <returns></returns>
98242
public static Point Division(this Point point1, double x, double y)
99243
{
100244
return new Point(point1.X / x, point1.Y / y);
101245
}
246+
/// <summary>
247+
/// Operation /
248+
/// </summary>
249+
/// <param name="point1"></param>
250+
/// <param name="x"></param>
251+
/// <param name="y"></param>
252+
/// <returns></returns>
253+
public static Point Division(this Point point1, Size size)
254+
{
255+
return new Point(point1.X / size.Width, point1.Y / size.Height);
256+
}
102257

103-
258+
/// <summary>
259+
/// Operation *
260+
/// </summary>
261+
/// <param name="point1"></param>
262+
/// <param name="point2"></param>
263+
/// <returns></returns>
104264
public static Point Multiply(this Point point1, Point point2)
105265
{
106266
return new Point(point1.X * point2.X, point1.Y * point2.Y);
107267
}
268+
/// <summary>
269+
/// Operation *
270+
/// </summary>
271+
/// <param name="point1"></param>
272+
/// <param name="number"></param>
273+
/// <returns></returns>
108274
public static Point Multiply(this Point point1, int number)
109275
{
110276
return new Point(point1.X * number, point1.Y * number);
111277
}
278+
/// <summary>
279+
/// Operation *
280+
/// </summary>
281+
/// <param name="point1"></param>
282+
/// <param name="x"></param>
283+
/// <param name="y"></param>
284+
/// <returns></returns>
112285
public static Point Multiply(this Point point1, int x, int y)
113286
{
114287
return new Point(point1.X * x, point1.Y * y);
115288
}
289+
/// <summary>
290+
/// Operation *
291+
/// </summary>
292+
/// <param name="point1"></param>
293+
/// <param name="number"></param>
294+
/// <returns></returns>
116295
public static Point Multiply(this Point point1, double number)
117296
{
118297
return new Point(point1.X * number, point1.Y * number);
119298
}
299+
/// <summary>
300+
/// Operation *
301+
/// </summary>
302+
/// <param name="point1"></param>
303+
/// <param name="x"></param>
304+
/// <param name="y"></param>
305+
/// <returns></returns>
120306
public static Point Multiply(this Point point1, double x, double y)
121307
{
122308
return new Point(point1.X * x, point1.Y * y);
123309
}
310+
/// <summary>
311+
/// Operation *
312+
/// </summary>
313+
/// <param name="point1"></param>
314+
/// <param name="x"></param>
315+
/// <param name="y"></param>
316+
/// <returns></returns>
317+
public static Point Multiply(this Point point1, Size size)
318+
{
319+
return new Point(point1.X * size.Width, point1.Y * size.Height);
320+
}
124321
}
125322
}

0 commit comments

Comments
 (0)