void CGetBlackOutDlg::resize() { CRect cdialog; GetClientRect(cdialog); CRect wdialog; GetWindowRect(&wdialog); CPoint topleft = wdialog.TopLeft(); CPoint br(topleft.x + mBoard.pwidth()+mBoard.pborder(), topleft.y + mBoard.pheight()+ 30 + (mBoard.pper() * 2) + mBoard.pborder()); wdialog.BottomRight() = br; MoveWindow(wdialog, TRUE); CWnd *p; // p = GetDlgItem(IDD_GETBLACKOUT_DIALOG); p = GetDlgItem(IDC_STATIC1); CRect staticrect; p->GetWindowRect(staticrect); CPoint ctl(0,0); CPoint cbr(mBoard.pwidth(), mBoard.pheight()); staticrect.TopLeft() = ctl; staticrect.BottomRight() = cbr; p->MoveWindow(staticrect, TRUE); mBoard.mBoardRect = staticrect; CRect slot( (mBoard.pborder() * 2) + mBoard.pper(), (mBoard.pheight()-3), (mBoard.pborder() * 3) + (mBoard.pper()*3), (mBoard.pheight()) ); mBoardStatic.setrect(slot); CRect btr; UpdateWindow(); }
void CP4::OnBnClickedButton3() { CClientDC dc(this); RECT CR; CR.left=18; CR.top =241; CR.right=CR.left+650; CR.bottom=CR.top+1000; CBrush cbr(GetSysColor(15)); dc.SelectObject(&cbr); CPen cpen(PS_NULL,1,RGB(0,0,0)); dc.SelectObject(&cpen); dc.Rectangle(&CR); cpen.DeleteObject(); cbr.DeleteObject(); //TEMPLATE_READ_OUT_DATA TD; zstringEx zs; // TODO: 在此添加控件通知处理程序代码 zs.getCtlText(IDC_EDIT1,this->m_hWnd);//取ID if(zs.getStringLen()==0)return; int num=zCountTemplateTotaleNums(OID,zs.v()); //取得总数 if(num==0)return; int dx=21;int dy=282; for(int i=0;i<num;i++) { if(i>=5){dy=282+140;} dx=21+(i%5)*(133); zDrawOneTemplatePhoto(OID,zs.v(),i,(LONG)this->m_hWnd,dx,dy,NULL); } }
/*---------------------------------------------------------------------- | Test4 +---------------------------------------------------------------------*/ static void Test4() { NPT_Debug("--- Test4 Start ---\n"); NPT_ThreadCallbackSlot slot; CBR2 cbr(slot); NPT_Thread* t = new NPT_Thread(cbr); t->Start(); for (int i=0; i<20; i++) { NPT_Debug("Test4: calling back [%d]\n", i); NPT_Result result = slot.SendCallback(NULL); if (NPT_FAILED(result)) { CHECK(result == NPT_ERROR_CALLBACK_HANDLER_SHUTDOWN); CHECK(i >= 10); NPT_Debug("Test4: slot shutdown\n"); } } delete t; NPT_Debug("--- Test4 End ---\n"); }
void CP4::OnBnClickedButton4() { //this->RedrawWindow(); zstringEx zs;CString outjg; CClientDC dc(this); RECT CR; CR.left=18; CR.top =241; CR.right=CR.left+650; CR.bottom=CR.top+1000; CBrush cbr(GetSysColor(15)); dc.SelectObject(&cbr); CPen cpen(PS_NULL,1,RGB(0,0,0)); dc.SelectObject(&cpen); dc.Rectangle(&CR); cpen.DeleteObject(); cbr.DeleteObject(); bool is_mulite_face; int v8=zs.getCtlCheck(IDC_CHECK8,this->m_hWnd); if(v8)is_mulite_face=true; else is_mulite_face=false; ////////////////////////////////////////////////////// int facenum=1; if(is_mulite_face)facenum=32; //if(!gm->dx_capture_one_file(&gm->m_dxcap,"temp.bmp"))return; if( UsbVideo_CapOneBmp("temp.bmp")!=1)return; int ret=zFaceLocate( OID, //第一个函数返回的人脸识别实例对象ID "temp.bmp", //图像文件名,JPG,BMP facenum, //用户要求的最大人脸输出数 60, //人脸置信度阀值,高于这个阀值才会被输出 ofs); //人脸输出结构数组 if(ret<1) { zw_showmsgwindow("信息","未能检测到60分以上的人脸",1500); return; } for(int i=0;i<ret;i++)zFlagFace(OID,(LONG)this->m_hWnd,i,0,0); //标记出选中的人脸,60分以上才画眼与黄矩形 for(int i=0;i<ret;i++) { int ret2=zRecog1CN( OID,i,1,rout); if(ret2>0) { outjg.Format("最相似的ID: %s 相似度: %0.2f %% ",rout[i].Template_ID,rout[i].value *100); dc.TextOut(30+rand_ofx,248+rand_ofy+i*20,outjg); } else if(ret2<0) { char er[1024];zGetLastError(OID,er); AfxMessageBox(er); } } zFaceLocate_FreeMemory(OID);//回收人脸检测内存 }//end func
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Behandlungsroutinen für Nachrichten CListCtrlEx void CListCtrlEx::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) { CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC); CRect rcItem(lpDrawItemStruct->rcItem); BOOL bFocus = (GetFocus() == this); COLORREF clrTextSave = 0; COLORREF clrBkSave = 0; static _TCHAR szBuff[MAX_PATH]; // get item data int nItem = lpDrawItemStruct->itemID; LV_ITEM lvi; lvi.mask = LVIF_IMAGE | LVIF_STATE; lvi.iItem = nItem; lvi.iSubItem = 1; lvi.pszText = szBuff; lvi.cchTextMax = sizeof(szBuff); lvi.stateMask = 0xFFFF; // get all state flags GetItem(&lvi); BOOL bSelected = (bFocus || (GetStyle() & LVS_SHOWSELALWAYS)) && lvi.state & LVIS_SELECTED; bSelected = bSelected || (lvi.state & LVIS_DROPHILITED); // set colors if item is selected CRect rcAllLabels; GetItemRect(nItem, rcAllLabels, LVIR_BOUNDS); if (bSelected) { clrTextSave = pDC->SetTextColor(::GetSysColor(COLOR_HIGHLIGHTTEXT)); clrBkSave = pDC->SetBkColor(::GetSysColor(COLOR_HIGHLIGHT)); CBrush cbr(::GetSysColor(COLOR_HIGHLIGHT)); pDC->FillRect(rcAllLabels, &cbr); } else { CBrush cbr(RGB(255, 255, 255)); pDC->FillRect(rcAllLabels, &cbr); } // draw state icon/////////////////////////////////////////////////////////////////////// LV_COLUMN lvc; lvc.mask = LVCF_FMT | LVCF_WIDTH; GetColumn(0, &lvc); UINT nStateImageMask = lvi.state & LVIS_STATEIMAGEMASK; if (nStateImageMask) { int nImage = (nStateImageMask>>12) - 1; CImageList* pImageList = GetImageList(LVSIL_STATE); if (pImageList) { rcItem.left += lvc.cx; pImageList->Draw(pDC, nImage, CPoint(rcItem.left+8, rcItem.top), ILD_TRANSPARENT); } } int nColumn = 0; GetColumn(nColumn, &lvc); GetItemRect(nItem, rcAllLabels, LVIR_BOUNDS); int nRetLen = GetItemText(nItem, nColumn,szBuff, sizeof(szBuff)); if (nRetLen == 0) return; UINT nJustify = DT_LEFT; CRect rcText; rcText = rcAllLabels; rcText.left += OFFSET_OTHER; rcText.right -= OFFSET_OTHER; pDC->DrawText(szBuff, -1, rcText, nJustify | DT_SINGLELINE | DT_NOPREFIX | DT_NOCLIP | DT_VCENTER); // draw focus rectangle if item has focus if (lvi.state & LVIS_FOCUSED && bFocus) { pDC->DrawFocusRect(rcAllLabels); } // set original colors if item was selected if (bSelected) { pDC->SetTextColor(clrTextSave); pDC->SetBkColor(clrBkSave); } }
int main (int argc, char* argv[]) { BoxLib::Initialize(argc,argv); std::cout << std::setprecision(10); if (argc < 2) { std::cerr << "usage: " << argv[0] << " inputsfile [options]" << '\n'; exit(-1); } ParmParse pp; int n; BoxArray bs; #if BL_SPACEDIM == 2 Box domain(IntVect(0,0),IntVect(11,11)); std::string boxfile("gr.2_small_a") ; #elif BL_SPACEDIM == 3 Box domain(IntVect(0,0,0),IntVect(11,11,11)); std::string boxfile("grids/gr.3_2x3x4") ; #endif pp.query("boxes", boxfile); std::ifstream ifs(boxfile.c_str(), std::ios::in); if (!ifs) { std::string msg = "problem opening grids file: "; msg += boxfile.c_str(); BoxLib::Abort(msg.c_str()); } ifs >> domain; if (ParallelDescriptor::IOProcessor()) std::cout << "domain: " << domain << std::endl; bs.readFrom(ifs); if (ParallelDescriptor::IOProcessor()) std::cout << "grids:\n" << bs << std::endl; Geometry geom(domain); const Real* H = geom.CellSize(); int ratio=2; pp.query("ratio", ratio); // allocate/init soln and rhs int Ncomp=BL_SPACEDIM; int Nghost=0; int Ngrids=bs.size(); MultiFab soln(bs, Ncomp, Nghost, Fab_allocate); soln.setVal(0.0); MultiFab out(bs, Ncomp, Nghost, Fab_allocate); MultiFab rhs(bs, Ncomp, Nghost, Fab_allocate); rhs.setVal(0.0); for(MFIter rhsmfi(rhs); rhsmfi.isValid(); ++rhsmfi) { FORT_FILLRHS(rhs[rhsmfi].dataPtr(), ARLIM(rhs[rhsmfi].loVect()),ARLIM(rhs[rhsmfi].hiVect()), H,&Ncomp); } // Create the boundary object MCViscBndry vbd(bs,geom); BCRec phys_bc; Array<int> lo_bc(BL_SPACEDIM), hi_bc(BL_SPACEDIM); pp.getarr("lo_bc",lo_bc,0,BL_SPACEDIM); pp.getarr("hi_bc",hi_bc,0,BL_SPACEDIM); for (int i = 0; i < BL_SPACEDIM; i++) { phys_bc.setLo(i,lo_bc[i]); phys_bc.setHi(i,hi_bc[i]); } // Create the BCRec's interpreted by ViscBndry objects #if BL_SPACEDIM==2 Array<BCRec> pbcarray(4); pbcarray[0] = BCRec(D_DECL(REFLECT_ODD,REFLECT_EVEN,EXT_DIR), D_DECL(EXT_DIR,EXT_DIR,EXT_DIR)); pbcarray[1] = BCRec(D_DECL(REFLECT_EVEN,REFLECT_ODD,EXT_DIR), D_DECL(EXT_DIR,EXT_DIR,EXT_DIR)); pbcarray[2] = BCRec(D_DECL(EXT_DIR,EXT_DIR,EXT_DIR), D_DECL(EXT_DIR,EXT_DIR,EXT_DIR)); pbcarray[3] = BCRec(D_DECL(EXT_DIR,EXT_DIR,EXT_DIR), D_DECL(EXT_DIR,EXT_DIR,EXT_DIR)); #elif BL_SPACEDIM==3 Array<BCRec> pbcarray(12); #if 1 pbcarray[0] = BCRec(EXT_DIR,EXT_DIR,EXT_DIR,EXT_DIR,EXT_DIR,EXT_DIR); pbcarray[1] = BCRec(EXT_DIR,EXT_DIR,EXT_DIR,EXT_DIR,EXT_DIR,EXT_DIR); pbcarray[2] = BCRec(EXT_DIR,EXT_DIR,EXT_DIR,EXT_DIR,EXT_DIR,EXT_DIR); pbcarray[3] = BCRec(D_DECL(EXT_DIR,EXT_DIR,EXT_DIR), D_DECL(EXT_DIR,EXT_DIR,EXT_DIR)); pbcarray[4] = BCRec(D_DECL(EXT_DIR,EXT_DIR,EXT_DIR), D_DECL(EXT_DIR,EXT_DIR,EXT_DIR)); pbcarray[5] = BCRec(D_DECL(EXT_DIR,EXT_DIR,EXT_DIR), D_DECL(EXT_DIR,EXT_DIR,EXT_DIR)); pbcarray[6] = BCRec(D_DECL(EXT_DIR,EXT_DIR,EXT_DIR), D_DECL(EXT_DIR,EXT_DIR,EXT_DIR)); pbcarray[7] = BCRec(D_DECL(EXT_DIR,EXT_DIR,EXT_DIR), D_DECL(EXT_DIR,EXT_DIR,EXT_DIR)); pbcarray[8] = BCRec(D_DECL(EXT_DIR,EXT_DIR,EXT_DIR), D_DECL(EXT_DIR,EXT_DIR,EXT_DIR)); pbcarray[9] = BCRec(D_DECL(EXT_DIR,EXT_DIR,EXT_DIR), D_DECL(EXT_DIR,EXT_DIR,EXT_DIR)); pbcarray[10] = BCRec(D_DECL(EXT_DIR,EXT_DIR,EXT_DIR), D_DECL(EXT_DIR,EXT_DIR,EXT_DIR)); pbcarray[11] = BCRec(D_DECL(EXT_DIR,EXT_DIR,EXT_DIR), D_DECL(EXT_DIR,EXT_DIR,EXT_DIR)); #else for (int i = 0; i < 12; i++) pbcarray[i] = phys_bc; #endif #endif Nghost = 1; // need space for bc info MultiFab fine(bs,Ncomp,Nghost,Fab_allocate); for(MFIter finemfi(fine); finemfi.isValid(); ++finemfi) { FORT_FILLFINE(fine[finemfi].dataPtr(), ARLIM(fine[finemfi].loVect()),ARLIM(fine[finemfi].hiVect()), H,&Ncomp); } // Create "background coarse data" Box crse_bx = Box(domain).coarsen(ratio).grow(1); BoxArray cba(crse_bx); cba.maxSize(32); Real h_crse[BL_SPACEDIM]; for (n=0; n<BL_SPACEDIM; n++) h_crse[n] = H[n]*ratio; MultiFab crse_mf(cba, Ncomp, 0); // FArrayBox crse_fab(crse_bx,Ncomp); for (MFIter mfi(crse_mf); mfi.isValid(); ++mfi) { FORT_FILLCRSE(crse_mf[mfi].dataPtr(), ARLIM(crse_mf[mfi].loVect()),ARLIM(crse_mf[mfi].hiVect()), h_crse,&Ncomp); } // Create coarse boundary register, fill w/data from coarse FAB int bndry_InRad=0; int bndry_OutRad=1; int bndry_Extent=1; BoxArray cbs = BoxArray(bs).coarsen(ratio); BndryRegister cbr(cbs,bndry_InRad,bndry_OutRad,bndry_Extent,Ncomp); for (OrientationIter face; face; ++face) { Orientation f = face(); FabSet& bnd_fs(cbr[f]); bnd_fs.copyFrom(crse_mf, 0, 0, 0, Ncomp); } // Interpolate crse data to fine boundary, where applicable int cbr_Nstart=0; int fine_Nstart=0; int bndry_Nstart=0; vbd.setBndryValues(cbr,cbr_Nstart,fine,fine_Nstart, bndry_Nstart,Ncomp,ratio,pbcarray); Nghost = 1; // other variables don't need extra space DivVis lp(vbd,H); Real a = 0.0; Real b[BL_SPACEDIM]; b[0] = 1.0; b[1] = 1.0; #if BL_SPACEDIM>2 b[2] = 1.0; #endif MultiFab acoefs; int NcompA = (BL_SPACEDIM == 2 ? 2 : 1); acoefs.define(bs, NcompA, Nghost, Fab_allocate); acoefs.setVal(a); MultiFab bcoefs[BL_SPACEDIM]; for (n=0; n<BL_SPACEDIM; ++n) { BoxArray bsC(bs); bcoefs[n].define(bsC.surroundingNodes(n), 1, Nghost, Fab_allocate); #if 1 for(MFIter bmfi(bcoefs[n]); bmfi.isValid(); ++bmfi) { FORT_MAKEMU(bcoefs[n][bmfi].dataPtr(), ARLIM(bcoefs[n][bmfi].loVect()),ARLIM(bcoefs[n][bmfi].hiVect()),H,n); } #else bcoefs[n].setVal(b[n]); #endif } // -->> over dimension lp.setCoefficients(acoefs, bcoefs); #if 1 lp.maxOrder(4); #endif Nghost = 1; MultiFab tsoln(bs, Ncomp, Nghost, Fab_allocate); tsoln.setVal(0.0); #if 1 tsoln.copy(fine); #endif #if 0 // testing apply lp.apply(out,tsoln); Box subbox = out[0].box(); Real n1 = out[0].norm(subbox,1,0,BL_SPACEDIM)*pow(H[0],BL_SPACEDIM); ParallelDescriptor::ReduceRealSum(n1); if (ParallelDescriptor::IOProcessor()) { cout << "n1 output is "<<n1<<std::endl; } out.minus(rhs,0,BL_SPACEDIM,0); // special to single grid prob Real n2 = out[0].norm(subbox,1,0,BL_SPACEDIM)*pow(H[0],BL_SPACEDIM); ParallelDescriptor::ReduceRealSum(n2); if (ParallelDescriptor::IOProcessor()) { cout << "n2 difference is "<<n2<<std::endl; } #if 0 subbox.grow(-1); Real n3 = out[0].norm(subbox,0,0,BL_SPACEDIM)*pow(H[0],BL_SPACEDIM); ParallelDescriptor::ReduceRealMax(n3); if (ParallelDescriptor::IOProcessor()) { cout << "n3 difference is "<<n3<<std::endl; } #endif #endif const IntVect refRatio(D_DECL(2,2,2)); const Real bgVal = 1.0; #if 1 #ifndef NDEBUG // testing flux computation BoxArray xfluxbox(bs); xfluxbox.surroundingNodes(0); MultiFab xflux(xfluxbox,Ncomp,Nghost,Fab_allocate); xflux.setVal(1.e30); BoxArray yfluxbox(bs); yfluxbox.surroundingNodes(1); MultiFab yflux(yfluxbox,Ncomp,Nghost,Fab_allocate); yflux.setVal(1.e30); #if BL_SPACEDIM>2 BoxArray zfluxbox(bs); zfluxbox.surroundingNodes(2); MultiFab zflux(zfluxbox,Ncomp,Nghost,Fab_allocate); zflux.setVal(1.e30); #endif lp.compFlux(xflux, yflux, #if BL_SPACEDIM>2 zflux, #endif tsoln); // Write fluxes //writeMF(&xflux,"xflux.mfab"); //writeMF(&yflux,"yflux.mfab"); #if BL_SPACEDIM>2 //writeMF(&zflux,"zflux.mfab"); #endif #endif #endif Real tolerance = 1.0e-10; pp.query("tol", tolerance); Real tolerance_abs = 1.0e-10; pp.query("tol_abs", tolerance_abs); #if 0 cout << "Bndry Data object:" << std::endl; cout << lp.bndryData() << std::endl; #endif #if 0 bool use_mg_pre = false; MCCGSolver cg(lp,use_mg_pre); cg.solve(soln,rhs,tolerance,tolerance_abs); #else MCMultiGrid mg(lp); mg.solve(soln,rhs,tolerance,tolerance_abs); #endif #if 0 cout << "MCLinOp object:" << std::endl; cout << lp << std::endl; #endif VisMF::Write(soln,"soln"); #if 0 // apply operator to soln to see if really satisfies eqn tsoln.copy(soln); lp.apply(out,tsoln); soln.copy(out); // Output "apply" results on soln VisMF::Write(soln,"apply"); // Compute truncation for (MFIter smfi(soln); smfi.isValid(); ++smfi) { soln[smfi] -= fine[smfi]; } for( int icomp=0; icomp < BL_SPACEDIM ; icomp++ ) { Real solnMin = soln.min(icomp); Real solnMax = soln.max(icomp); ParallelDescriptor::ReduceRealMin(solnMin); ParallelDescriptor::ReduceRealMax(solnMax); if (ParallelDescriptor::IOProcessor()) { cout << icomp << " "<<solnMin << " " << solnMax <<std::endl; } } // Output truncation VisMF::Write(soln,"trunc"); #endif int dumpLp=0; pp.query("dumpLp",dumpLp); bool write_lp = (dumpLp == 1 ? true : false); if (write_lp) std::cout << lp << std::endl; // Output trunc ParallelDescriptor::EndParallel(); }