Equals() public méthode

public Equals ( Region region, Graphics g ) : bool
region Region
g Graphics
Résultat bool
Exemple #1
0
		public void ClipTest_2() {
			Region r = new Region(new Rectangle(10, 10, 60, 60));
			t.Graphics.Clip = r;
			Assert.IsTrue(r.Equals(t.Graphics.Clip, t.Graphics));

			Pen redPen   = new Pen(Color.Red, 3);
			Pen greenPen = new Pen(Color.Green, 3);
			// Create points that define curve.
			Point point1 = new Point( 50,  50);
			Point point2 = new Point(100,  25);
			Point point3 = new Point(200,   5);
			Point point4 = new Point(250,  50);
			Point point5 = new Point(300, 100);
			Point point6 = new Point(350, 200);
			Point point7 = new Point(250, 250);
			Point[] curvePoints = {
									  point1,
									  point2,
									  point3,
									  point4,
									  point5,
									  point6,
									  point7
								  };
			// Draw lines between original points to screen.
			t.Graphics.DrawLines(redPen, curvePoints);
			t.Show ();
			Assert.IsTrue(t.PDCompare(TOLERANCE));
		}
Exemple #2
0
		public void IsEqual ()
		{
			Region r1 = new Region (sp1);
			Region r2 = new Region (sp2);
			Region r3 = new Region (sp3);
			Region r4 = new Region (sp4);
			// with self
			Assert.IsTrue (r1.Equals (r1, graphic), "r1-r1");
			Assert.IsTrue (r2.Equals (r2, graphic), "r2-r2");
			Assert.IsTrue (r3.Equals (r3, graphic), "r3-r3");
			Assert.IsTrue (r4.Equals (r4, graphic), "r4-r4");
			// with a different
			Assert.IsFalse (r1.Equals (r4, graphic), "r1-r4");
			Assert.IsFalse (r2.Equals (r3, graphic), "r2-r3");
			Assert.IsFalse (r3.Equals (r2, graphic), "r3-r2");
			Assert.IsFalse (r4.Equals (r1, graphic), "r4-r1");
			// with same (not self)
			Region r5 = r1.Clone ();
			r1.Exclude (r4);
			Assert.IsTrue (r1.Equals (r5, graphic), "r1-r5");
			Assert.IsTrue (r5.Equals (r1, graphic), "r5-r1");
			Assert.IsFalse (r5.Equals (r4, graphic), "r5-r4");
			Assert.IsFalse (r4.Equals (r5, graphic), "r4-r5");
		}
Exemple #3
0
		public void ClipTest_1() {
			Region r = new Region();
			Assert.IsTrue(r.Equals(t.Graphics.Clip, t.Graphics));
		}
Exemple #4
0
		public void ClipTest_1() {
			Region r = new Region();
			Assert.That(r.Equals(t.Graphics.Clip, t.Graphics), Is.True);
		}
Exemple #5
0
		public void TestCloneAndEquals()
		{
			Bitmap bmp = new Bitmap (600, 800);
			Graphics dc = Graphics.FromImage (bmp);
			Rectangle rect1, rect2;
			Region rgn1, rgn2;
			RectangleF [] rects;
			RectangleF [] rects2;
			Matrix matrix = new Matrix ();

			rect1 = new Rectangle (500, 30, 60, 80);
			rect2 = new Rectangle (520, 40, 60, 80);
			rgn1 = new Region (rect1);
			rgn1.Union (rect2);
			rgn2 = rgn1.Clone ();

			rects = rgn1.GetRegionScans (matrix);
			rects2 = rgn2.GetRegionScans (matrix);

			Assert.AreEqual (rects.Length, rects2.Length);

			for (int i = 0; i < rects.Length; i++) {

				Assert.AreEqual (rects[i].X, rects[i].X);
				Assert.AreEqual (rects[i].Y, rects[i].Y);
				Assert.AreEqual (rects[i].Width, rects[i].Width);
				Assert.AreEqual (rects[i].Height, rects[i].Height);
			}

			Assert.AreEqual (true, rgn1.Equals (rgn2, dc));
		}
 public string GetRegionNameInString(Region region)
 {
     if (region.Equals(Player.FrontField))
     {
         return "前卫区";
     }
     else if (region.Equals(Player.BackField))
     {
         return "后卫区";
     }
     else if (region.Equals(Player.Deck))
     {
         return "卡组";
     }
     else if (region.Equals(Player.Grave))
     {
         return "退避区";
     }
     else if (region.Equals(Player.Hand))
     {
         return "手卡";
     }
     else if (region.Equals(Player.Kizuna) || region.Equals(Player.KizunaUsed))
     {
         return "羁绊区";
     }
     else if (region.Equals(Player.Orb))
     {
         return "宝玉区";
     }
     else if (region.Equals(Player.Support))
     {
         return "支援区";
     }
     else if (region.Equals(Rival.FrontField))
     {
         return "对手前卫区";
     }
     else if (region.Equals(Rival.BackField))
     {
         return "对手后卫区";
     }
     else
     {
         return "Error";
     }
 }
Exemple #7
0
 public string GetRegionNameInString(Region region)
 {
     if (Language == Language.Chinese)
     {
         if (region.Equals(Player.FrontField))
         {
             return "前卫区";
         }
         else if (region.Equals(Player.BackField))
         {
             return "后卫区";
         }
         else if (region.Equals(Player.Deck))
         {
             return "卡组";
         }
         else if (region.Equals(Player.Grave))
         {
             return "退避区";
         }
         else if (region.Equals(Player.Hand))
         {
             return "手牌";
         }
         else if (region.Equals(Player.Kizuna) || region.Equals(Player.KizunaUsed))
         {
             return "羁绊区";
         }
         else if (region.Equals(Player.Orb))
         {
             return "宝玉区";
         }
         else if (region.Equals(Player.Support))
         {
             return "支援区";
         }
         else if (region.Equals(Player.Overlay))
         {
             return "叠放区";
         }
         else if (region.Equals(Rival.FrontField))
         {
             return "对手前卫区";
         }
         else if (region.Equals(Rival.BackField))
         {
             return "对手后卫区";
         }
         else
         {
             return "Error";
         }
     }
     else
     {
         if (region.Equals(Player.FrontField))
         {
             return "Frontline";
         }
         else if (region.Equals(Player.BackField))
         {
             return "Backline";
         }
         else if (region.Equals(Player.Deck))
         {
             return "Deck";
         }
         else if (region.Equals(Player.Grave))
         {
             return "Retreat";
         }
         else if (region.Equals(Player.Hand))
         {
             return "Hand";
         }
         else if (region.Equals(Player.Kizuna) || region.Equals(Player.KizunaUsed))
         {
             return "Bond";
         }
         else if (region.Equals(Player.Orb))
         {
             return "Orb";
         }
         else if (region.Equals(Player.Support))
         {
             return "Support";
         }
         else if (region.Equals(Player.Overlay))
         {
             return "Stacked";
         }
         else if (region.Equals(Rival.FrontField))
         {
             return "Opponent's Frontline";
         }
         else if (region.Equals(Rival.BackField))
         {
             return "Opponent's Backline";
         }
         else
         {
             return "Error";
         }
     }
 }