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


C++ NodeTree类代码示例

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


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

示例1: copyTree

void copyTree(VisualNode* node_t, NodeTree& tree_t,
              const VisualNode* node_s, const NodeTree& tree_s) {

  auto& na_t = tree_t.getNA();
  const auto& na_s = tree_s.getNA();

  stack<VisualNode*> stk_t;
  stack<const VisualNode*> stk_s;

  stk_s.push(node_s);
  stk_t.push(node_t);

  while (stk_s.size() > 0) {

      const VisualNode* n = stk_s.top(); stk_s.pop();
      VisualNode*    next = stk_t.top(); stk_t.pop();

      auto kids = n->getNumberOfChildren();
      next->setNumberOfChildren(kids, na_t);

      next->setStatus(n->getStatus());
      next->dirtyUp(na_t);

      for (auto i = 0u; i < kids; ++i) {
          stk_s.push(n->getChild(na_s, i));
          stk_t.push(next->getChild(na_t, i));
      }
  }

}
开发者ID:cp-profiler,项目名称:cp-profiler,代码行数:30,代码来源:tree_utils.cpp

示例2: Search

void  MainWindow::Search(wxTreeItemId search,bool toogle)
{
	wxTreeItemIdValue cookie;
	NodeTree *itemData = search.IsOk() ? (NodeTree *) tree->GetItemData(search)
		:NULL;

	if(itemData->getTipo()==N_World )
		if(itemData->pointer.world->getNumObjects()!=0)
			Search(tree->GetFirstChild(search,cookie),toogle);
	
	if(itemData->menus.menu_positionable)
	{
		if(itemData->menus.menu_composed || itemData->pointer.positionableentity->getOwner()->getClassName()=="World")
		{
			if(toogle)
				itemData->pointer.positionableentity->setDrawReferenceSystem();
			else
				itemData->pointer.positionableentity->setDrawReferenceSystem(false);
		
			if(itemData->menus.menu_composed)
				if(itemData->pointer.composedentity->getNumObjects()>0)
					Search(tree->GetFirstChild(search,cookie),toogle);
		}
	}
	if(tree->GetLastChild(tree->GetItemParent(search))==search)
		return;
	
	Search(tree->GetNextSibling(search),toogle);

}
开发者ID:CristinaGajate,项目名称:Apolo,代码行数:30,代码来源:mainWindow.cpp

示例3: calculateMaxDepth

int calculateMaxDepth(const NodeTree& nt) {

  const auto& na = nt.getNA();
  const auto* root = nt.getRoot();

  return calcDepth(na, root);
}
开发者ID:cp-profiler,项目名称:cp-profiler,代码行数:7,代码来源:tree_utils.cpp

示例4: ShowSelection

void MainWindow::ShowSelection(wxCommandEvent& event)
{
	int id=event.GetId();
	bool d_box=toolbar->GetToolState(id);
	NodeTree *itemData = tree->GetSelection().IsOk() ? (NodeTree *) tree->GetItemData(tree->GetSelection())
										:NULL;
		
	if(d_box)
	{
		tree->SetShowSelection(true);
		if(!tree->GetSelection().IsOk()) return;
		if(itemData->menus.menu_solid  && tree->GetSelection()!=tree->GetRootItem())
		{
			itemData->pointer.solidentity->setDrawBox(true);
			itemData->getSimu()->getChild()->Refresh();
		}
	}
	else
	{
		
		tree->SetShowSelection(false);
		if(!tree->GetSelection().IsOk()) return;
		if(itemData->menus.menu_solid && tree->GetSelection()!=tree->GetRootItem())
		{
			itemData->pointer.solidentity->setDrawBox(false);
			itemData->getSimu()->getChild()->Refresh();
		}
		
	}
	
		
}
开发者ID:CristinaGajate,项目名称:Apolo,代码行数:32,代码来源:mainWindow.cpp

示例5: highlightSubtrees

void highlightSubtrees(NodeTree& nt, const std::vector<VisualNode*>& nodes) {

  QMutexLocker lock(&nt.getMutex());

  auto& na = nt.getNA();
  auto* root = nt.getRoot();

  root->unhideAll(na);

  {
    QMutexLocker lock(&nt.getLayoutMutex());
    root->layout(na);
  }

  // unhighlight all
  applyToEachNode(nt, [](VisualNode* n) {
    n->setHighlighted(false);
  });

  for (auto node : nodes) {
    node->setHighlighted(true);
  }

  // TODO: hide not highlighted
  // HideNotHighlightedCursor hnhc(root, na);
  // PostorderNodeVisitor<HideNotHighlightedCursor>(hnhc).run();

  nt.treeModified();

}
开发者ID:cp-profiler,项目名称:cp-profiler,代码行数:30,代码来源:tree_utils.cpp

示例6: applyToEachNodePO

void applyToEachNodePO(NodeTree& nt, const NodeAction& action) {

  /// PO-traversal requires two stacks
  std::stack<VisualNode*> stk_1;
  std::stack<VisualNode*> stk_2;

  auto* root = nt.getRoot();
  auto& na = nt.getNA();

  stk_1.push(root);

  while (stk_1.size() > 0) {
    auto* node = stk_1.top(); stk_1.pop();

    stk_2.push(node);

    for (auto i = 0u; i < node->getNumberOfChildren(); ++i) {
      auto kid = node->getChild(na, i);
      stk_1.push(kid);
    }
  }

  while (stk_2.size() > 0) {
    auto* node = stk_2.top(); stk_2.pop();

    action(node);
  }

}
开发者ID:cp-profiler,项目名称:cp-profiler,代码行数:29,代码来源:tree_utils.cpp

示例7: while

std::vector<NodeTree<int>*>* GraphStructuredStack::getReachable(NodeTree<int>* start, int length) {
	std::vector<NodeTree<int>*>* reachableList = new std::vector<NodeTree<int>*>();
	std::queue<NodeTree<int>*> currentNodes;
	std::queue<NodeTree<int>*> nextNodes;
	currentNodes.push(start);
	for (int i = 0; i < length; i++) {
		while (!currentNodes.empty()) {
			NodeTree<int>* currentNode = currentNodes.front();
			currentNodes.pop();
			std::vector<NodeTree<int>*> children = currentNode->getChildren();
			//std::cout << currentNode->getData() << " has children ";
			for (std::vector<NodeTree<int>*>::size_type j = 0; j < children.size(); j++) {
				std::cout << children[j]->getData() << " ";
				nextNodes.push(children[j]);
			}
			std::cout << std::endl;
		}
		currentNodes = nextNodes;
		//No clear function, so go through and remove
		while(!nextNodes.empty())
			nextNodes.pop();
	}
	while (!currentNodes.empty()) {
		reachableList->push_back(currentNodes.front());
		//std::cout << currentNodes.front()->getData() << " is reachable from " << start->getData() << " by length " << length << std::endl;
		currentNodes.pop();
	}
	return reachableList;
}
开发者ID:jorendorff,项目名称:kraken,代码行数:29,代码来源:GraphStructuredStack.cpp

示例8: it

void HuffmanCompression::getCarEncode(){
    codeTable = new QMap<char,QString>;
    QListIterator<NodeTree*> it(*externalNodesList);
    while(it.hasNext()){
        NodeTree *n = it.next();
        QString str = goThroughBranch(n);
        codeTable->insert(n->getCharacter(),str);
    }
}
开发者ID:bend,项目名称:Huffman-algorithm,代码行数:9,代码来源:huffmancompression.cpp

示例9: getPath

	//get path from root to node at index
	NodeTree* getPath(unsigned int index){
		RRTNode* node = _nodes[index];
		NodeTree* path = new NodeTree(node);

		while(node->getParent() != NULL)
		{
			path->addNode(node); // insert 
			node = node->getParent();
		}
		path->addNode(node); 
		// std::reverse(path->_nodes.begin(),path->_nodes.end());
		return path;
	}
开发者ID:varunverlencar,项目名称:MotionPlanning,代码行数:14,代码来源:myrrt.hpp

示例10: NodeTree

void HuffmanCompression::unify(NodeTree *nodeL,NodeTree *nodeR){
    unsigned int weight = nodeL->getweight()+nodeR->getweight();
    NodeTree *tree = new NodeTree();
    nodeL->setType(Constants::LEFT);
    nodeR->setType(Constants::RIGHT);
    nodeR->setParent(tree);
    nodeL->setParent(tree);
    tree->setLeft(nodeL);
    tree->setRight(nodeR);
    tree->setType(Constants::ROOT);
    tree->setWeight(weight);
    list->insert(tree);
    if(list->size()==1)
        return;
    unify(list->getFirst(),list->getFirst());
}
开发者ID:bend,项目名称:Huffman-algorithm,代码行数:16,代码来源:huffmancompression.cpp

示例11: addChildren

void addChildren(VisualNode* node, NodeTree& nt, int kids) {

  auto& na = nt.getNA();

  node->setNumberOfChildren(kids, na);
  node->dirtyUp(na);

  auto& stats = nt.getStatistics();
  stats.undetermined += kids;

  int depth = tree_utils::calculateDepth(nt, *node) + 1;
  int new_depth = depth + 1;

  stats.maxDepth = std::max(stats.maxDepth, new_depth);

};
开发者ID:cp-profiler,项目名称:cp-profiler,代码行数:16,代码来源:tree_utils.cpp

示例12: applyToEachNode

void applyToEachNode(NodeTree& nt, const NodeAction& action) {
  auto& na = nt.getNA();

  for (int i = 0; i < na.size(); ++i) {
    action(na[i]);
  }
}
开发者ID:cp-profiler,项目名称:cp-profiler,代码行数:7,代码来源:tree_utils.cpp

示例13: WXUNUSED

void MainWindow::OnRobotSimPanelCtrl(wxCommandEvent& WXUNUSED(event))
{
	wxTreeItemId itemId = tree->GetSelection();
	NodeTree *itemData = itemId.IsOk() ? (NodeTree *) tree->GetItemData(itemId):NULL;
	if(itemData->pointer.robotsim)
	{
		if(managewindow->CheckWindowsExist(itemData))
		{
			RobotSimPanel* robotSimCtrl;
			robotSimCtrl = new RobotSimPanel(this,wxID_ANY,wxT("Move all Joints"),itemData);
			robotSimCtrl->getTitle()->SetLabel(wxString(itemData->getNameTree()));
			robotSimCtrl->setManageWindow(managewindow);
			robotSimCtrl->Show(true);	
			wxLogStatus(wxT("Robot Sim Panel"));
		}
		
	}
}
开发者ID:CristinaGajate,项目名称:Apolo,代码行数:18,代码来源:mainWindow.cpp

示例14: calculateDepth

int calculateDepth(const NodeTree& nt, const VisualNode& node) {
  int count = 0;

  auto it = &node;
  auto& na = nt.getNA();

  while ( (it = it->getParent(na)) ) { count++; }

  return count;
}
开发者ID:cp-profiler,项目名称:cp-profiler,代码行数:10,代码来源:tree_utils.cpp

示例15: recursiveHierarchy

static void recursiveHierarchy(NodeTree& tree, CSFile *csf, int idx, int cloneoffset)
{
  for (int i = 0; i < csf->nodes[idx].numChildren; i++){
    tree.setNodeParent((NodeTree::nodeID)csf->nodes[idx].children[i] + cloneoffset,(NodeTree::nodeID)idx + cloneoffset);
  }

  for (int i = 0; i < csf->nodes[idx].numChildren; i++){
    recursiveHierarchy(tree,csf,csf->nodes[idx].children[i],cloneoffset);
  }
}
开发者ID:ADNbox,项目名称:gl_cadscene_rendertechniques,代码行数:10,代码来源:cadscene.cpp


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