示例#1
0
 private void Dispose(bool disposing)
 {
     if (!disposed)
     {
         if (disposing)
         {
             Close();
             _Envelope = null;
             tree      = null;
         }
         disposed = true;
     }
 }
示例#2
0
 /// <summary>
 /// Forces a rebuild of the spatial index. If the instance of the ShapeFile provider
 /// uses a file-based index the file is rewritten to disk.
 /// </summary>
 public void RebuildSpatialIndex()
 {
     if (this._FileBasedIndex)
     {
         if (System.IO.File.Exists(_Filename + ".sidx"))
         {
             System.IO.File.Delete(_Filename + ".sidx");
         }
         tree = CreateSpatialIndexFromFile(_Filename);
     }
     else
     {
         tree = CreateSpatialIndex(_Filename);
     }
     if (System.Web.HttpContext.Current != null)
     {
         //TODO: Remove this when connection pooling is implemented:
         System.Web.HttpContext.Current.Cache.Insert(_Filename, tree, null, System.Web.Caching.Cache.NoAbsoluteExpiration, TimeSpan.FromDays(1));
     }
 }
示例#3
0
 private void LoadSpatialIndex(bool ForceRebuild, bool LoadFromFile)
 {
     //Only load the tree if we haven't already loaded it, or if we want to force a rebuild
     if (tree == null || ForceRebuild)
     {
         // Is this a web application? If so lets store the index in the cache so we don't
         // need to rebuild it for each request
         if (System.Web.HttpContext.Current != null)
         {
             //Check if the tree exists in the cache
             if (System.Web.HttpContext.Current.Cache[_Filename] != null)
             {
                 tree = (Utilities.SpatialIndexing.QuadTree)System.Web.HttpContext.Current.Cache[_Filename];
             }
             else
             {
                 if (!LoadFromFile)
                 {
                     tree = CreateSpatialIndex(_Filename);
                 }
                 else
                 {
                     tree = CreateSpatialIndexFromFile(_Filename);
                 }
                 //Store the tree in the web cache
                 //TODO: Remove this when connection pooling is implemented
                 System.Web.HttpContext.Current.Cache.Insert(_Filename, tree, null, System.Web.Caching.Cache.NoAbsoluteExpiration, TimeSpan.FromDays(1));
             }
         }
         else
         if (!LoadFromFile)
         {
             tree = CreateSpatialIndex(_Filename);
         }
         else
         {
             tree = CreateSpatialIndexFromFile(_Filename);
         }
     }
 }
示例#4
0
 private void LoadSpatialIndex(bool ForceRebuild, bool LoadFromFile)
 {
     //Only load the tree if we haven't already loaded it, or if we want to force a rebuild
     if (tree == null || ForceRebuild)
     {
         // Is this a web application? If so lets store the index in the cache so we don't
         // need to rebuild it for each request
         if (System.Web.HttpContext.Current != null)
         {
             //Check if the tree exists in the cache
             if (System.Web.HttpContext.Current.Cache[_Filename] != null)
                 tree = (Utilities.SpatialIndexing.QuadTree)System.Web.HttpContext.Current.Cache[_Filename];
             else
             {
                 if (!LoadFromFile)
                     tree = CreateSpatialIndex(_Filename);
                 else
                     tree = CreateSpatialIndexFromFile(_Filename);
                 //Store the tree in the web cache
                 //TODO: Remove this when connection pooling is implemented
                 System.Web.HttpContext.Current.Cache.Insert(_Filename, tree, null, System.Web.Caching.Cache.NoAbsoluteExpiration, TimeSpan.FromDays(1));
             }
         }
         else
             if (!LoadFromFile)
                 tree = CreateSpatialIndex(_Filename);
             else
                 tree = CreateSpatialIndexFromFile(_Filename);
     }
 }
示例#5
0
 private void Dispose(bool disposing)
 {
     if (!disposed)
     {
         if (disposing)
         {
             Close();
             _Envelope = null;
             tree = null;
         }
         disposed = true;
     }
 }
示例#6
0
 /// <summary>
 /// Forces a rebuild of the spatial index. If the instance of the ShapeFile provider
 /// uses a file-based index the file is rewritten to disk.
 /// </summary>
 public void RebuildSpatialIndex()
 {
     if (this._FileBasedIndex)
     {
         if (System.IO.File.Exists(_Filename + ".sidx"))
             System.IO.File.Delete(_Filename + ".sidx");
         tree = CreateSpatialIndexFromFile(_Filename);
     }
     else
         tree = CreateSpatialIndex(_Filename);
     if (System.Web.HttpContext.Current != null)
         //TODO: Remove this when connection pooling is implemented:
         System.Web.HttpContext.Current.Cache.Insert(_Filename, tree, null, System.Web.Caching.Cache.NoAbsoluteExpiration, TimeSpan.FromDays(1));
 }