static bool parseDeviceScribblePage(const sketch::PageKey &key, const sketch::SketchPagePtr &page, PageScribble &parsedScribble) { bool ok = false; int num_page = key.toInt(&ok); if (!ok) { std::cerr<<"["<<__FILE__<<", "<<__func__<<", "<<__LINE__<<"]"<<"parse PageKey to decimal failed: "<<key.toStdString()<<std::endl; assert(false); return false; } parsedScribble.page_ = num_page; Strokes strokes = page.get()->strokes(); std::cout<<strokes.size()<<" strokes in page"<<std::endl; int i = 0; for (StrokesIter it = strokes.begin(); it != strokes.end(); it++) { std::cout<<"parsing stroke "<<i<<std::endl; i++; const ZoomFactor stroke_zoom_factor = it->get()->zoom(); std::vector<PAPoint> pa_points; Points points = (*it).get()->points(); std::cout<<points.size()<<" points in stroke"<<std::endl; int j = 0; for (PointsIter pit = points.begin(); pit != points.end(); pit++) { j++; pa_points.push_back(PAPoint(pit->x() / stroke_zoom_factor, pit->y() / stroke_zoom_factor)); } if (pa_points.size() == 0) { std::cerr<<"["<<__FILE__<<", "<<__func__<<", "<<__LINE__<<"]"<<"0 points in SketchStroke"<<std::endl; assert(false); continue; } const double stroke_thickness = sketch::getPenSize(it->get()->shape()) / stroke_zoom_factor; const int GRAY_MAX = 0xFF; const double stroke_gray = sketch::getPenColor(it->get()->color()) / static_cast<double>(GRAY_MAX); parsedScribble.strokes_.push_back(PageScribble::Stroke(pa_points, stroke_thickness, stroke_gray)); } return true; }