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


C# IGeometry.GeometryToMBR方法代码示例

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


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

示例1: SearchDistance

 /// <summary>
 /// find all object which distance less or equal d from this geometry have
 /// </summary>
 /// <param name="result">
 /// result
 /// </param>
 /// <param name="distance">
 /// value of distance for serching
 /// </param>
 /// <param name="geometry">
 /// geometry
 /// </param>
 /// <returns>
 /// <c>true</c> if something was found; otherwise, <c>false</c>.
 /// </returns>
 public bool SearchDistance(out ReadOnlyCollection<AGraphElement> result, float distance, IGeometry geometry)
 {
     if (ReadResource())
     {
         result = new List<AGraphElement>().AsReadOnly();
         SpatialDataContainer searchContainer;
         if (DimensionTest(geometry.Dimensions) && TestOfGeometry(geometry))
         {
             searchContainer = CreateSearchContainer(geometry.GeometryToMBR(), distance);
             result = OverlapSearch(searchContainer);
         }
         FinishReadResource();
         return result.Count > 0;
     }
     throw new CollisionException(this);
 }
开发者ID:politician,项目名称:fallen-8,代码行数:31,代码来源:RTree.cs

示例2: Overlap

        public bool Overlap(out ReadOnlyCollection<AGraphElement> result, IGeometry geometry)
        {
            if (ReadResource())
            {
                result = new List<AGraphElement>().AsReadOnly();
                if (TestOfGeometry(geometry) && DimensionTest(geometry.Dimensions))
                {
                    IRTreeDataContainer searchContainer;
                    if (geometry is IPoint)
                        searchContainer = new PointDataContainer(((IPoint)geometry).PointToSpaceR());
                    else
                        searchContainer = new SpatialDataContainer(geometry.GeometryToMBR());

                    result = OverlapSearch(searchContainer);
                }
                FinishReadResource();
                return result.Count > 0;
            }
            throw new CollisionException(this);
        }
开发者ID:politician,项目名称:fallen-8,代码行数:20,代码来源:RTree.cs

示例3: Distance

        public float Distance(IGeometry geometry1, IGeometry geometry2)
        {
            if (ReadResource())
            {
                if (geometry1 is IPoint && geometry2 is IPoint)
                {
                    FinishReadResource();
                    return Metric.Distance(new RTreePoint(((IPoint)geometry1).PointToSpaceR()),
                        new RTreePoint(((IPoint)geometry2).PointToSpaceR()));
                }

                var mbr1 = geometry1.GeometryToMBR();
                var mbr2 = geometry2.GeometryToMBR();
                var points = FindNeighborPoints(mbr1.Lower, mbr1.Upper, mbr2.Lower, mbr2.Upper);

                FinishReadResource();
                return Metric.Distance(points.Item1, points.Item2);
            }
            throw new CollisionException(this);
        }
开发者ID:politician,项目名称:fallen-8,代码行数:20,代码来源:RTree.cs

示例4: GetNextNeighbors

        public bool GetNextNeighbors(out ReadOnlyCollection<AGraphElement> result, IGeometry geometry, int countOfNextNeighbors)
        {
            if (ReadResource())
            {
                result = new List<AGraphElement>().AsReadOnly();
                if (TestOfGeometry(geometry) && DimensionTest(geometry.Dimensions))
                {
                    IRTreeDataContainer output;
                    if (geometry is IPoint)
                        output = new PointDataContainer(((IPoint)geometry).PointToSpaceR());
                    else
                        output = new SpatialDataContainer(geometry.GeometryToMBR());

                    var containers = new LinkedList<Tuple<float, IRTreeDataContainer>>();
                    var maxElement = float.PositiveInfinity;

                    var stack = new Stack<ARTreeContainer>();
                    if (Distance(_root, output) < maxElement || containers.Count < countOfNextNeighbors)
                        stack.Push(_root);
                    while (stack.Count > 0)
                    {
                        var currentContainer = stack.Pop();

                        if (!currentContainer.IsLeaf)
                        {
                            foreach (var value2 in ((RTreeNode)currentContainer).Children)
                            {
                                if (Distance(value2, output) < maxElement || containers.Count < countOfNextNeighbors)
                                    stack.Push(value2);
                            }
                        }
                        else
                        {
                            foreach (var value2 in ((RTreeLeaf)currentContainer).Data)
                            {
                                var dist = Distance(value2, output);

                                if ((containers.Count < countOfNextNeighbors || dist < maxElement) && value2 != output)
                                {
                                    if (containers.Count == 0)
                                    {
                                        containers.AddFirst(new LinkedListNode<Tuple<float, IRTreeDataContainer>>(Tuple.Create(dist, value2)));
                                        maxElement = dist;
                                    }
                                    else
                                    {
                                        var end = true;
                                        var start = containers.First;
                                        while (end)
                                        {

                                            if (dist < start.Value.Item1)
                                            {
                                                containers.AddBefore(start, Tuple.Create(dist, value2));
                                                if (containers.Count > countOfNextNeighbors)
                                                {
                                                    containers.RemoveLast();
                                                    maxElement = containers.Last.Value.Item1;
                                                }
                                                break;
                                            }
                                            if (start == containers.Last)
                                            {
                                                end = false;
                                            }
                                            else
                                            {
                                                start = start.Next;
                                            }
                                        }
                                        if (!end && containers.Count < countOfNextNeighbors)
                                        {
                                            maxElement = dist;
                                            containers.AddLast(Tuple.Create(dist, value2));
                                        }
                                    }
                                }
                            }
                        }

                    }
                    result = containers.Select(_ => _.Item2.GraphElement).ToList().AsReadOnly();
                }
                FinishReadResource();
                return result.Count > 0;

            }
            throw new CollisionException(this);
        }
开发者ID:politician,项目名称:fallen-8,代码行数:89,代码来源:RTree.cs

示例5: TestOfGeometry

 private bool TestOfGeometry(IGeometry key)
 {
     var iPoint = key as IPoint;
     return iPoint != null ? TestOfPoint(iPoint) : TestOfMBR(key.GeometryToMBR());
 }
开发者ID:politician,项目名称:fallen-8,代码行数:5,代码来源:RTree.cs


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