Beispiel #1
0
        private ConversionResult ExecuteProj4(TestCase testCase)
        {
            var result = new ConversionResult();
            try {
                var transformation = new Proj4Transform(testCase.Source, testCase.Target);
                if(transformation == null)
                    throw new InvalidOperationException("No transformation");

                result.ResultData = transformation.TransformValues(testCase.InputCoordinates).ToArray();
            }
            catch (Exception ex) {
                result.Exception = ex;
            }
            return result;
        }
Beispiel #2
0
        private ConversionResult ExecuteStaticEpsg(TestCase testCase)
        {
            var result = new ConversionResult();
            try {

                var paths = _epsgPathGenerator.Generate(testCase.Source, testCase.Target)
                    .OrderBy(x => GetEpsgAccuracy(x) ?? 999);

                var compiler = new StaticCoordinateOperationCompiler();
                var compiledPaths = paths
                    .Select(x => compiler.Compile(x));

                var bestCompiledPath = compiledPaths.FirstOrDefault(x => x != null);

                var transformation = bestCompiledPath;
                if (transformation == null)
                    throw new InvalidOperationException("No compiled transformation");

                result.ResultData = transformation.TransformValues(testCase.InputCoordinates).ToArray();
            }
            catch (Exception ex) {
                result.Exception = ex;
            }

            return result;
        }
Beispiel #3
0
        public TestResult Execute(TestCase testCase)
        {
            var result = new TestResult {
                Source = testCase.Source,
                Target = testCase.Target
            };

            var staticResult = ExecuteStaticEpsg(testCase);
            var proj4Results = ExecuteProj4(testCase);
            try {
                var statsData = new CoordinateComparisonStatistics();
                statsData.Process(proj4Results.ResultData, staticResult.ResultData);
                result.StatsData = statsData;
            }
            catch (Exception ex) {
                ; // eat it
            }

            return result;
        }