Esempio n. 1
0
        /// <summary>
        /// Generates a spatial index for a specified shape file.
        /// </summary>
        /// <param name="filename"></param>
        private Utilities.SpatialIndexing.QuadTree CreateSpatialIndex(string filename)
        {
            List <Utilities.SpatialIndexing.QuadTree.BoxObjects> objList = new List <Utilities.SpatialIndexing.QuadTree.BoxObjects>();
            //Convert all the geometries to boundingboxes
            uint i = 0;

            foreach (SharpMap.Geometries.BoundingBox box in GetAllFeatureBoundingBoxes())
            {
                if (!double.IsNaN(box.Left) && !double.IsNaN(box.Right) && !double.IsNaN(box.Bottom) && !double.IsNaN(box.Top))
                {
                    Utilities.SpatialIndexing.QuadTree.BoxObjects g = new Utilities.SpatialIndexing.QuadTree.BoxObjects();
                    g.box = box;
                    g.ID  = i;
                    objList.Add(g);
                    i++;
                }
            }

            Utilities.SpatialIndexing.Heuristic heur;
            heur.maxdepth  = (int)Math.Ceiling(Math.Log(this.GetFeatureCount(), 2));
            heur.minerror  = 10;
            heur.tartricnt = 5;
            heur.mintricnt = 2;
            return(new Utilities.SpatialIndexing.QuadTree(objList, 0, heur));
        }
Esempio n. 2
0
        /// <summary>
        /// Generates a spatial index for a specified shape file.
        /// </summary>
        /// <param name="filename"></param>
        private Utilities.SpatialIndexing.QuadTree CreateSpatialIndex(string filename)
        {
            List<Utilities.SpatialIndexing.QuadTree.BoxObjects> objList = new List<Utilities.SpatialIndexing.QuadTree.BoxObjects>();
            //Convert all the geometries to boundingboxes
            uint i = 0;
            foreach (SharpMap.Geometries.BoundingBox box in GetAllFeatureBoundingBoxes())
            {
                if (!double.IsNaN(box.Left) && !double.IsNaN(box.Right) && !double.IsNaN(box.Bottom) && !double.IsNaN(box.Top))
                {
                    Utilities.SpatialIndexing.QuadTree.BoxObjects g = new Utilities.SpatialIndexing.QuadTree.BoxObjects();
                    g.box = box;
                    g.ID = i;
                    objList.Add(g);
                    i++;
                }
            }

            Utilities.SpatialIndexing.Heuristic heur;
            heur.maxdepth = (int)Math.Ceiling(Math.Log(this.GetFeatureCount(), 2));
            heur.minerror = 10;
            heur.tartricnt = 5;
            heur.mintricnt = 2;
            return new Utilities.SpatialIndexing.QuadTree(objList, 0, heur);
        }