Exemplo n.º 1
0
        private static StaticCoordinateOperationCompiler.StepCompilationResult CreateMadridToEd50Polynomial(TransformationCompilationParams opData)
        {
            Contract.Requires(opData != null);
            var a0Param  = new FullMatchParameterSelector("A0");
            var a1Param  = new FullMatchParameterSelector("A1");
            var a2Param  = new FullMatchParameterSelector("A2");
            var a3Param  = new FullMatchParameterSelector("A3");
            var b00Param = new FullMatchParameterSelector("B00");
            var b0Param  = new FullMatchParameterSelector("B0");
            var b1Param  = new FullMatchParameterSelector("B1");
            var b2Param  = new FullMatchParameterSelector("B2");
            var b3Param  = new FullMatchParameterSelector("B3");

            opData.ParameterLookup.Assign(a0Param, a1Param, a2Param, a3Param, b00Param, b0Param, b1Param, b2Param, b3Param);

            double a0, a1, a2, a3, b00, b0, b1, b2, b3;

            TryGetCoefficientValue(a0Param.Selection, out a0);
            TryGetCoefficientValue(a1Param.Selection, out a1);
            TryGetCoefficientValue(a2Param.Selection, out a2);
            TryGetCoefficientValue(a3Param.Selection, out a3);
            TryGetCoefficientValue(b00Param.Selection, out b00);
            TryGetCoefficientValue(b0Param.Selection, out b0);
            TryGetCoefficientValue(b1Param.Selection, out b1);
            TryGetCoefficientValue(b2Param.Selection, out b2);
            TryGetCoefficientValue(b3Param.Selection, out b3);

            ITransformation transformation = new MadridEd50Polynomial(a0, a1, a2, a3, b00, b0, b1, b2, b3);

            var conv = StaticCoordinateOperationCompiler.CreateCoordinateUnitConversion(opData.StepParams.InputUnit, OgcAngularUnit.DefaultDegrees);

            if (null != conv)
            {
                transformation = new ConcatenatedTransformation(new[] { conv, transformation });
            }

            return(new StaticCoordinateOperationCompiler.StepCompilationResult(
                       opData.StepParams,
                       OgcAngularUnit.DefaultDegrees,
                       transformation));
        }
        public void example_2_3_1_3()
        {
            var transformation = new MadridEd50Polynomial(
                11.328779,
                -0.1674,
                -0.03852,
                0.0000379,
                -13276.58,
                2.5079425,
                0.08352,
                -0.00864,
                -0.0000038
            );

            var input = new GeographicCoordinate(42.647992, 3.659603);
            var expectedResult = new GeographicCoordinate(42.649117, -0.026658);

            var result = transformation.TransformValue(input);

            Assert.AreEqual(expectedResult.Latitude, result.Latitude, 0.0000005);
            Assert.AreEqual(expectedResult.Longitude, result.Longitude, 0.0000006);
        }
Exemplo n.º 3
0
        public void example_2_3_1_3()
        {
            var transformation = new MadridEd50Polynomial(
                11.328779,
                -0.1674,
                -0.03852,
                0.0000379,
                -13276.58,
                2.5079425,
                0.08352,
                -0.00864,
                -0.0000038
                );

            var input          = new GeographicCoordinate(42.647992, 3.659603);
            var expectedResult = new GeographicCoordinate(42.649117, -0.026658);

            var result = transformation.TransformValue(input);

            Assert.AreEqual(expectedResult.Latitude, result.Latitude, 0.0000005);
            Assert.AreEqual(expectedResult.Longitude, result.Longitude, 0.0000006);
        }
        private static StaticCoordinateOperationCompiler.StepCompilationResult CreateMadridToEd50Polynomial(TransformationCompilationParams opData)
        {
            Contract.Requires(opData != null);
            var a0Param = new FullMatchParameterSelector("A0");
            var a1Param = new FullMatchParameterSelector("A1");
            var a2Param = new FullMatchParameterSelector("A2");
            var a3Param = new FullMatchParameterSelector("A3");
            var b00Param = new FullMatchParameterSelector("B00");
            var b0Param = new FullMatchParameterSelector("B0");
            var b1Param = new FullMatchParameterSelector("B1");
            var b2Param = new FullMatchParameterSelector("B2");
            var b3Param = new FullMatchParameterSelector("B3");
            opData.ParameterLookup.Assign(a0Param, a1Param, a2Param, a3Param, b00Param, b0Param, b1Param, b2Param, b3Param);

            double a0, a1, a2, a3, b00, b0, b1, b2, b3;
            TryGetCoefficientValue(a0Param.Selection, out a0);
            TryGetCoefficientValue(a1Param.Selection, out a1);
            TryGetCoefficientValue(a2Param.Selection, out a2);
            TryGetCoefficientValue(a3Param.Selection, out a3);
            TryGetCoefficientValue(b00Param.Selection, out b00);
            TryGetCoefficientValue(b0Param.Selection, out b0);
            TryGetCoefficientValue(b1Param.Selection, out b1);
            TryGetCoefficientValue(b2Param.Selection, out b2);
            TryGetCoefficientValue(b3Param.Selection, out b3);

            ITransformation transformation = new MadridEd50Polynomial(a0, a1, a2, a3, b00, b0, b1, b2, b3);

            var conv = StaticCoordinateOperationCompiler.CreateCoordinateUnitConversion(opData.StepParams.InputUnit, OgcAngularUnit.DefaultDegrees);
            if (null != conv)
                transformation = new ConcatenatedTransformation(new[] { conv, transformation });

            return new StaticCoordinateOperationCompiler.StepCompilationResult(
                opData.StepParams,
                OgcAngularUnit.DefaultDegrees,
                transformation);
        }