public void TestEqualOperator() { var s1 = new QPoint(3, 7); var s2 = new QPoint(3, 7); Assert.AreEqual(s1, s2); }
/// <summary> /// Convert Image to grayscale indexed image (like GIF) /// </summary> /// <param name="originalImage"></param> /// <returns></returns> public static QImage ConvertToGrayScaleIndexed(QImage originalImage) { var newImage = new QImage(originalImage.Size, QImage.Format.FormatGrayscale8); newImage.ColorCount = 256; for (int i = 0; i < 256; i++) { newImage.SetColor(i, qrgb.QRgb(i, i, i)); } // Add color table for image // [looking at example](http://stackoverflow.com/questions/5504768/how-to-use-a-color-lut-in-qt-qimage) for (int x = 0; x < originalImage.Width; x++) { for (int y = 0; y < originalImage.Height; y++) { var point = new QPoint(x, y); // pixel position UInt32 pixel = originalImage.Pixel(point); var gray = qrgb.QGray(pixel); newImage.SetPixel(point, qrgb.QRgb(gray, gray, gray)); } } //newImage.Save ( @"d:\dump.png", "png" ); return(newImage); }
public void TestIntegerConstructor() { var s = new QPoint(5, 10); Assert.AreEqual(5, s.X); Assert.AreEqual(10, s.Y); }
private void OnContextMenu(QListViewItem item,QPoint point,int col) { popupMenuItem = item; if (item is ClassItem) { ClassItem klass = (ClassItem)item; QPopupMenu menu = new QPopupMenu(this); menu.InsertItem("Exclude from coverage",this,SLOT("OnExclude()")); if (klass.Model.sourceFile != null) { menu.InsertItem("View Source",this,SLOT("OnViewSource()")); } menu.Exec(point); } else if (item is NamespaceItem) { QPopupMenu menu = new QPopupMenu(this); menu.InsertItem("Exclude from coverage",this,SLOT("OnExclude()")); menu.Exec(point); } }
void on_participantsGrid_customContextMenuRequested(QPoint point) { if (participantsGrid.HoverItem != null) { var mucHandler = (MucHandler)m_Handler; m_SelectedParticipant = participantsGrid.HoverItem; var me = mucHandler.Room.Participants[mucHandler.Room.RoomAndNick]; bool isModerator = me.Role == RoomRole.moderator; bool isAdminOrOwner = me.Affiliation == RoomAffiliation.admin || me.Affiliation == RoomAffiliation.owner; m_ModeratorActionsMenu.Enabled = isModerator || isAdminOrOwner; m_ChangeAffiliationAction.Enabled = isAdminOrOwner; m_ModeratorAction.Checked = (m_SelectedParticipant.Role == RoomRole.moderator); m_VisitorAction.Checked = (m_SelectedParticipant.Role == RoomRole.visitor); m_ParticipantAction.Checked = (m_SelectedParticipant.Role == RoomRole.participant); m_AddAsFriendAction.Enabled = !String.IsNullOrEmpty(participantsGrid.HoverItem.RealJID); m_ParticipantItemMenu.Popup(participantsGrid.MapToGlobal(point)); } else { m_ParticipantsMenu.Popup(participantsGrid.MapToGlobal(point)); } }
public void TestEmptyConstructor() { var s = new QPoint(); Assert.AreEqual(0, s.X); Assert.AreEqual(0, s.Y); }
public void TestManhattanLength() { var s1 = new QPoint(3, 7); var res = s1.ManhattanLength; Assert.AreEqual(10, res); }
public void TestY() { var s1 = new QPoint(3, 7); var res = s1.Y; Assert.AreEqual(7, res); }
public void TestDotProduct() { var s1 = new QPoint(3, 7); var s2 = new QPoint(-1, 4); var dot = QPoint.DotProduct(s1, s2); Assert.AreEqual(25, dot); }
public void TestX() { var s1 = new QPoint(3, 7); var res = s1.X; Assert.AreEqual(3, res); }
public unsafe void TestRy() { var s1 = new QPoint(3, 7); int *res = s1.Ry; Assert.AreEqual(7, *res); }
public void TestSubQPointOperator() { var s1 = new QPoint(3, 7); var res = -s1; Assert.AreEqual(-3, res.X); Assert.AreEqual(-7, res.Y); }
public void TestDivEqualOperator() { var s1 = new QPoint(-3, 10); s1 /= 2.5; Assert.AreEqual(-1, s1.X); Assert.AreEqual(4, s1.Y); }
public void TestDivOperator() { var s1 = new QPoint(3, 7); var res = s1 / 1.0; Assert.AreEqual(3, res.X); Assert.AreEqual(7, res.Y); }
public void TestMultiEqualDoubleOperator() { var s1 = new QPoint(3, 7); s1 *= 5.0; Assert.AreEqual(15, s1.X); Assert.AreEqual(35, s1.Y); }
private bool BarrelHit(QPoint pos) { QMatrix matrix = new QMatrix(); matrix.Translate(0, Height()); matrix.Rotate(-currentAngle); matrix = matrix.Inverted(); return(barrelRect.Contains(matrix.Map(pos))); }
public void TestMultDoubleOperator() { var s1 = new QPoint(3, 7); var res = s1 * 5.0; Assert.AreEqual(15, res.X); Assert.AreEqual(35, res.Y); }
public void TestAddQPointOperator() { var s1 = new QPoint(3, 7); var res = +s1; Assert.AreEqual(3, res.X); Assert.AreEqual(7, res.Y); }
public void TestMultIntRevOperator() { var s1 = new QPoint(3, 7); var res = 5 * s1; Assert.AreEqual(15, res.X); Assert.AreEqual(35, res.Y); }
public void TestSubEqualOperator() { var s1 = new QPoint(3, 7); var s2 = new QPoint(-1, 4); s1 -= s2; Assert.AreEqual(4, s1.X); Assert.AreEqual(3, s1.Y); }
public void TestSubQPointsOperator() { var s1 = new QPoint(3, 7); var s2 = new QPoint(-1, 4); var res = s1 - s2; Assert.AreEqual(4, res.X); Assert.AreEqual(3, res.Y); }
public void TestAddQPointsOperator() { var s1 = new QPoint(3, 7); var s2 = new QPoint(-1, 4); var res = s1 + s2; Assert.AreEqual(2, res.X); Assert.AreEqual(11, res.Y); }
public void TestAddEqualOperator() { var s1 = new QPoint(3, 7); var s2 = new QPoint(-1, 4); s1 += s2; Assert.AreEqual(2, s1.X); Assert.AreEqual(11, s1.Y); }
public override void QueryOffset(Pnt point, out double offset, out double along) { along = 0; offset = 0; bool rightSide = false; QPoint.PutCoords(point.X, point.Y); InnerSegment.QueryPointAndDistance(esriSegmentExtension.esriExtendTangents, QPoint, true, QPoint, ref along, ref offset, ref rightSide); }
public void NewTarget() { if (firstTime) { firstTime = false; random = new Random(); } target = new QPoint(200 + random.Next(190), 10 + random.Next(255)); Update(); }
public void newTarget() { if (firstTime) { firstTime = false; QTime midnight = new QTime(0,0,0); RandomClass = new Random(); } target = new QPoint(200 + RandomClass.Next(190), 10 + RandomClass.Next(255)); Update(); }
public void TestPointSizeConstructor() { var p1 = new QPoint(50, 100); var p2 = new QSize(200, 150); var s = new QRect(p1, p2); Assert.AreEqual(50, s.Left); Assert.AreEqual(100, s.Top); Assert.AreEqual(200, s.Width); Assert.AreEqual(150, s.Height); }
public void TestContainsWithQPoint() { var s = new QRect(); s.X = 50; s.Y = 150; s.Width = 500; s.Height = 600; var p = new QPoint(275, 375); var n = s.Contains(p); Assert.IsTrue(n); }
public void TestSetPoints() { var s = new QLine(); var p1 = new QPoint(5, 5); var p2 = new QPoint(10, 10); s.SetPoints(p1, p2); Assert.AreEqual(5, s.P1.X); Assert.AreEqual(5, s.P1.Y); Assert.AreEqual(10, s.P2.X); Assert.AreEqual(10, s.P2.Y); }
public CannonField(QWidget parent) : base(parent) { currentAngle = 45; currentForce = 0; timerCount = 0; autoShootTimer = new QTimer(this); Connect(autoShootTimer, SIGNAL("timeout()"), this, SLOT("moveShot()")); shootAngle = 0; shootForce = 0; target = new QPoint(0, 0); Palette = new QPalette(new QColor(250, 250, 200)); AutoFillBackground = true; newTarget(); }
private void OnContextMenu(QListViewItem item, QPoint point, int col) { popupMenuItem = item; if (item is ClassItem) { ClassItem klass = (ClassItem)item; QPopupMenu menu = new QPopupMenu (this); menu.InsertItem ("Exclude from coverage", this, SLOT ("OnExclude()")); if (klass.Model.sourceFile != null) menu.InsertItem ("View Source", this, SLOT ("OnViewSource()")); menu.Exec (point); } else if (item is NamespaceItem) { QPopupMenu menu = new QPopupMenu (this); menu.InsertItem ("Exclude from coverage", this, SLOT ("OnExclude()")); menu.Exec (point); } }