private void Generate_Click(object sender, EventArgs e) { if (CadanceList.FocusedItem != null && CadanceList.FocusedItem.Index != -1) { IAgStkObject facObj; IAgFacility fac; IAgConstellation optAssets = null; IAgConstellation radAssets = null; IAgStkObject constObj; IAgStkObject sensor; if (_cadances[CommonData.CadenceSelected].NumOptical > 0) { constObj = CreatorFunctions.GetCreateConstellation(_cadances[CommonData.CadenceSelected].Name + "_Opt"); optAssets = constObj as IAgConstellation; optAssets.Objects.RemoveAll(); } if (_cadances[CommonData.CadenceSelected].NumRadars > 0) { constObj = CreatorFunctions.GetCreateConstellation(_cadances[CommonData.CadenceSelected].Name + "_Rad"); radAssets = constObj as IAgConstellation; radAssets.Objects.RemoveAll(); } foreach (var item in _cadances[CommonData.CadenceSelected].FacilityList) { facObj = CreatorFunctions.GetCreateFacility(item.Name); fac = facObj as IAgFacility; fac.Position.AssignGeodetic(Double.Parse(item.Latitude), Double.Parse(item.Longitude), Double.Parse(item.Altitude)); fac.AltRef = AgEAltRefType.eWGS84; if (item.IsOpt) { sensor = CreatorFunctions.AttachFacilityOptical(facObj, item.Name + "_Opt", item.OParams); optAssets.Objects.AddObject(sensor); } else { sensor = CreatorFunctions.AttachFacilityRadar(facObj, item.Name + "_Radar", item.RParams); radAssets.Objects.AddObject(sensor); } } } }
private void GenerateSingle_Click(object sender, EventArgs e) { Tuple <int, string> check = FieldCheck(); if (check.Item1 == 0) { try { IAgStkObject facObj = CreatorFunctions.GetCreateFacility(FacilityName.Text); IAgFacility fac = facObj as IAgFacility; IAgStkObject sensor = null; fac.Position.AssignGeodetic(Double.Parse(Latitude.Text), Double.Parse(Longitude.Text), Double.Parse(Altitude.Text)); fac.AltRef = AgEAltRefType.eWGS84; if (SensorType.SelectedIndex == 1) { OpticalParams oParams = new OpticalParams(); oParams.MinEl = "0"; oParams.MaxEl = "90"; oParams.MinRange = "4800"; oParams.MaxRange = "90000"; oParams.LunarExAngle = "10"; oParams.SunElAngle = "-12"; oParams.HalfAngle = "70"; sensor = CreatorFunctions.AttachFacilityOptical(facObj, FacilityName.Text + "_Opt", oParams); } else if (SensorType.SelectedIndex == 2) { RadarParams rParams = new RadarParams(); rParams.MinEl = "0"; rParams.MaxEl = "90"; rParams.MinRange = "1600"; rParams.MaxRange = "40000"; rParams.SolarExAngle = "10"; rParams.HalfAngle = "85"; sensor = CreatorFunctions.AttachFacilityRadar(facObj, FacilityName.Text + "_Radar", rParams); } else { } if (ConstType.SelectedIndex != 0) { IAgStkObject constObj = null; IAgConstellation constel = null; if (ConstType.SelectedIndex == 1) { constObj = CreatorFunctions.GetCreateConstellation(ExistingConst.Text); constel = constObj as IAgConstellation; } else if (ConstType.SelectedIndex == 2) { constObj = CreatorFunctions.GetCreateConstellation(ConstName.Text); constel = constObj as IAgConstellation; } if (SensorType.SelectedIndex == 0) { constel.Objects.AddObject(facObj); } else if (SensorType.SelectedIndex == 1 || SensorType.SelectedIndex == 2) { constel.Objects.AddObject(sensor); } } } catch (Exception) { MessageBox.Show("Could not create facility"); } } else { MessageBox.Show(check.Item2); } }