本文整理汇总了C++中IntervalItem类的典型用法代码示例。如果您正苦于以下问题:C++ IntervalItem类的具体用法?C++ IntervalItem怎么用?C++ IntervalItem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IntervalItem类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setHtml
void IntervalSummaryWindow::intervalSelected()
{
// if no ride available don't bother - just reset for color changes
if (context->currentRideItem() == NULL || context->currentRide() == 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;
}
示例2: setClean
void
ModelWindow::setData(bool adjustPlot)
{
settings.ride = ride;
settings.x = xSelector->itemData(xSelector->currentIndex()).toInt();
settings.y = ySelector->itemData(ySelector->currentIndex()).toInt();
settings.z = zSelector->itemData(zSelector->currentIndex()).toInt();
settings.color = colorSelector->itemData(colorSelector->currentIndex()).toInt();
settings.xbin = binWidthSlider->value(); // XXX fixed to single bin width
settings.ybin = binWidthSlider->value(); // XXX due to issues with bar geometry
settings.crop = false; // XXX not implemented
settings.zpane = 0;
settings.ignore = ignore->isChecked();
settings.gridlines = grid->isChecked();
settings.frame = frame->isChecked();
settings.legend = legend->isChecked();
settings.adjustPlot = adjustPlot;
zpane->setValue(0); // reset it!
// any intervals to plot?
settings.intervals.clear();
for (int i=0; i<main->allIntervalItems()->childCount(); i++) {
IntervalItem *current = dynamic_cast<IntervalItem *>(main->allIntervalItems()->child(i));
if (current != NULL && current->isSelected() == true)
settings.intervals.append(current);
}
modelPlot->setData(&settings);
setClean();
}
示例3: setIsBlank
void
ScatterWindow::setData()
{
settings.ride = ride;
settings.x = xSelector->itemData(xSelector->currentIndex()).toInt();
settings.y = ySelector->itemData(ySelector->currentIndex()).toInt();
settings.ignore = ignore->isChecked();
settings.gridlines = grid->isChecked();
settings.frame = frame->isChecked();
/* Not a blank state ? Just no data and we can change series ?
if ((setting.x == MODEL_POWER || setting.y == MODEL_POWER ) && !ride->ride()->isDataPresent(RideFile::watts))
setIsBlank(true);
else if ((setting.x == MODEL_CADENCE || setting.y == MODEL_CADENCE ) && !ride->ride()->isDataPresent(RideFile::cad))
setIsBlank(true);
else if ((setting.x == MODEL_HEARTRATE || setting.y == MODEL_HEARTRATE ) && !ride->ride()->isDataPresent(RideFile::hr))
setIsBlank(true);
else if ((setting.x == MODEL_SPEED || setting.y == MODEL_SPEED ) && !ride->ride()->isDataPresent(RideFile::kph))
setIsBlank(true);
else
setIsBlank(false);
*/
// any intervals to plot?
settings.intervals.clear();
for (int i=0; i<main->allIntervalItems()->childCount(); i++) {
IntervalItem *current = dynamic_cast<IntervalItem *>(main->allIntervalItems()->child(i));
if (current != NULL && current->isSelected() == true)
settings.intervals.append(current);
}
scatterPlot->setData(&settings);
}
示例4:
// ------------------------------------------------------------------------------------------------------------
// note this is operating on the children of allIntervals and not the
// intervalWidget (QTreeWidget) -- this is why we do not use the
// selectedItems() member. N starts a one not zero.
// ------------------------------------------------------------------------------------------------------------
IntervalItem *IntervalAerolabData::intervalNum
(
int number
) const
{
int highlighted = 0;
const QTreeWidgetItem *allIntervals = context->athlete->allIntervalItems();
for ( int ii = 0; ii < allIntervals->childCount(); ii++)
{
IntervalItem *current = (IntervalItem *) allIntervals->child( ii );
if ( current == NULL)
{
return NULL;
}
if ( current->isSelected() == true )
{
++highlighted;
}
if ( highlighted == number )
{
return current;
}
}
return NULL;
}
示例5: TimeInterval
QList<TimeInterval*> IntervalEditImpl::intervals() const {
QList<TimeInterval*> l;
int cnt = intervalList->topLevelItemCount();
for (int i=0; i < cnt; ++i) {
IntervalItem *item = static_cast<IntervalItem*>(intervalList->topLevelItem(i));
l.append(new TimeInterval(item->interval().first, item->interval().second));
}
return l;
}
示例6: slotIntervalSelectionChanged
void IntervalEditImpl::slotIntervalSelectionChanged() {
QList<QTreeWidgetItem*> lst = intervalList->selectedItems();
if (lst.count() == 0)
return;
IntervalItem *ii = static_cast<IntervalItem *>(lst[0]);
startTime->setTime(ii->interval().first);
length->setValue((double)(ii->interval().second) / (1000.*60.*60.));
enableButtons();
}
示例7: intervalCount
// how many intervals selected?
int PfPvPlot::intervalCount() const
{
int highlighted;
highlighted = 0;
if (context->athlete->allIntervalItems() == NULL) return 0; // not inited yet!
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() == true) {
++highlighted;
}
}
}
return highlighted;
}
示例8: setUpdatesEnabled
void
ModelWindow::setData(bool adjustPlot)
{
settings.ride = ride;
settings.x = xSelector->itemData(xSelector->currentIndex()).toInt();
settings.y = ySelector->itemData(ySelector->currentIndex()).toInt();
settings.z = zSelector->itemData(zSelector->currentIndex()).toInt();
settings.color = colorSelector->itemData(colorSelector->currentIndex()).toInt();
settings.xbin = binWidthSlider->value();
settings.ybin = binWidthSlider->value();
settings.crop = false; // not implemented yet
settings.zpane = 0;
settings.ignore = ignore->isChecked();
settings.gridlines = grid->isChecked();
settings.frame = frame->isChecked();
settings.legend = legend->isChecked();
settings.adjustPlot = adjustPlot;
zpane->setValue(0); // reset it!
// any intervals to plot?
settings.intervals.clear();
for (int i=0; i<main->allIntervalItems()->childCount(); i++) {
IntervalItem *current = dynamic_cast<IntervalItem *>(main->allIntervalItems()->child(i));
if (current != NULL && current->isSelected() == true)
settings.intervals.append(current);
}
setUpdatesEnabled(false);
// reset the model parameters
modelPlot->setData(&settings);
// if setdata resulted in the plot being hidden
// then the settings were not valid.
if (modelPlot->basicModelPlot->isHidden()) {
zpane->hide();
nodata->show();
} else {
zpane->show();
nodata->hide();
}
setClean();
setUpdatesEnabled(true);
}
示例9:
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);
}
示例10: intervalCount
// ------------------------------------------------------------------------------------------------------------
// how many intervals selected?
// ------------------------------------------------------------------------------------------------------------
int IntervalAerolabData::intervalCount() const
{
int highlighted = 0;
if ( context->athlete->allIntervalItems() != NULL )
{
const QTreeWidgetItem *allIntervals = context->athlete->allIntervalItems();
for ( int ii = 0; ii < allIntervals->childCount(); ii++)
{
IntervalItem *current = (IntervalItem *) allIntervals->child( ii );
if ( current != NULL )
{
if ( current->isSelected() == true )
{
++highlighted;
}
}
}
}
return highlighted;
}
示例11: intervalSelected
void IntervalSummaryWindow::intervalSelected()
{
// if no ride available don't bother
if (mainWindow->currentRideItem() == NULL || mainWindow->currentRide() == NULL) return;
QString html;
if (mainWindow->allIntervalItems() != NULL) {
for (int i=0; i<mainWindow->allIntervalItems()->childCount(); i++) {
IntervalItem *current = dynamic_cast<IntervalItem*>(mainWindow->allIntervalItems()->child(i));
if (current != NULL) {
if (current->isSelected()) {
calcInterval(current, html);
}
}
}
}
if (html.length() == 0)
html = "<i>" + tr("select an interval for summary info") + "</i>";
setHtml(html);
return;
}
示例12: setRide
void
Tab::rideSelected(RideItem*)
{
// update the ride property on all widgets
// to let them know they need to replot new
// selected ride
setRide(context->ride);
if (!context->ride) return;
// refresh interval list for bottom left
// first lets wipe away the existing intervals
QList<QTreeWidgetItem *> intervals = context->athlete->allIntervals->takeChildren();
for (int i=0; i<intervals.count(); i++) delete intervals.at(i);
// now add the intervals for the current ride
if (context->ride) { // only if we have a ride pointer
RideFile *selected = context->ride->ride();
if (selected) {
// get all the intervals in the currently selected RideFile
QList<RideFileInterval> intervals = selected->intervals();
for (int i=0; i < intervals.count(); i++) {
// add as a child to context->athlete->allIntervals
IntervalItem *add = new IntervalItem(selected,
intervals.at(i).name,
intervals.at(i).start,
intervals.at(i).stop,
selected->timeToDistance(intervals.at(i).start),
selected->timeToDistance(intervals.at(i).stop),
context->athlete->allIntervals->childCount()+1);
add->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsDragEnabled);
context->athlete->allIntervals->addChild(add);
}
}
}
}
示例13: foreach
//.........这里部分代码省略.........
}
if (settings->gridlines) {
grid = new QwtPlotGrid();
grid->setPen(gridPen);
grid->enableX(true);
grid->enableY(true);
grid->attach(this);
} else {
grid = NULL;
}
setAxisTitle(yLeft, describeType(settings->y, true, useMetricUnits));
setAxisTitle(xBottom, describeType(settings->x, true, useMetricUnits));
// truncate PfPv values to make easier to read
if (settings->y == MODEL_AEPF) setAxisScale(yLeft, 0, 600);
else setAxisScale(yLeft, minY, maxY);
if (settings->x == MODEL_CPV) setAxisScale(xBottom, 0, 3);
else setAxisScale(xBottom, minX, maxX);
//
// Create Interval Plot dataset - used to frame intervals
//
// clear out any interval curves which are presently defined
if (intervalCurves.size()) {
QListIterator<QwtPlotCurve *> i(intervalCurves);
while (i.hasNext()) {
QwtPlotCurve *curve = i.next();
curve->detach();
delete curve;
}
}
intervalCurves.clear();
// which ones are highlighted then?
QVector<int> intervals;
QMap<int,int> displaySequence;
for (int child=0; child<context->athlete->allIntervalItems()->childCount(); child++) {
IntervalItem *current = dynamic_cast<IntervalItem *>(context->athlete->allIntervalItems()->child(child));
if ((current != NULL) && current->isSelected()) {
intervals.append(child);
displaySequence.insert(current->displaySequence, intervals.count()-1);
}
}
if (intervals.count() > 0) {
// interval data in here
QVector<QVector<double> > xvals(intervals.count()); // array of curve x arrays
QVector<QVector<double> > yvals(intervals.count()); // array of curve x arrays
QVector<int> points(intervals.count()); // points in eac curve
// extract interval data
foreach(const RideFilePoint *point, settings->ride->ride()->dataPoints()) {
double x = pointType(point, settings->x, useMetricUnits, cranklength);
double y = pointType(point, settings->y, useMetricUnits, cranklength);
if (!(settings->ignore && (x == 0 && y ==0))) {
// which interval is it in?
for (int idx=0; idx<intervals.count(); idx++) {
IntervalItem *current = dynamic_cast<IntervalItem *>(context->athlete->allIntervalItems()->child(intervals[idx]));
if (point->secs+settings->ride->ride()->recIntSecs() > current->start && point->secs< current->stop) {
xvals[idx].append(x);
yvals[idx].append(y);
points[idx]++;
}
}
}
}
// now we have the interval data lets create the curves
QMapIterator<int, int> order(displaySequence);
while (order.hasNext()) {
order.next();
int idx = order.value();
QPen pen;
QColor intervalColor;
intervalColor.setHsv((255/context->athlete->allIntervalItems()->childCount()) * (intervals[idx]), 255,255);
pen.setColor(intervalColor);
sym.setPen(pen);
QwtPlotCurve *curve = new QwtPlotCurve();
curve->setSymbol(new QwtSymbol(sym));
curve->setStyle(QwtPlotCurve::Dots);
curve->setRenderHint(QwtPlotItem::RenderAntialiased);
curve->setData(xvals[idx].constData(), yvals[idx].constData(), points[idx]);
curve->attach(this);
intervalCurves.append(curve);
}
}