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 AllPlotWindow::rideDeleted(RideItem *ride) { if (ride == myRideItem) { // we have nothing to show setProperty("ride", QVariant::fromValue<RideItem*>(NULL)); // notify all the plots, because when zones are redrawn // they will try and reference AllPlot::rideItem setAllPlotWidgets(NULL); fullPlot->setDataFromRide(NULL); } }
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; }