private void apriToolStripMenuItem_Click(object sender, EventArgs e) { DialogResult result = Makefire.LoadFile(); if (result == DialogResult.OK) { listBox.Items.Clear(); markerOverlay.Markers.Clear(); double lat = 0; double lon = 0; SceneryObject n; foreach (XmlElement el in Makefire.doc.GetElementsByTagName("SceneryObject")) { lat = Convert.ToDouble(el.Attributes["lat"].InnerText.Replace(".", ",")); lon = Convert.ToDouble(el.Attributes["lon"].InnerText.Replace(".", ",")); if (el.FirstChild.Name == "Effect") { if (el.FirstChild.Attributes[0].InnerText.Contains("Fire")) { n = new Fire(el.FirstChild.Attributes[0].InnerText, lat, lon); n.AddMarkerToMap(ref markerOverlay); n.MarkAsAddedToXml(); listBox.Items.Add(n); } else if (el.FirstChild.Attributes[0].InnerText.Contains("moke")) { n = new Smoke(el.FirstChild.Attributes[0].InnerText, lat, lon); n.AddMarkerToMap(ref markerOverlay); n.MarkAsAddedToXml(); listBox.Items.Add(n); } else { XDocument doc = XDocument.Load(Application.StartupPath + Path.Combine(@"\Effetti\Effetti.xml")); foreach (XElement i in doc.Root.Element("EffettiComboSingolo").Elements()) { if (i.Value == el.FirstChild.Attributes[0].Value) { n = new CustomObject(i.Name.ToString(), i.Value, lat, lon, (GMarkerGoogleType)Enum.Parse(typeof(GMarkerGoogleType), i.FirstAttribute.Value)); n.AddMarkerToMap(ref markerOverlay); n.MarkAsAddedToXml(); listBox.Items.Add(n); break; } } foreach (XElement i in doc.Root.Element("EffettiComboLinea").Elements()) { if (i.Value == el.FirstChild.Attributes[0].Value) { n = new CustomObject(i.Name.ToString(), i.Value, lat, lon, (GMarkerGoogleType)Enum.Parse(typeof(GMarkerGoogleType), i.FirstAttribute.Value)); n.AddMarkerToMap(ref markerOverlay); n.MarkAsAddedToXml(); listBox.Items.Add(n); break; } } } } else if (el.FirstChild.Name == "LibraryObject") { n = new Autocisterna(lat, lon); n.AddMarkerToMap(ref markerOverlay); n.MarkAsAddedToXml(); listBox.Items.Add(n); } } foreach (XmlElement el in Makefire.doc.GetElementsByTagName("Waypoint")) { lat = Convert.ToDouble(el.Attributes["lat"].InnerText.Replace(".", ",")); lon = Convert.ToDouble(el.Attributes["lon"].InnerText.Replace(".", ",")); n = new Waypoint(lat, lon); n.AddMarkerToMap(ref markerOverlay); n.MarkAsAddedToXml(); listBox.Items.Add(n); } panelOverIncendio.Visible = false; areaTB.Focus(); } EnableSelezionatuttiAndCompilaBGL(); areaTB.Text = Makefire.GetAreaFromComment().Substring(6); string position = Makefire.GetPositionFromComment().Substring(11); double Lat = 0; double Lng = 0; int index = 16; bool continua = true; do { try { Lat = Convert.ToDouble(position.Substring(5, index)); continua = false; } catch { index--; } } while (continua); continua = true; index = 16; do { try { Lng = Convert.ToDouble(position.Substring(27, index)); continua = false; } catch { index--; } } while (continua); if (areaTB.Text != "") { //gMC.Position = (PointLatLng)GMapProviders.GoogleMap.GetPoint(areaTB.Text, out gcsc); gMC.Position = new PointLatLng(Lat, Lng); gMC.Zoom = 15; } if (Makefire.GetMapTypeFromComment().Contains("Sat")) { gMC.MapProvider = GMapProviders.BingSatelliteMap; satelliteRB.CheckedChanged -= StradeSatelliteRadioButtonChange; satelliteRB.Checked = true; satelliteRB.CheckedChanged += StradeSatelliteRadioButtonChange; /*stradeRB.CheckedChanged -= StradeSatelliteRadioButtonChange; * stradeRB.Checked = false; * stradeRB.CheckedChanged += StradeSatelliteRadioButtonChange;*/ } else if (Makefire.GetMapTypeFromComment().Contains("Str")) { gMC.MapProvider = GMapProviders.GoogleMap; stradeRB.CheckedChanged -= StradeSatelliteRadioButtonChange; stradeRB.Checked = true; stradeRB.CheckedChanged += StradeSatelliteRadioButtonChange; /*satelliteRB.CheckedChanged -= StradeSatelliteRadioButtonChange; * satelliteRB.Checked = false; * satelliteRB.CheckedChanged += StradeSatelliteRadioButtonChange;*/ } else { gMC.MapProvider = GMapProviders.GoogleMap; } }
public Fire(Fire n) : base(n) { }