本文整理汇总了C#中DotSpatial.Topology.Envelope.Center方法的典型用法代码示例。如果您正苦于以下问题:C# Envelope.Center方法的具体用法?C# Envelope.Center怎么用?C# Envelope.Center使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DotSpatial.Topology.Envelope
的用法示例。
在下文中一共展示了Envelope.Center方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DetermineZoomLevel
/// <summary>
///
/// </summary>
/// <param name="envelope"></param>
/// <param name="rectangle"></param>
/// <returns></returns>
public static int DetermineZoomLevel(Envelope envelope, Rectangle rectangle)
{
double metersAcross = EarthRadiusKms * envelope.Width * Math.PI / 180; //find the arc length represented by the displayed map
metersAcross *= Math.Cos(envelope.Center().Y * Math.PI / 180); //correct for the center latitude
double metersAcrossPerPixel = metersAcross / rectangle.Width; //find the resolution in meters per pixel
//find zoomlevel such that metersAcrossPerPix is close
for (int i = 2; i < 19; i++)
{
double groundRes = GroundResolution(envelope.Center().Y, i);
if (metersAcrossPerPixel > groundRes)
{
//System.Diagnostics.Debug.WriteLine("metersPerPixel: " + metersAcrossPerPixel);
//System.Diagnostics.Debug.WriteLine("groundRes: " + groundRes);
//double ratio = metersAcrossPerPixel / groundRes;
//System.Diagnostics.Debug.WriteLine("ratio: " + ratio);
//fix zoom level..
//changed to a slightly lower zoom level to increase readability
if (i > 2 && i < 18) return i - 1;
////MessageBox.Show("MAPP: "+metersAcrossPerPixel+" , zoom: "+(i-1));
return i;
}
}
return -1;
}