本文整理汇总了C#中DotSpatial.Data.Extent.ExpandToInclude方法的典型用法代码示例。如果您正苦于以下问题:C# Extent.ExpandToInclude方法的具体用法?C# Extent.ExpandToInclude怎么用?C# Extent.ExpandToInclude使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DotSpatial.Data.Extent
的用法示例。
在下文中一共展示了Extent.ExpandToInclude方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Select
/// <inheritdoc/>
public virtual List<IFeature> Select(Extent region, out Extent affectedRegion)
{
var result = new List<IFeature>();
affectedRegion = new Extent();
if (IndexMode)
{
var aoi = new ShapeRange(region);
var shapes = ShapeIndices;
for (var shp = 0; shp < shapes.Count; shp++)
{
if (!shapes[shp].Intersects(aoi))
{
continue;
}
var feature = GetFeature(shp);
affectedRegion.ExpandToInclude(feature.Envelope.ToExtent());
result.Add(feature);
}
}
else
{
foreach (var feature in Features)
{
if (!region.Intersects(feature.Envelope) ||
!feature.Intersects(region.ToEnvelope()))
{
continue;
}
result.Add(feature);
affectedRegion.ExpandToInclude(feature.Envelope.ToExtent());
}
}
return result;
}
示例2: CalculateCategoryExtent
/// <summary>
/// This calculates the extent for the category and caches it in the extents collection
/// </summary>
/// <param name="category">
/// </param>
protected virtual Extent CalculateCategoryExtent(IFeatureCategory category)
{
Extent ext = new Extent(new[] { double.MaxValue, double.MaxValue, double.MinValue, double.MinValue });
if (_editMode)
{
IDictionary<IFeature, IDrawnState> features = _drawingFilter.DrawnStates;
foreach (IFeature f in DataSet.Features)
{
if (category == features[f].SchemeCategory)
{
ext.ExpandToInclude(new Extent(f.Envelope));
}
}
if (_categoryExtents.Keys.Contains(category))
{
_categoryExtents[category] = ext.Copy();
}
else
{
_categoryExtents.Add(category, ext.Copy());
}
}
else
{
FastDrawnState[] states = DrawnStates;
List<ShapeRange> ranges = DataSet.ShapeIndices;
for (int shp = 0; shp < DrawnStates.Length; shp++)
{
if (states[shp].Category != null)
{
if (!_categoryExtents.ContainsKey(states[shp].Category))
{
_categoryExtents.Add(states[shp].Category, ranges[shp].Extent.Copy());
}
else
{
_categoryExtents[states[shp].Category].ExpandToInclude(ranges[shp].Extent);
}
}
}
}
return ext;
}
示例3: Select
/// <inheritdoc/>
public virtual List<IFeature> Select(Extent region, out Extent affectedRegion)
{
List<IFeature> result = new List<IFeature>();
if (IndexMode)
{
ShapeRange aoi = new ShapeRange(region);
Extent affected = new Extent();
List<ShapeRange> shapes = ShapeIndices;
if (shapes != null)
{
//ProgressMeter = new ProgressMeter(ProgressHandler, "Selecting shapes", shapes.Count);
for (int shp = 0; shp < shapes.Count; shp++)
{
//ProgressMeter.Next();
if (!shapes[shp].Intersects(aoi))
{
continue;
}
IFeature f = GetFeature(shp);
affected.ExpandToInclude(shapes[shp].Extent);
result.Add(f);
}
//ProgressMeter.Reset();
}
affectedRegion = affected;
return result;
}
affectedRegion = new Extent();
bool useProgress = (Features.Count > 10000);
//ProgressMeter = new ProgressMeter(ProgressHandler, "Selecting Features", Features.Count);
foreach (IFeature feature in Features)
{
//if (useProgress)
// ProgressMeter.Next();
if (!region.Intersects(feature.Envelope))
{
continue;
}
if (!feature.Intersects(region.ToEnvelope()))
{
continue;
}
result.Add(feature);
affectedRegion.ExpandToInclude(feature.Envelope.ToExtent());
}
//if (useProgress)
// ProgressMeter.Reset();
return result;
}
示例4: UpdateExtent
/// <summary>
/// After changing coordinates, this will force the re-calculation of envelopes on a feature
/// level or test the shapes in index mode to rebuild an Extent.
/// </summary>
public void UpdateExtent()
{
Extent mx;
if (Count == 0)
{
mx = new Extent(-180, -90, 180, 90);
}
else
{
mx = new Extent();
for (var i = 0; i < Count; i++)
{
var extent = GetFeatureExtent(i);
mx.ExpandToInclude(extent);
}
}
MyExtent = mx;
}
示例5: CalculateExtents
/// <summary>
/// Forces each of the parts to adopt an extent equal to a calculated extents.
/// The extents for the shape will expand to include those.
/// </summary>
public Extent CalculateExtents()
{
Extent ext = new Extent();
foreach (PartRange part in Parts)
{
ext.ExpandToInclude(part.CalculateExtent());
}
Extent = ext;
return ext;
}
示例6: GetMaxExtent
public Extent GetMaxExtent()
{
Extent extent= new Extent();
Extent x = new Extent();
for (int i = 0; i < Servicies.Count(); i++)
{
if (Servicies.ElementAt(i).GetType() == typeof(WMSClient))
{
WMSClient WmsClient = (WMSClient)Servicies.ElementAt(i);
x=WmsClient.GetMaxSize();
}
else
{
WMTClient WmtClient = (WMTClient)Servicies.ElementAt(i);
x=WmtClient.Extent();
}
if (i == 0)
extent = x;
else
extent.ExpandToInclude(x);
}
return extent;
}
示例7: CalculateExtent
/// <summary>
/// This creates a new extent and cylces through the coordinates to calculate what it is.
/// Since the vertices may change so easilly, this is not cached.
/// </summary>
/// <returns></returns>
public Extent CalculateExtent()
{
// Create an extent for faster checking in most cases
Extent ext = new Extent();
// Do this once, and then we can re-use it for each other part.
foreach (Vertex point in this)
{
ext.ExpandToInclude(point.X, point.Y);
}
return ext;
}
示例8: UpdateExtent
/// <summary>
/// After changing coordinates, this will force the re-calculation of envelopes on a feature
/// level or test the shapes in index mode to rebuild an Extent.
/// </summary>
public void UpdateExtent()
{
MyExtent = new Extent();
if (!IndexMode)
{
if (Features == null || Features.Count <= 0)
{
// jany_ (2015-07-17) return the empty extent because any other extent would result in to big extent when zooming to full map extent
return;
}
foreach (IFeature feature in Features)
{
feature.UpdateEnvelope();
MyExtent.ExpandToInclude(new Extent(feature.Envelope));
}
}
else
{
if (_shapeIndices == null || _shapeIndices.Count == 0)
{
// jany_ (2015-07-17) return the empty extent because any other extent would result in to big extent when zooming to full map extent
return;
}
foreach (ShapeRange range in _shapeIndices)
{
range.CalculateExtents();
MyExtent.ExpandToInclude(range.Extent);
}
}
}
示例9: Create
/// <summary>
/// Create search layer
/// </summary>
public IEnumerable<IMapPointLayer> Create()
{
var ext = new Extent();
Debug.WriteLine("Starting Create method");
if (!_searchResult.ResultItems.Any())
{
Debug.WriteLine("Returning new point layer");
return new List<IMapPointLayer>();
}
Debug.WriteLine("Getting data sites layer...");
var root = _map.GetDataSitesLayer(true);
Debug.WriteLine("Done");
var layersToSelect = new List<MapPointLayer>();
var result = new List<IMapPointLayer>();
Debug.WriteLine("Starting loop, count: " + _searchResult.ResultItems.Count());
foreach(var item in _searchResult.ResultItems)
{
try
{
Debug.WriteLine("creating search result layer");
var subResultLayer = CreateSearchResultLayer(item, root);
Debug.WriteLine("Done; adding subResultLayer to list of result layers");
result.Add(subResultLayer);
Debug.WriteLine("Done; adding subResultLayer to root");
root.Add(subResultLayer);
Debug.WriteLine("Done; adding subResultLayer to layersToSelect");
layersToSelect.Add(subResultLayer);
Debug.WriteLine("Done with loop iteration");
}
catch (Exception e)
{
Debug.WriteLine("Exception: " + e.Message);
Debug.WriteLine(e.StackTrace);
}
}
Debug.WriteLine("Loop Done, refreshing map");
_map.Refresh();
Debug.WriteLine("Done");
Debug.WriteLine("Starting another loop");
//assign the projection again
foreach (var item in _searchResult.ResultItems)
{
item.FeatureSet.Reproject(_map.Projection);
ext.ExpandToInclude(item.FeatureSet.Extent);
}
Debug.WriteLine("Loop done. Now looping through layers: " + root.Layers.Count);
for (int i = 0; i < root.Layers.Count; i++)
{
var layer = root[i];
var state = layersToSelect.Contains(layer);
var rendItem = layer as IRenderableLegendItem;
if (rendItem != null)
{
rendItem.IsVisible = state; // force a re-draw in the case where we are talking about layers.
}
else
{
layer.Checked = state;
}
}
Debug.WriteLine("End loop");
ext.ExpandBy(_map.ViewExtents.Width / 100);
_map.ViewExtents = ext;
_map.Refresh();
Debug.WriteLine("Return result");
return result;
}