示例#1
0
        protected void AddEdge(IEdge e)
        {
            StackPanel p = new StackPanel();

            p.Margin = new Thickness(Margin);

            if (!GeneralUtil.CompareStrings(e.Meta.Value, "$Empty"))
            {
                TextBlock label = new TextBlock();
                label.Foreground      = (Brush)FindResource("0GrayBrush");
                label.Text            = e.Meta.Value.ToString();
                label.LayoutTransform = new ScaleTransform(Scale, Scale);

                p.Children.Add(label);
            }

            VisualiserEditWrapper w = new VisualiserEditWrapper();

            w.LayoutTransform = new ScaleTransform(Scale, Scale);

            w.BaseEdge = e;

            p.Children.Add(w);

            Children.Add(p);
        }
示例#2
0
        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);
        }