public PublishMapForm(Document document, WaypointAttribute colorCodingAttribute, WaypointAttribute? secondaryColorCodingAttribute, ColorRangeProperties colorRangeProperties) { InitializeComponent(); this.document = document; this.colorCodingAttribute = colorCodingAttribute; this.secondaryColorCodingAttribute = secondaryColorCodingAttribute; this.colorRangeProperties = colorRangeProperties; foreach (var setting in Util.ApplicationSettings.PublishMapSettings) { if (!webServiceURL.Items.Contains(setting.WebServiceURL)) { webServiceURL.Items.Add(setting.WebServiceURL); } } if (webServiceURL.Items.Count > 0) webServiceURL.SelectedIndex = 0; var defaultTime = DateTime.Now.ToLocalTime().Date; if (document.Sessions.Count > 0 && document.Sessions[0].Route.FirstWaypoint != null) { defaultTime = document.Sessions[0].Route.FirstWaypoint.Time.ToLocalTime(); } date.Value = defaultTime; SetControlEnabledState(false); imageFormat.SelectedIndex = 0; }
private void CreateKmz(Document document, Stream stream, KmlProperties kmlProperties, WaypointAttribute colorCodingAttribute, WaypointAttribute? secondaryColorCodingAttribute, ColorRangeProperties colorRangeProperties) { var imageExporterProperties = new ImageExporterProperties() { ColorCodingAttribute = colorCodingAttribute, SecondaryColorCodingAttribute = secondaryColorCodingAttribute, ColorRangeProperties = colorRangeProperties }; var imageExporter = new ImageExporter(document) { Properties = imageExporterProperties }; var kmlExporter = new KmlExporter(document, imageExporter, stream) { KmlProperties = kmlProperties }; kmlExporter.ExportKmz(CommonUtil.GetTempFileName() + @"\"); }
private void OpenInGoogleEarthFromCommandLine(string fileName) { var wa = WaypointAttribute.Pace; var sc = new TimeScaleCreator(210, 1200, 10, false); var crp = new ColorRangeProperties { NumericConverter = Util.GetNumericConverterFromWaypointAttribute(wa), ScaleCreator = sc, ScaleCaption = new WaypointAttributeString(wa).Name, ScaleUnit = new WaypointAttributeString(wa).Unit }; OpenInGoogleEarth(fileName, wa, null, crp); Util.SaveSettings(ApplicationSettings); var process = Process.GetCurrentProcess(); process.Kill(); }
private void OpenInGoogleEarth(Document document, WaypointAttribute? colorCodingAttribute, WaypointAttribute? secondaryColorCodingAttribute, ColorRangeProperties colorRangeProperties) { if (document == null) throw new ArgumentNullException("document"); // set default values if (!colorCodingAttribute.HasValue) colorCodingAttribute = SelectedColorCodingAttribute; if (colorRangeProperties == null) colorRangeProperties = GetCurrentColorRangeProperties(); using (var kmlPropertySelector = new KmlPropertySelectorDialog(ApplicationSettings.ExportKmlProperties) { DialogTitle = Strings.OpenInGoogleEarth }) { var result = kmlPropertySelector.ShowDialog(); if (result == DialogResult.OK) { BeginWork(); try { ApplicationSettings.ExportKmlProperties = kmlPropertySelector.Properties; using (var stream = new MemoryStream()) { CreateKmz(document, stream, kmlPropertySelector.Properties, colorCodingAttribute.Value, secondaryColorCodingAttribute, colorRangeProperties); GoogleEarthUtil.OpenInGoogleEarth(stream); stream.Close(); } EndWork(); } catch (Exception ex) { EndWork(); Util.ShowExceptionMessageBox(Strings.Error_GoogleEarthNotInstalledMessage, ex, Strings.Error_GoogleEarthNotInstalledTitle); } } } }
private void OpenInGoogleEarth(string documentFileName, WaypointAttribute? colorCodingAttribute, WaypointAttribute? secondaryColorCodingAttribute, ColorRangeProperties colorRangeProperties) { var document = Document.Open(documentFileName); try { OpenInGoogleEarth(document, colorCodingAttribute, secondaryColorCodingAttribute, colorRangeProperties); } catch (Exception) { MessageBox.Show(Strings.Error_InvalidQuickRouteFile, Strings.OpenInGoogleEarth, MessageBoxButtons.OK, MessageBoxIcon.Error); } }