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


C++ NodeType类代码示例

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


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

示例1: GetClosestNodeToPosition

//------------------------ GetClosestNodeToPosition ---------------------------
//
//  returns the index of the closest visible graph node to the given position
//-----------------------------------------------------------------------------
int Raven_PathPlanner::GetClosestNodeToPosition(Vector2D pos)const
{
  double ClosestSoFar = MaxDouble;
  int   ClosestNode  = no_closest_node_found;

  //when the cell space is queried this the the range searched for neighboring
  //graph nodes. This value is inversely proportional to the density of a 
  //navigation graph (less dense = bigger values)
  const double range = m_pOwner->GetWorld()->GetMap()->GetCellSpaceNeighborhoodRange();

  //calculate the graph nodes that are neighboring this position
  m_pOwner->GetWorld()->GetMap()->GetCellSpace()->CalculateNeighbors(pos, range);

  //iterate through the neighbors and sum up all the position vectors
  for (NodeType* pN = m_pOwner->GetWorld()->GetMap()->GetCellSpace()->begin();
                 !m_pOwner->GetWorld()->GetMap()->GetCellSpace()->end();     
                 pN = m_pOwner->GetWorld()->GetMap()->GetCellSpace()->next())
  {
    //if the path between this node and pos is unobstructed calculate the
    //distance
    if (m_pOwner->canWalkBetween(pos, pN->Pos()))
    {
      double dist = Vec2DDistanceSq(pos, pN->Pos());

      //keep a record of the closest so far
      if (dist < ClosestSoFar)
      {
        ClosestSoFar = dist;
        ClosestNode  = pN->Index();
      }
    }
  }
   
  return ClosestNode;
}
开发者ID:ButchDean,项目名称:game-ai-by-example,代码行数:39,代码来源:Raven_PathPlanner.cpp

示例2: visibleNetwork

NodeType* visibleNetwork(Algorithm* algo) {
  stack<NodeType*> toVisit;
  set<NodeType*> visited;
  map<Algorithm*, NodeType*> algoNodeMap;

  NodeType* networkRoot = new NodeType(algo);
  toVisit.push(networkRoot);

  E_DEBUG(ENetwork, "building visible network from " << algo->name());
  E_DEBUG_INDENT;

  while (!toVisit.empty()) {
    NodeType* currentNode = toVisit.top();
    toVisit.pop();
    //E_DEBUG(ENetwork, "visiting: " << currentNode->algorithm()->name());

    if (visited.find(currentNode) != visited.end()) continue;
    visited.insert(currentNode);

    vector<NodeType*> deps = currentNode->addVisibleDependencies(algoNodeMap);

    E_DEBUG(ENetwork, currentNode->algorithm()->name() << ":");
    for (int i=0; i<(int)deps.size(); i++) {
      E_DEBUG(ENetwork, "  → " << deps[i]->algorithm()->name());
      toVisit.push(deps[i]);
    }
  }

  E_DEBUG_OUTDENT;
  E_DEBUG(ENetwork, "building visible network from " << algo->name() << " ok!");
  return networkRoot;
}
开发者ID:spherepeer,项目名称:essentia,代码行数:32,代码来源:network.cpp

示例3: pixelIsAssignedToNode

    bool pixelIsAssignedToNode(unsigned int x, unsigned int y,
            const NodeType& node) {
        auto pixelNodeId = nodeIdImage.getPixelValue(x, y);
        auto pixelNodeLevel = internalImage.getPixelValue(x, y);

        return pixelNodeId == node.getId() && pixelNodeLevel == node.getLevel();
    }
开发者ID:jvff,项目名称:mestrado-implementacao,代码行数:7,代码来源:MinMaxTreeImage.hpp

示例4:

void mitk::FastMarchingTool3D::OnAddPoint()
{
  // Add a new seed point for FastMarching algorithm
  mitk::Point3D clickInIndex;

  m_ReferenceImage->GetGeometry()->WorldToIndex(m_SeedsAsPointSet->GetPoint(m_SeedsAsPointSet->GetSize()-1),
                                                clickInIndex);
  itk::Index<3> seedPosition;
  seedPosition[0] = clickInIndex[0];
  seedPosition[1] = clickInIndex[1];
  seedPosition[2] = clickInIndex[2];

  NodeType node;
  const double seedValue = 0.0;
  node.SetValue( seedValue );
  node.SetIndex( seedPosition );
  this->m_SeedContainer->InsertElement(this->m_SeedContainer->Size(), node);
  m_FastMarchingFilter->Modified();

  mitk::RenderingManager::GetInstance()->RequestUpdateAll();

  m_NeedUpdate = true;

  this->Update();
}
开发者ID:zomboir,项目名称:MITK,代码行数:25,代码来源:mitkFastMarchingTool3D.cpp

示例5: focusedIndex

void NodeTypesDelegate::showPropertiesDialog()
{
    QModelIndex index = focusedIndex();
    NodeType *type = qobject_cast<NodeType*>(index.data(NodeTypeModel::DataRole).value<QObject*>());
    QPointer<NodeTypeProperties> dialog = new NodeTypeProperties(0);
    dialog->setType(type->self());
    dialog->exec();
}
开发者ID:KDE,项目名称:rocs,代码行数:8,代码来源:nodetypesdelegate.cpp

示例6: connectPixelsMaybeReplacingParent

    void connectPixelsMaybeReplacingParent(const NodeType& firstNode,
            const NodeType& secondNode) {
        auto& isBefore = levelOrderComparator;
        auto firstNodeParentLevel = firstNode.getParent().getLevel();
        auto secondNodeLevel = secondNode.getLevel();

        if (isBefore(firstNodeParentLevel, secondNodeLevel))
            minMaxTree.setNodeParent(firstNode, secondNode);
    }
开发者ID:jvff,项目名称:mestrado-implementacao,代码行数:9,代码来源:MinMaxTreeImage.hpp

示例7: removeNormalNode

    void removeNormalNode(const NodeType& node) {
        auto& parent = node.getParent();
        auto newColor = parent.getLevel();
        auto newId = parent.getId();

        updatePixelsIfAssignedToNode(node, newColor, newId);

        minMaxTree.removeNode(node.getLevel(), node.getId());
    }
开发者ID:jvff,项目名称:mestrado-implementacao,代码行数:9,代码来源:MinMaxTreeImage.hpp

示例8: removeRootNode

    void removeRootNode(const NodeType& node) {
        minMaxTree.removeNode(node.getLevel(), node.getId());

        auto newColor = minMaxTree.getFirstLevel();
        auto newId = 0u;

        updatePixelsIfOnCollapsedLevel(newColor, newId);
        updatePixelsIfAssignedToNode(node, newColor, newId);
    }
开发者ID:jvff,项目名称:mestrado-implementacao,代码行数:9,代码来源:MinMaxTreeImage.hpp

示例9: addChild

    static NodeType addChild(NodeType node, const std::string& name)
    {
        XMLCh buffer[256];
        xercesc::XMLString::transcode(name.c_str(), buffer, sizeof(buffer));

        NodeType child = node->getOwnerDocument()->createElement(buffer);
        node->appendChild(child);

        return child;
    }
开发者ID:APTriTec,项目名称:ponder,代码行数:10,代码来源:xerces.hpp

示例10:

bool mitk::FastMarchingTool::OnAddPoint( StateMachineAction*, InteractionEvent* interactionEvent )
{
  if ( SegTool2D::CanHandleEvent(interactionEvent) < 1.0 )
      return false;

  // Add a new seed point for FastMarching algorithm
  mitk::InteractionPositionEvent* positionEvent = dynamic_cast<mitk::InteractionPositionEvent*>( interactionEvent );
  //const PositionEvent* p = dynamic_cast<const PositionEvent*>(stateEvent->GetEvent());
  if ( positionEvent == NULL ) return false;

  if ( m_PositionEvent.IsNotNull() )
      m_PositionEvent = NULL;

  m_PositionEvent = InteractionPositionEvent::New( positionEvent->GetSender(),
                                                   positionEvent->GetPointerPositionOnScreen(),
                                                   positionEvent->GetPositionInWorld() );

  //if click was on another renderwindow or slice then reset pipeline and preview
  if( (m_LastEventSender != m_PositionEvent->GetSender()) || (m_LastEventSlice != m_PositionEvent->GetSender()->GetSlice()) )
  {
      this->BuildITKPipeline();
      this->ClearSeeds();
  }

  m_LastEventSender = m_PositionEvent->GetSender();
  m_LastEventSlice = m_LastEventSender->GetSlice();

  mitk::Point3D clickInIndex;

  m_ReferenceImageSlice->GetGeometry()->WorldToIndex(m_PositionEvent->GetPositionInWorld(), clickInIndex);
  itk::Index<2> seedPosition;
  seedPosition[0] = clickInIndex[0];
  seedPosition[1] = clickInIndex[1];

  NodeType node;
  const double seedValue = 0.0;
  node.SetValue( seedValue );
  node.SetIndex( seedPosition );
  this->m_SeedContainer->InsertElement(this->m_SeedContainer->Size(), node);
  m_FastMarchingFilter->Modified();

  m_SeedsAsPointSet->InsertPoint(m_SeedsAsPointSet->GetSize(), m_PositionEvent->GetPositionInWorld());

  mitk::RenderingManager::GetInstance()->RequestUpdateAll();

  m_NeedUpdate = true;

  this->Update();

  m_ReadyMessage.Send();

  return true;
}
开发者ID:GHfangxin,项目名称:MITK,代码行数:53,代码来源:mitkFastMarchingTool.cpp

示例11: load_

    void load_(vector<uint32_t>& indexes)
    {
        uint32_t idx = indexes.front();
        indexes.erase(indexes.begin());

        NodeType* n = nodes[idx].pNode_ ;
        nodes[idx] =  _cache_node_(n);

        for (uint32_t i=0; i<n->getSize(); i++)
        {
            if (n->getDiskAddr(i)==(uint64_t)-1)
                continue;

            if (n->getDiskAddr(i)%2==0)
                continue;

            NodeType* t = new NodeType(f_);
            t->load(n->getDiskAddr(i));
            nodes[count_] = _cache_node_(t);

            indexes.push_back(count_);
            n->setMemAddr(i, count_);

            count_++;
            if (count_>=CACHE_SIZE)
            {
                indexes.clear();
                return;
            }

        }
    }
开发者ID:RedSunCMX,项目名称:izenelib,代码行数:32,代码来源:node_cache.hpp

示例12: while

void Algorithm<NodeType, ConfigType>::Apply(NodeType* current_node,
                                            ConfigType& config,
                                            size_t stop_time)
{
  NodeType* node = current_node;
  while(util::Timer::microtimer() < stop_time)
  {
    node = current_node;
    while(true)
    {
      config.CurrentNode() = node;
      if(node->IsTerminal())
        break;

      if(!node->IsExpanded())
      {
        node = node->AddChild();
        break;
      }

      node = node->BestChild();
    }

    config.NumSimulations()++;
    const size_t* goals = node->Simulate();

    while(node != NULL)
    {
      node->Update(goals);
      node = node->Parent();
    }
  }
}
开发者ID:AMPedGames,项目名称:libgdl,代码行数:33,代码来源:mcts_alternate_impl.hpp

示例13: setText

    static void setText(NodeType node, const std::string& text)
    {
        XMLCh buffer[256];
        xercesc::XMLString::transcode(text.c_str(), buffer, sizeof(buffer));

        node->setTextContent(buffer);
    }
开发者ID:APTriTec,项目名称:ponder,代码行数:7,代码来源:xerces.hpp

示例14: get_image_interpolation

static InterpolationType get_image_interpolation(NodeType& b_node)
{
	int value = b_node.interpolation();
	return (InterpolationType)validate_enum_value(value,
	                                              INTERPOLATION_NUM_TYPES,
	                                              INTERPOLATION_LINEAR);
}
开发者ID:GameLemur,项目名称:blender,代码行数:7,代码来源:blender_shader.cpp

示例15: get_image_extension

static ExtensionType get_image_extension(NodeType& b_node)
{
	int value = b_node.extension();
	return (ExtensionType)validate_enum_value(value,
	                                          EXTENSION_NUM_TYPES,
	                                          EXTENSION_REPEAT);
}
开发者ID:GameLemur,项目名称:blender,代码行数:7,代码来源:blender_shader.cpp


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