本文整理汇总了C#中IEnvelope.ExpandBy方法的典型用法代码示例。如果您正苦于以下问题:C# IEnvelope.ExpandBy方法的具体用法?C# IEnvelope.ExpandBy怎么用?C# IEnvelope.ExpandBy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEnvelope
的用法示例。
在下文中一共展示了IEnvelope.ExpandBy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ZoomToLayerEnvelope
private void ZoomToLayerEnvelope(IEnvelope layerEnvelope)
{
if (_extendBuffer)
{
layerEnvelope.ExpandBy(layerEnvelope.Width, layerEnvelope.Height);
}
const double eps = 1e-7;
if (layerEnvelope.Width > eps && layerEnvelope.Height > eps)
{
layerEnvelope.ExpandBy(layerEnvelope.Width / 10, layerEnvelope.Height / 10); // work item #84
}
else
{
double zoomInFactor = 0.05; //fixed zoom-in by 10% - 5% on each side
double newExtentWidth = ViewExtents.Width * zoomInFactor;
double newExtentHeight = ViewExtents.Height * zoomInFactor;
layerEnvelope.ExpandBy(newExtentWidth, newExtentHeight);
}
ViewExtents = layerEnvelope.ToExtent();
}
示例2: AddMargin
/// <summary>
/// Expands the given boundingBox by percentage.
/// </summary>
/// <param name="boundingBox">Boundingbox to expand</param>
/// <param name="percentage">Percentage by which boundingBox is expanded</param>
private static void AddMargin(IEnvelope boundingBox,double percentage)
{
double minX = 0.0;
double minY = 0.0;
if (boundingBox.Width < 1.0e-6)
{
minX = 1.0;
}
if (boundingBox.Height < 1.0e-6)
{
minY = 1.0;
}
var factor = percentage/100;
boundingBox.ExpandBy(minX + boundingBox.Width * factor, minY + boundingBox.Height * factor);
}