本文整理汇总了C++中Duration::minutes方法的典型用法代码示例。如果您正苦于以下问题:C++ Duration::minutes方法的具体用法?C++ Duration::minutes怎么用?C++ Duration::minutes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Duration
的用法示例。
在下文中一共展示了Duration::minutes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: advance
void MainWindow::advance()
{
if( momit == simCompsPtr->moments.end() )
return;
if( aktCzas >= momit->first )
{
for( unsigned int i = 0; i < train_vector.size(); i++ )
{
for( unsigned int j = 0; j < momit->second.size(); j++ )
{
if( train_vector[i]->train == simCompsPtr->map.getTrain(momit->second[j].trainID) )
{
disconnect(train_vector[i]->timer, SIGNAL(timeout()), train_vector[i], SLOT(move()));
if( simCompsPtr->map.getBlock(momit->second[j].worldBlockID)->whatIsIt() == WorldBlock::TRACK )
{
if( train_vector[i]->route->getSections()[train_vector[i]->index].getBlock().whatIsIt() == WorldBlock::STATION )
{
QStation *curr_station;
for( int k = 0; k < station_vector.size(); k++ )
if( station_vector[k]->block == simCompsPtr->map.getBlock(
train_vector[i]->route->getSections()[train_vector[i]->index].getBlock().getStation().getID() ) )
{
curr_station = station_vector[k];
break;
}
curr_station->noOfTrains--;
}
train_vector[i]->index ++;
train_vector[i]->next_index ++;
int railNo = momit->second[j].railNo;
QTrack *curr_track;
for( unsigned int k = 0; k < track_vector.size(); k++ )
if( track_vector[k]->block == simCompsPtr->map.getBlock(momit->second[j].worldBlockID ))
{
curr_track = track_vector[k];
break;
}
train_vector[i]->change = &( momit->second[j] );
train_vector[i]->track = curr_track;
QPointF wb( 0, 0 );
if( train_vector[i]->route->getSections()[train_vector[i]->index-1].getBlock().whatIsIt() == WorldBlock::STATION )
{
wb.setX( train_vector[i]->route->getSections()[train_vector[i]->index-1].getBlock().getStation().getPosX() );
wb.setY( train_vector[i]->route->getSections()[train_vector[i]->index-1].getBlock().getStation().getPosY() );
}
if( train_vector[i]->route->getSections()[train_vector[i]->index-1].getBlock().whatIsIt() == WorldBlock::JUNCT )
{
wb.setX( train_vector[i]->route->getSections()[train_vector[i]->index-1].getBlock().getJunction().getPosX() );
wb.setY( train_vector[i]->route->getSections()[train_vector[i]->index-1].getBlock().getJunction().getPosY() );
}
QLineF line1( wb, curr_track->start_points[railNo - 1] );
QLineF line2( wb, curr_track->end_points[railNo - 1] );
QLineF start_line( 0, 0, 0, 0 );
if( line1.length() < line2.length() )
start_line = line1;
else
start_line = line2;
train_vector[i]->setPos( start_line.x2() - train_vector[i]->a/2, start_line.y2() - train_vector[i]->a/2 );
Duration time = momit->second[j].end - momit->second[j].begin;
train_vector[i]->move_duration = 0;
double one = 1;
train_vector[i]->move_part = one / ( time.hours()*60 + time.minutes() );
connect(train_vector[i]->timer, SIGNAL(timeout()), train_vector[i], SLOT(move()));
train_vector[i]->timer->start(time_skip);
}
if( simCompsPtr->map.getBlock(momit->second[j].worldBlockID)->whatIsIt() == WorldBlock::STATION )
{
if( train_vector[i]->index == -1 )
scene->addItem( train_vector[i] );
train_vector[i]->index ++;
train_vector[i]->next_index ++;
if( train_vector[i]->route->getSections().size() == train_vector[i]->next_index + 1 )
scene->removeItem( train_vector[i] );
train_vector[i]->setPos( simCompsPtr->map.getBlock(momit->second[j].worldBlockID)->getStation().getPosX() - train_vector[i]->a/2 ,
simCompsPtr->map.getBlock(momit->second[j].worldBlockID)->getStation().getPosY() - train_vector[i]->a/2 );
QStation *curr_station;
for( int k = 0; k < station_vector.size(); k++ )
if( station_vector[k]->block == simCompsPtr->map.getBlock(momit->second[j].worldBlockID ) )
{
curr_station = station_vector[k];
break;
}
curr_station->noOfTrains++;
}
if( simCompsPtr->map.getBlock(momit->second[j].worldBlockID)->whatIsIt() == WorldBlock::JUNCT )
{
if( train_vector[i]->index == -1 )
scene->addItem( train_vector[i] );
train_vector[i]->index ++;
//.........这里部分代码省略.........