Exemple #1
0
        } // to be called after Vertex is setted up

        public virtual void VisualiserUpdate()
        {
            double sizeX = GraphUtil.GetDoubleValue(Vertex.Get("SizeX:"));
            double sizeY = GraphUtil.GetDoubleValue(Vertex.Get("SizeY:"));

            if (sizeX != GraphUtil.NullDouble && sizeY != GraphUtil.NullDouble)
            {
                Width  = sizeX;
                Height = sizeY;
            }

            if (Vertex.Get("BackgroundColor:") != null)
            {
                BackgroundColor = UIWpf.GetBrushFromColorVertex(Vertex.Get("BackgroundColor:"));
            }
            else
            {
                BackgroundColor = (Brush)FindResource("0BackgroundBrush");
            }

            if (Vertex.Get("ForegroundColor:") != null)
            {
                ForegroundColor = UIWpf.GetBrushFromColorVertex(Vertex.Get("ForegroundColor:"));
            }
            else
            {
                ForegroundColor = (Brush)FindResource("0ForegroundBrush");
            }

            if (GraphUtil.GetDoubleValue(Vertex.Get("LineWidth:")) != GraphUtil.NullDouble)
            {
                LineWidth = GraphUtil.GetDoubleValue(Vertex.Get("LineWidth:"));
            }

            SetBackAndForeground();
        }
Exemple #2
0
        protected virtual void UpdateLineEnds()
        {
            if (Vertex.Get("BackgroundColor:") != null)
            {
                BackgroundColor = UIWpf.GetBrushFromColorVertex(Vertex.Get("BackgroundColor:"));
            }
            else
            {
                BackgroundColor = (Brush)Line.FindResource("0BackgroundBrush");
            }

            if (Vertex.Get("ForegroundColor:") != null)
            {
                ForegroundColor = UIWpf.GetBrushFromColorVertex(Vertex.Get("ForegroundColor:"));
            }
            else
            {
                ForegroundColor = (Brush)Line.FindResource("0ForegroundBrush");
            }

            LineEndings.Stroke = ForegroundColor;
            Line.Stroke        = ForegroundColor;
            Label.Foreground   = ForegroundColor;


            string StartAnchor = (string)GraphUtil.GetValue(Vertex.Get(@"StartAnchor:"));
            string EndAnchor   = (string)GraphUtil.GetValue(Vertex.Get(@"EndAnchor:"));

            if (StartAnchor == "Straight")
            {
                LineEndings.StartEnding = LineEndEnum.Straight;
                Line.StartEnding        = LineEndEnum.Straight;
            }

            if (EndAnchor == "Straight")
            {
                LineEndings.EndEnding = LineEndEnum.Straight;
                Line.EndEnding        = LineEndEnum.Straight;
            }

            if (StartAnchor == "Arrow")
            {
                LineEndings.StartEnding = LineEndEnum.Arrow;
                Line.StartEnding        = LineEndEnum.Arrow;
            }

            if (EndAnchor == "Arrow")
            {
                LineEndings.EndEnding = LineEndEnum.Arrow;
                Line.EndEnding        = LineEndEnum.Arrow;
            }

            if (StartAnchor == "Triangle")
            {
                LineEndings.StartEnding = LineEndEnum.Triangle;
                Line.StartEnding        = LineEndEnum.Triangle;

                FillBrush          = BackgroundColor;
                HighlightFillBrush = BackgroundColor;
            }

            if (EndAnchor == "Triangle")
            {
                LineEndings.EndEnding = LineEndEnum.Triangle;
                Line.EndEnding        = LineEndEnum.Triangle;

                FillBrush          = BackgroundColor;
                HighlightFillBrush = BackgroundColor;
            }

            if (StartAnchor == "FilledTriangle")
            {
                LineEndings.StartEnding = LineEndEnum.FilledTriangle;
                Line.StartEnding        = LineEndEnum.FilledTriangle;

                FillBrush          = ForegroundColor;
                HighlightFillBrush = (Brush)LineEndings.FindResource("0LightHighlightBrush");
            }

            if (EndAnchor == "FilledTriangle")
            {
                LineEndings.EndEnding = LineEndEnum.FilledTriangle;
                Line.EndEnding        = LineEndEnum.FilledTriangle;

                FillBrush          = ForegroundColor;
                HighlightFillBrush = (Brush)LineEndings.FindResource("0LightHighlightBrush");
            }

            if (StartAnchor == "Diamond")
            {
                LineEndings.StartEnding = LineEndEnum.Diamond;
                Line.StartEnding        = LineEndEnum.Diamond;

                FillBrush          = BackgroundColor;
                HighlightFillBrush = BackgroundColor;
            }

            if (EndAnchor == "Diamond")
            {
                LineEndings.EndEnding = LineEndEnum.Diamond;
                Line.EndEnding        = LineEndEnum.Diamond;

                FillBrush          = BackgroundColor;
                HighlightFillBrush = BackgroundColor;
            }

            if (StartAnchor == "FilledDiamond")
            {
                LineEndings.StartEnding = LineEndEnum.FilledDiamond;
                Line.StartEnding        = LineEndEnum.FilledDiamond;

                FillBrush          = ForegroundColor;
                HighlightFillBrush = (Brush)LineEndings.FindResource("0LightHighlightBrush");
            }

            if (EndAnchor == "FilledDiamond")
            {
                LineEndings.EndEnding = LineEndEnum.FilledDiamond;
                Line.EndEnding        = LineEndEnum.FilledDiamond;

                FillBrush          = ForegroundColor;
                HighlightFillBrush = (Brush)LineEndings.FindResource("0LightHighlightBrush");
            }


            if (FillBrush != null)
            {
                LineEndings.Fill = FillBrush;
            }

            LineEndings.ArrowLength = 0;
            Line.ArrowLength        = 0;
            LineEndings.ArrowLength = 15;
            Line.ArrowLength        = 15;
        }