Пример #1
0
        public void Invalidate()
        {
            this.EdgeLabel.InvokeInUiThread(() =>
            {
                this.UpdateVisibility(this.Edge);
                if (!this.Edge.IsVisible)
                {
                    return;
                }

                this.EdgePath.Data = VisualsFactory.CreateEdgePath(Edge.GeometryEdge.Curve);

                // arrows should be nulled and removed if they are nor required anymore.
                // revist on graphic property editing
                // --wgross 28.09.2018
                if (this.Edge.Attr.ArrowAtSource)
                {
                    this.SourceArrowHeadPath.Data = VisualsFactory.CreateEdgeSourceArrow(this.Edge.GeometryEdge.EdgeGeometry, this.PathStrokeThickness);
                }
                if (this.Edge.Attr.ArrowAtTarget)
                {
                    this.TargetArrowHeadPath.Data = VisualsFactory.CreateEdgeTargetArrow(this.Edge.GeometryEdge.EdgeGeometry, this.PathStrokeThickness);
                }

                this.SetPathStroke();

                if (VLabel != null)
                {
                    ((IInvalidatable)VLabel).Invalidate();
                }
            });
        }
Пример #2
0
        public (FrameworkElement edgeLabel, Path edgePath, Path edgeSourceArrow, Path edgeTargetArrow) SetupEdgeVisuals(FrameworkElement edgeLabel)
        {
            // nope: this must be VLabel//edgeLabel.Tag = this;

            var edgePath = new Path
            {
                Data = VisualsFactory.CreateEdgePath(this.Edge.GeometryEdge.Curve),
                Tag  = this
            };

            var edgeSourceArrow = this.Edge.Attr.ArrowAtSource ?
                                  new Path
            {
                Data = VisualsFactory.CreateEdgeSourceArrow(this.Edge.GeometryEdge.EdgeGeometry, this.PathStrokeThickness),
                Tag  = this
            } : null;

            var edgeTargetArrow = this.Edge.Attr.ArrowAtTarget ?
                                  new Path
            {
                Data = VisualsFactory.CreateEdgeTargetArrow(this.Edge.GeometryEdge.EdgeGeometry, this.PathStrokeThickness),
                Tag  = this
            } : null;

            return(edgeLabel, edgePath, edgeSourceArrow, edgeTargetArrow);
        }
Пример #3
0
 public void DrawRubberEdge(EdgeGeometry edgeGeometry)
 {
     if (_rubberEdgePath == null)
     {
         _rubberEdgePath = new Path
         {
             Stroke          = Brushes.Black,
             StrokeThickness = GetBorderPathThickness() * 3
         };
         GraphCanvas.Children.Add(_rubberEdgePath);
         _targetArrowheadPathForRubberEdge = new Path
         {
             Stroke          = Brushes.Black,
             StrokeThickness = GetBorderPathThickness() * 3
         };
         GraphCanvas.Children.Add(_targetArrowheadPathForRubberEdge);
     }
     _rubberEdgePath.Data = VisualsFactory.CreateEdgePath(edgeGeometry.Curve);
     _targetArrowheadPathForRubberEdge.Data = VisualsFactory.CreateEdgeTargetArrow(edgeGeometry, edgeGeometry.LineWidth);
 }