/// <summary>
 /// kbd4hire 20090318
 /// Move transformation to view coordindates here.
 /// </summary>
 /// <param name="points"></param>
 /// <returns></returns>
 private IEnumerable <Point2D> convertPoints(IEnumerable <IPoint> points)
 {
     foreach (IPoint2D point in points)
     {
         yield return(RenderTransform.TransformVector(point.X, point.Y));
     }
 }
 /// <summary>
 /// kbd4hire 20090318
 /// Move transformation to view coordindates here.
 /// </summary>
 /// <param name="coordinates"></param>
 /// <returns></returns>
 private IEnumerable <Point2D> convertCoordinates(IEnumerable coordinates)
 {
     foreach (ICoordinate coordinate in coordinates)
     {
         yield return(RenderTransform.TransformVector(
                          coordinate[Ordinates.X],
                          coordinate[Ordinates.Y]));
     }
 }
        public virtual IEnumerable <TRenderObject> RenderLabel(Label2D label)
        {
            Size2D textSize = TextRenderer.MeasureString(label.Text, label.Font);
            //Size2D size = new Size2D(textSize.Width + 2*label.CollisionBuffer.Width, textSize.Height + 2*label.CollisionBuffer.Height);
            //Rectangle2D layoutRectangle =
            //    new Rectangle2D(new Point2D(label.Location.X-label.CollisionBuffer.Width, label.Location.Y-label.CollisionBuffer.Height), size);

            LabelStyle style = label.Style;
            Int32      x = 0, y = 0;

            if (style.HorizontalAlignment != HorizontalAlignment.Right || style.VerticalAlignment != VerticalAlignment.Bottom)
            {
                switch (style.HorizontalAlignment)
                {
                case HorizontalAlignment.Center:
                    x -= (Int32)(textSize.Width / 2.0f);
                    break;

                case HorizontalAlignment.Left:
                    x -= (Int32)textSize.Width;
                    break;

                default:
                    break;
                }

                switch (style.VerticalAlignment)
                {
                case VerticalAlignment.Middle:
                    y += (Int32)(textSize.Height / 2.0f);
                    break;

                case VerticalAlignment.Top:
                    y += (Int32)textSize.Height;
                    break;

                default:
                    break;
                }
            }

            Point2D     location        = RenderTransform.TransformVector(label.Location.X, label.Location.Y).Add(new Point2D(x, y));
            Rectangle2D layoutRectangle = new Rectangle2D(location, textSize);

            if (label.Style.Halo != null)
            {
                StylePen   halo       = label.Style.Halo;
                StyleBrush background = label.Style.Background;

                IEnumerable <TRenderObject> haloPath = VectorRenderer.RenderPaths(
                    generateHaloPath(layoutRectangle), background, background, background,
                    halo, halo, halo, RenderState.Normal);

                foreach (TRenderObject ro in haloPath)
                {
                    yield return(ro);
                }
            }

            IEnumerable <TRenderObject> renderedText = TextRenderer.RenderText(
                label.Text, label.Font, layoutRectangle, label.FlowPath, label.Style.Foreground, label.Transform);

            foreach (TRenderObject ro in renderedText)
            {
                yield return(ro);
            }
        }