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


C# Shape.GetCenter方法代码示例

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


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

示例1: CreateIndexableFields

        public AbstractField[] CreateIndexableFields(Shape shape, double distErr)
        {
            int detailLevel = grid.GetLevelForDistance(distErr);
            var cells = grid.GetNodes(shape, detailLevel, true);//true=intermediates cells
            //If shape isn't a point, add a full-resolution center-point so that
            // PointPrefixTreeFieldCacheProvider has the center-points.
            // TODO index each center of a multi-point? Yes/no?
            if (!(shape is Point))
            {
                Point ctr = shape.GetCenter();
                //TODO should be smarter; don't index 2 tokens for this in CellTokenStream. Harmless though.
                cells.Add(grid.GetNodes(ctr, grid.GetMaxLevels(), false)[0]);
            }

            //TODO is CellTokenStream supposed to be re-used somehow? see Uwe's comments:
            //  http://code.google.com/p/lucene-spatial-playground/issues/detail?id=4

            return new AbstractField[]
                       {
                           new Field(GetFieldName(), new CellTokenStream(cells.GetEnumerator()))
                               {OmitNorms = true, OmitTermFreqAndPositions = true}
                       };
        }
开发者ID:hanabi1224,项目名称:lucene.net,代码行数:23,代码来源:PrefixTreeStrategy.cs

示例2: MakeRecipDistanceValueSource

 /// <summary>
 /// Returns a ValueSource with values ranging from 1 to 0, depending inversely
 /// on the distance from {@link #makeDistanceValueSource(com.spatial4j.core.shape.Point)}.
 /// The formula is <c>c/(d + c)</c> where 'd' is the distance and 'c' is
 /// one tenth the distance to the farthest edge from the center. Thus the
 /// scores will be 1 for indexed points at the center of the query shape and as
 /// low as ~0.1 at its furthest edges.
 /// </summary>
 /// <param name="queryShape"></param>
 /// <returns></returns>
 public ValueSource MakeRecipDistanceValueSource(Shape queryShape)
 {
     Rectangle bbox = queryShape.GetBoundingBox();
     double diagonalDist = ctx.GetDistCalc().Distance(
         ctx.MakePoint(bbox.GetMinX(), bbox.GetMinY()), bbox.GetMaxX(), bbox.GetMaxY());
     double distToEdge = diagonalDist*0.5;
     float c = (float) distToEdge*0.1f; //one tenth
     return new ReciprocalFloatFunction(MakeDistanceValueSource(queryShape.GetCenter()), 1f, c, c);
 }
开发者ID:raol,项目名称:lucene.net,代码行数:19,代码来源:SpatialStrategy.cs

示例3: newDoc

 protected override Document newDoc(String id, Shape shape)
 {
     //called by adoc().  Make compatible with BBoxStrategy.
     if (shape != null && strategy is BBoxStrategy)
         shape = ctx.MakeRectangle(shape.GetCenter(), shape.GetCenter());
     return base.newDoc(id, shape);
 }
开发者ID:Nangal,项目名称:lucene.net,代码行数:7,代码来源:DistanceStrategyTest.cs


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