Example #1
0
void FindResultsTab::OnSearchStart(wxCommandEvent& e)
{
    m_searchInProgress = true;
    SearchData* data = (SearchData*)e.GetClientData();
    wxString label = data ? data->GetFindString() : wxT("");

    if(e.GetInt() != 0 || m_sci == NULL) {
        if(m_book) {
            clWindowUpdateLocker locker(this);
            MySTC* sci = new MySTC(m_book);
            SetStyles(sci);
            sci->Connect(wxEVT_STC_STYLENEEDED, wxStyledTextEventHandler(FindResultsTab::OnStyleNeeded), NULL, this);
            m_book->AddPage(sci, label, true);
#ifdef __WXMAC__
            m_book->GetSizer()->Layout();
#endif
            size_t where = m_book->GetPageCount() - 1;

            // keep the search data used for this tab
            wxWindow* tab = m_book->GetPage(where);
            if(tab) {
                tab->SetClientData(data);
            }

            m_matchInfo.push_back(MatchInfo());
            m_sci = sci;
        }
    } else if(m_book) {
        // using current tab, update the tab title and the search data
        int where = m_book->GetPageIndex(m_sci);
        if(where != wxNOT_FOUND) {
            m_book->SetPageText(where, label);
            // delete the old search data
            wxWindow* tab = m_book->GetPage(where);
            SearchData* oldData = (SearchData*)tab->GetClientData();
            if(oldData) {
                delete oldData;
            }
            // set the new search data
            tab->SetClientData(data);
        }
    }

    // This is needed in >=wxGTK-2.9, otherwise the 'Search' pane doesn't fully expand
    SendSizeEvent(wxSEND_EVENT_POST);

    m_recv = m_sci;
    Clear();

    if(data) {
        m_searchData = *data;

        wxString message;
        message << _("====== Searching for: '") << data->GetFindString() << _("'; Match case: ")
                << (data->IsMatchCase() ? _("true") : _("false")) << _(" ; Match whole word: ")
                << (data->IsMatchWholeWord() ? _("true") : _("false")) << _(" ; Regular expression: ")
                << (data->IsRegularExpression() ? _("true") : _("false")) << wxT(" ======\n");
        AppendText(message);
    }
}
Example #2
0
/*****************************************************************************
 *		Private Functions
 *****************************************************************************/
static void
CheckFreePrivInfo(_DtCvSegment *seg)
{
    /*
     * free the match information
     */
    if (NULL != MatchInfo(seg))
      {
	SdlMatchData *m = (SdlMatchData *)(MatchInfo(seg));

	if (NULL != m->ssi)
	    free(m->ssi);
	free(m);
      }

    /*
     * free any abbreviation
     */
    if (NULL != AbbrevStr(seg))
	free(AbbrevStr(seg));
}
Example #3
0
void BundlerMatcher::matchSiftFeature(int fileIndexA, int fileIndexB)
{
    SiftKeyPoints pointsA           = mFeatureInfos[fileIndexA].points;
    SiftKeyDescriptors descriptorsA = mFeatureInfos[fileIndexA].descriptors;

    SiftKeyPoints pointsB           = mFeatureInfos[fileIndexB].points;
    SiftKeyDescriptors descriptorsB = mFeatureInfos[fileIndexB].descriptors;

    mMatcher->SetDescriptors(0, (int) pointsA.size(), &descriptorsA[0]);
    mMatcher->SetDescriptors(1, (int) pointsB.size(), &descriptorsB[0]);

    int (*matchBuffer)[2] = new int[pointsA.size()][2];
    int nbMatch = mMatcher->GetSiftMatch((int)pointsA.size(), matchBuffer, mMatchThreshold);

    //Save Match in RAM
    std::vector<Match> matches(nbMatch);
    for (int i=0; i<nbMatch; ++i)
        matches[i] = Match(matchBuffer[i][0], matchBuffer[i][1]);
    mMatchInfos.push_back(MatchInfo(fileIndexA, fileIndexB, matches));
    delete[] matchBuffer;
}