当前位置: 首页>>代码示例>>C#>>正文


C# Shape.Relate方法代码示例

本文整理汇总了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();
 }
开发者ID:ccurrens,项目名称:Spatial4n,代码行数:7,代码来源:NtsPoint.cs

示例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();
 }
开发者ID:h0st1le,项目名称:Spatial4n,代码行数:12,代码来源:NtsGeometry.cs

示例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();
 }
开发者ID:ccurrens,项目名称:Spatial4n,代码行数:14,代码来源:RectangleImpl.cs

示例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;
 }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:44,代码来源:QuadPrefixTree.cs

示例5: Relate

 public SpatialRelation Relate(Shape other)
 {
     if (other is Point)
         return this.Equals(other) ? SpatialRelation.INTERSECTS : SpatialRelation.DISJOINT;
     return other.Relate(this).Transpose();
 }
开发者ID:h0st1le,项目名称:Spatial4n,代码行数:6,代码来源:PointImpl.cs

示例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();
 }
开发者ID:h0st1le,项目名称:Spatial4n,代码行数:14,代码来源:RectangleImpl.cs

示例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();
        }
开发者ID:ccurrens,项目名称:Spatial4n,代码行数:26,代码来源:CircleImpl.cs

示例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);
            }
        }
开发者ID:ccurrens,项目名称:Spatial4n,代码行数:34,代码来源:AbstractTestShapes.cs


注:本文中的Shape.Relate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。