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;
                }
            }
        }
 // assumes that _fn_node is not NULL
 public FlNwNodeVisualization(FlowNwGraph _parent, FlNetNode _fn_node, NodePosInFlow _pos_in_flow)
     : base(_parent, FlNwElementVisualization.NODE_WIDTH_DEFAULT, FlNwElementVisualization.NODE_HEIGHT_DEFAULT,
            _fn_node.Position.X, _fn_node.Position.Y)
 {
     this.fn_node = _fn_node;
     this.fn_node.PropertyChanged += node_PropertyChanged;
     this.PosInFlow = _pos_in_flow;
 }
        private void node_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            FlNetNode node = sender as FlNetNode;

            if (node == null || e == null)
            {
                return;
            }

            if (e.PropertyName == "Content" || e.PropertyName == "ParamValueToDisplay")
            {
                this.UpdateContent();
            }
        }
Beispiel #4
0
        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);
            }
        }