Esempio n. 1
0
        // move the time
        private void moveButton_Click(object sender, EventArgs e)
        {
            // get time
            double days      = Convert.ToDouble(daysTextBox.Text);
            double hour      = Convert.ToDouble(hoursTextBox.Text);
            double mins      = Convert.ToDouble(minutesTextBox.Text);
            double secs      = Convert.ToDouble(secondsTextBox.Text);
            double totalSecs = days * 86400.0 + hour * 3600.0 + mins * 60.0 + secs;
            Int32  fullSecs  = Convert.ToInt32(Math.Floor(totalSecs));
            Int32  mSecs     = Convert.ToInt32((totalSecs - Math.Floor(totalSecs)) * 1000.0);

            TimeSpan timeShift          = new TimeSpan(0, 0, 0, fullSecs, mSecs);
            double   timeShiftDirection = 1.0;

            if (earlierRadioButton.Checked)
            {
                timeShiftDirection = -1.0;
            }

            // loop through all treenodes
            foreach (TreeNode thisNode in mtoTreeView.Nodes)
            {
                IAgMto thisMto = m_root.CurrentScenario.Children.GetElements(AgESTKObjectType.eMTO)[thisNode.Text] as IAgMto;

                foreach (TreeNode thisSubNode in thisNode.Nodes)
                {
                    if (thisSubNode.Checked)
                    {
                        // find associated track
                        foreach (IAgMtoTrack thisTrack in thisMto.Tracks)
                        {
                            if (thisTrack.Id.ToString() == thisSubNode.Text)
                            {
                                // loop through all points to copy out data
                                List <LLAPt> trackPts = new List <LLAPt>();
                                foreach (IAgMtoTrackPoint thisPoint in thisTrack.Points)
                                {
                                    trackPts.Add(new LLAPt(thisPoint.Time.ToString(), thisPoint.Latitude, thisPoint.Longitude, thisPoint.Altitude));
                                }

                                // remove all points
                                thisTrack.Points.RemoveAll();

                                // add points with new time
                                foreach (LLAPt thisPoint in trackPts)
                                {
                                    // compute new time
                                    string oldTime      = m_root.ConversionUtility.ConvertDate("UTCG", "EpSec", thisPoint.Time);
                                    double newTimeEpSec = Convert.ToDouble(oldTime) + totalSecs * timeShiftDirection;
                                    string newTimeUTCG  = m_root.ConversionUtility.ConvertDate("EpSec", "UTCG", newTimeEpSec.ToString());

                                    // add point again
                                    thisTrack.Points.AddPoint(newTimeUTCG, thisPoint.Latitude, thisPoint.Longitude, thisPoint.Altitude);
                                }
                            }
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        private void DisplayUI()
        {
            // clear all previous results
            mtoTreeView.Nodes.Clear();

            // check if scenario is loaded
            if (m_root.CurrentScenario == null)
            {
                MessageBox.Show("Please load a scenario.");
            }
            else
            {
                // get all MTOs
                IAgStkObjectElementCollection mtos = m_root.CurrentScenario.Children.GetElements(AgESTKObjectType.eMTO);

                if (mtos.Count > 0)
                {
                    foreach (IAgStkObject thisMto in mtos)
                    {
                        TreeNode thisNode = mtoTreeView.Nodes.Add(thisMto.InstanceName);
                        thisNode.Checked = true;

                        // get tracks
                        IAgMto thisRealMto = thisMto as IAgMto;
                        foreach (IAgMtoTrack thisTrack in thisRealMto.Tracks)
                        {
                            TreeNode thisSubNode = thisNode.Nodes.Add(thisTrack.Id.ToString());
                            thisSubNode.Checked = true;
                        }
                    }
                }
            }
        }
Esempio n. 3
0
        public static void CreateMto(AgStkObjectRoot root, List <PropagationResults> propResults)
        {
            try
            {
                IAgMto mto = root.CurrentScenario.Children.New(AgESTKObjectType.eMTO, "MTO") as IAgMto;
                IAgMtoTrackCollection trackCollection = mto.Tracks as IAgMtoTrackCollection;
                for (int i = 0; i < propResults.Count; i++)
                {
                    trackCollection.Add(i + 1);
                    IAgMtoTrack track = trackCollection[i];
                    track.Points.LoadPoints(propResults[i].EphemerisFilePath);
                    root.ExecuteCommand("Track */MTO/MTO Interpolate " + (i + 1).ToString() + " On");
                    root.ExecuteCommand("Track2d */MTO/MTO MarkerStyle " + (i + 1).ToString() + " Circle");

                    // show 2d marker
                    root.ExecuteCommand("Track2d */MTO/MTO ShowMarker " + (i + 1).ToString() + " On");
                    root.ExecuteCommand("Track2d */MTO/MTO Color " + (i + 1).ToString() + " Red");
                    root.ExecuteCommand("Track2d */MTO/MTO LineWidth " + (i + 1).ToString() + " 3");
                    mto.Graphics.Tracks[i].LeadTrailTimes.UseLeadTrail = true;
                    mto.Graphics.Tracks[i].LeadTrailTimes.LeadTime     = 0;
                    mto.Graphics.Tracks[i].LeadTrailTimes.TrailTime    = 300;
                    mto.Graphics.Tracks[i].FadeTimes.UsePostFade       = false;
                    mto.Graphics.Tracks[i].FadeTimes.UsePreFade        = true;
                    mto.Graphics.Tracks[i].FadeTimes.PreFadeTime       = 200;
                    // don't show 2d track
                    //root.ExecuteCommand("Track2d */MTO/MTO ShowLine " + (i + 1).ToString() + " Off");
                    root.ExecuteCommand("Track3d */MTO/MTO TranslucentTrackTrail " + (i + 1).ToString() + " On");
                    root.ExecuteCommand("Track3d */MTO/MTO Point " + (i + 1).ToString() + " Show On Size 15");
                    mto.VO.Tracks[i].Point.Size       = 10;
                    mto.VO.Tracks[i].Marker.PixelSize = 15;
                    //root.ExecuteCommand("VO */MTO/MTO Marker " + (i + 1).ToString() + " Size 12");
                }
            }
            catch (Exception)
            {
                throw new Exception();
            }
        }