Example #1
0
 internal PartAccessor(PageCache pageCache, FileSystemAbstraction fs, SpatialIndexFiles.SpatialFileLayout fileLayout, RecoveryCleanupWorkCollector recoveryCleanupWorkCollector, IndexProvider.Monitor monitor, StoreIndexDescriptor descriptor, SpaceFillingCurveConfiguration searchConfiguration, bool readOnly) : base(pageCache, fs, fileLayout.IndexFile, fileLayout.Layout, monitor, descriptor, NO_HEADER_WRITER, readOnly)
 {
     this.Layout              = fileLayout.Layout;
     this.Descriptor          = descriptor;
     this.SearchConfiguration = searchConfiguration;
     this.Crs      = fileLayout.SpatialFile.crs;
     this.Settings = fileLayout.Settings;
     instantiateTree(recoveryCleanupWorkCollector, HeaderWriter);
 }
 private void VerifySpatialSettings(File indexFile, SpaceFillingCurveSettings expectedSettings)
 {
     try
     {
         SpaceFillingCurveSettings settings = SpaceFillingCurveSettingsFactory.fromGBPTree(indexFile, _pageCache, NativeIndexHeaderReader.readFailureMessage);
         assertThat("Should get correct results from header", settings, equalTo(expectedSettings));
     }
     catch (IOException e)
     {
         fail("Failed to read GBPTree header: " + e.Message);
     }
 }
Example #3
0
 private static LayoutBootstrapper SpatialLayoutFactory(CoordinateReferenceSystem crs)
 {
     return((indexFile, pageCache, meta, targetLayout) =>
     {
         if (targetLayout.Equals(crs.Name))
         {
             MutableBoolean failure = new MutableBoolean(false);
             Function <ByteBuffer, string> onError = byteBuffer =>
             {
                 failure.setTrue();
                 return "";
             };
             SpaceFillingCurveSettings curveSettings = SpaceFillingCurveSettingsFactory.fromGBPTree(indexFile, pageCache, onError);
             if (!failure.Value)
             {
                 return new SpatialLayout(crs, curveSettings.curve());
             }
         }
         return null;
     });
 }
Example #4
0
 public override void Visit(CoordinateReferenceSystem crs, SpaceFillingCurveSettings settings)
 {
     SpatialIndexConfig.AddSpatialConfig(_map, crs, settings);
 }
Example #5
0
 internal SpatialFileLayout(SpatialFile spatialFile, SpaceFillingCurveSettings settings)
 {
     this.SpatialFile = spatialFile;
     this.Settings    = settings;
     this.Layout      = new SpatialLayout(spatialFile.Crs, settings.Curve());
 }
Example #6
0
            /// <summary>
            /// If we are loading a layout for an existing index, read the settings from the index header, and ignore config settings
            /// </summary>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: SpatialFileLayout getLayoutForExistingIndex(org.neo4j.io.pagecache.PageCache pageCache) throws java.io.IOException
            internal virtual SpatialFileLayout GetLayoutForExistingIndex(PageCache pageCache)
            {
                SpaceFillingCurveSettings settings = SpaceFillingCurveSettingsFactory.fromGBPTree(IndexFile, pageCache, NativeIndexHeaderReader.readFailureMessage);

                return(new SpatialFileLayout(this, settings));
            }
Example #7
0
        /// <summary>
        /// Extract spatial index configuration and put into provided map.
        /// </summary>
        /// <param name="map"> <seealso cref="System.Collections.IDictionary"/> into which extracted configurations should be inserted. </param>
        /// <param name="crs"> <seealso cref="CoordinateReferenceSystem"/> from which to extract configurations. </param>
        /// <param name="settings"> <seealso cref="SpaceFillingCurveSettings"/> from which to extract configurations. </param>
        internal static void AddSpatialConfig(IDictionary <string, Value> map, CoordinateReferenceSystem crs, SpaceFillingCurveSettings settings)
        {
            string crsName    = crs.Name;
            int    tableId    = crs.Table.TableId;
            int    code       = crs.Code;
            int    dimensions = settings.Dimensions;
            int    maxLevels  = settings.MaxLevels;

            double[] min = settings.IndexExtents().Min;
            double[] max = settings.IndexExtents().Max;

            string prefix = prefix(crsName);

            map[prefix + ".tableId"]    = Values.intValue(tableId);
            map[prefix + ".code"]       = Values.intValue(code);
            map[prefix + ".dimensions"] = Values.intValue(dimensions);
            map[prefix + ".maxLevels"]  = Values.intValue(maxLevels);
            map[prefix + ".min"]        = Values.doubleArray(min);
            map[prefix + ".max"]        = Values.doubleArray(max);
        }
Example #8
0
 internal PartPopulator(PageCache pageCache, FileSystemAbstraction fs, SpatialIndexFiles.SpatialFileLayout fileLayout, IndexProvider.Monitor monitor, StoreIndexDescriptor descriptor, SpaceFillingCurveConfiguration configuration) : base(pageCache, fs, fileLayout.IndexFile, fileLayout.Layout, monitor, descriptor, NO_HEADER_WRITER)
 {
     this.Configuration = configuration;
     this.Settings      = fileLayout.Settings;
     this.Crs           = fileLayout.SpatialFile.crs;
 }