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


C# Envelope.Center方法代码示例

本文整理汇总了C#中Envelope.Center方法的典型用法代码示例。如果您正苦于以下问题:C# Envelope.Center方法的具体用法?C# Envelope.Center怎么用?C# Envelope.Center使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Envelope的用法示例。


在下文中一共展示了Envelope.Center方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Center

 public void Center()
 {
     var rnd = new Random();
     var c1 = new Coordinate((rnd.NextDouble() * 360) - 180, (rnd.NextDouble() * 180) - 90);
     var c2 = new Coordinate((rnd.NextDouble() * 360) - 180, (rnd.NextDouble() * 180) - 90);
     var ev = new Envelope(c1, c2);
     var x1 = c1.X;
     var y1 = c1.Y;
     var x2 = c2.X;
     var y2 = c2.Y;
     var c1Check = new GeoAPI.Geometries.Coordinate(x1, y1);
     var c2Check = new GeoAPI.Geometries.Coordinate(x2, y2);
     var evcheck = new GeoAPI.Geometries.Envelope(c1Check, c2Check);
     var center = new Coordinate(ev.Center());
     var centercheck = new GeoAPI.Geometries.Coordinate(evcheck.Centre);
     AssertExt.AreEqual15(center.X, centercheck.X);
     AssertExt.AreEqual15(center.Y, centercheck.Y);
 }
开发者ID:joelmuzz,项目名称:DotSpatial,代码行数:18,代码来源:EnvelopeUnitTests.cs

示例2: Center

 public void Center()
 {
     Random rnd = new Random();
     Coordinate c1 = new Coordinate((rnd.NextDouble() * 360) - 180, (rnd.NextDouble() * 180) - 90);
     Coordinate c2 = new Coordinate((rnd.NextDouble() * 360) - 180, (rnd.NextDouble() * 180) - 90);
     Envelope ev = new Envelope(c1, c2);
     double x1 = c1.X;
     double y1 = c1.Y;
     double x2 = c2.X;
     double y2 = c2.Y;
     GisSharpBlog.NetTopologySuite.Geometries.Coordinate c1Check = new GisSharpBlog.NetTopologySuite.Geometries.Coordinate(x1, y1);
     GisSharpBlog.NetTopologySuite.Geometries.Coordinate c2Check = new GisSharpBlog.NetTopologySuite.Geometries.Coordinate(x2, y2);
     GisSharpBlog.NetTopologySuite.Geometries.Envelope evcheck = new GisSharpBlog.NetTopologySuite.Geometries.Envelope(c1Check, c2Check);
     Coordinate center = new Coordinate(ev.Center());
     GisSharpBlog.NetTopologySuite.Geometries.Coordinate centercheck = new GisSharpBlog.NetTopologySuite.Geometries.Coordinate(evcheck.Centre);
     AssertExt.AreEqual15(center.X, centercheck.X);
     AssertExt.AreEqual15(center.Y, centercheck.Y);
 }
开发者ID:ExRam,项目名称:DotSpatial-PCL,代码行数:18,代码来源:EnvelopeUnitTests.cs


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