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


C# BoundingRectangle.GetBoundingRectangle方法代码示例

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


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

示例1: FillFromCache

        /// <summary>
        /// Adds the features retrieved from cache to the receiver.
        /// </summary>
        /// <param name="processAttributes">A value indicating whether the attributes will be processed or not</param>
        /// <param name="cacheAccessor">Cache accessor instance</param>
        /// <param name="fr">An object that receives the retrieved features</param>
        /// <param name="bounds">Rectangle that defines a query region</param>
        /// <returns>Number of retrieved features</returns>
        public static int FillFromCache(IFeatureCollectionCacheAccessor cacheAccessor, IFeatureReceiver fr, BoundingRectangle bounds, bool processAttributes)
        {
            ISpatialIndex pointsIndex = cacheAccessor.RestoreFeaturesIndex(MapAround.Mapping.FeatureType.Point);
            ISpatialIndex polylinesIndex = cacheAccessor.RestoreFeaturesIndex(MapAround.Mapping.FeatureType.Polyline);
            ISpatialIndex polygonsIndex = cacheAccessor.RestoreFeaturesIndex(MapAround.Mapping.FeatureType.Polygon);

            BoundingRectangle b;
            if (!bounds.IsEmpty())
                b = bounds.GetBoundingRectangle();
            else
            {
                b = new BoundingRectangle();
                b.Join(pointsIndex.IndexedSpace);
                b.Join(polylinesIndex.IndexedSpace);
                b.Join(polygonsIndex.IndexedSpace);
            }

            List<Feature> points = new List<Feature>();
            pointsIndex.QueryObjectsInRectangle(bounds, points);

            List<Feature> polylines = new List<Feature>();
            polylinesIndex.QueryObjectsInRectangle(bounds, polylines);

            List<Feature> polygons = new List<Feature>();
            polygonsIndex.QueryObjectsInRectangle(bounds, polygons);

            points.ForEach(point => fr.AddFeature((Feature)point.Clone()));
            polylines.ForEach(polyline => fr.AddFeature((Feature)polyline.Clone()));
            polygons.ForEach(polygon => fr.AddFeature((Feature)polygon.Clone()));

            if (processAttributes)
            {
                fr.FeatureAttributeNames.Clear();
                IList<string> attributeNames = cacheAccessor.RestoreAttributeNames();
                foreach (string s in attributeNames)
                    fr.FeatureAttributeNames.Add(s);
            }

            return points.Count + polylines.Count + polygons.Count;
        }
开发者ID:gkrsu,项目名称:maparound.core,代码行数:48,代码来源:SpatialDataProviders.cs


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