1 | using System;
|
---|
2 |
|
---|
3 | namespace Netron.Diagramming.Core.Layout.Force {
|
---|
4 | /// <summary>
|
---|
5 | /// Interface for force functions in a force simulation.
|
---|
6 | /// </summary>
|
---|
7 | public interface IForce {
|
---|
8 | /// <summary>
|
---|
9 | /// Initialize this force function.
|
---|
10 | /// </summary>
|
---|
11 | /// <param name="fsim"> the encompassing ForceSimulator</param>
|
---|
12 | void Init(ForceSimulator fsim);
|
---|
13 |
|
---|
14 | /// <summary>
|
---|
15 | /// Returns the number of parameters (e.g., gravitational constant or
|
---|
16 | /// spring force coefficient) affecting this force function.
|
---|
17 | /// </summary>
|
---|
18 | int ParameterCount { get; }
|
---|
19 |
|
---|
20 | /// <summary>
|
---|
21 | /// Returns the specified, numbered parameter.
|
---|
22 | /// </summary>
|
---|
23 | /// <param name="i">i the index of the parameter to return</param>
|
---|
24 | /// <returns>the parameter value</returns>
|
---|
25 | float GetParameter(int i);
|
---|
26 |
|
---|
27 | /// <summary>
|
---|
28 | /// Get the suggested minimum value for a parameter. This value is not
|
---|
29 | /// strictly enforced, but is used by interface components that allow force
|
---|
30 | /// parameters to be varied.
|
---|
31 | /// </summary>
|
---|
32 | /// <param name="param">the parameter index</param>
|
---|
33 | /// <returns>the suggested minimum value.</returns>
|
---|
34 | float GetMinValue(int param);
|
---|
35 |
|
---|
36 | /// <summary>
|
---|
37 | /// Get the suggested maximum value for a parameter. This value is not
|
---|
38 | /// strictly enforced, but is used by interface components that allow force
|
---|
39 | /// parameters to be varied.
|
---|
40 | /// </summary>
|
---|
41 | /// <param name="param">the parameter index</param>
|
---|
42 | /// <returns>the suggested maximum value.</returns>
|
---|
43 | float GetMaxValue(int param);
|
---|
44 |
|
---|
45 | /// <summary>
|
---|
46 | /// Gets the text name of the requested parameter.
|
---|
47 | /// </summary>
|
---|
48 | /// <param name="i"> the index of the parameter</param>
|
---|
49 | /// <returns>a String containing the name of this parameter</returns>
|
---|
50 | String GetParameterName(int i);
|
---|
51 |
|
---|
52 | /// <summary>
|
---|
53 | /// Sets the specified parameter value.
|
---|
54 | /// </summary>
|
---|
55 | /// <param name="i"> the index of the parameter</param>
|
---|
56 | /// <param name="val">the new value of the parameter</param>
|
---|
57 | void SetParameter(int i, float val);
|
---|
58 |
|
---|
59 | /// <summary>
|
---|
60 | /// Set the suggested minimum value for a parameter. This value is not
|
---|
61 | /// strictly enforced, but is used by interface components that allow force
|
---|
62 | /// parameters to be varied.
|
---|
63 | /// </summary>
|
---|
64 | /// <param name="i">the parameter index</param>
|
---|
65 | /// <param name="val">the suggested minimum value to use</param>
|
---|
66 | void SetMinValue(int i, float val);
|
---|
67 |
|
---|
68 | /// <summary>
|
---|
69 | /// Set the suggested maximum value for a parameter. This value is not
|
---|
70 | /// strictly enforced, but is used by interface components that allow force
|
---|
71 | /// parameters to be varied.
|
---|
72 | /// </summary>
|
---|
73 | /// <param name="i">the parameter index</param>
|
---|
74 | /// <param name="val">the suggested maximum value to use</param>
|
---|
75 | void SetMaxValue(int i, float val);
|
---|
76 |
|
---|
77 | /// <summary>
|
---|
78 | /// Indicates if this force function will compute forces on Spring instances.
|
---|
79 | /// </summary>
|
---|
80 | /// <returns>
|
---|
81 | /// <c>true</c> if this force function processes Spring instances; otherwise, <c>false</c>.
|
---|
82 | /// </returns>
|
---|
83 | bool IsSpringForce { get; }
|
---|
84 |
|
---|
85 | /// <summary>
|
---|
86 | /// Indicates if this force function will compute forces on ForceItem instances
|
---|
87 | /// </summary>
|
---|
88 | /// <returns>
|
---|
89 | /// <c>true</c> if this force function processes IForce instances; otherwise, <c>false</c>.
|
---|
90 | /// </returns>
|
---|
91 | bool IsItemForce { get; }
|
---|
92 |
|
---|
93 | /// <summary>
|
---|
94 | /// Updates the force calculation on the given ForceItem
|
---|
95 | /// </summary>
|
---|
96 | /// <param name="item"> the ForceItem on which to compute updated forces</param>
|
---|
97 | void GetForce(ForceItem item);
|
---|
98 |
|
---|
99 | /// <summary>
|
---|
100 | /// Updates the force calculation on the given Spring. The ForceItems
|
---|
101 | /// attached to Spring will have their force values updated appropriately.
|
---|
102 | /// </summary>
|
---|
103 | /// <param name="spring">spring the Spring on which to compute updated forces</param>
|
---|
104 | void GetForce(Spring spring);
|
---|
105 |
|
---|
106 | }
|
---|
107 |
|
---|
108 | }
|
---|