本文整理汇总了C++中CNode::getId方法的典型用法代码示例。如果您正苦于以下问题:C++ CNode::getId方法的具体用法?C++ CNode::getId怎么用?C++ CNode::getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CNode
的用法示例。
在下文中一共展示了CNode::getId方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: draw
void CDebugDrawer::draw()
{
unsigned int i;
CNode *node;
m_debugShader->bind();
m_debugShapes->bind();
for(i = 0; i < m_partitioner->m_visiblePropNodes.size(); i++)
{
node = m_partitioner->m_visiblePropNodes[i];
node->drawDebug(m_debugShapes);
}
for(i = 0; i < m_partitioner->m_visibleLightNodes.size(); i++)
{
node = m_partitioner->m_visibleLightNodes[i];
node->drawDebug(m_debugShapes);
}
for(i = 0; i < m_partitioner->m_visibleLogicNodes.size(); i++)
{
node = m_partitioner->m_visibleLogicNodes[i];
node->drawDebug(m_debugShapes);
}
m_pickShader->bind();
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_fboId);
glDrawBuffers(1, m_fboDrawBuffers);
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
for(i = 0; i < m_partitioner->m_visiblePropNodes.size(); i++)
{
node = m_partitioner->m_visiblePropNodes[i];
CShaderResource::glslSendInt("id", node->getId());
node->drawDebug(m_debugShapes);
}
for(i = 0; i < m_partitioner->m_visibleLightNodes.size(); i++)
{
node = m_partitioner->m_visibleLightNodes[i];
CShaderResource::glslSendInt("id", node->getId());
node->drawDebug(m_debugShapes);
}
for(i = 0; i < m_partitioner->m_visibleLogicNodes.size(); i++)
{
node = m_partitioner->m_visibleLogicNodes[i];
CShaderResource::glslSendInt("id", node->getId());
node->drawDebug(m_debugShapes);
}
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
}
示例2: while
CNode *CNetwork::findNode(int id)
{
// find the node id in the node list
bool found = false;
CNode *node = NULL;
POSITION pos = m_node_list.GetHeadPosition();
while ((pos != NULL) && (!found))
{
node = m_node_list.GetNext(pos);
found = node->getId() == id;
}
if (found)
return node;
else
return NULL;
}
示例3: toolsIsSelected
bool CEditorEngine::toolsIsSelected(int id)
{
CNode *node;
std::vector<CNode *>::iterator it = m_selectedNodes.begin();
while(it != m_selectedNodes.end())
{
node = *it;
if(node && node->getId() == id)
{
return true;
}
it++;
}
return false;
}
示例4: toolsUnselect
void CEditorEngine::toolsUnselect(int id)
{
CNode *node;
std::vector<CNode *>::iterator it = m_selectedNodes.begin();
while(it != m_selectedNodes.end())
{
node = *it;
if(node && node->getId() == id)
{
node->setSelected(false);
m_selectedNodes.erase(it);
break;
}
it++;
}
}
示例5:
std::list<CNodeChangeInfo> CEditorEngine::deleteSelectedNodes()
{
int id;
CNode *node;
std::list<CNodeChangeInfo> changes;
while(m_selectedNodes.size() > 0)
{
node = m_selectedNodes.front();
if(node)
{
changes.push_back(CNodeChangeInfo(node, CNodeChangeInfo::ENCIT_REMOVED));
id = node->getId();
toolsUnselect(id);
m_activeScene->deleteNode(id);
}
}
return changes;
}
示例6: getNodes
void CNetwork::getNodes(FILE *file)
{
if (is_log_active && log_level == 2)
{
sprintf(out_buf, "Parsing %s ...", "nodes");
OutputString(out_buf, strlen(out_buf), SIM_COLOR_RGB, RTE_MESSAGE_RGB);
}
// get the node information from the TRAF file and create the node list
char line[81] = { '\0' };
int card_type = 0;
CNode *node = NULL;
POSITION pos = NULL;
int node_id = 0;
char node_ids[5] = { '\0' };
char control_type[2] = { '\0' };
char x_pos[7] = { '\0' };
char y_pos[7] = { '\0' };
// read data records from the TRAF file
while (!feof(file))
{
// read a line of the file
card_type = readTRFLine(file, line);
// parse the line based on its card type
if (card_type == 36 || card_type == 43)
{
// first, extract the node id
strncpy_s(node_ids, line, 4);
node_ids[4] = '\0';
node_id = atoi(node_ids);
// second, determine if this node is under external control
strncpy_s(control_type, line + 76, 1);
control_type[1] = '\0';
if (node_id < 9000)
{
// create a node object
if (node_id > 8000)
{
node = new CNode(node_id, "source"); // source node
}
else
{
if ((control_type[0] == '2') || (control_type[0] == '3'))
{
// node is controlled by algorithm external to corsim
node = new CNode(node_id, "external");
}
else
{
// node is controlled by corsim
node = new CNode(node_id, "corsim");
}
}
m_node_list.AddTail(node);
}
}
else if (card_type == 195)
{
// first, get the node id
strncpy_s(node_ids, line, 4);
node_ids[4] = '\0';
node_id = atoi(node_ids);
// second, extract the node coordinates
strncpy_s(x_pos, line + 6, 6);
x_pos[6] = '\0';
strncpy_s(y_pos, line + 14, 6);
y_pos[6] = '\0';
// search the node list for the corresponding node object and set its node coordinates
pos = m_node_list.GetHeadPosition();
while (pos != NULL)
{
node = m_node_list.GetNext(pos);
if (node->getId() == node_id)
{
node->setLocation(atoi(x_pos), atoi(y_pos));
}
}
}
}
// assign the corsim internal id to each node
int inode_id = 0;
bool found;
pos = m_node_list.GetHeadPosition();
while (pos != NULL)
{
inode_id = 0;
found = false;
node = m_node_list.GetNext(pos);
while ((inode_id < IMXNOD) && (!found))
{
if (node->getId() == net_node_num[inode_id])
{
found = true;
node->setCorsimId(inode_id);
}
inode_id++;
}
}
}
示例7: if
CNode *CDefaultPartitioner::removeNode(const int id)
{
ENodeType type;
CNode *current;
CNode *node = CPartitioner::removeNode(id);
if(node)
{
type = node->getType();
if(type & PROP_BIT)
{
for(std::vector<CPropNode *>::iterator it = m_visiblePropNodes.begin(); it != m_visiblePropNodes.end(); it++)
{
current = *it;
if(current && current->getId() == id)
{
m_visiblePropNodes.erase(it);
break;
}
}
}
else if(type & LOGIC_BIT)
{
for(std::vector<CLogicNode *>::iterator it = m_visibleLogicNodes.begin(); it != m_visibleLogicNodes.end(); it++)
{
current = *it;
if(current && current->getId() == id)
{
m_visibleLogicNodes.erase(it);
break;
}
}
}
else if(type == ENT_LIGHT)
{
for(std::vector<CLightNode *>::iterator it = m_visibleLightNodes.begin(); it != m_visibleLightNodes.end(); it++)
{
current = *it;
if(current && current->getId() == id)
{
m_visibleLightNodes.erase(it);
break;
}
}
}
else if(type == ENT_MAP)
{
for(std::vector<CMapNode *>::iterator it = m_visibleMapNodes.begin(); it != m_visibleMapNodes.end(); it++)
{
current = *it;
if(current && current->getId() == id)
{
m_visibleMapNodes.erase(it);
break;
}
}
}
}
return node;
}