Beispiel #1
0
        public NewGroundEventForm()
        {
            InitializeComponent();
            _contactEvent       = new GroundEvent();
            ManualSSR.Checked   = true;
            SSRFromFile.Checked = false;
            FileText.Enabled    = false;
            Browse.Enabled      = false;

            foreach (var type in CommonData.Preferences.EventTypeList)
            {
                TypeSelect.Items.Add(type);
            }
            TypeSelect.SelectedIndex = 0;

            IAgScenario scenario = (IAgScenario)CommonData.StkRoot.CurrentScenario;

            StartTimeText.Text   = scenario.StartTime;
            StopTimeText.Text    = scenario.StopTime;
            ImportActive.Checked = true;
            IDText.Text          = "NewEvent";
            Latitude.Text        = "0";
            Longitude.Text       = "0";
            CountryText.Text     = "Global";

            foreach (string c in Enum.GetNames(typeof(CustomUserInterface.ColorOptions)))
            {
                ColorSelection.Items.Add(c);
                SheetColor.Items.Add(c);
            }
            ColorSelection.SelectedIndex = 0;
            SheetColor.SelectedIndex     = 0;
        }
        private void CreateButton_Click(object sender, EventArgs e)
        {
            if (ManualSSR.Checked)
            {
                int fieldCheck = FieldCheck();
                if (fieldCheck == 0)
                {
                    GroundEvent current = new GroundEvent();
                    current.Id = IDText.Text;
                    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;

                    CommonData.CurrentEvents.Add(current);
                    GroundEventFunctions.CreateGroundEvent(current);
                    ReadWrite.WriteEventFile(CommonData.EventFileStr);
                }
                CommonData.NewSsrCreated = true;
            }
            else if(SSRFromFile.Checked)
            {
                int importOption = 0;
                if (ImportAll.Checked)
                {
                    importOption = 1;
                }
                ReadWrite.ImportEventSheet(FileText.Text, importOption);
                CommonData.NewSsrCreated = true;
            }
            this.Close();
        }
        //Uses a satellite object to create a time component if AWB is not available
        public static void CreateTimelineComponentNoAwb(GroundEvent currentGroundEvent)
        {
            IAgSatellite sat;
            string       mes     = null;
            bool         error   = false;
            string       satName = "z" + currentGroundEvent.Id + "-TimelineObject";

            try
            {
                string cmd1 = "Timeline * TimeComponent Remove ContentView \"Event_Timeline\" \"Satellite/" + satName + " AvailabilityTimeSpan Interval\"";
                CommonData.StkRoot.ExecuteCommand(cmd1);
            }
            catch (Exception)
            {
            }

            IAgExecCmdResult result = CommonData.StkRoot.ExecuteCommand("DoesObjExist / */Satellite/" + satName);

            if (result[0] == "0")
            {
                sat = CommonData.StkRoot.CurrentScenario.Children.New(AgESTKObjectType.eSatellite, satName) as IAgSatellite;
            }
            else
            {
                sat = CommonData.StkRoot.GetObjectFromPath("Satellite/" + satName) as IAgSatellite;
            }
            try
            {
                ((IAgSatellite)sat).SetPropagatorType(AgEVePropagatorType.ePropagatorJ2Perturbation);
                IAgVePropagatorJ2Perturbation prop = sat.Propagator as IAgVePropagatorJ2Perturbation;
                prop.EphemerisInterval.SetExplicitInterval(currentGroundEvent.StartTime, currentGroundEvent.StopTime);
                prop.Propagate();
            }
            catch (Exception)
            {
                error = true;
                mes   = "Error with " + currentGroundEvent.Id + ": Could not update or create time component- Error with Start or Stop Time";
            }

            sat.Graphics.IsObjectGraphicsVisible = false;
            try
            {
                string cmd = "Timeline * TimeComponent Add ContentView \"Event_Timeline\" DisplayName \"" + currentGroundEvent.Id + "-Interval\" \"Satellite/" + satName + " AvailabilityTimeSpan Interval\"";
                CommonData.StkRoot.ExecuteCommand(cmd);
            }
            catch (Exception)
            {
                error = true;
                mes   = "Error with " + currentGroundEvent.Id + ": Could not update or create time component- Error with Start or Stop Time";
            }
            CommonData.StkRoot.ExecuteCommand("Timeline * Refresh");
            if (error)
            {
                MessageBox.Show(mes);
            }
        }
        public static void RemoveTimelineComponentNoAwb(GroundEvent currentGroundEvent)
        {
            string satName = "z" + currentGroundEvent.Id + "-TimelineObject";

            try
            {
                IAgStkObject sat = CommonData.StkRoot.GetObjectFromPath("Satellite/" + satName);
                sat.Unload();
            }
            catch (Exception)
            {
            }
        }
        public static int GetImageIndex(GroundEvent currentGroundEvent)
        {
            int index = -1;

            for (int i = 0; i < CommonData.Preferences.EventTypeList.Count; i++)
            {
                if (currentGroundEvent.SsrType.Contains(CommonData.Preferences.EventTypeList[i]))
                {
                    index = i;
                }
            }

            return(index);
        }
        public static void CreateTimelineComponent(GroundEvent currentGroundEvent)
        {
            IAgStkObject place = CommonData.StkRoot.GetObjectFromPath("Place/" + currentGroundEvent.Id);

            if (!place.Vgt.EventIntervals.Contains(currentGroundEvent.Id + "-Interval"))
            {
                IAgCrdnEventInterval      interval     = place.Vgt.EventIntervals.Factory.CreateEventIntervalFixed(currentGroundEvent.Id + "-Interval", "");
                IAgCrdnEventIntervalFixed fixedInstant = interval as IAgCrdnEventIntervalFixed;
                fixedInstant.SetInterval(currentGroundEvent.StartTime, currentGroundEvent.StopTime);
            }
            string cmd = "Timeline * TimeComponent Add ContentView \"Event_Timeline\" DisplayName \"" + currentGroundEvent.Id + "-Interval\"" + " \"Place/" + currentGroundEvent.Id + " " + currentGroundEvent.Id + "-Interval Interval\"";

            CommonData.StkRoot.ExecuteCommand(cmd);
            CommonData.StkRoot.ExecuteCommand("Timeline * Refresh");
        }
Beispiel #7
0
 public ContactInfoForm(GroundEvent groundEvent)
 {
     InitializeComponent();
     contactEvent = new GroundEvent();
     if (!String.IsNullOrEmpty(groundEvent.Poc))
     {
         POCName.Text = groundEvent.Poc;
     }
     if (!String.IsNullOrEmpty(groundEvent.PocPhone))
     {
         POCPhone.Text = groundEvent.PocPhone;
     }
     if (!String.IsNullOrEmpty(groundEvent.PocEmail))
     {
         POCEmail.Text = groundEvent.PocEmail;
     }
 }
        public static void RemoveTimelineComponent(GroundEvent currentGroundEvent)
        {
            IAgStkObject place = CommonData.StkRoot.GetObjectFromPath("Place/" + currentGroundEvent.Id);
            IAgCrdnEventIntervalGroup intervals = place.Vgt.EventIntervals;

            if (!intervals.Contains(currentGroundEvent.Id + "-Interval"))
            {
                return;
            }
            try
            {
                intervals.Remove(currentGroundEvent.Id + "-Interval");
            }
            catch (Exception)
            {
                // ignored
            }
        }
        public static void CreateSubObject(GroundEvent currentGroundEvent, SubObject currentSub)
        {
            string           placeName = currentGroundEvent.Id + "-" + currentSub.Name;
            IAgPlace         place;
            IAgExecCmdResult result = CommonData.StkRoot.ExecuteCommand("DoesObjExist / */Place/" + placeName);

            if (result[0] == "0")
            {
                place = CommonData.StkRoot.CurrentScenario.Children.New(AgESTKObjectType.ePlace, placeName) as IAgPlace;
            }
            else
            {
                place = CommonData.StkRoot.GetObjectFromPath("Place/" + placeName) as IAgPlace;
            }
            place.Position.AssignGeodetic(Double.Parse(currentSub.Latitude), Double.Parse(currentSub.Longitude), 0);
            string filePath = GetImagePath(currentSub.Type);
            string cmd      = "VO */Place/" + placeName + " marker show on markertype imagefile imagefile \"" + filePath + "\" Transparent Off Size 32";

            if (filePath != null)
            {
                try
                {
                    CommonData.StkRoot.ExecuteCommand(cmd);
                }
                catch (Exception)
                {
                    MessageBox.Show("Could not update image. Check image file path in settings");
                }
            }
            string zoom = currentSub.ZoomLevel + "000";

            try
            {
                cmd = "VO */Place/" + placeName + " ModelDetail Set ModelLabel " + zoom + " MarkerLabel " + zoom + " Marker " + zoom + " Point " + zoom;
                CommonData.StkRoot.ExecuteCommand(cmd);
            }
            catch (Exception)
            {
                string mes = "Could not Modify Zoom for SubObject";
                MessageBox.Show(mes);
            }
        }
        public static void CreateGroundEvent(GroundEvent currentGroundEvent)
        {
            IAgPlace         place;
            IAgExecCmdResult result = CommonData.StkRoot.ExecuteCommand("DoesObjExist / */Place/" + currentGroundEvent.Id);

            if (result[0] == "0")
            {
                place = CommonData.StkRoot.CurrentScenario.Children.New(AgESTKObjectType.ePlace, currentGroundEvent.Id) as IAgPlace;
            }
            else
            {
                place = CommonData.StkRoot.GetObjectFromPath("Place/" + currentGroundEvent.Id) as IAgPlace;
            }
            place.Position.AssignGeodetic(Double.Parse(currentGroundEvent.Latitude), Double.Parse(currentGroundEvent.Longitude), 0);
            string filePath = GetImagePath(currentGroundEvent.SsrType);
            string cmd      = "VO */Place/" + currentGroundEvent.Id + " marker show on markertype imagefile imagefile \"" + filePath + "\" Transparent Off Size 32";

            if (filePath != null)
            {
                try
                {
                    CommonData.StkRoot.ExecuteCommand(cmd);
                }
                catch (Exception)
                {
                    MessageBox.Show("Could not update image. Check image file path in settings");
                }
            }
            if (currentGroundEvent.StartTime == "Unspecified" || currentGroundEvent.StopTime == "Unspecified")
            {
            }
            else
            {
                CreateTimelineComponent(currentGroundEvent);
            }
        }
Beispiel #11
0
        public EditForm()
        {
            InitializeComponent();
            _contactEvent      = new GroundEvent();
            IDText.Text        = CommonData.CurrentEvents[CommonData.EventSelectedIndex].Id;
            CountryText.Text   = CommonData.CurrentEvents[CommonData.EventSelectedIndex].Country;
            Latitude.Text      = CommonData.CurrentEvents[CommonData.EventSelectedIndex].Latitude;
            Longitude.Text     = CommonData.CurrentEvents[CommonData.EventSelectedIndex].Longitude;
            StartTimeText.Text = CommonData.CurrentEvents[CommonData.EventSelectedIndex].StartTime;
            StopTimeText.Text  = CommonData.CurrentEvents[CommonData.EventSelectedIndex].StopTime;
            if (!String.IsNullOrEmpty(CommonData.CurrentEvents[CommonData.EventSelectedIndex].Poc))
            {
                _contactEvent.Poc = CommonData.CurrentEvents[CommonData.EventSelectedIndex].Poc;
            }
            if (!String.IsNullOrEmpty(CommonData.CurrentEvents[CommonData.EventSelectedIndex].PocPhone))
            {
                _contactEvent.PocPhone = CommonData.CurrentEvents[CommonData.EventSelectedIndex].PocPhone;
            }
            if (!String.IsNullOrEmpty(CommonData.CurrentEvents[CommonData.EventSelectedIndex].PocEmail))
            {
                _contactEvent.PocPhone = CommonData.CurrentEvents[CommonData.EventSelectedIndex].PocEmail;
            }
            //Populate description if not null
            if (CommonData.CurrentEvents[CommonData.EventSelectedIndex].Description != null)
            {
                DesciptionText.Text = CommonData.CurrentEvents[CommonData.EventSelectedIndex].Description;
            }
            //Select correct index for Type ComboBox
            foreach (var type in CommonData.Preferences.EventTypeList)
            {
                TypeSelect.Items.Add(type);
            }
            int index = GroundEventFunctions.GetImageIndex(CommonData.CurrentEvents[CommonData.EventSelectedIndex]);

            TypeSelect.SelectedIndex = index;
        }
Beispiel #12
0
        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();
        }
Beispiel #13
0
 public ContactInfoForm()
 {
     InitializeComponent();
     contactEvent = new GroundEvent();
 }