本文整理汇总了C#中DotSpatial.Data.Extent.ExpandBy方法的典型用法代码示例。如果您正苦于以下问题:C# Extent.ExpandBy方法的具体用法?C# Extent.ExpandBy怎么用?C# Extent.ExpandBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DotSpatial.Data.Extent
的用法示例。
在下文中一共展示了Extent.ExpandBy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Layers_LayerAdded
/// <summary>
/// Zooms to the envelope if no envelope has been established for this frame.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected virtual void Layers_LayerAdded(object sender, LayerEventArgs e)
{
if (ExtentsInitialized) return;
ExtentsInitialized = true;
if (e.Layer != null)
{
ViewExtents = e.Layer.Extent.Copy();
ViewExtents.ExpandBy(e.Layer.Extent.Width / 10, e.Layer.Extent.Height / 10);
}
}
示例2: 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;
}