mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-04-15 05:32:21 +00:00
Workout Editor MMP Curve
.. now shows MMP curve as you edit. .. WIP code for block selection is also in there but needs some work done to it !
This commit is contained in:
@@ -1028,8 +1028,9 @@ WorkoutWidget::recompute()
|
||||
context->athlete->zones(false)->useCPforFTPSetting(), 0).toInt() == 0);
|
||||
if (useCPForFTP) FTP=CP;
|
||||
|
||||
// compute the metrics based upon the data...
|
||||
QVector<int> wattsArray;
|
||||
// truncate
|
||||
wattsArray.resize(0);
|
||||
mmpArray.resize(0);
|
||||
|
||||
// running time and watts for interpolating
|
||||
int ctime = 0;
|
||||
@@ -1110,8 +1111,7 @@ WorkoutWidget::recompute()
|
||||
//
|
||||
// MEAN MAX [works but need to think about UI]
|
||||
//
|
||||
//QVector<int>mmpArray;
|
||||
//RideFileCache::fastSearch(wattsArray, mmpArray);
|
||||
RideFileCache::fastSearch(wattsArray, mmpArray);
|
||||
//qDebug()<<"RECOMPUTE:"<<timer.elapsed()<<"ms"<<wattsArray.count()<<"samples";
|
||||
}
|
||||
|
||||
@@ -1411,17 +1411,17 @@ WorkoutWidget::undo()
|
||||
void
|
||||
WorkoutWidget::cut()
|
||||
{
|
||||
qDebug()<<"cut";
|
||||
//qDebug()<<"cut";
|
||||
}
|
||||
|
||||
void
|
||||
WorkoutWidget::copy()
|
||||
{
|
||||
qDebug()<<"copy";
|
||||
//qDebug()<<"copy";
|
||||
}
|
||||
|
||||
void
|
||||
WorkoutWidget::paste()
|
||||
{
|
||||
qDebug()<<"paste";
|
||||
//qDebug()<<"paste";
|
||||
}
|
||||
|
||||
@@ -126,6 +126,10 @@ class WorkoutWidget : public QWidget
|
||||
// ergFile being edited
|
||||
ErgFile *ergFile;
|
||||
|
||||
// CP data
|
||||
QVector<int> wattsArray;
|
||||
QVector<int>mmpArray;
|
||||
|
||||
// get regions for items to paint in
|
||||
QRectF left();
|
||||
QRectF right();
|
||||
|
||||
@@ -297,7 +297,7 @@ WWBlockCursor::paint(QPainter *painter)
|
||||
void
|
||||
WWBlockSelection::paint(QPainter *painter)
|
||||
{
|
||||
qDebug()<<"select cursor paint";
|
||||
//XXX TODO qDebug()<<"select cursor paint";
|
||||
}
|
||||
|
||||
// locate me on the parent widget in paint coordinates
|
||||
@@ -353,6 +353,40 @@ WWWBLine::paint(QPainter *painter)
|
||||
}
|
||||
}
|
||||
|
||||
//MMP Curve
|
||||
void
|
||||
WWMMPCurve::paint(QPainter *painter)
|
||||
{
|
||||
// thin ?
|
||||
QPen linePen(GColor(CCP));
|
||||
linePen.setWidth(0.5);
|
||||
painter->setPen(linePen);
|
||||
|
||||
// top left origin
|
||||
QPointF tl = workoutWidget()->canvas().topLeft();
|
||||
|
||||
// join the dots
|
||||
QPointF last(-1,-1);
|
||||
|
||||
// run through the wpBal values...
|
||||
int secs=0;
|
||||
foreach(int watts, workoutWidget()->mmpArray) {
|
||||
|
||||
// skip zero
|
||||
if (watts == 0) { secs++; continue; }
|
||||
|
||||
// x and y pixel location
|
||||
QPointF point = workoutWidget()->transform(secs,watts);
|
||||
|
||||
if (last.x() >= 0) painter->drawLine(last, point);
|
||||
|
||||
// move on
|
||||
last = point;
|
||||
secs++;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// COMMANDS
|
||||
//
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#define GCWW_RECT 6 // selection rectangle
|
||||
#define GCWW_BCURSOR 7 // interval "block" cursor
|
||||
#define GCWW_BRECT 8 // block selection
|
||||
#define GCWW_MMPCURVE 9
|
||||
|
||||
//
|
||||
// ITEMS
|
||||
@@ -81,6 +82,22 @@ class WWWBalScale : public WorkoutWidgetItem {
|
||||
Context *context; // for athlete zones etc
|
||||
};
|
||||
|
||||
class WWMMPCurve : public WorkoutWidgetItem {
|
||||
|
||||
public:
|
||||
|
||||
WWMMPCurve(WorkoutWidget *w) : WorkoutWidgetItem(w) { w->addItem(this); }
|
||||
|
||||
// Reimplement in children
|
||||
int type() { return GCWW_MMPCURVE; }
|
||||
|
||||
void paint(QPainter *painter);
|
||||
|
||||
// locate me on the parent widget in paint coordinates
|
||||
QRectF bounding() { return workoutWidget()->canvas(); }
|
||||
|
||||
};
|
||||
|
||||
// is a point, can be manipulated ...
|
||||
class WWPoint : public WorkoutWidgetItem {
|
||||
|
||||
|
||||
@@ -36,6 +36,9 @@ WorkoutWindow::WorkoutWindow(Context *context) :
|
||||
// the workout scene
|
||||
workout = new WorkoutWidget(this, context);
|
||||
|
||||
// paint the W'bal curve
|
||||
mmp = new WWMMPCurve(workout);
|
||||
|
||||
// add the power and W'bal scale
|
||||
powerscale = new WWPowerScale(workout, context);
|
||||
wbalscale = new WWWBalScale(workout, context);
|
||||
|
||||
@@ -43,6 +43,7 @@ class WWWBLine;
|
||||
class WWRect;
|
||||
class WWBlockCursor;
|
||||
class WWBlockSelection;
|
||||
class WWMMPCurve;
|
||||
|
||||
class WorkoutWindow : public GcWindow
|
||||
{
|
||||
@@ -85,6 +86,7 @@ class WorkoutWindow : public GcWindow
|
||||
WWRect *rect;
|
||||
WWBlockCursor *bcursor;
|
||||
WWBlockSelection *brect;
|
||||
WWMMPCurve *mmp;
|
||||
bool active;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user