public static IList<VA.Drawing.Point> ToVAPoints(MG.Edge edge)
        {
            var final_bez_points = new List<VA.Drawing.Point> { ToVAPoint(edge.Curve.Start) };

            var curve = (MG.Splines.Curve) edge.Curve;

            foreach (var cur_seg in curve.Segments)
            {
                if (cur_seg is MG.Splines.CubicBezierSegment)
                {
                    var bezier_seg = (MG.Splines.CubicBezierSegment) cur_seg;

                    var bez_points =
                        new[] { 0, 1, 2, 3 }
                            .Select(bezier_seg.B)
                            .Select(ToVAPoint)
                            .ToArray();

                    final_bez_points.AddRange(bez_points.Skip(1));
                }
                else if (cur_seg is MG.Splines.LineSegment)
                {
                    var line_seg = (MG.Splines.LineSegment) cur_seg;
                    final_bez_points.Add(ToVAPoint(line_seg.Start));
                    final_bez_points.Add(ToVAPoint(line_seg.End));
                    final_bez_points.Add(ToVAPoint(line_seg.End));
                }
                else
                {
                    throw new System.InvalidOperationException("Unsupported Curve Segment type");
                }
            }

            return final_bez_points;
        }
        public static IList<Drawing.Point> ToVAPoints(MG.Core.Layout.Edge edge)
        {

            if (edge.Curve is MG.Core.Geometry.Curves.Curve)
            {
                var curve = (MG.Core.Geometry.Curves.Curve)edge.Curve;

                var final_bez_points = new List<Drawing.Point> { MsaglUtil.ToVAPoint(edge.Curve.Start) };

                foreach (var cur_seg in curve.Segments)
                {
                    if (cur_seg is MG.Core.Geometry.Curves.CubicBezierSegment)
                    {
                        var bezier_seg = (MG.Core.Geometry.Curves.CubicBezierSegment)cur_seg;

                        var bez_points =
                            new[] { 0, 1, 2, 3 }
                                .Select(bezier_seg.B)
                                .Select(MsaglUtil.ToVAPoint)
                                .ToArray();

                        final_bez_points.AddRange(bez_points.Skip(1));
                    }
                    else if (cur_seg is MG.Core.Geometry.Curves.LineSegment)
                    {
                        var line_seg = (MG.Core.Geometry.Curves.LineSegment)cur_seg;
                        final_bez_points.Add(MsaglUtil.ToVAPoint(line_seg.Start));
                        final_bez_points.Add(MsaglUtil.ToVAPoint(line_seg.End));
                        final_bez_points.Add(MsaglUtil.ToVAPoint(line_seg.End));
                    }
                    else
                    {
                        throw new InvalidOperationException("Unsupported Curve Segment type");
                    }
                }

                return final_bez_points;
                
            }
            else if (edge.Curve is MG.Core.Geometry.Curves.LineSegment)
            {
                var final_bez_points = new List<Drawing.Point> { MsaglUtil.ToVAPoint(edge.Curve.Start) };
                var line_seg = (MG.Core.Geometry.Curves.LineSegment)edge.Curve;
                final_bez_points.Add(MsaglUtil.ToVAPoint(line_seg.Start));
                final_bez_points.Add(MsaglUtil.ToVAPoint(line_seg.End));
                final_bez_points.Add(MsaglUtil.ToVAPoint(line_seg.End));
                return final_bez_points;
                
            }

            throw new Exception();
        }
 public static Drawing.Rectangle ToVARectangle(MG.Core.Geometry.Rectangle n)
 {
     return new Drawing.Rectangle(n.Left, n.Bottom, n.Right, n.Top);
 }
 public static Drawing.Point ToVAPoint(MG.Core.Geometry.Point p)
 {
     return new Drawing.Point(p.X, p.Y);
 }
Beispiel #5
0
 //using the background color does not seem to work in this version of glee
 //use the font color of nodes instead,
 //node label highlighting during hovering has therefore been turned off
 private void SetNodeSelectionColor(GraphLayout.Drawing.Node n, GraphLayout.Drawing.Color c)
 {
     //n.Attr.FillColor = c;
     n.Label.FontColor = c;
 }
Beispiel #6
0
 private void RememberSelectedNodeOriginalColor(GraphLayout.Drawing.Node n)
 {
     //selectedNodeOriginalColor = n.Attr.FillColor;
     selectedNodeOriginalColor = n.Label.FontColor;
 }
 public static VA.Drawing.Rectangle ToVARectangle(MG.Splines.Rectangle n)
 {
     return new VA.Drawing.Rectangle(n.Left, n.Bottom, n.Right, n.Top);
 }
 public static VA.Drawing.Point ToVAPoint(MG.Point p)
 {
     return new VA.Drawing.Point(p.X, p.Y);
 }