예제 #1
0
 private void SensorList_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (SensorList.SelectedIndex != -1 && SensorList.SelectedItem != null)
     {
         _onMenuSwitch = true;
         if (opt)
         {
             OpticalParams oParams = sensors[SensorList.SelectedIndex].OParams;
             MinRange.Text   = oParams.MinRange;
             MaxRange.Text   = oParams.MaxRange;
             MinEl.Text      = oParams.MinEl;
             MaxEl.Text      = oParams.MaxEl;
             LunExAngle.Text = oParams.LunarExAngle;
             MaxSunEl.Text   = oParams.SunElAngle;
             HalfAngle.Text  = oParams.HalfAngle;
             MinAz.Text      = oParams.MinAz;
             MaxAz.Text      = oParams.MaxAz;
             OName.Text      = sensors[SensorList.SelectedIndex].SensorName;
         }
         else
         {
             RadarParams rParams = sensors[SensorList.SelectedIndex].RParams;
             RMinRange.Text    = rParams.MinRange;
             RMaxRange.Text    = rParams.MaxRange;
             RMinEl.Text       = rParams.MinEl;
             RMaxEl.Text       = rParams.MaxEl;
             SolarExAngle.Text = rParams.SolarExAngle;
             RHalfAngle.Text   = rParams.HalfAngle;
             RMinAz.Text       = rParams.MinAz;
             RMaxAz.Text       = rParams.MaxAz;
             RName.Text        = sensors[SensorList.SelectedIndex].SensorName;
         }
         _onMenuSwitch = false;
     }
 }
        private void AddFacility_Click(object sender, EventArgs e)
        {
            FcFacility facility = new FcFacility();

            facility.Name      = "New_Facility";
            facility.Latitude  = "0";
            facility.Longitude = "0";
            facility.Altitude  = "0";
            facility.Type      = "Optical";
            facility.IsOpt     = true;
            RadarParams rParams = new RadarParams();

            rParams.MinEl        = "0";
            rParams.MaxEl        = "90";
            rParams.MinRange     = "1600";
            rParams.MaxRange     = "40000";
            rParams.SolarExAngle = "10";
            rParams.HalfAngle    = "85";
            facility.RParams     = rParams;
            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";
            facility.OParams        = oParams;
            facility.UseDefaultCnst = true;
            CurFacilityList.Add(facility);
            PopulateCadance();
            CadanceList.FocusedItem = CadanceList.Items[CadanceList.Items.Count - 1];
            PopulateNumSensors();
        }
예제 #3
0
        private void AddFacility_Click(object sender, EventArgs e)
        {
            FcFacility facility = new FcFacility();
            FCSensor   sensor   = new FCSensor();

            facility.Name = "New_Facility";
            bool exists = CommonData.StkRoot.ObjectExists("Facility/Sensor1");

            if (exists)
            {
                for (int i = 0; i < 99; i++)
                {
                    exists = CommonData.StkRoot.ObjectExists("Facility/Sensor" + i.ToString());
                    if (!exists)
                    {
                        sensor.SensorName = "Sensor" + i.ToString();
                        break;
                    }
                }
            }
            else
            {
                sensor.SensorName = "Sensor1";
            }
            facility.Latitude  = "0";
            facility.Longitude = "0";
            facility.Altitude  = "0";
            facility.Type      = "Optical";
            facility.IsOpt     = true;
            RadarParams rParams = new RadarParams();

            rParams.MinEl        = "0";
            rParams.MaxEl        = "90";
            rParams.MinRange     = "300";
            rParams.MaxRange     = "40000";
            rParams.SolarExAngle = "10";
            rParams.HalfAngle    = "85";
            rParams.MinAz        = "0";
            rParams.MaxAz        = "360";
            sensor.RParams       = rParams;
            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";
            oParams.MinAz           = "0";
            oParams.MaxAz           = "360";
            sensor.OParams          = oParams;
            facility.UseDefaultCnst = true;
            facility.Sensors.Add(sensor);
            CurFacilityList.Add(facility);
            PopulateCadance();
            CadanceList.FocusedItem = CadanceList.Items[CadanceList.Items.Count - 1];
            PopulateNumSensors();
        }
 private void DefineConstraints_Click(object sender, EventArgs e)
 {
     if (SensorType.SelectedIndex == 0)
     {
         if (CurFacilityList[CadanceList.FocusedItem.Index].OParams == null)
         {
             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";
             CurFacilityList[CadanceList.FocusedItem.Index].OParams = oParams;
         }
         ChangeConstraintsForm form = new ChangeConstraintsForm(CurFacilityList[CadanceList.FocusedItem.Index].OParams);
         var result = form.ShowDialog();
         if (result == DialogResult.OK)
         {
             CurFacilityList[CadanceList.FocusedItem.Index].OParams.HalfAngle    = form.OParams.HalfAngle;
             CurFacilityList[CadanceList.FocusedItem.Index].OParams.LunarExAngle = form.OParams.LunarExAngle;
             CurFacilityList[CadanceList.FocusedItem.Index].OParams.MinEl        = form.OParams.MinEl;
             CurFacilityList[CadanceList.FocusedItem.Index].OParams.MaxEl        = form.OParams.MaxEl;
             CurFacilityList[CadanceList.FocusedItem.Index].OParams.MinRange     = form.OParams.MinRange;
             CurFacilityList[CadanceList.FocusedItem.Index].OParams.MaxRange     = form.OParams.MaxRange;
             CurFacilityList[CadanceList.FocusedItem.Index].OParams.SunElAngle   = form.OParams.SunElAngle;
         }
     }
     else if (SensorType.SelectedIndex == 1)
     {
         if (CurFacilityList[CadanceList.FocusedItem.Index].RParams == null)
         {
             RadarParams rParams = new RadarParams();
             rParams.MinEl        = "0";
             rParams.MaxEl        = "90";
             rParams.MinRange     = "1600";
             rParams.MaxRange     = "40000";
             rParams.SolarExAngle = "10";
             rParams.HalfAngle    = "85";
             CurFacilityList[CadanceList.FocusedItem.Index].RParams = rParams;
         }
         ChangeConstraintsForm form = new ChangeConstraintsForm(CurFacilityList[CadanceList.FocusedItem.Index].RParams);
         var result = form.ShowDialog();
         if (result == DialogResult.OK)
         {
             CurFacilityList[CadanceList.FocusedItem.Index].RParams.HalfAngle    = form.RParams.HalfAngle;
             CurFacilityList[CadanceList.FocusedItem.Index].RParams.SolarExAngle = form.RParams.SolarExAngle;
             CurFacilityList[CadanceList.FocusedItem.Index].RParams.MinEl        = form.RParams.MinEl;
             CurFacilityList[CadanceList.FocusedItem.Index].RParams.MaxEl        = form.RParams.MaxEl;
             CurFacilityList[CadanceList.FocusedItem.Index].RParams.MinRange     = form.RParams.MinRange;
             CurFacilityList[CadanceList.FocusedItem.Index].RParams.MaxRange     = form.RParams.MaxRange;
         }
     }
 }
예제 #5
0
        private void AddSensor_Click(object sender, EventArgs e)
        {
            FCSensor newSensor = new FCSensor();
            bool     exists    = SensorList.Items.Contains("Sensor1");

            if (exists)
            {
                for (int i = 0; i < 99; i++)
                {
                    exists = SensorList.Items.Contains("Sensor" + i.ToString());
                    if (!exists)
                    {
                        newSensor.SensorName = "Sensor" + i.ToString();
                        break;
                    }
                }
            }
            else
            {
                newSensor.SensorName = "Sensor1";
            }
            RadarParams rParams = new RadarParams();

            rParams.MinEl        = "0";
            rParams.MaxEl        = "90";
            rParams.MinRange     = "300";
            rParams.MaxRange     = "40000";
            rParams.SolarExAngle = "10";
            rParams.HalfAngle    = "85";
            rParams.MinAz        = "0";
            rParams.MaxAz        = "360";
            rParams.Az           = "0";
            rParams.El           = "90";
            newSensor.RParams    = rParams;
            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";
            oParams.MinAz        = "0";
            oParams.MaxAz        = "360";
            oParams.Az           = "0";
            oParams.El           = "90";
            newSensor.OParams    = oParams;

            sensors.Add(newSensor);
            SensorList.Items.Add(newSensor.SensorName);
            SensorList.SelectedIndex = SensorList.Items.Count - 1;
        }
예제 #6
0
 public ChangeConstraintsForm(OpticalParams oParams)
 {
     InitializeComponent();
     OParams = new OpticalParams();
     OpticalControlPanel.Visible = true;
     OpticalControlPanel.Enabled = true;
     RadarControlPanel.Visible   = false;
     RadarControlPanel.Enabled   = false;
     MinRange.Text   = oParams.MinRange;
     MaxRange.Text   = oParams.MaxRange;
     MinEl.Text      = oParams.MinEl;
     MaxEl.Text      = oParams.MaxEl;
     LunExAngle.Text = oParams.LunarExAngle;
     MaxSunEl.Text   = oParams.SunElAngle;
     HalfAngle.Text  = oParams.HalfAngle;
 }
예제 #7
0
 public ChangeConstraintsForm(List <FCSensor> sensorList, bool isOpt)
 {
     InitializeComponent();
     sensors = new List <FCSensor>();
     foreach (var sensor in sensorList)
     {
         _onMenuSwitch = true;
         sensors.Add(new FCSensor(sensor));
         SensorList.Items.Add(sensor.SensorName);
         if (isOpt)
         {
             opt = true;
             OpticalControlPanel.Visible = true;
             OpticalControlPanel.Enabled = true;
             RadarControlPanel.Visible   = false;
             RadarControlPanel.Enabled   = false;
             OpticalParams oParams = sensor.OParams;
             MinRange.Text   = oParams.MinRange;
             MaxRange.Text   = oParams.MaxRange;
             MinEl.Text      = oParams.MinEl;
             MaxEl.Text      = oParams.MaxEl;
             LunExAngle.Text = oParams.LunarExAngle;
             MaxSunEl.Text   = oParams.SunElAngle;
             HalfAngle.Text  = oParams.HalfAngle;
             MinAz.Text      = oParams.MinAz;
             MaxAz.Text      = oParams.MaxAz;
         }
         else
         {
             opt = false;
             OpticalControlPanel.Visible = false;
             OpticalControlPanel.Enabled = false;
             RadarControlPanel.Visible   = true;
             RadarControlPanel.Enabled   = true;
         }
         if (SensorList.Items.Count != 0)
         {
             SensorList.SelectedIndex = 0;
         }
     }
     _onMenuSwitch = false;
 }
        public static IAgStkObject AttachFacilityOptical(IAgStkObject parent, string radarName, OpticalParams rParams)
        {
            IAgStkObject sensorObj = CreatorFunctions.GetCreateSensor(parent, radarName);
            IAgSensor    sensor    = sensorObj as IAgSensor;

            sensor.Graphics.IsObjectGraphicsVisible = false;
            IAgSnSimpleConicPattern pattern = sensor.Pattern as IAgSnSimpleConicPattern;

            pattern.ConeAngle = Double.Parse(rParams.HalfAngle);
            IAgSnPtFixed pointing = sensor.Pointing as IAgSnPtFixed;

            pointing.Orientation.AssignAzEl(Double.Parse(rParams.Az), Double.Parse(rParams.El), AGI.STKUtil.AgEAzElAboutBoresight.eAzElAboutBoresightRotate);

            IAgAccessConstraintCollection constraints = sensor.AccessConstraints;
            IAgAccessCnstrMinMax          elConstraint;
            IAgAccessCnstrMinMax          azConstraint;
            IAgAccessCnstrMinMax          rangeConstraint;
            IAgAccessCnstrMinMax          sunElConstraint;
            IAgAccessCnstrAngle           lunExConstraint;

            elConstraint = CreatorFunctions.GetElCnst(constraints);
            CreatorFunctions.SetCnstMinMax(elConstraint, Double.Parse(rParams.MinEl), Double.Parse(rParams.MaxEl));
            azConstraint = CreatorFunctions.GetAzCnst(constraints);
            CreatorFunctions.SetCnstMinMax(azConstraint, Double.Parse(rParams.MinAz), Double.Parse(rParams.MaxAz));

            sunElConstraint = CreatorFunctions.GetSunElCnst(constraints);
            CreatorFunctions.SetCnstMinMax(sunElConstraint, -90, Double.Parse(rParams.SunElAngle));

            rangeConstraint = CreatorFunctions.GetRangeCnst(constraints);
            CreatorFunctions.SetCnstMinMax(rangeConstraint, Double.Parse(rParams.MinRange), Double.Parse(rParams.MaxRange));

            lunExConstraint       = CreatorFunctions.GetLunExCnst(constraints);
            lunExConstraint.Angle = rParams.LunarExAngle;

            SetOpticalGraphics(sensor);

            return(sensorObj);
        }
        private void GenerateSingle_Click(object sender, EventArgs e)
        {
            Tuple <int, string> check = FieldCheck();

            if (check.Item1 == 0)
            {
                if (ManualInput.Checked)
                {
                    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";
                            oParams.MinAz        = "0";
                            oParams.MaxAz        = "360";
                            sensor = FacilityCreatorFunctions.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";
                            rParams.MinAz        = "0";
                            rParams.MaxAz        = "360";
                            sensor = FacilityCreatorFunctions.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 if (ImportFromFile.Checked)
                {
                    if (!String.IsNullOrEmpty(FilenameText.Text))
                    {
                        IAgStkObject          facObj;
                        IAgFacility           fac;
                        IAgStkObject          sensor;
                        List <GroundLocation> locations = ReadWrite.ReadFacilityFile(FilenameText.Text);
                        foreach (GroundLocation loc in locations)
                        {
                            facObj = CreatorFunctions.GetCreateFacility(loc.LocationName);
                            fac    = facObj as IAgFacility;
                            sensor = null;
                            fac.Position.AssignGeodetic(loc.Latitude, loc.Longitude, loc.Altitude);
                            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";
                                oParams.MinAz        = "0";
                                oParams.MaxAz        = "360";
                                sensor = FacilityCreatorFunctions.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";
                                rParams.MinAz        = "0";
                                rParams.MaxAz        = "360";
                                sensor = FacilityCreatorFunctions.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);
                                }
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("Please choose a valid input file");
                    }
                }
            }
            else
            {
                MessageBox.Show(check.Item2);
            }
        }
        private void GenerateSingle_Click(object sender, EventArgs e)
        {
            Tuple <int, string> check = FieldCheck();

            if (check.Item1 == 0)
            {
                if (ManualInput.Checked)
                {
                    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";
                            oParams.MinAz        = "0";
                            oParams.MaxAz        = "360";
                            sensor = FacilityCreatorFunctions.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";
                            rParams.MinAz        = "0";
                            rParams.MaxAz        = "360";
                            sensor = FacilityCreatorFunctions.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 if (ImportFromFile.Checked)
                {
                    if (!String.IsNullOrEmpty(FilenameText.Text))
                    {
                        SensorCadance cad = new SensorCadance();
                        cad.FacilityList = new List <FcFacility>();
                        cad.CadenceColor = "Custom";
                        cad.Name         = "NewCadence";
                        IAgStkObject          facObj;
                        IAgFacility           fac;
                        IAgStkObject          sensor;
                        List <GroundLocation> locations = null;
                        if (FilenameText.Text.Contains(".json"))
                        {
                            try
                            {
                                List <SensorCadance> tempCadences = ReadWrite.ReadCadences(FilenameText.Text);
                                if (SaveData.Checked)
                                {
                                    foreach (var item in tempCadences)
                                    {
                                        CommonData.Cadences.Add(item);
                                    }
                                    ReadWrite.WriteCadenceDatabase();
                                    PopulateCadanceList();
                                }
                            }
                            catch (Exception)
                            {
                                MessageBox.Show("Json Error");
                            }
                        }
                        else
                        {
                            locations = ReadWrite.ReadFacilityFile(FilenameText.Text);
                            foreach (GroundLocation loc in locations)
                            {
                                FcFacility fcFac = new FcFacility();
                                fcFac.Name      = loc.LocationName;
                                fcFac.Latitude  = loc.Latitude.ToString();
                                fcFac.Longitude = loc.Longitude.ToString();
                                fcFac.Altitude  = loc.Altitude.ToString();
                                facObj          = CreatorFunctions.GetCreateFacility(loc.LocationName);
                                fac             = facObj as IAgFacility;
                                sensor          = null;
                                fac.Position.AssignGeodetic(loc.Latitude, loc.Longitude, loc.Altitude);
                                fac.AltRef = AgEAltRefType.eWGS84;

                                FCSensor fcSensor = new FCSensor();
                                fcSensor.SensorName = loc.LocationName + "_Opt";
                                if (SensorType.SelectedIndex == 0 || SensorType.SelectedIndex == 1)
                                {
                                    OpticalParams oParams = new OpticalParams();
                                    cad.Type             = "Opt";
                                    cad.NumOptical       = locations.Count;
                                    cad.NumRadars        = 0;
                                    fcFac.Type           = "Optical";
                                    fcFac.IsOpt          = true;
                                    oParams.MinEl        = "0";
                                    oParams.MaxEl        = "90";
                                    oParams.MinRange     = "4800";
                                    oParams.MaxRange     = "90000";
                                    oParams.LunarExAngle = "10";
                                    oParams.SunElAngle   = "-12";
                                    oParams.HalfAngle    = "70";
                                    oParams.MinAz        = "0";
                                    oParams.MaxAz        = "360";
                                    oParams.Az           = "0";
                                    oParams.El           = "90";
                                    fcSensor.OParams     = oParams;
                                    if (SensorType.SelectedIndex == 1)
                                    {
                                        sensor = FacilityCreatorFunctions.AttachFacilityOptical(facObj, loc.LocationName + "_Opt", oParams);
                                    }
                                }
                                else if (SensorType.SelectedIndex == 2)
                                {
                                    RadarParams rParams = new RadarParams();
                                    fcSensor.SensorName  = loc.LocationName + "_Rad";
                                    cad.Type             = "Rad";
                                    cad.NumOptical       = 0;
                                    cad.NumRadars        = locations.Count;
                                    fcFac.Type           = "Radar";
                                    fcFac.IsOpt          = false;
                                    rParams.MinEl        = "0";
                                    rParams.MaxEl        = "90";
                                    rParams.MinRange     = "1600";
                                    rParams.MaxRange     = "40000";
                                    rParams.SolarExAngle = "10";
                                    rParams.HalfAngle    = "85";
                                    rParams.MinAz        = "0";
                                    rParams.MaxAz        = "360";
                                    rParams.Az           = "0";
                                    rParams.El           = "90";
                                    fcSensor.RParams     = rParams;
                                    sensor = FacilityCreatorFunctions.AttachFacilityRadar(facObj, loc.LocationName + "_Radar", rParams);
                                }
                                else
                                {
                                }
                                fcFac.Sensors.Add(fcSensor);
                                cad.FacilityList.Add(fcFac);
                                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);
                                    }
                                }
                            }
                            if (SaveData.Checked)
                            {
                                CommonData.Cadences.Add(cad);
                                ReadWrite.WriteCadenceDatabase();
                                PopulateCadanceList();
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("Please choose a valid input file");
                    }
                }
            }
            else
            {
                MessageBox.Show(check.Item2);
            }
        }
        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);
            }
        }
예제 #12
0
 public FCSensor(FCSensor sensor)
 {
     RParams    = new RadarParams(sensor.RParams);
     OParams    = new OpticalParams(sensor.OParams);
     SensorName = sensor.SensorName;
 }