本文整理汇总了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);
}
示例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);
}