void AnalyseGHFlight(HttpSession* hs) { string html(hs->getResponseBody()); // ofstream f("./gh.html"); // f << html << endl; boost::regex rFlightDetailsBlock("<div class=\"flightDetailsBlock\">([\\s\\S]*?)<div class=\"detailsSubBlock detailsSubBlockExpandable detailsSubBlockFareBreakdown\">"); boost::smatch m; if (!boost::regex_search(html, m, rFlightDetailsBlock)) { return ; } string flightDetailsBlock = m[1].str(); // cout << "flightDetailsBlock=" << flightDetailsBlock << endl; boost::regex rFlight("<tbody>([\\s\\S]*?)</tbody>"); boost::sregex_iterator pos(flightDetailsBlock.begin(), flightDetailsBlock.end(), rFlight); boost::sregex_iterator end; //flight info while (pos != end) { string html((*pos)[1].str()); // cout << "tbody=" << html << endl; Flight flight; boost::regex rSrc("<td class=\"colDeparture\">([\\s\\S]*?)</td>"); boost::smatch what; if (boost::regex_search(html, what, rSrc)) { flight.DepartureCity = flight.DepartureStation = strMid(what[1].str(), "<span class=\"orig\">", "</span>"); string day = strMid(what[1].str(), "<span class=\"date\">", "</span>"); string time = strMid(what[1].str(), "<span class=\"time\">", "</span>"); flight.DepartureDate = day + " " + time; } boost::regex rDst("<td class=\"colArrival\">([\\s\\S]*?)</td>"); if (boost::regex_search(html, what, rDst)) { flight.ArrivalCity = flight.ArrivalStation = strMid(what[1].str(), "<span class=\"dest\">", "</span>"); string day = strMid(what[1].str(), "<span class=\"date\">", "</span>"); string time = strMid(what[1].str(), "<span class=\"time\">", "</span>"); flight.ArrivalDate = day + " " + time; } boost::regex rFlight("<td class=\"colFlight\" >([\\s\\S]*?)<a href=([^>]*?)>(\\w*?)</a>"); if (boost::regex_search(html, what, rFlight)) { flight.Number = what[3].str(); cout << "flight Num=" << flight.Number << endl; } ti.flights.push_back(flight); ++pos; } }
void FenetreZoom::TracerZoom(wxPoint p) { if (zoomInactif) { if (!IsShown()) return; zoomInactif =false; } ImageInfoCV* imAcq=fMere->ImAcq(); wxImage *d=fMere->ImageAffichee(); wxClientDC hdc(this); hdc.SetBrush(*wxBLACK_BRUSH); if (facteurZoom!=0) { if (imAcq && imAcq->cols>0) { wxRect src(0,0,imAcq->cols,imAcq->rows); wxRect dst=CalculPosRectDst(src,&p),r=GetClientSize(); hdc.DrawRectangle(r.GetRight(),r.GetTop(),r.GetRight(),r.GetBottom()); wxRect rSrc(src.GetLeft(),src.GetTop(),src.GetRight()-src.GetLeft()+1,src.GetBottom()-src.GetTop()+1); wxImage sousImage=d->GetSubImage(rSrc); // sousImage.SetMask(0); wxImage imageZoom=sousImage.Scale(dst.GetRight()-dst.GetLeft()+1,dst.GetBottom()-dst.GetTop()+1); // imageZoom.SetMask(0); wxBitmap b(imageZoom); hdc.DrawBitmap(b,0,0); hdc.SetPen(*wxBLACK); hdc.DrawRectangle(dst.GetRight(),r.GetTop(),r.GetRight(),r.GetBottom()); hdc.DrawRectangle(r.GetLeft(),dst.GetBottom(),r.GetRight(),r.GetBottom()); } } else { wxBitmap pub(*d); hdc.DrawBitmap(pub,-p.x,-p.y); } }