Ejemplo n.º 1
0
        public static Pair <PointValue, PointValue> PointsWithSameValueOnSpaceFillingCurve(Config config)
        {
            ConfiguredSpaceFillingCurveSettingsCache configuredCache = new ConfiguredSpaceFillingCurveSettingsCache(config);
            SpaceFillingCurveSettings spaceFillingCurveSettings      = configuredCache.ForCRS(CoordinateReferenceSystem.WGS84);
            SpaceFillingCurve         curve = spaceFillingCurveSettings.Curve();

            double[] origin = new double[] { 0.0, 0.0 };
            long?    spaceFillingCurveMapForOrigin = curve.DerivedValueFor(origin);

            double[]   centerPointForOriginTile = curve.CenterPointFor(spaceFillingCurveMapForOrigin.Value);
            PointValue originValue      = Values.pointValue(CoordinateReferenceSystem.WGS84, origin);
            PointValue centerPointValue = Values.pointValue(CoordinateReferenceSystem.WGS84, centerPointForOriginTile);

            assertThat("need non equal points for this test", origin, not(equalTo(centerPointValue)));
            return(Pair.of(originValue, centerPointValue));
        }
        public virtual SpaceFillingCurve ForCrs(CoordinateReferenceSystem crs, bool assignToIndexIfNotYetAssigned)
        {
            // Index-specific
            SpaceFillingCurveSettings specificSetting = _specificIndexConfigCache.get(crs);

            if (specificSetting != null)
            {
                return(specificSetting.Curve());
            }

            // Global config
            SpaceFillingCurveSettings configuredSetting = _globalConfigCache.forCRS(crs);

            if (assignToIndexIfNotYetAssigned)
            {
                _specificIndexConfigCache.put(crs, configuredSetting);
            }
            return(configuredSetting.Curve());
        }