예제 #1
0
        public GpxFile(EventDB eventDB, CoordinateMapper coordinateMapper, GpxCreationSettings settings)
        {
            this.eventDB          = eventDB;
            this.settings         = settings;
            this.coordinateMapper = coordinateMapper;

            if (coordinateMapper == null)
            {
                throw new Exception("The map file must be an OCAD file to use GPX files.");
            }
        }
예제 #2
0
        public GpxFile(EventDB eventDB, CoordinateMapper coordinateMapper, GpxCreationSettings settings)
        {
            this.eventDB = eventDB;
            this.settings = settings;
            this.coordinateMapper = coordinateMapper;

            if (coordinateMapper == null)
                throw new Exception("The map file must be an OCAD file to use GPX files.");
        }
예제 #3
0
        private void createGpxMenu_Click(object sender, EventArgs e)
        {
            // First check and give immediate message if we can't do coordinate mapping.
            string message;
            if (!controller.CanExportGpx(out message)) {
                ErrorMessage(message);
                return;
            }

            GpxCreationSettings settings;
            if (gpxCreationSettingsPrevious != null)
                settings = gpxCreationSettingsPrevious.Clone();
            else {
                // Default settings
                settings = new GpxCreationSettings();
            }

            // Initialize the dialog.
            CreateGpx createGpxDialog = new CreateGpx(controller.GetEventDB());
            createGpxDialog.CreationSettings = settings;

            // show the dialog; on success, create the files.
            if (createGpxDialog.ShowDialog(this) == DialogResult.OK) {
                // Show common save dialog to choose output file name.
               // The default output for the XML is the same as the event file name, with xml extension.
                string gpxFileName = Path.ChangeExtension(controller.FileName, ".gpx");

                saveGpxFileDialog.FileName = gpxFileName;
                DialogResult result = saveGpxFileDialog.ShowDialog();

                if (result == DialogResult.OK) {
                    gpxFileName = saveGpxFileDialog.FileName;

                    // Save settings persisted between invocations of this dialog.
                    gpxCreationSettingsPrevious = createGpxDialog.CreationSettings;
                    controller.ExportGpx(gpxFileName, createGpxDialog.CreationSettings);
                }
            }

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