コード例 #1
0
            private static string Abbreviation(FrameType type, CelestialBody selected)
            {
                switch (type)
                {
                case FrameType.BODY_CENTRED_NON_ROTATING:
                    return(L10N.CelestialStringOrNull(
                               "#Principia_ReferenceFrameSelector_Abbreviation_BodyCentredNonRotating",
                               new[] { selected }));

                case FrameType.BARYCENTRIC_ROTATING:
                    return("DEPRECATED");

                case FrameType.BODY_CENTRED_PARENT_DIRECTION:
                    if (selected.is_root())
                    {
                        throw Log.Fatal(
                                  "Naming parent-direction rotating frame of root body");
                    }
                    else
                    {
                        return(L10N.CelestialStringOrNull(
                                   "#Principia_ReferenceFrameSelector_Abbreviation_BodyCentredParentDirection",
                                   new[] { selected, selected.referenceBody }));
                    }

                case FrameType.BODY_SURFACE:
                    return(L10N.CelestialStringOrNull(
                               "#Principia_ReferenceFrameSelector_Abbreviation_BodySurface",
                               new[] { selected }));

                default:
                    throw Log.Fatal("Unexpected type " + type.ToString());
                }
            }
コード例 #2
0
 private static string TargetFrameAbbreviation(Vessel target)
 {
     return(L10N.CelestialStringOrNull(
                "#Principia_ReferenceFrameSelector_Abbreviation_Target",
                new[] { target.orbit.referenceBody }));
 }
コード例 #3
0
 private static string TargetFrameNavballName(Vessel target)
 {
     return(TargetFrameAbbreviation(target) ?? L10N.CelestialStringOrNull(
                "#Principia_ReferenceFrameSelector_NavballName_Target",
                new[] { target.orbit.referenceBody }) ?? TargetFrameName(target));
 }
コード例 #4
0
ファイル: orbit_analyser.cs プロジェクト: pleroy/Principia
            public static string OrbitDescription(CelestialBody primary,
                                                  OrbitalElements?elements,
                                                  OrbitRecurrence?recurrence,
                                                  OrbitGroundTrack?ground_track,
                                                  int?nodal_revolutions)
            {
                if (!elements.HasValue)
                {
                    return(null);
                }
                string properties = "";
                bool   circular   = false;
                bool   equatorial = false;

                if (elements.Value.mean_eccentricity.max < 0.01)
                {
                    circular    = true;
                    properties +=
                        L10N.CacheFormat(
                            "#Principia_OrbitAnalyser_OrbitDescription_Circular");
                }
                else if (elements.Value.mean_eccentricity.min > 0.5)
                {
                    circular    = true;
                    properties +=
                        L10N.CacheFormat(
                            "#Principia_OrbitAnalyser_OrbitDescription_HighlyElliptical");
                }
                const double degree = Math.PI / 180;

                if (elements.Value.mean_inclination.max < 5 * degree ||
                    elements.Value.mean_inclination.min > 175 * degree)
                {
                    equatorial  = true;
                    properties +=
                        L10N.CacheFormat(
                            "#Principia_OrbitAnalyser_OrbitDescription_Equatorial");
                }
                else if (elements.Value.mean_inclination.min > 80 * degree &&
                         elements.Value.mean_inclination.max < 100 * degree)
                {
                    properties +=
                        L10N.CacheFormat("#Principia_OrbitAnalyser_OrbitDescription_Polar");
                }
                else if (elements.Value.mean_inclination.min > 90 * degree)
                {
                    properties +=
                        L10N.CacheFormat(
                            "#Principia_OrbitAnalyser_OrbitDescription_Retrograde");
                }
                if (recurrence.HasValue && ground_track.HasValue)
                {
                    Interval ascending_longitudes = ground_track.Value.equatorial_crossings.
                                                    longitudes_reduced_to_ascending_pass;
                    Interval descending_longitudes = ground_track.Value.equatorial_crossings.
                                                     longitudes_reduced_to_descending_pass;
                    double drift = Math.Max(
                        ascending_longitudes.max - ascending_longitudes.min,
                        descending_longitudes.max - descending_longitudes.min);
                    double revolutions_per_day =
                        (double)recurrence.Value.number_of_revolutions / recurrence.Value.cto;
                    double days = nodal_revolutions.Value / revolutions_per_day;
                    // We ignore 0 drift as it means that there was only one pass, which is
                    // insufficient to assess synchronicity.
                    if (drift > 0 && drift / days < 0.1 * degree)
                    {
                        if (recurrence.Value.cto == 1)
                        {
                            switch (recurrence.Value.nuo)
                            {
                            case 1:
                                if (circular && equatorial)
                                {
                                    var stationary_string = L10N.CelestialStringOrNull(
                                        "#Principia_OrbitAnalyser_OrbitDescription_Stationary",
                                        new[] { primary });
                                    if (stationary_string != null)
                                    {
                                        return(stationary_string);
                                    }
                                    properties = L10N.CacheFormat(
                                        "#Principia_OrbitAnalyser_OrbitDescription_Stationary");
                                }
                                else
                                {
                                    var synchronous_string = L10N.CelestialStringOrNull(
                                        "#Principia_OrbitAnalyser_OrbitDescription_Synchronous",
                                        new[] { primary },
                                        properties);
                                    if (synchronous_string != null)
                                    {
                                        return(synchronous_string);
                                    }
                                    properties += L10N.CacheFormat(
                                        "#Principia_OrbitAnalyser_OrbitDescription_Synchronous");
                                }
                                break;

                            case 2:
                                properties += L10N.CacheFormat(
                                    "#Principia_OrbitAnalyser_OrbitDescription_Semisynchronous");
                                break;

                            default:
                                break;
                            }
                        }
                    }
                }
                return(L10N.CelestialString("#Principia_OrbitAnalyser_OrbitDescription",
                                            new[] { primary },
                                            properties));
            }