PurplePen.CoursePageLayout.LayoutCourse C# (CSharp) Method

LayoutCourse() private method

private LayoutCourse ( CourseDesignator courseDesignator ) : List
courseDesignator CourseDesignator
return List
        List<CoursePage> LayoutCourse(CourseDesignator courseDesignator)
        {
            List<CoursePage> pageList = new List<CoursePage>();

            // Get the area of the map we want to print, in map coordinates, and the ratio between print scale and map scale.
            float scaleRatio;
            bool landscape;
            PaperSize paperSize;
            string description;
            int margins;
            RectangleF mapArea = GetPrintAreaForCourse(courseDesignator, out landscape, out paperSize, out margins, out scaleRatio, out description);

            // Get the available page size on the page.
            RectangleF printableArea = GetPrintablePageArea(landscape, paperSize, margins);
            SizeF pageSizeAvailable = printableArea.Size;

            // Layout both page dimensions, iterate through them to get all the pages we have.
            foreach (DimensionLayout verticalLayout in LayoutPageDimension(mapArea.Top, mapArea.Height, printableArea.Top, printableArea.Height, scaleRatio))
                foreach (DimensionLayout horizontalLayout in LayoutPageDimension(mapArea.Left, mapArea.Width, printableArea.Left, printableArea.Width, scaleRatio)) {
                    CoursePage page = new CoursePage();
                    page.courseDesignator = courseDesignator;
                    page.description = description;
                    page.landscape = landscape;
                    page.paperSize = paperSize;
                    page.mapRectangle = new RectangleF(horizontalLayout.startMap, verticalLayout.startMap, horizontalLayout.lengthMap, verticalLayout.lengthMap);
                    page.printRectangle = new RectangleF(horizontalLayout.startPage, verticalLayout.startPage, horizontalLayout.lengthPage, verticalLayout.lengthPage);
                    pageList.Add(page);
                }

            return pageList;
        }