コード例 #1
0
ファイル: PTGUI_Info.cs プロジェクト: sswelm/PersistentThrust
        private void InitializeModules()
        {
            modules = new List <IInfoModule>();

            peri = new Periapsis("Periapsis", currentVessel);
            apo  = new Apoapsis("Apoapsis", currentVessel);
            sma  = new SemiMajorAxis("Semi-Major Axis", currentVessel);
            ecc  = new Eccentricity("Eccentricity", currentVessel);
            inc  = new Inclination("Inclination", currentVessel);
            alt  = new Altitude("Current Altitude", currentVessel);
            vel  = new Velocity("Current Speed", currentVessel);
            acc  = new Acceleration("Current Acceleration", currentVessel);

            peri.IsVisible = PTGUI_Settings.Instance.showPeriapsis;
            apo.IsVisible  = PTGUI_Settings.Instance.showApoapsis;
            sma.IsVisible  = PTGUI_Settings.Instance.showSMA;
            ecc.IsVisible  = PTGUI_Settings.Instance.showApoapsis;
            inc.IsVisible  = PTGUI_Settings.Instance.showInclination;
            alt.IsVisible  = PTGUI_Settings.Instance.showAltitude;
            vel.IsVisible  = PTGUI_Settings.Instance.showVelocity;
            acc.IsVisible  = PTGUI_Settings.Instance.showAcceleration;

            modules.Add(peri);
            modules.Add(apo);
            modules.Add(sma);
            modules.Add(ecc);
            modules.Add(inc);
            modules.Add(alt);
            modules.Add(vel);
            modules.Add(acc);
        }
コード例 #2
0
        public virtual void SaveToXml(System.Xml.XmlTextWriter xmlWriter)
        {
            xmlWriter.WriteStartElement("ReferenceFrame");
            xmlWriter.WriteAttributeString("Name", Name);
            xmlWriter.WriteAttributeString("Parent", Parent);
            xmlWriter.WriteAttributeString("ReferenceFrameType", ReferenceFrameType.ToString());
            xmlWriter.WriteAttributeString("Reference", Reference.ToString());
            xmlWriter.WriteAttributeString("ParentsRoationalBase", ParentsRoationalBase.ToString());
            xmlWriter.WriteAttributeString("MeanRadius", MeanRadius.ToString());
            xmlWriter.WriteAttributeString("Oblateness", Oblateness.ToString());
            xmlWriter.WriteAttributeString("Heading", Heading.ToString());
            xmlWriter.WriteAttributeString("Pitch", Pitch.ToString());
            xmlWriter.WriteAttributeString("Roll", Roll.ToString());
            xmlWriter.WriteAttributeString("Scale", Scale.ToString());
            xmlWriter.WriteAttributeString("Tilt", Tilt.ToString());
            xmlWriter.WriteAttributeString("Translation", Translation.ToString());
            if (ReferenceFrameType == ReferenceFrameTypes.FixedSherical)
            {
                xmlWriter.WriteAttributeString("Lat", Lat.ToString());
                xmlWriter.WriteAttributeString("Lng", Lng.ToString());
                xmlWriter.WriteAttributeString("Altitude", Altitude.ToString());
            }
            xmlWriter.WriteAttributeString("RotationalPeriod", RotationalPeriod.ToString());
            xmlWriter.WriteAttributeString("ZeroRotationDate", ZeroRotationDate.ToString());
            xmlWriter.WriteAttributeString("RepresentativeColor", SavedColor.Save(RepresentativeColor));
            xmlWriter.WriteAttributeString("ShowAsPoint", ShowAsPoint.ToString());
            xmlWriter.WriteAttributeString("ShowOrbitPath", ShowOrbitPath.ToString());

            xmlWriter.WriteAttributeString("StationKeeping", StationKeeping.ToString());

            if (ReferenceFrameType == ReferenceFrameTypes.Orbital)
            {
                xmlWriter.WriteAttributeString("SemiMajorAxis", SemiMajorAxis.ToString());
                xmlWriter.WriteAttributeString("SemiMajorAxisScale", this.SemiMajorAxisUnits.ToString());
                xmlWriter.WriteAttributeString("Eccentricity", Eccentricity.ToString());
                xmlWriter.WriteAttributeString("Inclination", Inclination.ToString());
                xmlWriter.WriteAttributeString("ArgumentOfPeriapsis", ArgumentOfPeriapsis.ToString());
                xmlWriter.WriteAttributeString("LongitudeOfAscendingNode", LongitudeOfAscendingNode.ToString());
                xmlWriter.WriteAttributeString("MeanAnomolyAtEpoch", MeanAnomolyAtEpoch.ToString());
                xmlWriter.WriteAttributeString("MeanDailyMotion", MeanDailyMotion.ToString());
                xmlWriter.WriteAttributeString("Epoch", Epoch.ToString());
            }

            if (ReferenceFrameType == ReferenceFrameTypes.Trajectory)
            {
                xmlWriter.WriteStartElement("Trajectory");

                foreach (TrajectorySample sample in Trajectory)
                {
                    string data = sample.ToString();
                    xmlWriter.WriteElementString("Sample", data);
                }
                xmlWriter.WriteEndElement();
            }

            xmlWriter.WriteEndElement();
        }
コード例 #3
0
        private List <IBasicModule> AddOrbitModules()
        {
            List <IBasicModule> modules = new List <IBasicModule>();

            apo      = new Apoapsis("Apoapsis");
            peri     = new Periapsis("Periapsis");
            inc      = new Inclination("Inclination");
            ecc      = new Eccentricity("Eccentricity");
            period   = new Period("Period");
            SMA      = new SemiMajorAxis("Semi Major Axis");
            LAN      = new LongAscending("LAN");
            AoPE     = new ArgOfPeriapsis("Arg of Pe");
            altitude = new OrbitAltitude("Altitude");
            radar    = new RadarAltitude("Radar Altitude");
            terrain  = new TerrainAltitude("Terrain Altitude");
            location = new Location("Location");

            apo.IsVisible       = settings.showApoapsis;
            apo.AlwaysShow      = settings.showApoapsisAlways;
            peri.IsVisible      = settings.showPeriapsis;
            peri.AlwaysShow     = settings.showPeriapsisAlways;
            inc.IsVisible       = settings.showInclination;
            inc.AlwaysShow      = settings.showInclinationAlways;
            ecc.IsVisible       = settings.showEccentricity;
            ecc.AlwaysShow      = settings.showEccentricityAlways;
            period.IsVisible    = settings.showPeriod;
            period.AlwaysShow   = settings.showPeriodAlways;
            SMA.IsVisible       = settings.showSMA;
            SMA.AlwaysShow      = settings.showSMAAlways;
            LAN.IsVisible       = settings.showLAN;
            LAN.AlwaysShow      = settings.showLANAlways;
            AoPE.IsVisible      = settings.showAoPe;
            AoPE.AlwaysShow     = settings.showAoPeAlways;
            altitude.IsVisible  = settings.showOrbitAltitude;
            altitude.AlwaysShow = settings.showOrbitAltitudeAlways;
            radar.IsVisible     = settings.showRadar;
            radar.AlwaysShow    = settings.showRadarAlways;
            terrain.IsVisible   = settings.showTerrain;
            terrain.AlwaysShow  = settings.showTerrainAlways;
            location.IsVisible  = settings.showLocation;
            location.AlwaysShow = settings.showLocationAlways;

            modules.Add(AoPE);
            modules.Add(LAN);
            modules.Add(SMA);
            modules.Add(terrain);
            modules.Add(radar);
            modules.Add(altitude);
            modules.Add(location);
            modules.Add(period);
            modules.Add(ecc);
            modules.Add(inc);
            modules.Add(peri);
            modules.Add(apo);

            return(modules);
        }
コード例 #4
0
ファイル: Orbit.cs プロジェクト: dotMorten/SGP.NET
 /// <inheritdoc />
 protected bool Equals(Orbit other)
 {
     return(MeanAnomoly.Equals(other.MeanAnomoly) && AscendingNode.Equals(other.AscendingNode) &&
            ArgumentPerigee.Equals(other.ArgumentPerigee) && MeanMotion.Equals(other.MeanMotion) &&
            RecoveredSemiMajorAxis.Equals(other.RecoveredSemiMajorAxis) &&
            RecoveredMeanMotion.Equals(other.RecoveredMeanMotion) && Perigee.Equals(other.Perigee) &&
            Apogee.Equals(other.Apogee) && Period.Equals(other.Period) && Epoch.Equals(other.Epoch) &&
            BStar.Equals(other.BStar) && Eccentricity.Equals(other.Eccentricity) &&
            Inclination.Equals(other.Inclination));
 }
コード例 #5
0
ファイル: Orbit.cs プロジェクト: dotMorten/SGP.NET
 /// <inheritdoc />
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = MeanAnomoly.GetHashCode();
         hashCode = (hashCode * 397) ^ AscendingNode.GetHashCode();
         hashCode = (hashCode * 397) ^ ArgumentPerigee.GetHashCode();
         hashCode = (hashCode * 397) ^ MeanMotion.GetHashCode();
         hashCode = (hashCode * 397) ^ RecoveredSemiMajorAxis.GetHashCode();
         hashCode = (hashCode * 397) ^ RecoveredMeanMotion.GetHashCode();
         hashCode = (hashCode * 397) ^ Perigee.GetHashCode();
         hashCode = (hashCode * 397) ^ Apogee.GetHashCode();
         hashCode = (hashCode * 397) ^ Period.GetHashCode();
         hashCode = (hashCode * 397) ^ Epoch.GetHashCode();
         hashCode = (hashCode * 397) ^ BStar.GetHashCode();
         hashCode = (hashCode * 397) ^ Eccentricity.GetHashCode();
         hashCode = (hashCode * 397) ^ Inclination.GetHashCode();
         return(hashCode);
     }
 }
コード例 #6
0
        private void accept_Click(object sender, RoutedEventArgs e)
        {
            Planets planet = new WPF_Material_Design.Source.Planets();



            decimal?radius;
            decimal?weigth;
            decimal?circulation_Period_Axis;
            decimal?circulation_Period;
            decimal?orbit_Radius;
            decimal?eccentricity;

            try
            {
                radius = Convert.ToDecimal(Radius.Text);
            }
            catch (Exception ex)
            {
                Radius.Clear();

                MessageBox.Show("Введите заново");
                return;
            }

            try
            {
                weigth = Convert.ToDecimal(Weigth.Text);
            }
            catch (Exception ex)
            {
                Weigth.Clear();

                MessageBox.Show("Введите заново");
                return;
            }

            try
            {
                circulation_Period_Axis = Convert.ToDecimal(Circulation_Period_Axis.Text);
            }
            catch (Exception ex)
            {
                Circulation_Period_Axis.Clear();

                MessageBox.Show("Введите заново");
                return;
            }

            try
            {
                circulation_Period = Convert.ToDecimal(Circulation_Period.Text);
            }
            catch (Exception ex)
            {
                Circulation_Period.Clear();

                MessageBox.Show("Введите заново");
                return;
            }

            try
            {
                orbit_Radius = Convert.ToDecimal(Orbit_Radius.Text);
            }
            catch (Exception ex)
            {
                Orbit_Radius.Clear();

                MessageBox.Show("Введите заново");
                return;
            }

            try
            {
                eccentricity = Convert.ToDecimal(Eccentricity.Text);
            }
            catch (Exception ex)
            {
                Eccentricity.Clear();

                MessageBox.Show("Введите заново");
                return;
            }


            if (new_planet)
            {
                planet.Create(Name.Text, radius, weigth, circulation_Period_Axis, circulation_Period, Center_body.Text, orbit_Radius, eccentricity, Info.Text);
                Planets.Add(planet);
            }
            else
            {
                this.planet.Create(Name.Text, radius, weigth, circulation_Period_Axis, circulation_Period, Center_body.Text, orbit_Radius, eccentricity, Info.Text);
            }

            Close();
        }