当前位置: 首页>>代码示例>>C#>>正文


C# Cell.GetSubCells方法代码示例

本文整理汇总了C#中Cell.GetSubCells方法的典型用法代码示例。如果您正苦于以下问题:C# Cell.GetSubCells方法的具体用法?C# Cell.GetSubCells怎么用?C# Cell.GetSubCells使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cell的用法示例。


在下文中一共展示了Cell.GetSubCells方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AllCellsIntersectQuery

 /// <summary>
 /// Returns true if the provided cell, and all its sub-cells down to
 /// detailLevel all intersect the queryShape.
 /// </summary>
 private bool AllCellsIntersectQuery(Cell cell, SpatialRelation relate/*cell to query*/)
 {
     if (relate == SpatialRelation.NOT_SET)
     {
         relate = cell.Shape.Relate(outerInstance.queryShape);
     }
     if (cell.Level == outerInstance.detailLevel)
     {
         return relate.Intersects();
     }
     if (relate == SpatialRelation.WITHIN)
     {
         return true;
     }
     if (relate == SpatialRelation.DISJOINT)
     {
         return false;
     }
     // Note: Generating all these cells just to determine intersection is not ideal.
     // It was easy to implement but could be optimized. For example if the docs
     // in question are already marked in the 'outside' bitset then it can be avoided.
     ICollection<Cell> subCells = cell.GetSubCells(null);
     foreach (Cell subCell in subCells)
     {
         if (!AllCellsIntersectQuery(subCell, SpatialRelation.NOT_SET))
         {
             //recursion
             return false;
         }
     }
     return true;
 }
开发者ID:apache,项目名称:lucenenet,代码行数:36,代码来源:WithinPrefixTreeFilter.cs

示例2: FindSubCellsToVisit

 protected internal override IEnumerator<Cell> FindSubCellsToVisit(Cell cell)
 {
     //use buffered query shape instead of orig.  Works with null too.
     return cell.GetSubCells(((WithinPrefixTreeFilter)outerInstance).bufferedQueryShape).GetEnumerator();
 }
开发者ID:apache,项目名称:lucenenet,代码行数:5,代码来源:WithinPrefixTreeFilter.cs

示例3: Visit

 //see getLeafDocs
 /// <summary>This is the primary algorithm; recursive.</summary>
 /// <remarks>This is the primary algorithm; recursive.  Returns null if finds none.</remarks>
 /// <exception cref="System.IO.IOException"></exception>
 internal SmallDocSet Visit(Cell cell, IBits acceptContains
     )
 {
     if (termsEnum == null)
     {
         //signals all done
         return null;
     }
     //Leaf docs match all query shape
     SmallDocSet leafDocs = GetLeafDocs(cell, acceptContains);
     // Get the AND of all child results
     SmallDocSet combinedSubResults = null;
     ICollection<Cell> subCells = cell.GetSubCells(_enclosing.queryShape);
     foreach (Cell subCell in subCells)
     {
         if (!SeekExact(subCell))
         {
             combinedSubResults = null;
         }
         else
         {
             if (subCell.Level == _enclosing.detailLevel)
             {
                 combinedSubResults = GetDocs(subCell, acceptContains);
             }
             else
             {
                 if (subCell.GetShapeRel() == SpatialRelation.WITHIN)
                 {
                     combinedSubResults = GetLeafDocs(subCell, acceptContains);
                 }
                 else
                 {
                     combinedSubResults = Visit(subCell, acceptContains);
                 }
             }
         }
         //recursion
         if (combinedSubResults == null)
         {
             break;
         }
         acceptContains = combinedSubResults;
     }
     //has the 'AND' effect on next iteration
     // Result: OR the leaf docs with AND of all child results
     if (combinedSubResults != null)
     {
         if (leafDocs == null)
         {
             return combinedSubResults;
         }
         return leafDocs.Union(combinedSubResults);
     }
     return leafDocs;
 }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:60,代码来源:ContainsPrefixTreeFilter.cs

示例4: FindSubCellsToVisit

 protected internal override IEnumerator<Cell> FindSubCellsToVisit(Cell cell)
 {
     //use buffered query shape instead of orig.  Works with null too.
     return cell.GetSubCells(_enclosing.bufferedQueryShape).GetEnumerator();
 }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:5,代码来源:WithinPrefixTreeFilter.cs

示例5: RecursiveGetCells

        /// <summary>Returns true if cell was added as a leaf.</summary>
        /// <remarks>
        /// Returns true if cell was added as a leaf. If it wasn't it recursively
        /// descends.
        /// </remarks>
        private bool RecursiveGetCells(Cell cell, IShape shape, int detailLevel, 
            bool inclParents, bool simplify, 
            IList<Cell> result)
        {
            if (cell.Level == detailLevel)
            {
                cell.SetLeaf();//FYI might already be a leaf
            }
            if (cell.IsLeaf)
            {
                result.Add(cell);
                return true;
            }
            if (inclParents && cell.Level != 0)
            {
                result.Add(cell);
            }

            ICollection<Cell> subCells = cell.GetSubCells(shape);
            int leaves = 0;
            foreach (Cell subCell in subCells)
            {
                if (RecursiveGetCells(subCell, shape, detailLevel, inclParents, simplify, result))
                {
                    leaves++;
                }
            }
            //can we simplify?
            if (simplify && leaves == cell.SubCellsSize && cell.Level != 0)
            {
                //Optimization: substitute the parent as a leaf instead of adding all
                // children as leaves

                //remove the leaves
                do
                {
                    result.RemoveAt(result.Count - 1);//remove last
                }
                while (--leaves > 0);
                //add cell as the leaf
                cell.SetLeaf();
                if (!inclParents)// otherwise it was already added up above
                {
                    result.Add(cell);
                }
                return true;
            }
            return false;
        }
开发者ID:apache,项目名称:lucenenet,代码行数:54,代码来源:SpatialPrefixTree.cs


注:本文中的Cell.GetSubCells方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。