public override TranslationState VisitSplitPart(SplitPart part, TranslationState ctx)
 {
     if (part.Orientation == Orientation.Vertical)
     {
         var height = ctx.Rect.Height / part.Parts.Count;
         ctx.Result = part.Parts.Select((p, i) =>
         {
             var rc = new RectangleF(ctx.Rect.Left, ctx.Rect.Top + i * height, ctx.Rect.Width, height);
             return(p.Accept(this, new TranslationState {
                 Rect = rc
             }).Result);
         }).Concat();
     }
     else
     {
         var width = ctx.Rect.Width / part.Parts.Count;
         ctx.Result = part.Parts.Select((p, i) =>
         {
             var rc = new RectangleF(ctx.Rect.Left + i * width, ctx.Rect.Top, width, ctx.Rect.Height);
             return(p.Accept(this, new TranslationState {
                 Rect = rc
             }).Result);
         }).Concat();
     }
     return(ctx);
 }
Beispiel #2
0
 public override int VisitSplitPart(SplitPart part, int state)
 {
     // Aggregate the count over all subparts
     return(part.Parts.Aggregate(state, (count, p) =>
                                 // Count words in each part
                                 p.Accept(this, count)));
 }