Example #1
0
 /// <summary>
 /// Breaks the connection.
 /// </summary>
 /// <param name="node1">The node1.</param>
 /// <param name="node2">The node2.</param>
 public override void BreakConnection(VisualNode node1, VisualNode node2)
 {
     this.isVisible = false;
 }
Example #2
0
        /// <summary>
        /// Forms the connection.
        /// </summary>
        /// <param name="node1">The node1.</param>
        /// <param name="node2">The node2.</param>
        /// <param name="distance">The distance.</param>
        public override void FormConnection(VisualNode node1, VisualNode node2, float distance)
        {
            this.isVisible = true;

            // draw a line between 2 nodes. The thickness/alpha varies depending on distance
            this.strokeThickness = (int)Global.Map(distance, 0, Global.MinDist, StrokeWeightMax, StrokeWeightMin);
            this.color = Color.White * Global.Map(distance, 0, Global.MinDist, 1.0f, 0);
            this.start = node1.CurrentPosition;
            this.end = node2.CurrentPosition;
        }
Example #3
0
 /// <summary>
 /// Forms the connection.
 /// </summary>
 /// <param name="node1">The node1.</param>
 /// <param name="node2">The node2.</param>
 /// <param name="distance">The distance.</param>
 public abstract void FormConnection(VisualNode node1, VisualNode node2, float distance);
Example #4
0
        /// <summary>
        /// Compute the connectedness value and make a normalized version also create visual connections between nodes
        /// </summary>
        /// <param name="connectedness">The amount of connectedness between this and node2</param>
        /// <param name="node2">The node that is connected to this</param>
        public virtual void ApplyConnection(float connectedness, VisualNode node2)
        {
            // increase the connectedness
            this.Connectedness += connectedness;

            // this allows us to get a reliable value for MaxConnectedness. Used for Mapping the Connectedness value
            if (this.Connectedness > maxConnectedness)
            {
                maxConnectedness = this.Connectedness;
            }

            // create a normalised version of the Connectedness variable
            this.NormalisedConnectedness = Global.Map(this.Connectedness, 0, maxConnectedness, 0, 1);
        }
Example #5
0
 /// <summary>
 /// Breaks the connection.
 /// </summary>
 /// <param name="node1">The node1.</param>
 /// <param name="node2">The node2.</param>
 public abstract void BreakConnection(VisualNode node1, VisualNode node2);