Beispiel #1
0
static void    test_stress( void )
{
    typedef std::vector<Path::iterator>     Wave;
    
    Wave    wave1;
    Wave    wave2;
    
    for (size_t  k = 0; k < 3; ++k)
    {
        Path    path;
        
        wave1.push_back( path.attach( PathData() ) );
        
        for (size_t  n = 0; n < 11; ++n)
        {
            for (Wave::iterator  it = wave1.begin(); it != wave1.end(); ++it)
            {
                for (size_t  i = 0; i < 4; ++i)
                {
                    wave2.push_back( path.attach( PathData(), *it, i ) );
                }
            }
            
            wave1.clear();
            wave1.swap( wave2 );
        }
        
        wave1.clear();
    }
}
Beispiel #2
0
static void     test( void )
{
    Path            path;
    
    SBE_ASSERT( path.size() == 0 );
    
    Path::iterator const    head = path.attach( PathData() );
    
    SBE_ASSERT( head.isLast() );
    SBE_ASSERT( path.size() == 1 );
    
    Path::iterator  child[4];
    
    for (size_t  i = 0; i < 4; ++i)
    {
        child[i] = path.attach( PathData(), head, i );
        SBE_ASSERT( child[i].isLast() );
    }
    
    SBE_ASSERT( path.size() == 5 );
    
    //-------------------------------------------------------//
    
    Path::iterator      grandchild[ 4 ];
    
    for (size_t  i = 0; i < 4; ++i)
    {
        grandchild[i] = path.attach( PathData(), child[i], i );
        
        SBE_ASSERT( !child[i].isLast() );
        SBE_ASSERT( grandchild[i].isLast() );
        SBE_ASSERT( child[i].size() == 2 );
        SBE_ASSERT( grandchild[i].size() == 1 );
    }
    
    //-------------------------------------------------------//
    
    SBE_ASSERT( path.size() == 9 );
    
    #ifdef SBE_DEBUG
        path.print();
    #endif
    
    for (size_t  i = 0; i < 3; ++i)
    {
        path.collapse( grandchild[i] );
        
        SBE_ASSERT( path.size() == (9 - (i + 1) * 2 ) );
    }
    
    path.collapse( grandchild[3] );
    
    SBE_ASSERT( path.size() == 0 );
}
Beispiel #3
0
void AIPlayer::clearPath()
{
   // Only delete if we own the path.
   if(!mPathData.path.isNull() && mPathData.owned)
      mPathData.path->deleteObject();
   // Reset path data.
   mPathData = PathData();
}
Beispiel #4
0
void DescriptionFactory::SetStartSegment(const PhantomNode &source, const bool traversed_in_reverse)
{
    start_phantom = source;
    const EdgeWeight segment_duration =
        (traversed_in_reverse ? source.reverse_weight : source.forward_weight);
    AppendSegment(source.location,
                  PathData(0, source.name_id, TurnInstruction::HeadOn, segment_duration));
    BOOST_ASSERT(path_description.back().duration == segment_duration);
}
Beispiel #5
0
void SegmentList<DataFacadeT>::InitRoute(const PhantomNode &node, const bool traversed_in_reverse)
{
    const auto segment_duration =
        (traversed_in_reverse ? node.reverse_weight : node.forward_weight);
    const auto travel_mode =
        (traversed_in_reverse ? node.backward_travel_mode : node.forward_travel_mode);

    AppendSegment(node.location, PathData(0, node.name_id, extractor::TurnInstruction::HeadOn,
                                          segment_duration, travel_mode));
}
// フレームデータ追加
void AnimationForm::slot_addNewFrameData( QModelIndex indexLayer, int frame, FrameData data )
{
	CObjectModel *pModel = m_pEditData->getObjectModel() ;
	if ( !pModel->isLayer(indexLayer) ) { return ; }

	qDebug() << "slot_addNewFrameData frame:" << frame ;
	data.frame = frame ;
	data.path[0] = data.path[1] = PathData() ;	// パス リセット
	QList<QWidget *> update ;
	update << m_pDataMarker << m_pGlWidget ;
	m_pEditData->cmd_addFrameData(indexLayer, data, update) ;
}
Beispiel #7
0
static void    test_2( void )
{
    Path        path;
    
    Path::iterator const    head = path.attach( PathData() );
    
    for (size_t  i = 0; i < 4; ++i)
    {
        Path::iterator const  child = path.attach( PathData(), head, i );
        
        for (size_t  k = 0; k < 4; ++k)
        {
            (void)path.attach( PathData(), child, k );
        }
    }
    
    #ifdef SBE_DEBUG
    path.print();
    #endif
    
    SBE_ASSERT( path.size() == 21 );
}
void PathMapper::updateMappings()
{
    QStringList filters;
    filters << "*.qcrml" << "*.confml";
    m_paths.clear();

    foreach (const QFileInfo &info, QDir::drives()) {
        const QDir crmlDir(info.path() + "resource/qt/crml");

        foreach (const QString &fileName, crmlDir.entryList(filters, QDir::Files)) {
            QList<KeyData> keyDatas = m_crmlParser.parseQCrml(crmlDir.filePath(fileName));
            if (m_crmlParser.error() != QCrmlParser::NoError)
                qDebug() << "error:" << m_crmlParser.errorString();

            foreach (const KeyData &keyData, keyDatas) {
                if (!m_paths.contains(keyData.path())) {
                    m_paths.insert(keyData.path(), PathData(PathMapper::Target(keyData.target()),
                                                            keyData.repoId(), keyData.keyId()));
                }
            }
        }
    }
}
void DescriptionFactory::SetStartSegment(const PhantomNode &source)
{
    start_phantom = source;
    AppendSegment(source.location, PathData(0, source.name_id, TurnInstruction::HeadOn, source.forward_weight));
}