Exemple #1
0
        private void FormRefresh(bool isAutoFit)
        {
            this.aqDisplay1.InteractiveGraphics.Clear();
            if (null != _producer.ImageIn)
            {
                this.aqDisplay1.Image = _producer.ImageIn.Clone() as Bitmap;
                if (_producer.IsDisplay)
                {
                    for (int index = 0; index < _device.TaskSize; ++index)
                    {
                        ShapeOf2D.ConvertRectToShapeOf2D(Rectangle.Truncate(_device.Roi[index]), out var shapeOf2D);
                        DisplayContour.GetContours(shapeOf2D.XldPointYs, shapeOf2D.XldPointXs, shapeOf2D.XldPointsNums, out var contours, _aqColor[index], 2);
                        DisplayContour.Display(this.aqDisplay1, contours);
                    }
                }
            }

            if (isAutoFit)
            {
                this.aqDisplay1.FitToScreen();
            }
            this.aqDisplay1.Update();

            return;
        }
        private void RefreshAqDisplayOfCheck(bool isSelected = false, int indexOfDefectRegion = 0)
        {
            this.aqDisplayOfCheck.Show();
            this.aqDisplayOfCheck.InteractiveGraphics.Clear();
            if (null == _defectCell || null == _defectCell.DefectImage)
            {
                this.aqDisplayOfCheck.Hide();

                return;
            }
            this.aqDisplayOfCheck.Image = _defectCell.DefectImage.Clone() as Bitmap;
            foreach (var defectRegion in _defectCell.DefectRegions)
            {
                List <AqShap> aqShape = new List <AqShap>();
                if (isSelected && indexOfDefectRegion == _defectCell.DefectRegions.IndexOf(defectRegion))
                {
                    DisplayContour.GetContours(defectRegion.XldYs, defectRegion.XldXs, defectRegion.XldPointCount, out aqShape, AqVision.Graphic.AqColorEnum.Green, 3);
                }
                else
                {
                    DisplayContour.GetContours(defectRegion.XldYs, defectRegion.XldXs, defectRegion.XldPointCount, out aqShape, AqVision.Graphic.AqColorEnum.Red, 1);
                }
                DisplayContour.Display(aqDisplayOfCheck, aqShape);
            }
            this.aqDisplayOfCheck.FitToScreen();
            this.aqDisplayOfCheck.Update();

            return;
        }
        private void RefreshDisplayShape()
        {
            ShapeOf2D result = new ShapeOf2D();

            if (IsDisplayOfDefect)
            {
                result += ProductManager.DefectParam.Region;
            }
            if (IsDisplayOfBadConnection)
            {
                result += ProductManager.BadConnectionParam.Region;
            }
            if (IsDisplayOfOverage)
            {
                result += ProductManager.OverageParam.Region;
            }
            if (IsDisplayOfOffset)
            {
                result += ProductManager.OffsetParam.Region;
                //
                ShapeOf2D.ConverPoint2DToCross(ProductManager.OffsetParam.CurrPoint, 3, out var currPoint);
                result += currPoint;
                ShapeOf2D.ConverPoint2DToCross(ProductManager.OffsetParam.StandardPoint, 5, out var standardPoint);
                result += standardPoint;
            }
            if (IsDisplayOfTip)
            {
                result += ProductManager.TipParam.Region;
            }

            DisplayContour.GetContours(result.XldPointYs, result.XldPointXs, result.XldPointsNums, out var _displayShapes, AqVision.Graphic.AqColorEnum.Red, 2);
            DisplayShapes = _displayShapes;

            return;
        }
Exemple #4
0
        public void Run()
        {
            if (null != ImageIn)
            {
                MessageManager.Instance().Info("++++++Producer.Run(): begin.");
                lock (TaskPool.PAD_LOCK)
                {
                    _device.TryPushImages(ImageIn);
                }
                MessageManager.Instance().Info("++++++Producer.Run(): end.");

                DisplayShapes = new List <AqShap>();
                if (IsDisplay)
                {
                    List <double> y   = new List <double>();
                    List <double> x   = new List <double>();
                    List <int>    num = new List <int>();
                    for (int index = 0; index < _device.TaskSize; ++index)
                    {
                        ShapeOf2D.ConvertRectToShapeOf2D(Rectangle.Truncate(_device.Roi[index]), out var shapeOf2D);
                        y.AddRange(shapeOf2D.XldPointYs);
                        x.AddRange(shapeOf2D.XldPointXs);
                        num.AddRange(shapeOf2D.XldPointsNums);
                    }
                    DisplayContour.GetContours(y, x, num, out var contours, AqVision.Graphic.AqColorEnum.Yellow, 2);
                    DisplayShapes = contours;

                    IsUpdate = true;
                }
                else
                {
                    IsUpdate = false;
                }

                IsResultOK = true;
            }

            return;
        }
        private void ConvertHRegionsToAqShapes(List <HObject> regions, out List <AqShap> aqShapes)
        {
            aqShapes = new List <AqShap>();
            List <double> posYs      = new List <double>();
            List <double> posXs      = new List <double>();
            List <int>    pointsNums = new List <int>();

            if (null == regions)
            {
                return;
            }

            foreach (var region in regions)
            {
                ConvertSingleHRegionToPoints(region, out var posYsOfElement, out var posXsOfElement, out var pointsNumsOfElement);
                posYs.AddRange(posYsOfElement);
                posXs.AddRange(posXsOfElement);
                pointsNums.AddRange(pointsNumsOfElement);
            }
            DisplayContour.GetContours(posYs, posXs, pointsNums, out aqShapes);

            return;
        }
Exemple #6
0
        private void FormRefresh(bool isAutoFit)
        {
            this.aqDisplay1.InteractiveGraphics.Clear();
            if (null != _detector.ImageIn)
            {
                this.aqDisplay1.Image = _detector.ImageIn.Clone() as Bitmap;
                if (_detector.IsDisplay)
                {
                    //
                    if (_detector.IsDisplayOfDefect)
                    {
                        if (null != _detector.ProductManager.DefectParam.Region && 0 != _detector.ProductManager.DefectParam.Region.XldPointsNums.Count)
                        {
                            var temp = _detector.ProductManager.DefectParam.Region;
                            DisplayContour.GetContours(temp.XldPointYs, temp.XldPointXs, temp.XldPointsNums, out var shape, AqVision.Graphic.AqColorEnum.Green, 2);
                            DisplayContour.Display(this.aqDisplay1, shape);
                        }
                    }
                    //
                    if (_detector.IsDisplayOfBadConnection)
                    {
                        if (null != _detector.ProductManager.BadConnectionParam.Region && 0 != _detector.ProductManager.BadConnectionParam.Region.XldPointsNums.Count)
                        {
                            var temp = _detector.ProductManager.BadConnectionParam.Region;
                            DisplayContour.GetContours(temp.XldPointYs, temp.XldPointXs, temp.XldPointsNums, out var shape, AqVision.Graphic.AqColorEnum.Red, 2);
                            DisplayContour.Display(this.aqDisplay1, shape);
                        }
                    }
                    //
                    if (_detector.IsDisplayOfOverage)
                    {
                        if (null != _detector.ProductManager.OverageParam.Region && 0 != _detector.ProductManager.OverageParam.Region.XldPointsNums.Count)
                        {
                            var temp = _detector.ProductManager.OverageParam.Region;
                            DisplayContour.GetContours(temp.XldPointYs, temp.XldPointXs, temp.XldPointsNums, out var shape, AqVision.Graphic.AqColorEnum.Blue, 2);
                            DisplayContour.Display(this.aqDisplay1, shape);
                        }
                    }
                    //
                    if (_detector.IsDisplayOfOffset)
                    {
                        if (null != _detector.ProductManager.OffsetParam.Region && 0 != _detector.ProductManager.OffsetParam.Region.XldPointsNums.Count)
                        {
                            var temp = _detector.ProductManager.OffsetParam.Region;
                            DisplayContour.GetContours(temp.XldPointYs, temp.XldPointXs, temp.XldPointsNums, out var shape, AqVision.Graphic.AqColorEnum.Yellow, 2);
                            DisplayContour.Display(this.aqDisplay1, shape);
                        }
                        //
                        ShapeOf2D.ConverPoint2DToCross(_detector.ProductManager.OffsetParam.StandardPoint, 3, out var standardPoint);
                        DisplayContour.GetContours(standardPoint.XldPointYs, standardPoint.XldPointXs, standardPoint.XldPointsNums, out var shapeOfStandardPoint, AqVision.Graphic.AqColorEnum.Yellow, 4);
                        DisplayContour.Display(this.aqDisplay1, shapeOfStandardPoint);
                        //
                        ShapeOf2D.ConverPoint2DToCross(_detector.ProductManager.OffsetParam.CurrPoint, 3, out var currPoint);
                        DisplayContour.GetContours(currPoint.XldPointYs, currPoint.XldPointXs, currPoint.XldPointsNums, out var shapeOfCurrPoint, AqVision.Graphic.AqColorEnum.Yellow, 2);
                        DisplayContour.Display(this.aqDisplay1, shapeOfCurrPoint);
                    }
                    //
                    if (_detector.IsDisplayOfTip)
                    {
                        if (null != _detector.ProductManager.TipParam.Region && 0 != _detector.ProductManager.TipParam.Region.XldPointsNums.Count)
                        {
                            var temp = _detector.ProductManager.TipParam.Region;
                            DisplayContour.GetContours(temp.XldPointYs, temp.XldPointXs, temp.XldPointsNums, out var shape, AqVision.Graphic.AqColorEnum.Orange, 2);
                            DisplayContour.Display(this.aqDisplay1, shape);
                        }
                    }
                }
            }
            if (isAutoFit)
            {
                this.aqDisplay1.FitToScreen();
            }
            this.aqDisplay1.Update();

            return;
        }