GitHubDashboard/FDG/Diagram.cs
/// <summary>
/// Runs the force-directed layout algorithm on this Diagram, using the specified parameters.
/// </summary>
/// <param name="damping">Value between 0 and 1 that slows the motion of the nodes during layout.</param>
/// <param name="springLength">Value in pixels representing the length of the imaginary springs that run along the connectors.</param>
/// <param name="maxIterations">Maximum number of iterations before the algorithm terminates.</param>
/// <param name="deterministic">Whether to use a random or deterministic layout.</param>
Runs the force-directed layout algorithm on this Diagram, using the specified parameters.
Runs the force - directed layout algorithm on this Diagram using the specified parameters .
public void Arrange(double damping, int springLength, int maxIterations, bool deterministic)
		{
			rnd = deterministic ? new Random(0) : new Random();
			for (int i = 0; i < nodes.Count; i++)
			{
				layout.Add(new NodeLayoutInfo(nodes[i], new Vector(), Point.Empty));
				layout[i].Node.Location = new Point(0, 0);
			}
		}
public void Arrange ( double damping , int springLength , int maxIterations , bool deterministic ) { rnd = deterministic ? new Random ( 0 ) : new Random ( ) ; for ( int i = 0 ; i < nodes . Count ; i ++ ) { layout . Add ( new NodeLayoutInfo ( nodes [ i ] , new Vector ( ) , Point . Empty ) ) ; layout [ i ] . Node . Location = new Point ( 0 , 0 ) ; } }
Runs the force-directed layout algorithm on this Diagram, using the specified parameters.
Runs the force - directed layout algorithm on this Diagram using the specified parameters .
// random starting positions can be made deterministic by seeding System.Random with a constant // copy nodes into an array of metadata and randomise initial coordinates for each node // Points must vary slightly in order to introduce a variation in the bearing angle for each point. // Otherwise, with the bearing angles all the same, the forces will end up all being the same.
damping
double
Value between 0 and 1 that slows the motion of the nodes during layout.
Value between 0 and 1 that slows the motion of the nodes during layout .
springLength
int
Value in pixels representing the length of the imaginary springs that run along the connectors.
Value in pixels representing the length of the imaginary springs that run along the connectors .
maxIterations
int
Maximum number of iterations before the algorithm terminates.
Maximum number of iterations before the algorithm terminates .
deterministic
bool
Whether to use a random or deterministic layout.
Whether to use a random or deterministic layout .