Ejemplo n.º 1
0
        public void ClearCameraView()
        {
            #region 清空liveview

            if (m_pLiveView != null)
            {
                m_pLiveView.Dispose();
                m_pLiveView = null;
            }

            #endregion
        }
Ejemplo n.º 2
0
 public LiveView()
 {
     #region 初始化
     m_ptTopLeft      = new Point(0, 0);
     m_ptBottomRight  = new Point(1920, 1200);
     m_ptCenter       = new Point(960, 600);
     m_rcScreenArea   = new Rectangle(0, 0, 1920, 1200);
     m_rcPCBImageArea = new Rectangle(0, 0, 1920, 1200);
     imageView        = null;
     m_pLiveView      = null;
     m_bIsColor       = false;
     #endregion
 }
Ejemplo n.º 3
0
        private void tsbtnSaveImage_Click(object sender, EventArgs e)
        {
            string path = Application.StartupPath + "\\SaveImages";

            if (!System.IO.Directory.Exists(path))
            {
                System.IO.Directory.CreateDirectory(path);
            }
            if (m_iViewType == ConstData.View_Area)
            {
                path += "\\" + DateTime.Now.ToString("yyyy-MM-dd-hh-mm-ss");
                if (!System.IO.Directory.Exists(path))
                {
                    System.IO.Directory.CreateDirectory(path);
                }
                int nCount = m_AreaView.m_CameraViewList.Count;
                if (nCount > 0)
                {
                    Wells.FrmType.frmProgressBar frm = new Wells.FrmType.frmProgressBar();
                    frm.SetBarInfo(clsWellsLanguage.getString(109), nCount + 2);
                    System.Threading.ThreadPool.QueueUserWorkItem((s) => { frm.Start(); });
                    for (int igg = 0; igg < nCount; igg++)
                    {
                        CameraView pView = m_AreaView.m_CameraViewList[igg];
                        if (pView.m_bmp != null)
                        {
                            pView.m_bmp.Save(path + "\\" + pView.m_iIndex.ToString("000") + ".bmp", System.Drawing.Imaging.ImageFormat.Bmp);
                        }
                        frm.SetBarValue(igg);
                    }
                    Bitmap bmp = m_AreaView.CreateBoardImageLarge();
                    if (bmp != null)
                    {
                        bmp.Save(path + "\\FullLayout.bmp", System.Drawing.Imaging.ImageFormat.Bmp);
                        frm.SetBarValue(nCount);
                        bmp.Save(path + "\\FullLayout_thumbnail.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
                        frm.SetBarValue(nCount + 1);
                    }
                    frm.SetBarValue(nCount + 2);
                }
            }
            else if (m_iViewType == ConstData.View_Camera)
            {
                if (m_LiveView.m_bmpLive != null)
                {
                    m_LiveView.m_bmpLive.Save(path + "\\LiveViewImage" + DateTime.Now.ToString("-yy-MM-dd-hh-mm-ss-fff") + ".bmp", System.Drawing.Imaging.ImageFormat.Bmp);
                }
            }
        }
Ejemplo n.º 4
0
        public bool GetPixelAreaImage(Point pt, out Color color)
        {
            #region 根据物理坐标获取区域像素值

            bool ret = false;
            color = Color.FromArgb(100, 100, 100);

            if (m_CameraViewList != null)
            {
                if (m_CameraViewList.Count > 0)
                {
                    if (m_iCurpos >= 0 && m_iCurpos < m_CameraViewList.Count)
                    {
                        CameraView pView = m_CameraViewList[m_iCurpos];
                        if (pView != null)
                        {
                            int xDistance = Math.Abs(pView.m_ptCenter.X - pt.X);
                            int yDistance = Math.Abs(pView.m_ptCenter.Y - pt.Y);
                            if (((2 * xDistance) <= PCB.m_pPCB.m_xStep) && ((2 * yDistance) <= PCB.m_pPCB.m_yStep))
                            {
                                return(pView.GetPixelViewImage(pt, out color));
                            }
                        }
                    }
                }

                for (int igg = 0; igg < m_CameraViewList.Count; igg++)
                {
                    m_iCurpos = igg;
                    CameraView pView = m_CameraViewList[igg];
                    if (pView != null)
                    {
                        int xDistance = Math.Abs(pView.m_ptCenter.X - pt.X);
                        int yDistance = Math.Abs(pView.m_ptCenter.Y - pt.Y);
                        if (((2 * xDistance) <= PCB.m_pPCB.m_xStep) && ((2 * yDistance) <= PCB.m_pPCB.m_yStep))
                        {
                            return(pView.GetPixelViewImage(pt, out color));
                        }
                    }
                }

                m_iCurpos = -1;
            }

            return(ret);

            #endregion
        }
Ejemplo n.º 5
0
        public bool PrepareCameraView()
        {
            #region 准备主区域视图显示

            bool ret = false;

            ClearCameraView();

            m_pLiveView = new CameraView();
            m_pLiveView.LinkToView(imageView);
            m_pLiveView.m_ptCenter = new Point(PCB.m_pPCB.m_uSizeX / 2, PCB.m_pPCB.m_uSizeY / 2);
            m_pLiveView.m_ptCenter.Offset(PCB.m_pPCB.m_ptOriginOffset);
            m_pLiveView.m_bmp = null;

            return(ret);

            #endregion
        }
Ejemplo n.º 6
0
        public void UnlockAreaImage()
        {
            #region 清除各相机视图的图像数据锁定

            if (m_CameraViewList != null)
            {
                if (m_CameraViewList.Count > 0)
                {
                    for (int igg = 0; igg < m_CameraViewList.Count; igg++)
                    {
                        CameraView pView = m_CameraViewList[igg];
                        pView.UnLockBitmap();
                    }
                }
            }

            #endregion
        }
Ejemplo n.º 7
0
        public bool CopyCameraView(CameraView pView)
        {
            #region 从view复制主区域视图显示

            bool ret = false;

            ClearCameraView();

            m_pLiveView = new CameraView();
            m_pLiveView.LinkToView(imageView);
            m_pLiveView.m_ptCenter = new Point(PCB.m_pPCB.m_uFovSizeX / 2, PCB.m_pPCB.m_uFovSizeY / 2);
            m_pLiveView.m_ptCenter.Offset(PCB.m_pPCB.m_ptOriginOffset);
            m_pLiveView.m_bmp = (Bitmap)pView.m_bmp.Clone();
            m_bmpLive         = (Bitmap)pView.m_bmp.Clone();

            return(ret);

            #endregion
        }
Ejemplo n.º 8
0
        public void PrepareCameraView()
        {
            #region 分配视图

            if (PCB.m_pPCB.IsNeedUpdateViewInfo())
            {
                ClearCameraView();

                m_CameraViewList = new List <CameraView>();

                for (int y = 0; y < PCB.m_pPCB.m_yFovNum; y++)
                {
                    Point pt = new Point();
                    pt.Y = PCB.m_pPCB.m_yStep / 2 + y * PCB.m_pPCB.m_yStep + PCB.m_pPCB.m_ptOriginOffset.Y;
                    if (y % 2 == 0)
                    {
                        for (int x = 0; x < PCB.m_pPCB.m_xFovNum; x++)
                        {
                            pt.X = PCB.m_pPCB.m_xStep / 2 + x * PCB.m_pPCB.m_xStep + PCB.m_pPCB.m_ptOriginOffset.X;
                            CameraView pView = new CameraView();
                            pView.LinkToView(imageView);
                            pView.m_iIndex   = m_CameraViewList.Count;
                            pView.m_ptCenter = pt;
                            m_CameraViewList.Add(pView);
                        }
                    }
                    else
                    {
                        for (int x = PCB.m_pPCB.m_xFovNum - 1; x >= 0; x--)
                        {
                            pt.X = PCB.m_pPCB.m_xStep / 2 + x * PCB.m_pPCB.m_xStep + PCB.m_pPCB.m_ptOriginOffset.X;
                            CameraView pView = new CameraView();
                            pView.LinkToView(imageView);
                            pView.m_iIndex   = m_CameraViewList.Count;
                            pView.m_ptCenter = pt;
                            m_CameraViewList.Add(pView);
                        }
                    }
                }
            }
            else
            {
                if (m_CameraViewList != null && m_CameraViewList.Count == PCB.m_pPCB.m_xFovNum * PCB.m_pPCB.m_yFovNum)
                {
                    for (int y = 0; y < PCB.m_pPCB.m_yFovNum; y++)
                    {
                        Point pt = new Point();
                        pt.Y = PCB.m_pPCB.m_yStep / 2 + y * PCB.m_pPCB.m_yStep + PCB.m_pPCB.m_ptOriginOffset.Y;
                        if (y % 2 == 0)
                        {
                            for (int x = 0; x < PCB.m_pPCB.m_xFovNum; x++)
                            {
                                pt.X = PCB.m_pPCB.m_xStep / 2 + x * PCB.m_pPCB.m_xStep + PCB.m_pPCB.m_ptOriginOffset.X;
                                int        index = y * PCB.m_pPCB.m_xFovNum + x;
                                CameraView pView = m_CameraViewList[index];
                                pView.m_ptCenter = pt;
                            }
                        }
                        else
                        {
                            for (int x = PCB.m_pPCB.m_xFovNum - 1; x >= 0; x--)
                            {
                                pt.X = PCB.m_pPCB.m_xStep / 2 + x * PCB.m_pPCB.m_xStep + PCB.m_pPCB.m_ptOriginOffset.X;
                                int        index = y * PCB.m_pPCB.m_xFovNum + (PCB.m_pPCB.m_xFovNum - 1 - x);
                                CameraView pView = m_CameraViewList[index];
                                pView.m_ptCenter = pt;
                            }
                        }
                    }
                }
            }

            #endregion
        }