public void RedirectEdge(FlNwNodeVisualization _to_node, bool _rerout_start, FlowNetwork _owner) { if (_to_node == null || _owner == null) { return; } // perform redirection in the data FlNetEdge edge_data = this.FN_Edge; FlNetNode node_data = _to_node.FN_Node; bool success = false; if (edge_data != null && node_data != null) { success = _owner.RedirectEdge(edge_data, _rerout_start, node_data); } // perform redirection in the visualizations if (success) { if (_rerout_start) { this.StartVis = _to_node; } else { this.EndVis = _to_node; } } }
public FlNwEdgeVisualization(FlowNwGraph _parent, FlNetEdge _fn_edge, FlNwNodeVisualization _start_vis, FlNwNodeVisualization _end_vis) : base(_parent, FlNwElementVisualization.NODE_WIDTH_DEFAULT, FlNwElementVisualization.NODE_HEIGHT_DEFAULT, _fn_edge.Start.Position.X + FlNwElementVisualization.NODE_WIDTH_DEFAULT * 0.5, _fn_edge.Start.Position.Y + FlNwElementVisualization.NODE_HEIGHT_DEFAULT * 0.5) { this.fn_edge = _fn_edge; this.fn_edge.PropertyChanged += fn_edge_PropertyChanged; this.UpdateGeometry(); this.StartVis = _start_vis; this.EndVis = _end_vis; }
private void fn_edge_PropertyChanged(object sender, PropertyChangedEventArgs e) { FlNetEdge edge = sender as FlNetEdge; if (edge == null || e == null) { return; } if (e.PropertyName == "Start" || e.PropertyName == "End") { this.UpdateGeometry(); this.UpdateContent(); } else if (e.PropertyName == "Content" || e.PropertyName == "ParamValueToDisplay") { this.UpdateContent(); } }
internal GeometricRelationship UpdateInstanceConnectivityInfo(FlNetEdge _edge) { if (_edge == null) { return(null); } GeometricRelationship gr = this.R2GInstances.FirstOrDefault(x => x.InstanceNWElementID == _edge.ID); if (gr == null) { return(null); } if (_edge.Start != null && _edge.End != null) { gr.InstancePath[0] = new System.Windows.Media.Media3D.Point3D(_edge.Start.ID, _edge.End.ID, -1); } return(gr); }
public override DataTemplate SelectTemplate(object item, DependencyObject container) { if (container == null) { return(null); } FrameworkElement element = container as FrameworkElement; if (element == null) { return(null); } if (item == null) { return(element.TryFindResource("DT_Empty") as DataTemplate); } FlNetNode node = item as FlNetNode; FlNetEdge edge = item as FlNetEdge; FlowNetwork network = item as FlowNetwork; if (node != null && network == null) { return(element.TryFindResource("FlNetNodeInList") as DataTemplate); } else if (edge != null) { return(element.TryFindResource("FlNetEdgeInList") as DataTemplate); } else if (network != null) { return(element.TryFindResource("NetworkInList") as DataTemplate); } else { return(null); } }