예제 #1
0
 public void Render(RenderContext context)
 {
     rectangle.Top    = Position.Y - Size / context.Scale / 2;
     rectangle.Left   = Position.X - Size / context.Scale / 2;
     rectangle.Width  = Size / context.Scale;
     rectangle.Height = Size / context.Scale;
     rectangle.Render(context);
 }
        public virtual void Render(RenderContext context)
        {
            painter.Render(context);

            /* Draw anchors */
            if (IsSelected())
            {
                Anchors.RenderAnchors(context);
            }
        }
예제 #3
0
        public void Render(RenderContext context)
        {
            if (Selected)
            {
                context.DrawFillRectangle(rectanglePainter.TopLeft.X - 5, rectanglePainter.TopLeft.Y - 5, rectanglePainter.BottomRight.X + 5, rectanglePainter.BottomRight.Y, Colors.Green);
                context.DrawFillRectangle(rectanglePainter.TopLeft.X - 5, rectanglePainter.BottomRight.Y, rectanglePainter.BottomRight.X + 5, rectanglePainter.BottomRight.Y + 5, Colors.Green);
                context.DrawFillRectangle(rectanglePainter.TopLeft.X - 5, rectanglePainter.TopLeft.Y - 5, rectanglePainter.TopLeft.X, rectanglePainter.BottomRight.Y + 5, Colors.Green);
                context.DrawFillRectangle(rectanglePainter.BottomRight.X, rectanglePainter.TopLeft.Y - 5, rectanglePainter.BottomRight.X + 5, rectanglePainter.BottomRight.Y + 5, Colors.Green);
            }

            rectanglePainter.Render(context);
            context.DrawFillRectangle(rectanglePainter.TopLeft.X, rectanglePainter.TopLeft.Y, rectanglePainter.BottomRight.X, rectanglePainter.BottomRight.Y, rectanglePainter.BackgroundColor);

            RenderEntrails(context);

            context.DrawRectangle(rectanglePainter.TopLeft.X, rectanglePainter.TopLeft.Y, rectanglePainter.BottomRight.X, rectanglePainter.BottomRight.Y, Colors.Black);

            /* Draw port name*/
            Point rectangleCenter = rectanglePainter.Center;

            portNamePainter.Text      = PortDefenition.Name;
            portNamePainter.Font      = AutosarApplication.GetInstance().PortsNamesFont;
            portNamePainter.TextColor = Colors.Black;

            if (isDelegate == false)
            {
                switch (ConnectionPortLocation)
                {
                case RectangleSide.Left:
                {
                    portNamePainter.Direction     = TextDirection.LeftToRight;
                    portNamePainter.Coordinates.X = rectangleCenter.X + 15.0;
                    portNamePainter.Coordinates.Y = rectangleCenter.Y;
                    break;
                }

                case RectangleSide.Right:
                {
                    portNamePainter.Direction     = TextDirection.RightToLeft;
                    portNamePainter.Coordinates.X = rectangleCenter.X - 15.0;
                    portNamePainter.Coordinates.Y = rectangleCenter.Y;
                    break;
                }

                case RectangleSide.Top:
                {
                    portNamePainter.Direction     = TextDirection.TopToBottom;
                    portNamePainter.Coordinates.X = rectangleCenter.X;
                    portNamePainter.Coordinates.Y = rectangleCenter.Y + 15.0;
                    break;
                }

                case RectangleSide.Bottom:
                {
                    portNamePainter.Direction     = TextDirection.BottomToTop;
                    portNamePainter.Coordinates.X = rectangleCenter.X;
                    portNamePainter.Coordinates.Y = rectangleCenter.Y - 15.0;
                    break;
                }

                default:
                {
                    break;
                }
                }
            }
            else /* isDelegate is true */
            {
                PortDefenition portDef = AutosarApplication.GetInstance().GetPortDefenition(PortDefenitionGuid);
                if ((portDef.PortType == PortDefenitions.PortType.Client) || (portDef.PortType == PortDefenitions.PortType.Sender))
                {
                    portNamePainter.Direction     = TextDirection.LeftToRight;
                    portNamePainter.Coordinates.X = rectangleCenter.X + 15.0;
                    portNamePainter.Coordinates.Y = rectangleCenter.Y;
                }
                else
                {
                    portNamePainter.Direction     = TextDirection.RightToLeft;
                    portNamePainter.Coordinates.X = rectangleCenter.X - 15.0;
                    portNamePainter.Coordinates.Y = rectangleCenter.Y;
                }
            }
            portNamePainter.Render(context);
        }