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; CreatorFunctions.ChangeObjectColor(facObj.Path, (CustomUserInterface.ColorOptions)Enum.Parse(typeof(CustomUserInterface.ColorOptions), _cadances[CommonData.CadenceSelected].CadenceColor)); if (item.IsOpt) { foreach (FCSensor fsensor in item.Sensors) { sensor = FacilityCreatorFunctions.AttachFacilityOptical(facObj, item.Name + "_" + fsensor.SensorName, fsensor.OParams); if (!optAssets.Objects.Contains(sensor.Path)) { optAssets.Objects.AddObject(sensor); } } } else { foreach (FCSensor fsensor in item.Sensors) { sensor = FacilityCreatorFunctions.AttachFacilityRadar(facObj, item.Name + "_" + fsensor.SensorName, fsensor.RParams); if (!optAssets.Objects.Contains(sensor.Path)) { radAssets.Objects.AddObject(sensor); } } } } } }
private void Add_Click(object sender, EventArgs e) { SubObjectList.SmallImageList = imageList1; SubObject newSub = new SubObject(); newSub.Type = "Unknown"; if (CommonData.CurrentEvents[CommonData.EventSelectedIndex].SubObjects.Count != 0) { newSub.Name = "SubObject" + CommonData.CurrentEvents[CommonData.EventSelectedIndex].SubObjects.Count.ToString(); } else { newSub.Name = "SubObject"; } //Assign default values to class newSub.Latitude = CommonData.CurrentEvents[CommonData.EventSelectedIndex].Latitude; newSub.Longitude = CommonData.CurrentEvents[CommonData.EventSelectedIndex].Longitude; newSub.ZoomLevel = "1000"; CommonData.CurrentEvents[CommonData.EventSelectedIndex].SubObjects.Add(newSub); int index = GroundEventFunctions.GetSubObjectImageIndex(newSub); var listItem = new ListViewItem(); listItem.ImageIndex = index; listItem.SubItems[0].Text = newSub.Name; SubObjectList.Items.Add(listItem); SubObjectList.FocusedItem = listItem; CommonData.SubObjectIndex = SubObjectList.Items.Count - 1; SubObjectType.Enabled = true; ZoomLevel.Enabled = true; LatitudeValue.Enabled = true; LongitudeValue.Enabled = true; NameValue.Enabled = true; //Assign GUI values SubObjectType.SelectedIndex = 0; ZoomLevel.SelectedIndex = 1; LongitudeValue.Text = CommonData.CurrentEvents[CommonData.EventSelectedIndex].Longitude.ToString(); LatitudeValue.Text = CommonData.CurrentEvents[CommonData.EventSelectedIndex].Latitude.ToString(); NameValue.Text = newSub.Name; //Create sub-object and change color to match higher level object GroundEventFunctions.CreateSubObject(CommonData.CurrentEvents[CommonData.EventSelectedIndex], newSub); CreatorFunctions.ChangeObjectColor("Place/" + CommonData.CurrentEvents[CommonData.EventSelectedIndex].Id + "-" + newSub.Name, (CustomUserInterface.ColorOptions)Enum.Parse(typeof(CustomUserInterface.ColorOptions), CommonData.CurrentEvents[CommonData.EventSelectedIndex].ColorOption)); }
private void Generate_Click(object sender, EventArgs e) { if (ExistingVolumes.SelectedIndex != -1 && ExistingVolumes.Items.Count > 0 && LocationList.SelectedIndex != -1) { IAgFacility place; IAgStkObject placeObj; placeObj = CreatorFunctions.GetCreateFacility(CommonData.LocationList[CommonData.LocationIndex].Name); place = placeObj as IAgFacility; place.Position.AssignGeodetic(Double.Parse(CommonData.LocationList[CommonData.LocationIndex].Latitude), Double.Parse(CommonData.LocationList[CommonData.LocationIndex].Longitude), 0); place.AltRef = AgEAltRefType.eWGS84; //Create complex conic sensor IAgStkObject sensorObj = CreatorFunctions.GetCreateSensor(placeObj, CommonData.VolumeList[CommonData.TvSelectedIndex].Name + "_" + CommonData.LocationList[CommonData.LocationIndex].Name); IAgSensor sensor = sensorObj as IAgSensor; sensor.SetPatternType(AgESnPattern.eSnComplexConic); IAgSnComplexConicPattern pattern = sensor.Pattern as IAgSnComplexConicPattern; pattern.OuterConeHalfAngle = 180.0; sensor.VO.PercentTranslucency = 70.0; IAgAccessConstraintCollection constraints = sensor.AccessConstraints; IAgAccessCnstrMinMax elConstraint; IAgAccessCnstrMinMax rangeConstraint; IAgAccessCnstrMinMax altConstraint; //Add elevation angle constraint if (constraints.IsConstraintActive(AgEAccessConstraints.eCstrElevationAngle)) { elConstraint = constraints.GetActiveConstraint(AgEAccessConstraints.eCstrElevationAngle) as IAgAccessCnstrMinMax; } else { elConstraint = constraints.AddConstraint(AgEAccessConstraints.eCstrElevationAngle) as IAgAccessCnstrMinMax; } elConstraint.EnableMin = true; elConstraint.Min = Double.Parse(CommonData.VolumeList[CommonData.TvSelectedIndex].MinEl); elConstraint.EnableMax = true; elConstraint.Max = Double.Parse(CommonData.VolumeList[CommonData.TvSelectedIndex].MaxEl); //Add range constraint if (constraints.IsConstraintActive(AgEAccessConstraints.eCstrRange)) { rangeConstraint = constraints.GetActiveConstraint(AgEAccessConstraints.eCstrRange) as IAgAccessCnstrMinMax; } else { rangeConstraint = constraints.AddConstraint(AgEAccessConstraints.eCstrRange) as IAgAccessCnstrMinMax; } rangeConstraint.EnableMin = true; rangeConstraint.Min = Double.Parse(CommonData.VolumeList[CommonData.TvSelectedIndex].MinRange); rangeConstraint.EnableMax = true; rangeConstraint.Max = Double.Parse(CommonData.VolumeList[CommonData.TvSelectedIndex].MaxRange); //Add altitude constraint if (constraints.IsConstraintActive(AgEAccessConstraints.eCstrAltitude)) { altConstraint = constraints.GetActiveConstraint(AgEAccessConstraints.eCstrAltitude) as IAgAccessCnstrMinMax; } else { altConstraint = constraints.AddConstraint(AgEAccessConstraints.eCstrAltitude) as IAgAccessCnstrMinMax; } altConstraint.EnableMin = true; altConstraint.Min = Double.Parse(CommonData.VolumeList[CommonData.TvSelectedIndex].MinAlt); altConstraint.EnableMax = true; altConstraint.Max = Double.Parse(CommonData.VolumeList[CommonData.TvSelectedIndex].MaxAlt); //Add Azimuth Constraint IAgAccessCnstrMinMax azConstraint = CreatorFunctions.GetAzCnst(constraints); CreatorFunctions.SetCnstMinMax(azConstraint, Double.Parse(CommonData.VolumeList[CommonData.TvSelectedIndex].MinAz), Double.Parse(CommonData.VolumeList[CommonData.TvSelectedIndex].MaxAz)); try { sensor.Graphics.Projection.UseConstraints = true; sensor.Graphics.Projection.EnableConstraint("ElevationAngle"); sensor.Graphics.Projection.EnableConstraint("AzimuthAngle"); CommonData.StkRoot.ExecuteCommand("Animate * Refresh"); } catch (Exception) { } CreatorFunctions.ChangeObjectColor(sensorObj.Path, (CustomUserInterface.ColorOptions)Enum.Parse(typeof(CustomUserInterface.ColorOptions), ColorSelection.Text)); } }
private void CreateButton_Click(object sender, EventArgs e) { if (ManualSSR.Checked) { int fieldCheck = FieldCheck(); if (fieldCheck == 0) { GroundEvent current = new GroundEvent(); current.Id = Regex.Replace(IDText.Text, @"[^0-9a-zA-Z_]+", ""); current.Country = CountryText.Text; current.Latitude = Latitude.Text; current.Longitude = Longitude.Text; string start = ReadWrite.CheckTimeCell(StartTimeText.Text); if (start == "Unspecified") { current.StartTime = "Unspecified"; current.MilStartTime = "Unspecified"; } else { current.MilStartTime = StartTimeText.Text; current.StartTime = StartTimeText.Text; } string stop = ReadWrite.CheckTimeCell(StopTimeText.Text); if (stop == "Unspecified") { current.StopTime = "Unspecified"; current.MilStopTime = "Unspecified"; } else { current.MilStopTime = StopTimeText.Text; current.StopTime = StopTimeText.Text; } current.Description = DesciptionText.Text; current.SsrType = TypeSelect.Text; if (!String.IsNullOrEmpty(_contactEvent.Poc)) { current.Poc = _contactEvent.Poc; } if (!String.IsNullOrEmpty(_contactEvent.PocPhone)) { current.PocPhone = _contactEvent.PocPhone; } if (!String.IsNullOrEmpty(_contactEvent.PocEmail)) { current.PocEmail = _contactEvent.PocEmail; } current.ColorOption = ColorSelection.Text; CommonData.CurrentEvents.Add(current); GroundEventFunctions.CreateGroundEvent(current); CreatorFunctions.ChangeObjectColor("Place/" + current.Id, (CustomUserInterface.ColorOptions)Enum.Parse(typeof(CustomUserInterface.ColorOptions), ColorSelection.Text)); ReadWrite.WriteEventFile(CommonData.EventFileStr); } CommonData.NewSsrCreated = true; } else if (SSRFromFile.Checked) { int importOption = 0; if (ImportAll.Checked) { importOption = 1; } ReadWrite.ImportEventSheet(FileText.Text, importOption, SheetColor.Text); CommonData.NewSsrCreated = true; } this.Close(); }