Example #1
0
        private void imageSet_ImageMouseDown(object sender, NationalInstruments.Vision.WindowsForms.ImageMouseEventArgs e)
        {
            if (GetBasePt || GetCurPt)
            {
                GetBasePt = false;
                GetCurPt  = false;
                PointF basePt     = new PointF();
                PointF curPt      = new PointF();
                double coordAngle = (double)this.nAngle.Value;
                var    cur        = Form_Main.Instance.XYPos;
                // 转到0度 计算X 和 Y的j间距
                basePt = Form_Main.Instance.Point2CCDCenter(cur, this.BasePt, CAM.Top, 0);
                curPt  = Form_Main.Instance.Point2CCDCenter(cur, this.CurPt, CAM.Top, 0);

                PointF rotateCured = new PointF();
                Form_Main.Instance.PtRotate(curPt, basePt, -coordAngle, out rotateCured);

                // 转回来
                PointF needRotatePt = new PointF();
                needRotatePt.X = basePt.X + (float)this.nStandardX.Value;
                needRotatePt.Y = basePt.Y + (float)this.nStandardY.Value;

                PointF needPt = new PointF();
                Form_Main.Instance.PtRotate(needRotatePt, basePt, coordAngle, out needPt);

                this.tOffsetX.Text = (needPt.X - curPt.X).ToString("f3");
                this.tOffsetY.Text = (needPt.Y - curPt.Y).ToString("f3");
            }
        }
Example #2
0
        private void imageSet_ImageMouseMove(object sender, NationalInstruments.Vision.WindowsForms.ImageMouseEventArgs e)
        {
            this.imageSet.Image.Overlays.Default.Clear();
            double angle = (double)this.nAngle.Value;

            if (bShowCross)
            {
                PointContour center = new PointContour(this.imageSet.Image.Width / 2, this.imageSet.Image.Height / 2);
                this.showCross(angle, center, Rgb32Value.RedColor);
            }

            if (GetBasePt)
            {
                BasePt = e.Point;
            }
            else if (GetCurPt)
            {
                CurPt = e.Point;
                PointF basePt = new PointF();
                PointF curPt  = new PointF();
                var    cur    = Form_Main.Instance.XYPos;
                basePt = Form_Main.Instance.Point2CCDCenter(cur, this.BasePt, CAM.Top, 0);
                curPt  = Form_Main.Instance.Point2CCDCenter(cur, this.CurPt, CAM.Top, 0);
                var          dist   = this.GetDist(basePt, curPt, (double)this.nAngle.Value);
                PointContour textPt = new PointContour();
                textPt.X = e.Point.X - 20;
                textPt.Y = e.Point.Y - 50;
                this.imageSet.Image.Overlays.Default.AddText($"X:{dist.X:N2},\r\nY:{dist.Y:N2}", textPt, Rgb32Value.BlueColor, new OverlayTextOptions("Consolas", 36));
            }

            this.showCross(angle, BasePt, Rgb32Value.YellowColor);
            this.showCross(angle, CurPt, Rgb32Value.BlueColor);
        }
Example #3
0
 private void imageSet_ImageMouseMove(object sender, NationalInstruments.Vision.WindowsForms.ImageMouseEventArgs e)
 {
     if (GetPt)
     {
         this.imageSet.Image.Overlays.Default.Clear();
         this.imageSet.Image.Overlays.Default.AddLine(new NationalInstruments.Vision.LineContour(
                                                          new NationalInstruments.Vision.PointContour(e.Point.X, 0),
                                                          new NationalInstruments.Vision.PointContour(e.Point.X, this.imageSet.Image.Height)));
         this.imageSet.Image.Overlays.Default.AddLine(new NationalInstruments.Vision.LineContour(
                                                          new NationalInstruments.Vision.PointContour(0, e.Point.Y),
                                                          new NationalInstruments.Vision.PointContour(this.imageSet.Image.Width, e.Point.Y)));
     }
 }
Example #4
0
        private void imageSet_ImageMouseMove(object sender, NationalInstruments.Vision.WindowsForms.ImageMouseEventArgs e)
        {
            this.imageSet.Image.Overlays.Default.Clear();
            double angle = (double)this.numericUpDown1.Value;

            if (bShowCross)
            {
                PointContour center = new PointContour(this.imageSet.Image.Width / 2, this.imageSet.Image.Height / 2);
                this.showCross(angle, center, Rgb32Value.RedColor);
            }

            if (IsGetPoint)
            {
                this.showCross(angle, e.Point, Rgb32Value.YellowColor);
            }
        }
Example #5
0
        private void imageSet_ImageMouseDown(object sender, NationalInstruments.Vision.WindowsForms.ImageMouseEventArgs e)
        {
            if (IsGetPoint)
            {
                this.GetPt = e.Point;
                double angle = (double)this.numericUpDown1.Value;
                double rate  = angle / 180 * Math.PI;

                var    cur   = SystemEntiy.Instance[this.Module].XYPos;
                PointF wrold = new PointF();
                SystemEntiy.Instance[this.Module].WroldPt(Camera.Top, cur, e.Point, out wrold);
                this.tOffsetX.Text = (cur.X - wrold.X).ToString("f3");
                this.tOffsetY.Text = (cur.Y - wrold.Y).ToString("f3");

                IsGetPoint = false;
            }
        }
Example #6
0
 private void imageSet_ImageMouseDown(object sender, NationalInstruments.Vision.WindowsForms.ImageMouseEventArgs e)
 {
     GetPt = false;
     //this.imageSet.Image.Overlays.Default.Clear();
     this.ImageMouseDown?.Invoke(sender, e);
 }