本文整理汇总了C#中Shape.Relate方法的典型用法代码示例。如果您正苦于以下问题:C# Shape.Relate方法的具体用法?C# Shape.Relate怎么用?C# Shape.Relate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Shape
的用法示例。
在下文中一共展示了Shape.Relate方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Relate
public SpatialRelation Relate(Shape other, SpatialContext ctx)
{
// ** NOTE ** the overall order of logic is kept consistent here with simple.PointImpl.
if (other is Point)
return this.Equals(other) ? SpatialRelation.INTERSECTS : SpatialRelation.DISJOINT;
return other.Relate(this, ctx).Transpose();
}
示例2: Relate
public SpatialRelation Relate(Shape other)
{
if (other is Point)
return Relate((Point)other);
else if (other is Rectangle)
return Relate((Rectangle)other);
else if (other is Circle)
return Relate((Circle)other, ctx);
else if (other is NtsGeometry)
return Relate((NtsGeometry)other);
return other.Relate(this).Transpose();
}
示例3: Relate
public SpatialRelation Relate(Shape other, SpatialContext ctx)
{
var point = other as Point;
if (point != null)
{
return Relate(point, ctx);
}
var rectangle = other as Rectangle;
if (rectangle != null)
{
return Relate(rectangle, ctx);
}
return other.Relate(this, ctx).Transpose();
}
示例4: CheckBattenberg
// possibly consider hilbert curve
// http://en.wikipedia.org/wiki/Hilbert_curve
// http://blog.notdot.net/2009/11/Damn-Cool-Algorithms-Spatial-indexing-with-Quadtrees-and-Hilbert-Curves
// if we actually use the range property in the query, this could be useful
private void CheckBattenberg(char c, double cx, double cy, int level, IList<Cell>
matches, StringBuilder str,
Shape shape, int maxLevel)
{
Debug.Assert(str.Length == level);
double w = levelW[level] / 2;
double h = levelH[level] / 2;
int strlen = str.Length;
Rectangle rectangle = ctx.MakeRectangle(cx - w, cx + w, cy - h, cy + h);
SpatialRelation v = shape.Relate(rectangle);
if (SpatialRelation.CONTAINS == v)
{
str.Append(c);
//str.append(SpatialPrefixGrid.COVER);
matches.Add(new QuadCell(this, str.ToString(), v.Transpose()));
}
else
{
if (SpatialRelation.DISJOINT == v)
{
}
else
{
// nothing
// SpatialRelation.WITHIN, SpatialRelation.INTERSECTS
str.Append(c);
int nextLevel = level + 1;
if (nextLevel >= maxLevel)
{
//str.append(SpatialPrefixGrid.INTERSECTS);
matches.Add(new QuadCell(this, str.ToString(), v.Transpose()));
}
else
{
Build(cx, cy, nextLevel, matches, str, shape, maxLevel);
}
}
}
str.Length = strlen;
}
示例5: Relate
public SpatialRelation Relate(Shape other)
{
if (other is Point)
return this.Equals(other) ? SpatialRelation.INTERSECTS : SpatialRelation.DISJOINT;
return other.Relate(this).Transpose();
}
示例6: Relate
public SpatialRelation Relate(Shape other)
{
var point = other as Point;
if (point != null)
{
return Relate(point);
}
var rectangle = other as Rectangle;
if (rectangle != null)
{
return Relate(rectangle);
}
return other.Relate(this).Transpose();
}
示例7: Relate
public SpatialRelation Relate(Shape other, SpatialContext ctx)
{
Debug.Assert(this.ctx == ctx);
//This shortcut was problematic in testing due to distinctions of CONTAINS/WITHIN for no-area shapes (lines, points).
// if (distance == 0) {
// return point.relate(other,ctx).intersects() ? SpatialRelation.WITHIN : SpatialRelation.DISJOINT;
// }
var other1 = other as Point;
if (other1 != null)
{
return Relate(other1, ctx);
}
var rectangle = other as Rectangle;
if (rectangle != null)
{
return Relate(rectangle, ctx);
}
var circle = other as Circle;
if (circle != null)
{
return Relate(circle, ctx);
}
return other.Relate(this, ctx).Transpose();
}
示例8: AssertIntersect
private void AssertIntersect(String msg, SpatialRelation expected, Shape a, Shape b)
{
SpatialRelation sect = a.Relate(b, ctx);
if (sect == expected)
return;
if (expected == SpatialRelation.WITHIN || expected == SpatialRelation.CONTAINS)
{
if (a.GetType() == b.GetType()) // they are the same shape type
Assert.Equal(/*msg,*/ a, b);
else
{
//they are effectively points or lines that are the same location
Assert.True(!a.HasArea(), msg);
Assert.True(!b.HasArea(), msg);
Rectangle aBBox = a.GetBoundingBox();
Rectangle bBBox = b.GetBoundingBox();
if (aBBox.GetHeight() == 0 && bBBox.GetHeight() == 0
&& (aBBox.GetMaxY() == 90 && bBBox.GetMaxY() == 90
|| aBBox.GetMinY() == -90 && bBBox.GetMinY() == -90))
{
; //== a point at the pole
}
else
{
Assert.Equal( /*msg,*/ aBBox, bBBox);
}
}
}
else
{
Assert.Equal(/*msg,*/ expected, sect);
}
}