void xFarDicLeitner::OnBackE(wxCommandEvent& event) { wxArrayInt selection; wxString tmpStr, msg; boxe->GetSelections(selection); if (!selection.GetCount() > 0) { msg.Printf( _("Please select a word.\n")); wxMessageBox(msg, _T("xFarDic"), wxOK | wxICON_INFORMATION, this); return; } else { if (boxacontents.GetCount() < bacap) { tmpStr = boxe->GetString(selection[0]); if (boxacontents.Index(tmpStr,FALSE) == wxNOT_FOUND) { boxacontents.Add(tmpStr); } boxecontents.RemoveAt(boxecontents.Index(tmpStr,FALSE),1); UpdateBoxes(); SubmitChanges(); } else { msg.Printf( _("Box A is full.\n")); wxMessageBox(msg, _T("xFarDic"), wxOK | wxICON_INFORMATION, this); return; } } }
void xFarDicLeitner::OnConfirm(wxCommandEvent& event) { wxArrayInt selection; wxString tmpStr, msg; wxMessageDialog *confirm; boxe->GetSelections(selection); if (!selection.GetCount() > 0) { msg.Printf( _("Please select a word.\n")); wxMessageBox(msg, _T("xFarDic"), wxOK | wxICON_INFORMATION, this); return; } else { msg.Printf( _("Are you sure that you have learnt this word?\n")); confirm = new wxMessageDialog(this, msg, _T("xFarDic"), wxYES_NO | wxNO_DEFAULT | wxICON_EXCLAMATION | wxSTAY_ON_TOP); if (confirm->ShowModal() == wxID_YES) { tmpStr = boxe->GetString(selection[0]); boxecontents.RemoveAt(boxecontents.Index(tmpStr,FALSE),1); UpdateBoxes(); SubmitChanges(); } } }
void BipartiteBoxPruningTest::PerformTest() { UpdateBoxes(); // We pretend that half the boxes belong to first group, and the other half to the second group. udword Nb0 = mNbBoxes/2; udword Nb1 = mNbBoxes - Nb0; mPairs.ResetPairs(); mProfiler.Start(); BipartiteBoxPruning(Nb0, mBoxPtrs, Nb1, mBoxPtrs+Nb0, mPairs, Axes(AXES_XZY)); mProfiler.End(); mProfiler.Accum(); // printf("%d pairs colliding\r ", mPairs.GetNbPairs()); bool* Flags = (bool*)_alloca(sizeof(bool)*mNbBoxes); ZeroMemory(Flags, sizeof(bool)*mNbBoxes); const Pair* P = mPairs.GetPairs(); for(udword i=0;i<mPairs.GetNbPairs();i++) { // A colliding pair is (i,j) where 0 <= i < Nb0 and 0 <= j < Nb1 Flags[P[i].id0] = true; Flags[P[i].id1+Nb0] = true; } // Render boxes OBB CurrentBox; CurrentBox.mRot.Identity(); for(udword i=0;i<mNbBoxes;i++) { if(Flags[i]) glColor3f(1.0f, 0.0f, 0.0f); else { if(i<Nb0) glColor3f(0.0f, 1.0f, 0.0f); else glColor3f(0.0f, 0.0f, 1.0f); } mBoxes[i].GetCenter(CurrentBox.mCenter); mBoxes[i].GetExtents(CurrentBox.mExtents); DrawOBB(CurrentBox); } char Buffer[4096]; sprintf(Buffer, "BipartiteBoxPruning - %5.1f us (%d cycles) - %d pairs\n", mProfiler.mMsTime, mProfiler.mCycles, mPairs.GetNbPairs()); GLFontRenderer::print(10.0f, 10.0f, 0.02f, Buffer); }
void CompleteBoxPruningTest::PerformTest() { int numBoxes = (mNbBoxes*percentUpdate)/100; if (m_firstTime) { numBoxes = mNbBoxes; m_firstTime = false; } mProfiler.Start(); UpdateBoxes(numBoxes); mPairs.ResetPairs(); CompleteBoxPruning(mNbBoxes, mBoxPtrs, mPairs, Axes(AXES_XZY)); mProfiler.End(); mProfiler.Accum(); // printf("%d pairs colliding\r ", mPairs.GetNbPairs()); bool* Flags = (bool*)_alloca(sizeof(bool)*mNbBoxes); ZeroMemory(Flags, sizeof(bool)*mNbBoxes); const Pair* P = mPairs.GetPairs(); for(udword i=0; i<mPairs.GetNbPairs(); i++) { Flags[P[i].id0] = true; Flags[P[i].id1] = true; } // Render boxes OBB CurrentBox; CurrentBox.mRot.Identity(); for(udword i=0; i<mNbBoxes; i++) { if(Flags[i]) glColor3f(1.0f, 0.0f, 0.0f); else glColor3f(0.0f, 1.0f, 0.0f); mBoxes[i].GetCenter(CurrentBox.mCenter); mBoxes[i].GetExtents(CurrentBox.mExtents); DrawOBB(CurrentBox); } char Buffer[4096]; sprintf(Buffer, "CompleteBoxPruning: %5.1f us (%d cycles) : %d pairs\n", mProfiler.mMsTime, mProfiler.mCycles, mPairs.GetNbPairs()); GLFontRenderer::print(10.0f, 10.0f, 0.02f, Buffer); }
void xFarDicLeitner::OnClear(wxCommandEvent& event) { wxString msg; wxMessageDialog *confirm; msg.Printf( _("Are you sure that you want to clear the box contents?\n")); confirm = new wxMessageDialog(this, msg, _T("xFarDic"), wxYES_NO | wxNO_DEFAULT | wxICON_EXCLAMATION | wxSTAY_ON_TOP); if (confirm->ShowModal() == wxID_YES) { boxacontents.Empty(); boxbcontents.Empty(); boxccontents.Empty(); boxdcontents.Empty(); boxecontents.Empty(); UpdateBoxes(); SubmitChanges(); } }
void unFilterListCtrl::OnSize( wxSizeEvent& event ) { UpdateBoxes(); event.Skip(); }