public void BdcEdit()
        {
            ReticleBulletDropCompensatorPoint bdc = new ReticleBulletDropCompensatorPoint()
            {
                Position   = new ReticlePosition(1, 2, AngularUnit.Mil),
                TextHeight = AngularUnit.MOA.New(3),
                TextOffset = AngularUnit.MOA.New(4),
            };

            EditBdcForm form = new EditBdcForm(bdc);

            form.MeasurementControl("measurementX").Should().HaveValue(bdc.Position.X);
            form.MeasurementControl("measurementY").Should().HaveValue(bdc.Position.Y);
            form.MeasurementControl("measurementH").Should().HaveValue(bdc.TextHeight);
            form.MeasurementControl("measurementO").Should().HaveValue(bdc.TextOffset);

            form.MeasurementControl("measurementX").Value = AngularUnit.MOA.New(10);
            form.MeasurementControl("measurementY").Value = AngularUnit.MOA.New(11);
            form.MeasurementControl("measurementH").Value = AngularUnit.MOA.New(12);
            form.MeasurementControl("measurementO").Value = AngularUnit.MOA.New(13);

            bdc.Position.X.Should().NotBe(AngularUnit.MOA.New(10));
            bdc.Position.Y.Should().NotBe(AngularUnit.MOA.New(11));
            bdc.TextHeight.Should().NotBe(AngularUnit.MOA.New(12));
            bdc.TextOffset.Should().NotBe(AngularUnit.MOA.New(13));

            form.Save();

            bdc.Position.X.Should().Be(AngularUnit.MOA.New(10));
            bdc.Position.Y.Should().Be(AngularUnit.MOA.New(11));
            bdc.TextHeight.Should().Be(AngularUnit.MOA.New(12));
            bdc.TextOffset.Should().Be(AngularUnit.MOA.New(13));
        }
Ejemplo n.º 2
0
        public EditBdcForm(ReticleBulletDropCompensatorPoint bdc)
        {
            Bdc = bdc;
            InitializeComponent();

            measurementX.Value = bdc.Position?.X;
            measurementY.Value = bdc.Position?.Y;

            measurementO.Value = bdc.TextOffset;
            measurementH.Value = bdc.TextHeight;
        }
Ejemplo n.º 3
0
        public void Bdc2()
        {
            ReticleBulletDropCompensatorPoint pt = new ReticleBulletDropCompensatorPoint()
            {
                Position   = new ReticlePosition(0, -5, AngularUnit.Mil),
                TextOffset = AngularUnit.Mil.New(-0.25),
                TextHeight = AngularUnit.Mil.New(0.5)
            };

            pt.ToString().Should().Be("Bdc(p=(0mil:-5mil),o=-0.25mil,h=0.5mil)");
        }
        public void RoundTripBDC()
        {
            ReticleBulletDropCompensatorPoint bdc = new ReticleBulletDropCompensatorPoint()
            {
                Position = new ReticlePosition()
                {
                    X = new Measurement <AngularUnit>(1, AngularUnit.MOA), Y = new Measurement <AngularUnit>(2, AngularUnit.MOA)
                },
                TextOffset = new Measurement <AngularUnit>(5, AngularUnit.Mil)
            };

            SerializerRoundtrip serializer = new SerializerRoundtrip();
            var xml  = serializer.Serialize(bdc);
            var bdc2 = serializer.Deserialize <ReticleBulletDropCompensatorPoint>(xml);

            bdc2.Position.X.Should().Be(bdc.Position.X);
            bdc2.Position.Y.Should().Be(bdc.Position.Y);
            bdc2.TextOffset.Should().Be(bdc.TextOffset);
        }
Ejemplo n.º 5
0
 private static bool BdcPointReached(TrajectoryPoint previousPoint, TrajectoryPoint point, ReticleBulletDropCompensatorPoint bdcPoint)
 => (previousPoint.DropAdjustment >= bdcPoint.Position.Y && point.DropAdjustment <= bdcPoint.Position.Y) ||
 (previousPoint.DropAdjustment <= bdcPoint.Position.Y && point.DropAdjustment >= bdcPoint.Position.Y);