public void ShowResult(HWndCtrl viewCtrl)
        {
            //搜索范围
            viewCtrl.ChangeGraphicSettings(Mode.DRAWMODE, "margin");
            if (SearchRegion != null && SearchRegion.IsInitialized())
            {
                viewCtrl.ChangeGraphicSettings(Mode.COLOR, "blue");
                viewCtrl.ChangeGraphicSettings(Mode.LINEWIDTH, 2);
                viewCtrl.AddIconicVar(SearchRegion);
            }
            //确保已有模板
            if (createShapeModel.hShapeModel == null || !createShapeModel.hShapeModel.IsInitialized() || createShapeModel.createNewModelID)
            {
                if (!createShapeModel.CreateShapeModelAct(refImage))
                {
                    return;
                }
            }
            //获取仿射变换后的轮廓
            HXLDCont modelXldCont = createShapeModel.ModelXLDCont;

            if (row.Length < 1)
            {
                return;
            }
            GenDetectionXLDResults(modelXldCont);


            if (resultXLDCont != null && resultXLDCont.IsInitialized())
            {
                viewCtrl.ChangeGraphicSettings(Mode.COLOR, "blue");
                viewCtrl.ChangeGraphicSettings(Mode.LINEWIDTH, 2);
                viewCtrl.AddIconicVar(resultXLDCont);
            }
        }
Example #2
0
 public void Show(HWndCtrl viewCtrl)
 {
     if (Arrow != null && Arrow.IsInitialized())
     {
         viewCtrl.ChangeGraphicSettings(Mode.COLOR, "green");
         viewCtrl.ChangeGraphicSettings(Mode.DRAWMODE, "margin");
         viewCtrl.ChangeGraphicSettings(Mode.LINEWIDTH, 2);
         viewCtrl.AddIconicVar(Arrow);
     }
 }
 public void ShowGrabPoint(HWndCtrl viewCtrl)
 {
     if (GrabRowTarget != null && GrabRowTarget.Length > 0)
     {
         GrabXld.GenCrossContourXld(GrabRowTarget, GrabColTarget, 30, 0);
     }
     if (GrabXld != null && GrabXld.IsInitialized())
     {
         viewCtrl.ChangeGraphicSettings(Mode.COLOR, "blue");
         viewCtrl.ChangeGraphicSettings(Mode.LINEWIDTH, 2);
         viewCtrl.AddIconicVar(GrabXld);
     }
 }
 public void Show(HWndCtrl viewCtrl)
 {
     if (ResultRegion != null && ResultRegion.IsInitialized())
     {
         viewCtrl.ChangeGraphicSettings(Mode.COLOR, "green");
         viewCtrl.ChangeGraphicSettings(Mode.LINEWIDTH, 3);
         viewCtrl.AddIconicVar(ResultRegion);
     }
     //if (LanQuan_Region_Affines != null && LanQuan_Region_Affines.IsInitialized())
     //{
     //    viewCtrl.ChangeGraphicSettings(Mode.COLOR, "blue");
     //    viewCtrl.ChangeGraphicSettings(Mode.LINEWIDTH, 2);
     //    viewCtrl.AddIconicVar(LanQuan_Region_Affines);
     //}
 }
Example #5
0
 public void Show(HWndCtrl viewCtrl)
 {
     if (ResultRegion != null && ResultRegion.IsInitialized())
     {
         viewCtrl.ChangeGraphicSettings(Mode.COLOR, "red");
         viewCtrl.ChangeGraphicSettings(Mode.LINEWIDTH, 3);
         viewCtrl.AddIconicVar(ResultRegion);
     }
     if (Grab_Intervene_Region_Affines != null && Grab_Intervene_Region_Affines.IsInitialized())
     {
         viewCtrl.ChangeGraphicSettings(Mode.COLOR, "blue");
         viewCtrl.ChangeGraphicSettings(Mode.LINEWIDTH, 2);
         viewCtrl.AddIconicVar(Grab_Intervene_Region_Affines);
     }
 }
Example #6
0
        public void ShowShapeModel(HWndCtrl viewCtrl)
        {
            if (modelRegion == null || !modelRegion.IsInitialized())
            {
                return;
            }
            if (ModelXLDCont == null || !ModelXLDCont.IsInitialized())
            {
                return;
            }
            viewCtrl.ChangeGraphicSettings(Mode.DRAWMODE, "margin");
            if (modelRegion != null && modelRegion.IsInitialized())
            {
                viewCtrl.ChangeGraphicSettings(Mode.COLOR, "blue");
                viewCtrl.ChangeGraphicSettings(Mode.LINEWIDTH, 2);
                viewCtrl.AddIconicVar(modelRegion);
            }

            if (modelXLDContAffine == null)
            {
                modelXLDContAffine = new HXLDCont();
            }
            if (modelXLDContAffine != null && modelXLDContAffine.IsInitialized())
            {
                modelXLDContAffine.Dispose();
            }
            if (refCoordinates == null || refCoordinates.Length != 3)
            {
                return;
            }

            HHomMat2D homMat2D = new HHomMat2D();

            homMat2D.VectorAngleToRigid(0.0, 0.0, 0.0, refCoordinates[0].D, refCoordinates[1].D, refCoordinates[2].D);
            modelXLDContAffine = homMat2D.AffineTransContourXld(ModelXLDCont);

            if (modelXLDContAffine != null && modelXLDContAffine.IsInitialized())
            {
                viewCtrl.ChangeGraphicSettings(Mode.COLOR, "red");
                viewCtrl.ChangeGraphicSettings(Mode.LINEWIDTH, 1);
                viewCtrl.AddIconicVar(modelXLDContAffine);
            }
        }
        public void ShowResult(HWndCtrl hWndCtrl, List <ToolBase> runToolList, bool runningResultFlag)
        {
            if (runningResultFlag == false)
            {
                hWndCtrl.ShowNg();
                if (IniStatus.Instance.SaveNgImage == 1)
                {
                    DateTime dt          = DateTime.Now;
                    string   timeNow     = dt.ToString("yyyy_MM_dd_HH_mm_ss_fff");
                    string   project     = Path.GetFileNameWithoutExtension(UserSetting.Instance.ProjectPath);
                    string   NGImagePath = "D:\\data\\" + project + "\\NgImage\\" + "\\工具组" + settingIndex + "\\";
                    SaveImage(NGImagePath + timeNow + ".png", runToolList[0].ImageTestOut);
                }
            }
            else
            {
                hWndCtrl.ShowOK();
                if (IniStatus.Instance.SaveOkImage == 1)
                {
                    DateTime dt          = DateTime.Now;
                    string   timeNow     = dt.ToString("yyyy_MM_dd_HH_mm_ss_fff");
                    string   project     = Path.GetFileNameWithoutExtension(UserSetting.Instance.ProjectPath);
                    string   NGImagePath = "D:\\data\\" + project + "\\OKImage\\" + "\\工具组" + settingIndex + "\\";
                    SaveImage(NGImagePath + timeNow + ".png", runToolList[0].ImageTestOut);
                }
            }
            HTuple showStart1;

            HOperatorSet.CountSeconds(out showStart1);
            hWndCtrl.ChangeGraphicSettings(Mode.LINESTYLE, new HTuple());
            hWndCtrl.AddIconicVar(runToolList[0].ImageTestOut);
            foreach (ToolBase item in runToolList)
            {
                try
                {
                    item.ShowResult(hWndCtrl);
                    if (item.Message != null && item.Message.Length > 0)
                    {
                        Util.Notify(string.Format("工具{0}_{1}", item.Name, item.Message));
                    }
                }
                catch (Exception ex)
                {
                    Util.Notify(string.Format("工具{0}显示异常", item.Name)); //("工具{0}显示异常{1}", item.Name,e.message));
                    Util.WriteLog(this.GetType(), ex);
                }
            }
            hWndCtrl.Repaint();
        }
        public void ShowResult(HWndCtrl viewCtrl)
        {
            viewCtrl.ChangeGraphicSettings(Mode.DRAWMODE, "margin");
            if (SearchRegion != null && SearchRegion.IsInitialized())
            {
                viewCtrl.ChangeGraphicSettings(Mode.COLOR, "blue");
                viewCtrl.ChangeGraphicSettings(Mode.LINEWIDTH, 2);
                viewCtrl.AddIconicVar(SearchRegion);
            }

            if (scan_regions != null && scan_regions.IsInitialized())
            {
                viewCtrl.ChangeGraphicSettings(Mode.COLOR, "cyan");
                viewCtrl.ChangeGraphicSettings(Mode.LINEWIDTH, 2);
                viewCtrl.AddIconicVar(scan_regions);
            }

            if (createShapeModel.hShapeModel == null || !createShapeModel.hShapeModel.IsInitialized() || createShapeModel.createNewModelID)
            {
                if (!createShapeModel.CreateShapeModelAct(refImage))
                {
                    return;
                }
            }

            HXLDCont modelXldCont = createShapeModel.ModelXLDCont;

            if (row.Length < 1)
            {
                return;
            }
            GenDetectionXLDResults(modelXldCont);
            if (resultXLDCont != null && resultXLDCont.IsInitialized())
            {
                viewCtrl.ChangeGraphicSettings(Mode.COLOR, "blue");
                viewCtrl.ChangeGraphicSettings(Mode.LINEWIDTH, 2);
                viewCtrl.AddIconicVar(resultXLDCont);
            }
            //GenDetectionRegionResult(createShapeModel.modelRegion);
            //if (resultRegion != null && resultRegion.IsInitialized())
            //{
            //    viewCtrl.ChangeGraphicSettings(Mode.COLOR, "green");
            //    viewCtrl.ChangeGraphicSettings(Mode.LINEWIDTH, 2);
            //    viewCtrl.AddIconicVar(resultRegion);
            //}
        }
Example #9
0
        private void DisplayCalib(HImage image)
        {
            if (ho_Caltab == null)
            {
                ho_Caltab = new HObject();
                ho_Caltab.GenEmptyObj();
            }
            ho_Caltab.Dispose();
            HOperatorSet.GetCalibDataObservContours(out ho_Caltab, CalibDataID, "caltab", 0, 0, index);
            HTuple hv_Row, hv_Column, hv_Index, hv_Pose;

            HOperatorSet.GetCalibDataObservPoints(CalibDataID, 0, 0, index, out hv_Row, out hv_Column, out hv_Index, out hv_Pose);
            if (ho_Cross == null)
            {
                ho_Cross = new HObject();
                ho_Cross.GenEmptyObj();
            }
            ho_Cross.Dispose();
            HOperatorSet.GenCrossContourXld(out ho_Cross, hv_Row, hv_Column, 30, 0.785398);

            mView.ClearList();
            if (image != null && image.IsInitialized())
            {
                mView.AddIconicVar(image);
            }
            if (ho_Caltab != null && ho_Caltab.IsInitialized())
            {
                mView.ChangeGraphicSettings(Mode.COLOR, "green");
                mView.ChangeGraphicSettings(Mode.LINEWIDTH, 3);
                mView.AddIconicVar(ho_Caltab);
            }
            if (ho_Cross != null && ho_Cross.IsInitialized())
            {
                mView.ChangeGraphicSettings(Mode.COLOR, "blue");
                mView.ChangeGraphicSettings(Mode.LINEWIDTH, 2);
                mView.AddIconicVar(ho_Cross);
            }
            mView.AddText(index.ToString(), 100, 100, 80, "green");
            mView.Repaint();
        }