Пример #1
0
 public void CompositeAdapterFirstSuccess_ShouldBeEqual_WhenTheSameOrder()
 {
     Assert.AreEqual(
         crsTransformationAdapterCompositeFactory.CreateCrsTransformationFirstSuccess(),
         // new instance but leafs created in the same order with the same method as above:
         crsTransformationAdapterCompositeFactory.CreateCrsTransformationFirstSuccess()
         );
 }
 public void TestCompositeFirstSuccess()
 {
     VerifyExpectedEnumWhenNotRepresentingThirdPartLibrary(
         crsTransformationAdapterCompositeFactory.CreateCrsTransformationFirstSuccess(),
         CrsTransformationAdapteeType.COMPOSITE_FIRST_SUCCESS
         );
 }
        public void TransformToCoordinate_ShouldReturnFirstResult_WhenUsingFirstSuccessCompositeAdapter()
        {
            CrsTransformationAdapterComposite firstSuccessCompositeAdapter = crsTransformationAdapterCompositeFactory.CreateCrsTransformationFirstSuccess(allLeafAdapters);
            CrsCoordinate resultCoordinate = firstSuccessCompositeAdapter.TransformToCoordinate(inputCoordinateSweref99, EpsgNumber.WORLD__WGS_84__4326);

            Assert.IsNotNull(resultCoordinate);

            // The assumption below (according to the setup code in the "before" method in this JUnit class)
            // is that the first adapter in the above list allLeafAdapters will return the result outputCoordinateWgs84ForImplementation_1
            Assert.AreEqual(
                outputCoordinateWgs84ForImplementation_1.YNorthingLatitude,
                resultCoordinate.YNorthingLatitude,
                SMALL_DELTA_VALUE_FOR_COMPARISONS
                );
            Assert.AreEqual(
                outputCoordinateWgs84ForImplementation_1.XEastingLongitude,
                resultCoordinate.XEastingLongitude,
                SMALL_DELTA_VALUE_FOR_COMPARISONS
                );

            AssertCompositeResultHasLeafSubResults(
                firstSuccessCompositeAdapter,
                1 // expectedNumberOfLeafResults
                );
        }
    public void SetUp() {
        weightFactory = CrsTransformationAdapterWeightFactory.Create();

        crsTransformationAdapterCompositeFactory = CrsTransformationAdapterCompositeFactory.Create();

        crsTransformationAdapterLeafImplementations = new List<ICrsTransformationAdapter>{
            new CrsTransformationAdapterDotSpatial(),
            new CrsTransformationAdapterProjNet(),
            new CrsTransformationAdapterMightyLittleGeodesy()
        };

        crsTransformationAdapterCompositeImplementations = new List<ICrsTransformationAdapter>{
            crsTransformationAdapterCompositeFactory.CreateCrsTransformationAverage(),
            crsTransformationAdapterCompositeFactory.CreateCrsTransformationMedian(),
            crsTransformationAdapterCompositeFactory.CreateCrsTransformationFirstSuccess(),
            crsTransformationAdapterCompositeFactory.CreateCrsTransformationWeightedAverage(new List<CrsTransformationAdapterWeight>{
                weightFactory.CreateFromInstance(new CrsTransformationAdapterDotSpatial(), 51.0),
                weightFactory.CreateFromInstance(new CrsTransformationAdapterProjNet(), 52.0),
                weightFactory.CreateFromInstance(new CrsTransformationAdapterMightyLittleGeodesy(), 53.0)
            })
        };
        crsTransformationAdapterImplementations = new List<ICrsTransformationAdapter>();
        crsTransformationAdapterImplementations.AddRange(crsTransformationAdapterLeafImplementations);
        crsTransformationAdapterImplementations.AddRange(crsTransformationAdapterCompositeImplementations);
    }
Пример #5
0
        public void SetUp()
        {
            weightFactory = CrsTransformationAdapterWeightFactory.Create();

            // Leaf adapters:
            dotSpatial          = new CrsTransformationAdapterDotSpatial();
            mightyLittleGeodesy = new CrsTransformationAdapterMightyLittleGeodesy();
            // currently there are no configurations possibilities for the above two leafs
            // but for the below leaf it is possible to create instances with
            // different configurations
            projNet = new CrsTransformationAdapterProjNet();
            ProjNetWithDifferentConfiguration = new CrsTransformationAdapterProjNet(new SridReader("somepath.csv"));

            // Composite adapters:
            crsTransformationAdapterCompositeFactory = CrsTransformationAdapterCompositeFactory.Create(
                new List <ICrsTransformationAdapter> {
                dotSpatial, mightyLittleGeodesy, projNet
            }
                );
            // Note that below list parameter is the same as the above but with the list items in reversed order
            crsTransformationAdapterCompositeFactoryWithLeafsInReversedOrder = CrsTransformationAdapterCompositeFactory.Create(
                new List <ICrsTransformationAdapter> {
                projNet, mightyLittleGeodesy, dotSpatial
            }
                );
            crsTransformationAdapterCompositeFactoryWithOneLeafDifferentlyConfigured = CrsTransformationAdapterCompositeFactory.Create(
                new List <ICrsTransformationAdapter> {
                dotSpatial, mightyLittleGeodesy, ProjNetWithDifferentConfiguration
            }
                );

            average         = crsTransformationAdapterCompositeFactory.CreateCrsTransformationAverage();
            median          = crsTransformationAdapterCompositeFactory.CreateCrsTransformationMedian();
            firstSuccess    = crsTransformationAdapterCompositeFactory.CreateCrsTransformationFirstSuccess();
            weightedAverage = crsTransformationAdapterCompositeFactory.CreateCrsTransformationWeightedAverage(new List <CrsTransformationAdapterWeight> {
                weightFactory.CreateFromInstance(dotSpatial, 1.0),
                weightFactory.CreateFromInstance(projNet, 2.0),
                weightFactory.CreateFromInstance(mightyLittleGeodesy, 3.0)
            });
        }
Пример #6
0
 public void CreateCrsTransformationFirstSuccess_ShouldBeCreatedWithManyImplementations_WhenInstantiatingWithoutParameters() {
     CrsTransformationAdapterComposite crsTransformationFirstSuccess = crsTransformationAdapterCompositeFactory.CreateCrsTransformationFirstSuccess();
     AssertCompositeNotNullAndAggregatesManyImplementations(crsTransformationFirstSuccess);
 }