本文整理汇总了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;
}