当前位置: 首页>>代码示例>>C++>>正文


C++ Movement::getDet2方法代码示例

本文整理汇总了C++中Movement::getDet2方法的典型用法代码示例。如果您正苦于以下问题:C++ Movement::getDet2方法的具体用法?C++ Movement::getDet2怎么用?C++ Movement::getDet2使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Movement的用法示例。


在下文中一共展示了Movement::getDet2方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: QAbstractItemModel

Entities::Entities(std::map<int,Detection*> _detections,
                   std::map<int,Movement*> _movements,
                   std::map<int,Path*> _paths,
                   std::map<int,Agent*> _agents,
                   std::map<int,Behavior*> _behaviors,
                   bool detailed)
: QAbstractItemModel(0), detections(_detections), movements(_movements),
    paths(_paths), agents(_agents), behaviors(_behaviors)
{
    rootEntitiesTreeItem = new EntitiesTreeItem(NULL, 0);

    if(detailed)
    {
        for(std::map<int,Detection*>::const_iterator it = detections.begin();
            it != detections.end(); it++)
        {
            EntitiesTreeItem *e = new EntitiesTreeItem((*it).second, rootEntitiesTreeItem);
            rootEntitiesTreeItem->appendChild(e);
        }
        for(std::map<int,Movement*>::const_iterator it = movements.begin();
            it != movements.end(); it++)
        {
            EntitiesTreeItem *e = new EntitiesTreeItem((*it).second, rootEntitiesTreeItem);
            rootEntitiesTreeItem->appendChild(e);

            EntitiesTreeItem *e1 = new EntitiesTreeItem(((*it).second)->getDet1(), e);
            e->appendChild(e1);

            EntitiesTreeItem *e2 = new EntitiesTreeItem(((*it).second)->getDet2(), e);
            e->appendChild(e2);
        }
        for(std::map<int,Path*>::const_iterator it = paths.begin();
            it != paths.end(); it++)
        {
            Path *p = (*it).second;
            EntitiesTreeItem *e = new EntitiesTreeItem(p, rootEntitiesTreeItem);
            rootEntitiesTreeItem->appendChild(e);

            p->movements_begin();
            while(!p->movements_end())
            {
                Movement *m = p->movements_next();
                EntitiesTreeItem *em = new EntitiesTreeItem(m, e);
                e->appendChild(em);

                EntitiesTreeItem *ed1 = new EntitiesTreeItem(m->getDet1(), em);
                em->appendChild(ed1);

                EntitiesTreeItem *ed2 = new EntitiesTreeItem(m->getDet2() ,em);
                em->appendChild(ed2);
            }
        }
        for(std::map<int,Agent*>::const_iterator it = agents.begin();
            it != agents.end(); it++)
        {
            Agent *a = (*it).second;
            EntitiesTreeItem *e = new EntitiesTreeItem(a, rootEntitiesTreeItem);
            rootEntitiesTreeItem->appendChild(e);

            a->paths_begin();
            while(!a->paths_end())
            {
                Path *p = a->paths_next();
                EntitiesTreeItem *ep = new EntitiesTreeItem(p, e);
                e->appendChild(ep);

                p->movements_begin();
                while(!p->movements_end())
                {
                    Movement *m = p->movements_next();
                    EntitiesTreeItem *em = new EntitiesTreeItem(m, ep);
                    ep->appendChild(em);

                    EntitiesTreeItem *ed1 = new EntitiesTreeItem(m->getDet1(), em);
                    em->appendChild(ed1);

                    EntitiesTreeItem *ed2 = new EntitiesTreeItem(m->getDet2() ,em);
                    em->appendChild(ed2);
                }
            }
        }
    } // if(detailed)

    for(std::map<int,Behavior*>::const_iterator it = behaviors.begin();
        it != behaviors.end(); it++)
    {
        Behavior *b = (*it).second;
        EntitiesTreeItem *e = new EntitiesTreeItem(b, rootEntitiesTreeItem);
        rootEntitiesTreeItem->appendChild(e);

        b->agents_begin();
        while(!b->agents_end())
        {
            Agent *a = b->agents_next();
            EntitiesTreeItem *ea = new EntitiesTreeItem(a, e);
            e->appendChild(ea);

            a->paths_begin();
            while(!a->paths_end())
            {
//.........这里部分代码省略.........
开发者ID:joshuaeckroth,项目名称:SURV-I,代码行数:101,代码来源:entities.cpp


注:本文中的Movement::getDet2方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。