public void Handle_CanModify_Test1()
        {
            //arrange
            var states      = CreateTestListStates();
            var inclination = new Inclination();

            inclination.SetStates(states);
            inclination.CanModify = false;

            var head = new Head(new List <IBodyPart>()
            {
                inclination
            });

            var robot = new Robot(new List <IBodyPartCollection>()
            {
                head
            });

            //act
            var request = new RequestNextStateOfBodyPartInteractor(robot);

            var requestMessage = new NextStateOfBodyPartRequestMessage(head.Id, inclination.Id);

            var responseTask = request.Handle(requestMessage, CancellationToken.None);

            responseTask.Wait();

            //assert
            Assert.NotNull(responseTask);
            Assert.NotNull(responseTask.Result);
            Assert.False(responseTask.Result.Success);
        }
Example #2
0
        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);
        }
        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();
        }
Example #4
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);
        }
Example #5
0
        public static IObservableBodyPart CreateInclination()
        {
            var inclinationStateMachine = CreateHeadInclinationStateList();
            var rotation = new Inclination()
            {
                Id = GenerateGuidId()
            };

            rotation.SetStates(inclinationStateMachine);

            return(rotation);
        }
Example #6
0
        public override void UpdateVisual()
        {
            var center     = Center;
            var startPoint = BeginLocation;
            var endPoint   = EndLocation;

            ArcShape.Size          = new Size(ToPhysical(SemiMajor), ToPhysical(SemiMinor));
            Figure.StartPoint      = ToPhysical(startPoint);
            ArcShape.Point         = ToPhysical(endPoint);
            ArcShape.RotationAngle = -Inclination.ToDegrees();
            ArcShape.IsLargeArc    = Clockwise ? Math.OAngle(endPoint, center, startPoint) > Math.PI :
                                     Math.OAngle(startPoint, center, endPoint) > Math.PI;
        }
Example #7
0
            public void WriteTo(XmlWriter xmlWriter)
            {
                xmlWriter.WriteStartElement("ThreeDProperties");
                {
                    if (Enabled.HasValue)
                    {
                        xmlWriter.WriteElementString("Enabled", Enabled.Value.ToString());
                    }

                    xmlWriter.WriteElementString("ProjectionMode", ProjectionMode.ToString());

                    if (ProjectionMode == ProjectionMode3DForRendering.Perspective)
                    {
                        if (Perspective.HasValue)
                        {
                            xmlWriter.WriteElementString("Perspective", Perspective.ToString());
                        }
                    }

                    if (Rotation.HasValue)
                    {
                        xmlWriter.WriteElementString("Rotation", Rotation.ToString());
                    }

                    if (Inclination.HasValue)
                    {
                        xmlWriter.WriteElementString("Inclination", Inclination.ToString());
                    }

                    xmlWriter.WriteElementString("Shading", Shading.ToString());

                    if (WallThickness.HasValue)
                    {
                        xmlWriter.WriteElementString("WallThickness", WallThickness.ToString());
                    }

                    //if ( chart type is bar OR column)
                    {
                        xmlWriter.WriteElementString("DrawingStyle", DrawingStyle.ToString());
                        if (Clustered.HasValue)
                        {
                            xmlWriter.WriteElementString("Clustered", Clustered.ToString());
                        }
                    }
                }
                xmlWriter.WriteEndElement();
            }
Example #8
0
        public override void UpdateVisual()
        {
            var             center       = ToPhysical(Center);
            var             logicalWidth = LogicalWidth();
            var             major        = ToPhysical(SemiMajor * 2 + logicalWidth);
            var             minor        = ToPhysical(SemiMinor * 2 + logicalWidth);
            double          angle        = -Inclination.ToDegrees();
            RotateTransform rotation     = new RotateTransform();

            rotation.CenterX      = major / 2;
            rotation.CenterY      = minor / 2;
            rotation.Angle        = angle;
            Shape.RenderTransform = rotation;
            Shape.Width           = major;
            Shape.Height          = minor;
            Shape.CenterAt(center);
        }
Example #9
0
        public void GetBodyPart_Test_1()
        {
            //arrange
            var inclination = new Inclination();

            var head = new Head(new List <IBodyPart>());

            var robot = new Robot(new List <IBodyPartCollection>()
            {
                head
            });

            //act
            var part = robot.GetBodyPart(head.Id, inclination.Id);

            //assert
            Assert.Null(part);
        }
 /// <summary>
 /// Returns a hash code for this instance.
 /// </summary>
 /// <returns>A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.</returns>
 public override int GetHashCode() => Inclination.GetHashCode() ^ Azimuth.GetHashCode() ^ Radius.GetHashCode();
Example #11
0
 /// <summary>
 /// Creates a new instance.
 /// </summary>
 public InclinometerEventArgs(Inclination value)
 {
     Value = value;
 }
 /// <summary>
 /// Creates a new instance.
 /// </summary>
 public InclinometerEventArgs(Inclination value)
 {
     Value = value;
 }