Example #1
0
        public static void SetAnalysisIntervalFromTCA(string tcaISOYMD)
        {
            tcaISOYMD = ValidateDateFormat(tcaISOYMD);
            IAgDate tca = Root.ConversionUtility.NewDate("ISO-YMD", tcaISOYMD);

            Scenario.AnalysisInterval.SetStartAndStopTimes(tca.Subtract("day", 1).Format("ISO-YMD"), tca.Add("day", 1).Format("ISO-YMD"));
            SetAnimationTime(tcaISOYMD, "ISO-YMD");
        }
Example #2
0
        public static void SetAnimationTime(string time, string format)
        {
            IAgDate animDate = null;
            double  epochSeconds;

            try
            {
                animDate     = Root.ConversionUtility.NewDate(format, time);
                epochSeconds = Convert.ToDouble(animDate.Format("epsec"));
            }
            catch
            {
                throw new Exception("Invalid date definition: " + time + " " + format);
            }

            (Root as AgStkObjectRoot).CurrentTime = epochSeconds;
        }
        public static GraphPane CreateGraph(string title, string tcaISOYMD, Graphics g, PointPairList[] points, string[] pointListNames, TextObj[] comments, bool isDashedLine = false)
        {
            ColorCounter = -1;
            GraphPane graph;

            if (!string.IsNullOrEmpty(tcaISOYMD))
            {
                IAgDate tca = StkAssistant.Root.ConversionUtility.NewDate("ISO-YMD", tcaISOYMD);
                graph = NewBlankGraph(tca.Subtract("day", 1).Format("ISO-YMD"), tca.Add("day", 1).Format("ISO-YMD"), title);
            }
            else
            {
                graph = NewBlankGraph(null, null, title);
            }

            graph.Legend.IsVisible = true;
            graph.Legend.Draw(g, graph, .75f);
            foreach (TextObj comment in comments)
            {
                graph.GraphObjList.Add(comment);
            }
            for (int i = 0; i < points.Length; i++)
            {
                LineItem newCurve = new LineItem(pointListNames[i], points[i], NextColor, isDashedLine ? NextSymbol : SymbolType.None, isDashedLine ? 2.0f : 5.0f);
                newCurve.Line.Style = isDashedLine ? System.Drawing.Drawing2D.DashStyle.Dash : System.Drawing.Drawing2D.DashStyle.Solid;
                graph.CurveList.Add(newCurve);
            }

            graph.AxisChange(g);

            if (!string.IsNullOrEmpty(tcaISOYMD))
            {
                PointPairList tcaLine = new PointPairList();
                tcaLine.Add(StkAssistant.ParseISOYMD(tcaISOYMD).ToOADate(), graph.YAxis.Scale.Min);
                tcaLine.Add(StkAssistant.ParseISOYMD(tcaISOYMD).ToOADate(), graph.YAxis.Scale.Max);
                graph.AddCurve("", tcaLine, Color.Black);
            }

            //graph.GetImage().Save(path, ImageFormat.Png);

            return(graph);
        }
Example #4
0
        public static RICResults GetRICDifferenceOverTime(string sat1Path, string sat2Path, string epochISOYMD)
        {
            IAgDate tca = StkAssistant.Root.ConversionUtility.NewDate("ISO-YMD", epochISOYMD);

            IAgStkObject primary, secondary;

            try
            {
                primary   = StkAssistant.Root.GetObjectFromPath(sat1Path);
                secondary = StkAssistant.Root.GetObjectFromPath(sat2Path);
            }
            catch
            {
                return(new RICResults());
            }

            double period1 = StkAssistant.GetSatellitePeriod(primary.Path, epochISOYMD);
            double period2 = StkAssistant.GetSatellitePeriod(secondary.Path, epochISOYMD);

            double period = (period1 + period2) / 2;

            IAgDataProviderInfo dpInfo = primary.DataProviders["RIC Coordinates"];

            IAgDataProvider dataProvider = primary.DataProviders["RIC Coordinates"] as IAgDataProvider;

            dataProvider.PreData = secondary.Path.Replace(StkAssistant.Root.CurrentScenario.Path, "");
            IAgDataPrvTimeVar dpTimeVarying = dataProvider as IAgDataPrvTimeVar;
            Array             elements      = new object[] { "Time", "Radial", "In-Track", "Cross-Track", "Range" };
            IAgDrResult       dpResult      = dpTimeVarying.ExecElements(
                tca.Subtract("sec", .5 * period).Format("ISO-YMD"),
                tca.Add("sec", .5 * period).Format("ISO-YMD"),
                10, elements);
            RICResults ricResults = new RICResults();

            foreach (IAgDrDataSet dataset in dpResult.DataSets)
            {
                if (dataset.ElementName.Equals("Time"))
                {
                    List <string> times = new List <string>();
                    foreach (object item in dataset.GetValues())
                    {
                        times.Add(item.ToString());
                    }
                    ricResults.Times = times.ToArray();
                }
                else
                {
                    List <double> values = new List <double>();
                    foreach (object item in dataset.GetValues())
                    {
                        values.Add((double)item);
                    }

                    switch (dataset.ElementName)
                    {
                    case "Radial":
                        ricResults.R = values.ToArray();
                        break;

                    case "In-Track":
                        ricResults.I = values.ToArray();
                        break;

                    case "Cross-Track":
                        ricResults.C = values.ToArray();
                        break;

                    case "Range":
                        ricResults.Range = values.ToArray();
                        break;

                    default:
                        break;
                    }
                }
            }

            return(ricResults);
        }