public NetworkLayoutRecord( BayesianNetwork network, NetworkLayout layout, NetworkLayoutOptions options) { Debug.Assert(options != null, "Layout options cannot be null."); this.Network = network; this.NetworkLayout = layout; this.Options = options; // Manually specify sizes. Dictionary <string, float> sizes = new Dictionary <string, float>(); foreach (var v in network.Variables) { sizes[v.Key] = Workbench.NetworkLayoutVertexSizeNormal; } // Instantiate algorithm. AlgorithmState = new LayoutAlgorithm(network.Clone(), sizes, options); // Copy existing positions over. if (layout != null && layout.Positions != null && layout.Positions.Count > 0) { foreach (var kvp in layout.Positions) { AlgorithmState.Positions[kvp.Key] = kvp.Value; } } }
public LayoutAlgorithm( BayesianNetwork network, IDictionary <string, float> sizes, NetworkLayoutOptions options) { this.BayesianNetwork = network; this.Positions = new Dictionary <string, Point>(); this._sizes = new Dictionary <string, Size>(); this._options = options; foreach (var kvp in sizes) { this._sizes[kvp.Key] = new Size(kvp.Value, kvp.Value); } }
private void xButtonApply_Click(object sender, RoutedEventArgs e) { var algorithm = NetworkLayoutOptions.AlgorithmEnum.SugiyamaEfficient; float nodeSeparationTarget = float.Parse(this.xNodeSeparationTargetTextBox.Text); int epochs = (int)Math.Round(float.Parse(this.xEpochsTextBox.Text)); float nodeSize = float.Parse(this.xNodeSizeTextBox.Text); float edgeThickness = float.Parse(this.xEdgeThickness.Text); var layoutOptions = new NetworkLayoutOptions( algorithm, nodeSeparationTarget, epochs, nodeSize, edgeThickness); App.Current.MainWindow.RequestLayoutOptions(layoutOptions); }
public NetworkLayoutRecord( BayesianNetwork network, NetworkLayout existingLayout, IList <string> interestVertices, NetworkLayoutOptions options) { Debug.Assert(options != null, "Layout options cannot be null."); this.Network = network; this.NetworkLayout = existingLayout; this.InterestVertices = interestVertices.ToList(); this.Options = options; // Manually specify sizes. Dictionary <string, float> sizes = new Dictionary <string, float>(); foreach (var v in network.Variables) { if (!interestVertices.Contains(v.Key)) { sizes[v.Key] = Workbench.NetworkLayoutVertexSizeMinimized; } else { sizes[v.Key] = Workbench.NetworkLayoutVertexSizeNormal; } } this.AlgorithmState = new LayoutAlgorithm(network.Clone(), sizes, options); // Copy existing positions over. if (existingLayout != null && existingLayout.Positions != null && existingLayout.Positions.Count > 0) { foreach (var kvp in existingLayout.Positions) { AlgorithmState.Positions[kvp.Key] = kvp.Value; } } }
internal void RequestLayoutOptions(NetworkLayoutOptions options) { Debug.Assert(options != null); this.Model.NetworkLayoutOptions = options; }
public NetworkLayoutRecord( BayesianNetwork network, NetworkLayout existingLayout, IList<string> interestVertices, NetworkLayoutOptions options) { Debug.Assert(options != null, "Layout options cannot be null."); this.Network = network; this.NetworkLayout = existingLayout; this.InterestVertices = interestVertices.ToList(); this.Options = options; // Manually specify sizes. Dictionary<string, float> sizes = new Dictionary<string, float>(); foreach (var v in network.Variables) { if (!interestVertices.Contains(v.Key)) { sizes[v.Key] = Workbench.NetworkLayoutVertexSizeMinimized; } else { sizes[v.Key] = Workbench.NetworkLayoutVertexSizeNormal; } } this.AlgorithmState = new LayoutAlgorithm(network.Clone(), sizes, options); // Copy existing positions over. if (existingLayout != null && existingLayout.Positions != null && existingLayout.Positions.Count > 0) { foreach (var kvp in existingLayout.Positions) { AlgorithmState.Positions[kvp.Key] = kvp.Value; } } }
public NetworkLayoutRecord( BayesianNetwork network, NetworkLayout layout, NetworkLayoutOptions options) { Debug.Assert(options != null, "Layout options cannot be null."); this.Network = network; this.NetworkLayout = layout; this.Options = options; // Manually specify sizes. Dictionary<string, float> sizes = new Dictionary<string, float>(); foreach (var v in network.Variables) { sizes[v.Key] = Workbench.NetworkLayoutVertexSizeNormal; } // Instantiate algorithm. AlgorithmState = new LayoutAlgorithm(network.Clone(), sizes, options); // Copy existing positions over. if (layout != null && layout.Positions != null && layout.Positions.Count > 0) { foreach (var kvp in layout.Positions) { AlgorithmState.Positions[kvp.Key] = kvp.Value; } } }
public LayoutAlgorithm( BayesianNetwork network, IDictionary<string, float> sizes, NetworkLayoutOptions options) { this.BayesianNetwork = network; this.Positions = new Dictionary<string, Point>(); this._sizes = new Dictionary<string, Size>(); this._options = options; foreach (var kvp in sizes) { this._sizes[kvp.Key] = new Size(kvp.Value, kvp.Value); } }
public void SetLayoutOptions(object options) { if (options == null) { throw new ArgumentNullException(); } // HACK this._layoutOptions = (NetworkLayoutOptions)options; this.UpdateNodeSizes(); }