本文整理汇总了C#中Spatial4n.Core.Context.SpatialContext.NormX方法的典型用法代码示例。如果您正苦于以下问题:C# SpatialContext.NormX方法的具体用法?C# SpatialContext.NormX怎么用?C# SpatialContext.NormX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Spatial4n.Core.Context.SpatialContext
的用法示例。
在下文中一共展示了SpatialContext.NormX方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RelateRectangleCircleWrapsPole
private SpatialRelation RelateRectangleCircleWrapsPole(Rectangle r, SpatialContext ctx)
{
//This method handles the case where the circle wraps ONE pole, but not both. For both,
// there is the inverseCircle case handled before now. The only exception is for the case where
// the circle covers the entire globe, and we'll check that first.
if (distDEG == 180)//whole globe
return SpatialRelation.CONTAINS;
//Check if r is within the pole wrap region:
double yTop = GetCenter().GetY() + distDEG;
if (yTop > 90)
{
double yTopOverlap = yTop - 90;
Debug.Assert(yTopOverlap <= 90, "yTopOverlap: " + yTopOverlap);
if (r.GetMinY() >= 90 - yTopOverlap)
return SpatialRelation.CONTAINS;
}
else
{
double yBot = point.GetY() - distDEG;
if (yBot < -90)
{
double yBotOverlap = -90 - yBot;
Debug.Assert(yBotOverlap <= 90);
if (r.GetMaxY() <= -90 + yBotOverlap)
return SpatialRelation.CONTAINS;
}
else
{
//This point is probably not reachable ??
Debug.Assert(yTop == 90 || yBot == -90);//we simply touch a pole
//continue
}
}
//If there are no corners to check intersection because r wraps completely...
if (r.GetWidth() == 360)
return SpatialRelation.INTERSECTS;
//Check corners:
int cornersIntersect = NumCornersIntersect(r);
// (It might be possible to reduce contains() calls within nCI() to exactly two, but this intersection
// code is complicated enough as it is.)
if (cornersIntersect == 4)
{//all
double backX = ctx.NormX(GetCenter().GetX() + 180);
if (r.RelateXRange(backX, backX, ctx).Intersects())
return SpatialRelation.INTERSECTS;
else
return SpatialRelation.CONTAINS;
}
else if (cornersIntersect == 0)
{//none
double frontX = GetCenter().GetX();
if (r.RelateXRange(frontX, frontX, ctx).Intersects())
return SpatialRelation.INTERSECTS;
else
return SpatialRelation.DISJOINT;
}
else//partial
return SpatialRelation.INTERSECTS;
}