public override void Draw(MurphyPA.H2D.Interfaces.IGraphicsContext GC)
        {
            if (_WhichEnd == TransitionContactEnd.To)
            {
            // want to draw an arrow here...

                pointer.Draw (GC, _OtherEnd.Centre, this.Centre, _Radius, _Radius);
            }
            else
            {
                base.Draw (GC);
            }

            if (_WhichEnd == TransitionContactEnd.To)
            {
                ITransitionGlyph trans = Owner as ITransitionGlyph;
                if (trans != null && trans.TransitionType == TransitionType.DeepHistory)
                {
                    using (Brush brush = new System.Drawing.SolidBrush (GC.Color))
                    {
                        GC.DrawString ("H*", brush, 12, _Centre, false);
                    }
                }
            }
        }
        public void Draw(MurphyPA.H2D.Interfaces.IGraphicsContext gc, Point from, Point to, int triangleBaseWidth, int triangleHeight)
        {
            GraphicsPath path = new GraphicsPath ();

            int dY = to.Y - from.Y;
            int dX = to.X - from.X;

            int x0 = to.X;
            int y0 = to.Y;

            if (dX != 0)
            {
                double lineSlope = (double)dY / (double)dX;

                if (Math.Abs (lineSlope) > double.Epsilon)
                {
                    AddSloped (from, to, x0, y0, triangleBaseWidth, triangleHeight, lineSlope, path);
                }
                else
                {
                    // horizontal line
                    AddHorizontal (from, to, x0, y0, triangleBaseWidth, triangleHeight, path);
                }
            }
            else
            {
                // vertical line
                AddVertical (from, to, x0, y0, triangleBaseWidth, triangleHeight, path);
            }

            path.CloseFigure ();

            using (Brush brush = new System.Drawing.SolidBrush (gc.Color))
            {
                using (Pen pen = new Pen (brush, 5))
                {
                    gc.DrawPath (pen, path);
                }
            }
        }
        public override void Draw(MurphyPA.H2D.Interfaces.IGraphicsContext GC)
        {
            if (_WhichEnd == TransitionContactEnd.To)
            {
                int height = this.Bounds.Width;
                pointer.Draw (GC, Centre (_OtherEnd.Bounds),  Centre (this.Bounds), height, height);
            }
            else
            {
                base.Draw (GC);
            }

            IPortLinkGlyph portLink = Owner as IPortLinkGlyph;
            if (portLink != null)
            {
                string portName = "?NoName";
                switch (_WhichEnd)
                {
                    case TransitionContactEnd.From:
                    {
                        portName = portLink.FromPortName;
                        if (IsNotEmptyString (portLink.SendIndex))
                        {
                            portName = portName + "-" + portLink.SendIndex;
                        }
                    } break;
                    case TransitionContactEnd.To:
                    {
                        portName = portLink.ToPortName;
                    } break;
                }

                using (Brush brush = new System.Drawing.SolidBrush (GC.Color))
                {
                    Rectangle bounds = Bounds;
                    GC.DrawString (portName, brush, 12, new Point (bounds.Right, bounds.Bottom), false);
                }
            }
        }
Пример #4
0
 public override void Draw(MurphyPA.H2D.Interfaces.IGraphicsContext GC)
 {
     GC.DrawCircle (_Centre, _Radius, true);
 }
Пример #5
0
 public override void Draw(MurphyPA.H2D.Interfaces.IGraphicsContext GC)
 {
     GC.DrawRectangle (_Bounds);
 }