Example #1
0
        private void ShouldGetSettingsFor(Config config, CoordinateReferenceSystem crs, int dimensions, int maxBits, Envelope envelope)
        {
            ConfiguredSpaceFillingCurveSettingsCache configuredSettings = new ConfiguredSpaceFillingCurveSettingsCache(config);
            SpaceFillingCurveSettings settings = configuredSettings.ForCRS(crs);

            assertThat("Expected " + dimensions + "D for " + crs.Name, settings.Dimensions, equalTo(dimensions));
            int maxLevels = maxBits / dimensions;

            assertThat("Expected maxLevels=" + maxLevels + " for " + crs.Name, settings.MaxLevels, equalTo(maxLevels));
            assertThat("Should have normal geographic 2D extents", settings.IndexExtents(), equalTo(envelope));
        }
Example #2
0
 public void visit(CoordinateReferenceSystem crs, SpaceFillingCurveSettings settings)
 {
     // For tableId+code the native layout is even stricter here, but it'd add unnecessary complexity to shave off a couple of more bits
     _cursor.putByte(( sbyte )assertInt("table id", crs.Table.TableId, 0xFF));
     _cursor.putInt(crs.Code);
     _cursor.putShort(( short )assertInt("max levels", settings.MaxLevelsConflict, 0xFFFF));
     _cursor.putShort(( short )assertInt("dimensions", settings.DimensionsConflict, 0xFFFF));
     double[] min = settings.Extents.Min;
     double[] max = settings.Extents.Max;
     for (int i = 0; i < settings.DimensionsConflict; i++)
     {
         _cursor.putLong(System.BitConverter.DoubleToInt64Bits(min[i]));
         _cursor.putLong(System.BitConverter.DoubleToInt64Bits(max[i]));
     }
 }
Example #3
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());
        }
        private void ReadNext(ByteBuffer headerBytes)
        {
            int tableId = headerBytes.get() & 0xFF;
            int code    = headerBytes.Int;
            CoordinateReferenceSystem crs = CoordinateReferenceSystem.get(tableId, code);

            int maxLevels  = headerBytes.Short & 0xFFFF;
            int dimensions = headerBytes.Short & 0xFFFF;

            double[] min = new double[dimensions];
            double[] max = new double[dimensions];
            for (int i = 0; i < dimensions; i++)
            {
                min[i] = Double.longBitsToDouble(headerBytes.Long);
                max[i] = Double.longBitsToDouble(headerBytes.Long);
            }
            Envelope extents = new Envelope(min, max);

            _settings[crs] = new SpaceFillingCurveSettings(dimensions, extents, maxLevels);
        }
Example #6
0
 public virtual bool Equals(SpaceFillingCurveSettings other)
 {
     return(this.DimensionsConflict == other.DimensionsConflict && this.MaxLevelsConflict == other.MaxLevelsConflict && this.Extents.Equals(other.Extents));
 }
Example #7
0
 public abstract void writeHeader(SpaceFillingCurveSettings settings, Org.Neo4j.Io.pagecache.PageCursor cursor);