upSimpleReport MatchResultList_ByGroup::regenerateReport()
{
  // collect the match groups with the requested match group number and
  // search in all rounds
  MatchMngr mm{db};
  MatchGroupList mgl = mm.getMatchGroupsForCat(cat);
  MatchGroupList filteredList;
  for (MatchGroup mg: mgl)
  {
    if (mg.getGroupNumber() == grpNum) filteredList.push_back(mg);
  }

  // sort match groups by round number
  if (filteredList.size() > 1)
  {
    std::sort(filteredList.begin(), filteredList.end(), [](MatchGroup& mg1, MatchGroup& mg2){
      if (mg1.getRound() < mg2.getRound()) return true;
      return false;
    });
  }

  upSimpleReport result = createEmptyReport_Portrait();
  QString repName = cat.getName() + tr(" -- Results of Group ") + QString::number(grpNum);
  setHeaderAndHeadline(result.get(), repName);

  for (MatchGroup mg : filteredList)
  {
    int round = mg.getRound();
    printIntermediateHeader(result, tr("Round ") + QString::number(round));

    MatchList maList = mg.getMatches();
    std::sort(maList.begin(), maList.end(), [](Match& ma1, Match& ma2)
    {
      return ma1.getMatchNumber() < ma2.getMatchNumber();
    });

    printMatchList(result, maList, PlayerPairList(), tr("Results of round ") + QString::number(round) + tr(" (cont.)"), true, false);

    if (mg.getState() != STAT_MG_FINISHED)
    {
      result->skip(1.0);
      result->writeLine(tr("Note: this round is not finished yet; results for this group can be incomplete."));
    }

    result->skip(3.0);
  }

  // set header and footer
  setHeaderAndFooter(result, repName);

  return result;
}
Exemplo n.º 2
0
Homography meanHomography(const Array<Feat>& feats1,const Array<Feat>& feats2,const MatchList& matches) {
    int nb=int(matches.size());
    Matrix<double> A(2*nb,8);
    Vector<double> B(2*nb);
    A.fill(0);
    int k=0;
    // Completer: remplir A et B pour que H verifie AH=B
    for (MatchList::const_iterator it=matches.begin(); it!=matches.end(); k++,it++) {
        Vec2 m1=feats1[it->first].pos;
        Vec2 m2=feats2[it->second].pos;
        // ...
    }
    Matrix<double> C=pseudoInverse(A);	// Moindres carr�s
    if(norm(C)==0)	// non invertible
        return Homography(0.);
    Vector<double> H=C*B;
    return Homography(H.data());	// Painlesss Vector -> FVector conversion
}