22 #include <QStringList> 40 void toXml(QTextStream &stream, QString indent =
"",
41 QString extraAttributes =
"")
const {
42 stream << QString(
"%1<point frame=\"%2\" mapframe=\"%3\" %4/>\n")
43 .arg(indent).arg(frame).arg(mapframe).arg(extraAttributes);
50 list << QString(
"%1").arg(mapframe);
51 return list.join(delimiter);
55 if (frame != p2.
frame)
return frame < p2.
frame;
64 m_sampleRate(sampleRate),
65 m_resolution(resolution) {
68 Path &operator=(
const Path &) =
default;
76 return int(m_points.size());
100 QString extraAttributes =
"")
const override {
110 if (!m_points.empty()) {
111 start = m_points.begin()->frame;
112 end = m_points.rbegin()->frame + m_resolution;
121 out << QString(
"<model id=\"%1\" name=\"\" sampleRate=\"%2\" " 122 "start=\"%3\" end=\"%4\" type=\"sparse\" " 123 "dimensions=\"2\" resolution=\"%5\" " 124 "notifyOnAdd=\"true\" dataset=\"%6\" " 125 "subtype=\"path\" %7/>\n")
132 .arg(extraAttributes);
134 out << indent << QString(
"<dataset id=\"%1\" dimensions=\"2\">\n")
138 p.toXml(out, indent +
" ",
"");
141 out << indent <<
"</dataset>\n";
151 if (p.frame < startFrame)
continue;
152 if (p.frame >= startFrame + duration)
break;
153 s += QString(
"%1%2%3\n")
bool operator<(const PathPoint &p2) const
double sv_samplerate_t
Sample rate.
std::set< PathPoint > Points
Path(sv_samplerate_t sampleRate, int resolution)
PathPoint(sv_frame_t _frame)
int64_t sv_frame_t
Frame index, the unit of our time axis.
static RealTime frame2RealTime(sv_frame_t frame, sv_samplerate_t sampleRate)
Convert a sample frame at the given sample rate into a RealTime.
void toXml(QTextStream &stream, QString indent="", QString extraAttributes="") const
int getPointCount() const
sv_samplerate_t getSampleRate() const
std::string toString(bool align=false) const
Return a human-readable debug-type string to full precision (probably not a format to show to a user ...
const Points & getPoints() const
QString toDelimitedDataString(QString delimiter, DataExportOptions, sv_samplerate_t sampleRate) const
QString toDelimitedDataString(QString delimiter, DataExportOptions, sv_frame_t startFrame, sv_frame_t duration) const
void toXml(QTextStream &out, QString indent="", QString extraAttributes="") const override
XmlExportable methods.
int getResolution() const
sv_samplerate_t m_sampleRate
PathPoint(sv_frame_t _frame, sv_frame_t _mapframe)