Advertisement
Guest User

Untitled

a guest
May 21st, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.11 KB | None | 0 0
  1. void CompositionItem::formComposition()
  2. {
  3.      fsmVector fsms;
  4.      linkVector links;
  5.  
  6.      auto getFsmsAndLinks = [&fsms, &links](QList<QGraphicsItem*> allItems)
  7.      {
  8.           for( const auto& item : allItems )
  9.           {
  10.                if( globals::customTypes::fsm == item->type() )
  11.                {
  12.                     // Автомат уже сформирован
  13.                     fsms.push_back( dynamic_cast<FsmItem*>(item)->getFsm() );
  14.                }
  15.                else if ( globals::customTypes::link == item->type() )
  16.                {
  17.                     // Связь нужно сначала сформировать
  18.                     LinkItem* link = dynamic_cast<LinkItem*>(item);
  19.                     link->formLink();
  20.                     links.push_back( link->getLink() );
  21.                }
  22.           }
  23.      };
  24.  
  25.      getFsmsAndLinks(collidingItems());
  26.  
  27.      composition_ = Composition(fsms, links);
  28. }
  29.  
  30. ////////////////////////////////////////////////////////////////////
  31. Composition::Composition(fsmVector fsms, linkVector links)
  32.      : fsms_(fsms), links_(links)
  33. {
  34.  
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement