static public void ReplaceEdgeEdges(IVertex baseVertex, IEdge edge) { GraphUtil.ReplaceEdge(baseVertex, "From", edge.From); GraphUtil.ReplaceEdge(baseVertex, "Meta", edge.Meta); if (edge.To != null) // there are edges with .To==null { GraphUtil.ReplaceEdge(baseVertex, "To", edge.To); } else { GraphUtil.DeleteEdgeByMeta(baseVertex, "To"); } // GraphUtil.ReplaceEdge(baseVertex, "To", MinusZero.Instance.Empty); }
protected void AddEdge(IVertex meta, bool isSet) { if (DisplayBaseVertex && BaseVertexEdgeAdded == false) { BaseVertexEdge = getMetaForForm(); BaseVertexEdgeAdded = true; AddEdge(BaseVertexEdge, false); } string group = getGroup(meta); string section = getSection(meta); IVertex r = MinusZero.Instance.Root; TextBlock metaControl = new TextBlock(); if (meta == null) { metaControl.Text = "XXX"; metaControl.Height = 0; } else { metaControl.Text = (string)meta.Value; } metaControl.FontStyle = FontStyles.Italic; metaControl.FontWeight = UIWpf.MetaWeight; metaControl.Foreground = (Brush)FindResource("0GrayBrush"); metaControl.FontStyle = FontStyles.Italic; System.Windows.FrameworkElement dataControl = null; if (isSet) { TableVisualiser tv = new TableVisualiser(); if (ExpertMode) { GraphUtil.SetVertexValue(tv.Vertex, MinusZero.Instance.Root.Get(@"System\Meta\Visualiser\Table\ExpertMode"), "True"); } // need to remove and add to have "transaction" GraphUtil.CreateOrReplaceEdge(tv.Vertex.Get("ToShowEdgesMeta:"), r.Get(@"System\Meta\ZeroTypes\Edge\Meta"), meta); IVertex v = tv.Vertex.Get("ToShowEdgesMeta:"); GraphUtil.DeleteEdgeByMeta(tv.Vertex, "ToShowEdgesMeta"); tv.Vertex.AddEdge(MinusZero.Instance.Root.Get(@"System\Meta\Visualiser\Table\ToShowEdgesMeta"), v); //GraphUtil.CreateOrReplaceEdge(tv.Vertex.Get("ToShowEdgesMeta:"), r.Get(@"System\Meta\ZeroTypes\Edge\To"), e.To); // do not need GraphUtil.ReplaceEdge(tv.Vertex.Get("BaseEdge:"), "To", Vertex.Get(@"BaseEdge:\To:")); dataControl = tv; } else { if (meta == BaseVertexEdge) { StringVisualiser sv = new StringVisualiser(); Edge.ReplaceEdgeEdges(sv.Vertex.Get("BaseEdge:"), Vertex.GetAll(@"BaseEdge:\To:").FirstOrDefault()); dataControl = sv; } else { VisualiserEditWrapper w = new VisualiserEditWrapper(); IEdge e; e = Vertex.GetAll(@"BaseEdge:\To:\" + (string)meta.Value + ":").FirstOrDefault(); if (e == null) // no edge in data vertex { w.BaseEdge = new EasyEdge(Vertex.Get(@"BaseEdge:\To:"), meta, null); } else { w.BaseEdge = e; } dataControl = w; } } ControlInfo ci = new ControlInfo(); ci.MetaControl = metaControl; ci.DataControl = dataControl; if (meta == null) { // BaseEdgeVertex TabList[group].ControlInfos.Add(MinusZero.Instance.CreateTempVertex(), ci); } else { if (TabList[group].ControlInfos.ContainsKey(meta)) { int x = 0; // same meta sub vertex two times in meta vertex } else { TabList[group].ControlInfos.Add(meta, ci); } } Panel place = GetUIPlace(group, section, ci); if (MetaOnLeft) { metaControl.TextAlignment = TextAlignment.Right; StackPanel s = new StackPanel(); s.Orientation = Orientation.Horizontal; ci.GapControl = new StackPanel(); s.Children.Add(ci.GapControl); s.Children.Add(metaControl); Border b2 = new Border(); b2.BorderThickness = new System.Windows.Thickness(metaVsDataSeparator, 0, 0, 0); s.Children.Add(b2); s.Children.Add(dataControl); place.Children.Add(s); } else { place.Children.Add(metaControl); place.Children.Add(dataControl); } Border b = new Border(); b.BorderThickness = new System.Windows.Thickness(0, controlLineVsControlLineSeparator, 0, 0); place.Children.Add(b); }