/// <summary> /// set controls status form kml data /// </summary> /// <param name="kml">kml data objects</param> public void initFromKml(KmlLib.KmlLib kml) { chkPlacemarks.Text = string.Format("{0} ({1})", chkPlacemarks.Tag, kml.CountPlacemarks()); if (kml.CountPlacemarks() > 0) { chkPlacemarks.Enabled = true; chkPlacemarks.Checked = true; } chkPaths.Text = string.Format("{0} ({1})", chkPaths.Tag, kml.CountPaths()); if (kml.CountPaths() > 0) { chkPaths.Enabled = true; chkPaths.Checked = true; } chkPolys.Text = string.Format("{0} ({1})", chkPolys.Tag, kml.CountPolys()); if (kml.CountPolys() > 0) { chkPolys.Enabled = true; chkPolys.Checked = true; } chkTracks.Text = string.Format("{0} ({1})", chkTracks.Tag, kml.CountTracks()); if (kml.CountTracks() > 0) { chkTracks.Enabled = true; chkTracks.Checked = true; } }
/// <summary> /// Initializes the combobox /// </summary> /// <param name="kml">instance of <see cref="T:CasaSoft.vrt.KmlLib.KmlLib"/></param> public void SetKml(KmlLib.KmlLib kml) { this.Kml = kml; if (cmbKml.Items.Count > 0) { cmbKml.Items.Clear(); cmbKml.Enabled = false; } if (kml != null) { cmbKml.Items.Add(""); cmbKml.Items.AddRange(kml.PlacemarksNames()); cmbKml.Enabled = true; } }
/// <summary> /// open file dirty work /// </summary> protected override void doOpenFile() { string file = fileOpener.FileName; kml = null; InitControls(); if (!string.IsNullOrWhiteSpace(file)) { try { kml = new KmlLib.KmlLib(file); } catch (Exception ex) { Balloon(catalog.GetString("Error processing file '{0}':\n{1}", file, ex.Message)); } if (kml != null) { AfterFileOpenerChanged(); base.doOpenFile(); } } }