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


C# Point.IsEmpty方法代码示例

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


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

示例1: Point

		public void Point()
		{
			//Do various Point method calls to cover the point class with sufficient testing
			Point p0 = new Point();
			Point p1 = new Point(0,0);
			Point p2 = new Point(450, 120);
			Assert.IsTrue(p0.IsEmpty());
			Assert.IsFalse(p1.IsEmpty());
			Assert.AreNotEqual(p0, p1);
			Assert.AreEqual(450, p2.X);
			Assert.AreEqual(120, p2.Y);
			Assert.AreNotSame(p2.Clone(), p2);
			p0 = p2.Clone();
			p0.X += 100; p0.Y = 150;
			p0[0] += p0[1];
			Assert.AreEqual(new Point(700, 150),p0);
			Assert.AreEqual(p2, p2.GetBoundingBox().Min);
			Assert.AreEqual(p2, p2.GetBoundingBox().Max);
			Assert.IsTrue(p2.IsSimple());
			Assert.IsFalse(p2.IsEmpty());
			Assert.AreEqual(2, p2.NumOrdinates);
			Assert.AreEqual(new Point(400, 100), p2 + new Point(-50, -20));
			Assert.AreEqual(new Point(500, 100), p2 - new Point(-50, 20));
			Assert.AreEqual(new Point(900, 240), p2 * 2);
			Assert.AreEqual(0, p2.Dimension);
			Assert.AreEqual(450, p2[0]);
			Assert.AreEqual(120, p2[1]);
			Assert.IsNull(p2.Boundary());
			Assert.AreEqual(p2.X.GetHashCode() ^ p2.Y.GetHashCode() ^ p2.IsEmpty().GetHashCode(), p2.GetHashCode());
			Assert.Greater(p2.CompareTo(p1), 0);
			Assert.Less(p1.CompareTo(p2), 0);
			Assert.AreEqual(p2.CompareTo(new Point(450,120)), 0);
		}
开发者ID:lishxi,项目名称:_SharpMap,代码行数:33,代码来源:PointTests.cs

示例2: AppendPointText

 /// <summary>
 /// Converts a Coordinate to Point Text format then Appends it to the writer.
 /// </summary>
 /// <param name="coordinate">The Coordinate to process.</param>
 /// <param name="writer">The output stream writer to Append to.</param>
 private static void AppendPointText(Point coordinate, StringWriter writer)
 {
     if (coordinate == null || coordinate.IsEmpty())
         writer.Write("EMPTY");
     else
     {
         writer.Write("(");
         AppendCoordinate(coordinate, writer);
         writer.Write(")");
     }
 }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:16,代码来源:GeometryToWKT.cs


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