예제 #1
0
        // mapDisplay is a MapDisplay that contains the correct map. All other features of the map display need to be customized.
        public CoursePdf(EventDB eventDB, SymbolDB symbolDB, Controller controller, MapDisplay mapDisplay, 
            CoursePdfSettings coursePdfSettings, CourseAppearance appearance)
        {
            this.eventDB = eventDB;
            this.symbolDB = symbolDB;
            this.controller = controller;
            this.mapDisplay = mapDisplay;
            this.coursePdfSettings = coursePdfSettings;
            this.appearance = appearance;

            // Set default features for printing.
            mapDisplay.MapIntensity = 1.0F;
            mapDisplay.AntiAlias = false;
            mapDisplay.Printing = true;
            mapDisplay.ColorModel = coursePdfSettings.ColorModel;

            mapBounds = mapDisplay.MapBounds;

            if (mapDisplay.MapType == MapType.PDF) {
                // For PDF maps, we remove the PDF map from the MapDisplay and add it in separately.
                sourcePdfMapFileName = mapDisplay.FileName;
            }
        }
예제 #2
0
        // mapDisplay is a MapDisplay that contains the correct map. All other features of the map display need to be customized.
        public CoursePdf(EventDB eventDB, SymbolDB symbolDB, Controller controller, MapDisplay mapDisplay,
                         CoursePdfSettings coursePdfSettings, CourseAppearance appearance)
        {
            this.eventDB           = eventDB;
            this.symbolDB          = symbolDB;
            this.controller        = controller;
            this.mapDisplay        = mapDisplay;
            this.coursePdfSettings = coursePdfSettings;
            this.appearance        = appearance;

            // Set default features for printing.
            mapDisplay.MapIntensity = 1.0F;
            mapDisplay.AntiAlias    = false;
            mapDisplay.Printing     = true;
            mapDisplay.ColorModel   = coursePdfSettings.ColorModel;

            mapBounds = mapDisplay.MapBounds;

            if (mapDisplay.MapType == MapType.PDF)
            {
                // For PDF maps, we remove the PDF map from the MapDisplay and add it in separately.
                sourcePdfMapFileName = mapDisplay.FileName;
            }
        }
예제 #3
0
        public CoursePdfSettings Clone()
        {
            CoursePdfSettings n = (CoursePdfSettings)base.MemberwiseClone();

            return(n);
        }
예제 #4
0
        private void createCoursePdfMenu_Click(object sender, EventArgs e)
        {
            if (! CheckForNonRenderableObjects(false, true))
                return;

            bool isPdfMap = controller.MapType == MapType.PDF;

            CoursePdfSettings settings;
            if (coursePdfSettings != null)
                settings = coursePdfSettings.Clone();
            else {
                // Default settings: creating in file directory
                settings = new CoursePdfSettings();

                settings.fileDirectory = true;
                settings.mapDirectory = false;
                settings.outputDirectory = Path.GetDirectoryName(controller.FileName);
            }

            if (isPdfMap) {
                // If the map file is a PDF, then created PDF must use that paper size, zero margins, and crop courses to that size.
                settings.CropLargePrintArea = true;
                RectangleF bounds = controller.MapDisplay.MapBounds;
            }

            // Initialize dialog
            CreatePdfCourses createPdfDialog = new CreatePdfCourses(controller.GetEventDB(), controller.AnyMultipart());
            createPdfDialog.controller = controller;
            createPdfDialog.PdfSettings = settings;
            if (isPdfMap) {
                createPdfDialog.EnableChangeCropping = false;
            }

            // show the dialog, on success, print.
            while (createPdfDialog.ShowDialog(this) == DialogResult.OK) {
                List<string> overwritingFiles = controller.OverwritingPdfFiles(createPdfDialog.PdfSettings);
                if (overwritingFiles.Count > 0) {
                    OverwritingOcadFilesDialog overwriteDialog = new OverwritingOcadFilesDialog();
                    overwriteDialog.Filenames = overwritingFiles;
                    if (overwriteDialog.ShowDialog(this) == DialogResult.Cancel)
                        continue;
                }

                // Save the settings for the next invocation of the dialog.
                coursePdfSettings = createPdfDialog.PdfSettings;
                controller.CreateCoursePdfs(coursePdfSettings);

                break;
            }

            // And the dialog is done.
            createPdfDialog.Dispose();
        }