コード例 #1
0
 private void PrepareThreshold(AerodromePoint aerodromePoint, Aerodrome aerodrome)
 {
     aerodromePoint.AerodromeInfo.Runway.Threshold.H         = aerodrome.Altitude;
     aerodromePoint.AerodromeInfo.Runway.Threshold.Latitude  = aerodrome.Runway[0].DirectCourse.Threshold.Latitude;
     aerodromePoint.AerodromeInfo.Runway.Threshold.Longitude = aerodrome.Runway[0].DirectCourse.Threshold.Longitude;
     aerodromePoint.AerodromeInfo.Runway.Threshold.X         = aerodrome.Runway[0].DirectCourse.Threshold.X;
     aerodromePoint.AerodromeInfo.Runway.Threshold.Z         = aerodrome.Runway[0].DirectCourse.Threshold.Z;
 }
コード例 #2
0
        public VisualAerodrome CrateVisualAerodrome(Aerodrome aerodrome)
        {
            var aerodromePoint = PrepareAerodromePoint(aerodrome);

            _aerodromePoints[_countaerodromePoint] = aerodromePoint;
            _countaerodromePoint++;
            EventsHelper.OnAerodromeCollectionEvent(_aerodromePoints);
            return(new VisualAerodrome(aerodromePoint));
        }
コード例 #3
0
 private void PrepareLocalizer(AerodromePoint aerodromePoint, Aerodrome aerodrome)
 {
     aerodromePoint.AerodromeInfo.Runway.Localizer.H         = aerodrome.Altitude;
     aerodromePoint.AerodromeInfo.Runway.Localizer.Latitude  = aerodrome.Runway[0].DirectCourse.ILS.LOC.Latitude;
     aerodromePoint.AerodromeInfo.Runway.Localizer.Longitude = aerodrome.Runway[0].DirectCourse.ILS.LOC.Longitude;
     _coordinateHelper.LocalCordToXZ(aerodrome.Runway[0].DirectCourse.Threshold.Latitude, aerodrome.Runway[0].DirectCourse.Threshold.Longitude,
                                     aerodrome.Runway[0].DirectCourse.ILS.LOC.Latitude, aerodrome.Runway[0].DirectCourse.ILS.LOC.Longitude, out var x, out var z);
     aerodromePoint.AerodromeInfo.Runway.Localizer.X = x;
     aerodromePoint.AerodromeInfo.Runway.Localizer.Z = z;
 }
コード例 #4
0
        public void Equals_WhenTwoDifferentInstancesAreCreated_ThenInstancesAreNotEqual()
        {
            // arrange
            Aerodrome instance0 = new Aerodrome("LZKZ");
            Aerodrome instance1 = new Aerodrome("LZIB");

            // act
            bool result = Equals(instance0, instance1);

            // assert
            Assert.That(instance0, Is.Not.Null);
            Assert.That(instance1, Is.Not.Null);
            Assert.That(ReferenceEquals(instance0, instance1), Is.Not.True);
            Assert.That(result, Is.False);
        }
コード例 #5
0
        public void GetHashCode_WhenTwoDifferentInstancesAreCreated_ThenInstanceHashCodesAreNotEqual()
        {
            // arrange
            Aerodrome instance0 = new Aerodrome("LZKZ");
            Aerodrome instance1 = new Aerodrome("LZIB");

            // act
            int result0 = instance0.GetHashCode();
            int result1 = instance1.GetHashCode();

            // assert
            Assert.That(instance0, Is.Not.Null);
            Assert.That(instance1, Is.Not.Null);
            Assert.That(ReferenceEquals(instance0, instance1), Is.Not.True);
            Assert.That(Equals(result0, result1), Is.False);
        }
コード例 #6
0
        public void Clone_WhenInstanceCloned_ThenInstancesAreEqual()
        {
            // arrange
            Aerodrome instance0 = new Aerodrome("LZKZ");

            object instance1 = instance0.Clone();

            // act
            bool result = Equals(instance0, instance1);

            // assert
            Assert.That(instance0, Is.Not.Null);
            Assert.That(instance1, Is.Not.Null);
            Assert.That(instance1, Is.InstanceOf <Aerodrome>());
            Assert.That(ReferenceEquals(instance0, instance1), Is.Not.True);
            Assert.That(result, Is.True);
        }
コード例 #7
0
        public void Equals_WhenInstanceIsDeseraializeAndSerializedBack_ThenInstancesAreEqual()
        {
            // arrange
            Aerodrome instance0 = new Aerodrome("LZKZ");

            string serializedText = instance0.Serialize();

            Aerodrome instance1 = serializedText.Deserialize <Aerodrome>();

            // act
            bool result = Equals(instance0, instance1);

            // assert
            Assert.That(instance0, Is.Not.Null);
            Assert.That(instance1, Is.Not.Null);
            Assert.That(ReferenceEquals(instance0, instance1), Is.Not.True);
            Assert.That(result, Is.True);
        }
コード例 #8
0
        public void Clone_WhenInstanceCloned_ThenInstancesHashCodesAreEqual()
        {
            // arrange
            Aerodrome instance0 = new Aerodrome("LZKZ");

            object instance1 = instance0.Clone();

            // act
            int result0 = instance0.GetHashCode();
            int result1 = instance1.GetHashCode();

            // assert
            Assert.That(instance0, Is.Not.Null);
            Assert.That(instance1, Is.Not.Null);
            Assert.That(instance1, Is.InstanceOf <Aerodrome>());
            Assert.That(ReferenceEquals(instance0, instance1), Is.Not.True);
            Assert.That(Equals(result0, result1), Is.True);
        }
コード例 #9
0
        public void GetHashCode_WhenInstanceIsDeseraializeAndSerializedBack_ThenInstancesHashCodesAreEqual()
        {
            // arrange
            Aerodrome instance0 = new Aerodrome("LZKZ");

            string serializedText = instance0.Serialize();

            Aerodrome instance1 = serializedText.Deserialize <Aerodrome>();

            // act
            int result0 = instance0.GetHashCode();
            int result1 = instance1.GetHashCode();

            // assert
            Assert.That(instance0, Is.Not.Null);
            Assert.That(instance1, Is.Not.Null);
            Assert.That(ReferenceEquals(instance0, instance1), Is.Not.True);
            Assert.That(Equals(result0, result1), Is.True);
        }
コード例 #10
0
        private AerodromePoint PrepareAerodromePoint(Aerodrome aerodrome)
        {
            _coordinateHelper.LatLonToPixel(aerodrome.Latitude, aerodrome.Longitude, out var px, out var py);
            AerodromePoint aerodromePoint = new AerodromePoint();

            aerodromePoint.NavigationPoint.Type                    = 1;
            aerodromePoint.NavigationPoint.GeoCoordinate.H         = aerodrome.Altitude;
            aerodromePoint.NavigationPoint.GeoCoordinate.Latitude  = aerodrome.Latitude;
            aerodromePoint.NavigationPoint.GeoCoordinate.Longitude = aerodrome.Longitude;

            PrepareThreshold(aerodromePoint, aerodrome);
            PrepareLocalizer(aerodromePoint, aerodrome);
            PrepareGlideSlope(aerodromePoint, aerodrome);
            PrepareLocatorMiddle(aerodromePoint, aerodrome);
            PrepareLocatorOuter(aerodromePoint, aerodrome);

            var name = aerodrome.Name.ToCharArray();

            name.CopyTo(aerodromePoint.AerodromeInfo.Name, 0);
            var country = aerodrome.Country.ToCharArray();

            country.CopyTo(aerodromePoint.AerodromeInfo.Country, 0);
            var rusname = aerodrome.Rusname.ToCharArray();

            rusname.CopyTo(aerodromePoint.AerodromeInfo.RusName, 0);
            aerodromePoint.AerodromeInfo.Runway.Width   = aerodrome.Runway[0].Width;
            aerodromePoint.AerodromeInfo.Runway.Length  = aerodrome.Runway[0].Length;
            aerodromePoint.AerodromeInfo.Runway.Heading = aerodrome.Runway[0].DirectCourse.Threshold.Heading;
            aerodromePoint.Guid = new Guid(aerodrome.Guid);

            if (aerodrome.Name == "Lipetsk")
            {
                aerodromePoint.AerodromeInfo.ActiveAerodrome = true;
                aerodromePoint.NavigationPoint.Measure.Psi   = aerodrome.Runway[0].DirectCourse.Threshold.Heading;
            }
            return(aerodromePoint);
        }