本文整理汇总了C#中Rectangle.Reset方法的典型用法代码示例。如果您正苦于以下问题:C# Rectangle.Reset方法的具体用法?C# Rectangle.Reset怎么用?C# Rectangle.Reset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rectangle
的用法示例。
在下文中一共展示了Rectangle.Reset方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CalcBoxByDistFromPt
public override Rectangle CalcBoxByDistFromPt(Point from, double distDEG, SpatialContext ctx, Rectangle reuse)
{
double minX = from.GetX() - distDEG;
double maxX = from.GetX() + distDEG;
double minY = from.GetY() - distDEG;
double maxY = from.GetY() + distDEG;
if (reuse == null)
{
return ctx.MakeRectangle(minX, maxX, minY, maxY);
}
else
{
reuse.Reset(minX, maxX, minY, maxY);
return reuse;
}
}
示例2: CalcBoxByDistFromPtDEG
public static Rectangle CalcBoxByDistFromPtDEG(double lat, double lon, double distDEG, SpatialContext ctx, Rectangle reuse)
{
//See http://janmatuschek.de/LatitudeLongitudeBoundingCoordinates Section 3.1, 3.2 and 3.3
double minX;
double maxX;
double minY;
double maxY;
if (distDEG == 0)
{
minX = lon;
maxX = lon;
minY = lat;
maxY = lat;
}
else if (distDEG >= 180)
{
//distance is >= opposite side of the globe
minX = -180;
maxX = 180;
minY = -90;
maxY = 90;
}
else
{
//--calc latitude bounds
maxY = lat + distDEG;
minY = lat - distDEG;
if (maxY >= 90 || minY <= -90)
{
//touches either pole
//we have special logic for longitude
minX = -180;
maxX = 180; //world wrap: 360 deg
if (maxY <= 90 && minY >= -90)
{
//doesn't pass either pole: 180 deg
minX = NormLonDEG(lon - 90);
maxX = NormLonDEG(lon + 90);
}
if (maxY > 90)
maxY = 90;
if (minY < -90)
minY = -90;
}
else
{
//--calc longitude bounds
double lon_delta_deg = CalcBoxByDistFromPt_deltaLonDEG(lat, lon, distDEG);
minX = NormLonDEG(lon - lon_delta_deg);
maxX = NormLonDEG(lon + lon_delta_deg);
}
}
if (reuse == null)
{
return ctx.MakeRectangle(minX, maxX, minY, maxY);
}
else
{
reuse.Reset(minX, maxX, minY, maxY);
return reuse;
}
}