void AllPlotWindow::redrawAllPlot() { if (!showStack->isChecked() && current) { RideItem *ride = current; int startidx, stopidx; if (fullPlot->bydist == true) { startidx =ride->ride()->distanceIndex((double)spanSlider->lowerValue()/(double)1000); stopidx = ride->ride()->distanceIndex((double)spanSlider->upperValue()/(double)1000); } else { startidx = ride->ride()->timeIndex(spanSlider->lowerValue()); stopidx = ride->ride()->timeIndex(spanSlider->upperValue()); } // need more than 1 sample to plot if (stopidx - startidx > 1) { allPlot->setDataFromPlot(fullPlot, startidx, stopidx); allZoomer->setZoomBase(); //allPlot->setTitle(""); allPlot->replot(); } } }
void AllPlotWindow::redrawFullPlot() { // always peformed sincethe data is used // by both the stack plots and the allplot RideItem *ride = current; // null rides are possible on new cyclist if (!ride) return; // hide the usual plot decorations etc fullPlot->setShowPower(1); //We now use the window background color //fullPlot->setCanvasBackground(GColor(CPLOTTHUMBNAIL)); fullPlot->setCanvasLineWidth(0); fullPlot->grid->enableY(false); fullPlot->enableAxis(QwtPlot::yLeft, false); fullPlot->enableAxis(QwtPlot::yLeft2, false); fullPlot->enableAxis(QwtPlot::yRight, false); fullPlot->enableAxis(QwtPlot::yRight2, false); fullPlot->enableAxis(QwtPlot::xBottom, false); //fullPlot->legend()->clear(); //fullPlot->setTitle(""); if (fullPlot->bydist) fullPlot->setAxisScale(QwtPlot::xBottom, ride->ride()->dataPoints().first()->km * (fullPlot->useMetricUnits ? 1 : MILES_PER_KM), ride->ride()->dataPoints().last()->km * (fullPlot->useMetricUnits ? 1 : MILES_PER_KM)); else fullPlot->setAxisScale(QwtPlot::xBottom, ride->ride()->dataPoints().first()->secs/60, ride->ride()->dataPoints().last()->secs/60); fullPlot->replot(); }
void PfPvWindow::rideSelected() { // we need to refresh for compare mode if (isCompare()) { if (isVisible() && compareStale) compareChanged(); return; } if (!amVisible()) { compareStale = true; return; } RideItem *ride = myRideItem; if (!ride || !ride->ride() || !ride->ride()->isDataPresent(RideFile::watts) || !ride->ride()->isDataPresent(RideFile::cad)) { setIsBlank(true); current = NULL; return; } else { setIsBlank(false); } if (!stale && ride == current) return; pfPvPlot->setData(ride); current = ride; stale = false; // update the QLabel widget with the CP value set in PfPvPlot::setData() qaCPValue->setText(QString("%1").arg(pfPvPlot->getCP())); }
void HrPwWindow::rideSelected() { if (!amVisible()) return; RideItem *ride = myRideItem; if (!ride || !ride->ride() || !ride->ride()->isDataPresent(RideFile::watts) || !ride->ride()->isDataPresent(RideFile::hr)) setIsBlank(true); else { setIsBlank(false); setData(ride); } }
void IntervalSummaryWindow::intervalSelected() { // if no ride available don't bother - just reset for color changes RideItem *rideItem = const_cast<RideItem*>(context->currentRideItem()); if (rideItem->intervalsSelected().count() == 0 || rideItem == NULL || rideItem->ride() == NULL) { // no ride just update the colors QString html = GCColor::css(); html += "<body></body>"; setHtml(html); return; } // summary is html QString html = GCColor::css(); html += "<body>"; // summarise all the intervals selected - this is painful! //if (rideItem->intervalsSelected().count()>1) summarise(rideItem->intervalsSelected(), html); // summary for each of the currently selected intervals foreach(IntervalItem *interval, rideItem->intervalsSelected()) html += summary(interval); if (html == GCColor::css()+"<body>") html += "<i>" + tr("select an interval for summary info") + "</i>"; html += "</body>"; setHtml(html); return; }
void IntervalSummaryWindow::intervalSelected() { // if no ride available don't bother - just reset for color changes RideItem *rideItem = const_cast<RideItem*>(context->currentRideItem()); if (context->athlete->intervalTreeWidget()->selectedItems().count() == 0 || rideItem == NULL || rideItem->ride() == NULL) { // no ride just update the colors QString html = GCColor::css(); html += "<body></body>"; setHtml(html); return; } QString html = GCColor::css(); html += "<body>"; if (context->athlete->allIntervalItems() != NULL) { for (int i=0; i<context->athlete->allIntervalItems()->childCount(); i++) { IntervalItem *current = dynamic_cast<IntervalItem*>(context->athlete->allIntervalItems()->child(i)); if (current != NULL) { if (current->isSelected()) { calcInterval(current, html); } } } } if (html == GCColor::css()+"<body>") { html += "<i>" + tr("select an interval for summary info") + "</i>"; } html += "</body>"; setHtml(html); return; }
void RideWindow::rideSelected() { // skip display if data drawn or invalid if (myRideItem == NULL || !amVisible()) return; RideItem * r = myRideItem; if (ride == r || !r || !r->ride()) return; else ride = r; loadRide(); }
void AllPlotWindow::rideSelected() { RideItem *ride = mainWindow->rideItem(); // ignore if not active if (mainWindow->activeTab() != this) { stale = true; return; } // ignore if null, or manual / empty if (!ride || !ride->ride() || !ride->ride()->dataPoints().count()) return; // we already plotted it! if (ride == current && stale == false) return; // ok, its now the current ride current = ride; // clear any previous selections clearSelection(); // setup the control widgets, dependant on // data present in this ride, needs to happen // before we set the plots below... setAllPlotWidgets(ride); // setup the charts to reflect current ride selection fullPlot->setDataFromRide(ride); allPlot->setDataFromPlot(fullPlot, ride->ride()->timeIndex(spanSlider->lowerValue()), ride->ride()->timeIndex(spanSlider->upperValue())); // redraw all the plots, they will check // to see if they are currently visible // and only redraw if neccessary redrawFullPlot(); redrawAllPlot(); setupStackPlots(); stale = false; }
void HrPwWindow::rideSelected() { if (!amVisible()) return; RideItem *ride = myRideItem; if (!ride || !ride->ride()) return; setData(ride); }
void AllPlotWindow::configChanged() { fullPlot->setCanvasBackground(GColor(CPLOTTHUMBNAIL)); // we're going to replot, but only if we're active // and all the other guff RideItem *ride = mainWindow->rideItem(); if (mainWindow->activeTab() != this) { stale = true; return; } // ignore if null, or manual / empty if (!ride || !ride->ride() || !ride->ride()->dataPoints().count()) return; // ok replot with the new config! redrawFullPlot(); redrawAllPlot(); redrawStackPlot(); }
void AllPlotWindow::rideSelected() { RideItem *ride = myRideItem; if (ride == NULL) current = NULL; // ignore if not active if (!amVisible()) { stale = true; return; } // ignore if null, or manual / empty if (!ride || !ride->ride() || !ride->ride()->dataPoints().count()) { current = NULL; return; } // we already plotted it! if (ride == current && stale == false) return; // ok, its now the current ride current = ride; // clear any previous selections clearSelection(); // setup the control widgets, dependant on // data present in this ride, needs to happen // before we set the plots below... setAllPlotWidgets(ride); // setup the charts to reflect current ride selection fullPlot->setDataFromRide(ride); // Fixup supplied by Josef Gebel int startidx, stopidx; if ( fullPlot->bydist == true ) { startidx = ride->ride()->distanceIndex( ( double ) spanSlider->lowerValue() / 1000.0 ); stopidx = ride->ride()->distanceIndex( ( double ) spanSlider->upperValue() / 1000.0 ); } else { startidx = ride->ride()->timeIndex( spanSlider->lowerValue() ); stopidx = ride->ride()->timeIndex( spanSlider->upperValue() ); } allPlot->setDataFromPlot( fullPlot, startidx, stopidx ); // redraw all the plots, they will check // to see if they are currently visible // and only redraw if neccessary redrawFullPlot(); redrawAllPlot(); setupStackPlots(); stale = false; }
void Athlete::updateRideFileIntervals() { // iterate over context->athlete->allIntervals as they are now defined // and update the RideFile->intervals RideItem *which = (RideItem *)treeWidget->selectedItems().first(); RideFile *current = which->ride(); current->clearIntervals(); for (int i=0; i < allIntervals->childCount(); i++) { // add the intervals as updated IntervalItem *it = (IntervalItem *)allIntervals->child(i); current->addInterval(it->start, it->stop, it->text(0)); } // emit signal for interval data changed context->notifyIntervalsChanged(); // set dirty which->setDirty(true); }