public SetPrintArea ( |
||
printArea | ||
Résultat | void |
// Create a single PDF file void CreateOneBitmap(string fileName, CourseDesignator courseDesignator) { RectangleF mapRectangle = controller.GetCurrentPrintAreaRectangle(courseDesignator); // Get the course view for the course we are printing. CourseView courseView = CourseView.CreatePrintingCourseView(eventDB, courseDesignator); // Get the correct purple color to print the course in. short ocadId; float purpleC, purpleM, purpleY, purpleK; bool purpleOverprint; FindPurple.GetPurpleColor(mapDisplay, appearance, out ocadId, out purpleC, out purpleM, out purpleY, out purpleK, out purpleOverprint); // Create a course layout from the view. CourseLayout layout = new CourseLayout(); layout.SetLayerColor(CourseLayer.Descriptions, NormalCourseAppearance.blackColorOcadId, NormalCourseAppearance.blackColorName, NormalCourseAppearance.blackColorC, NormalCourseAppearance.blackColorM, NormalCourseAppearance.blackColorY, NormalCourseAppearance.blackColorK, false); layout.SetLayerColor(CourseLayer.MainCourse, ocadId, NormalCourseAppearance.courseColorName, purpleC, purpleM, purpleY, purpleK, purpleOverprint); CourseFormatter.FormatCourseToLayout(symbolDB, courseView, appearance, layout, CourseLayer.MainCourse); // Set the course layout into the map display mapDisplay.SetCourse(layout); mapDisplay.SetPrintArea(null); ExportBitmap exportBitmap = new ExportBitmap(mapDisplay); exportBitmap.CreateBitmap(fileName, mapRectangle, GetImageFormat(), bitmapCreationSettings.Dpi, bitmapCreationSettings.WorldFile ? mapDisplay.CoordinateMapper : null); }
// The core printing routine. void DrawPage(IGraphicsTarget graphicsTarget, CoursePage page) { // Get the course view for the course we are printing. CourseView courseView = CourseView.CreatePrintingCourseView(eventDB, page.courseDesignator); // Get the correct purple color to print the course in. short ocadId; float purpleC, purpleM, purpleY, purpleK; bool purpleOverprint; FindPurple.GetPurpleColor(mapDisplay, appearance, out ocadId, out purpleC, out purpleM, out purpleY, out purpleK, out purpleOverprint); // Create a course layout from the view. CourseLayout layout = new CourseLayout(); layout.SetLayerColor(CourseLayer.Descriptions, NormalCourseAppearance.blackColorOcadId, NormalCourseAppearance.blackColorName, NormalCourseAppearance.blackColorC, NormalCourseAppearance.blackColorM, NormalCourseAppearance.blackColorY, NormalCourseAppearance.blackColorK, false); layout.SetLayerColor(CourseLayer.MainCourse, ocadId, NormalCourseAppearance.courseColorName, purpleC, purpleM, purpleY, purpleK, purpleOverprint); CourseFormatter.FormatCourseToLayout(symbolDB, courseView, appearance, layout, CourseLayer.MainCourse); // Set the course layout into the map display mapDisplay.SetCourse(layout); mapDisplay.SetPrintArea(null); // Set the transform, and the clip. Matrix transform = Geometry.CreateInvertedRectangleTransform(page.mapRectangle, page.printRectangle); PushRectangleClip(graphicsTarget, page.printRectangle); graphicsTarget.PushTransform(transform); // Determine the resolution in map coordinates. Matrix inverseTransform = transform.Clone(); inverseTransform.Invert(); float minResolutionPage = 100F / 2400F; // Assume 2400 DPI as the base resolution, to get very accurate print. float minResolutionMap = Geometry.TransformDistance(minResolutionPage, inverseTransform); // And draw. mapDisplay.Draw(graphicsTarget, page.mapRectangle, minResolutionMap); graphicsTarget.PopTransform(); graphicsTarget.PopClip(); }