本文整理汇总了C++中NodeGroup::addNode方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeGroup::addNode方法的具体用法?C++ NodeGroup::addNode怎么用?C++ NodeGroup::addNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NodeGroup
的用法示例。
在下文中一共展示了NodeGroup::addNode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _initContent
void MediaRoutingView::_initContent()
{
D_METHOD(("MediaRoutingView::_initContent()\n"));
Autolock lock(manager);
void *cookie = 0;
NodeRef *ref;
while (manager->getNextRef(&ref, &cookie) == B_OK)
{
// add self as observer
add_observer(this, ref);
// create & place node view (+++++ defer until observer status confirmed!)
_addPanelFor(ref->id(), BPoint(M_CLEANUP_H_MARGIN, M_CLEANUP_V_MARGIN));
}
cookie = 0;
Connection connection;
while (manager->getNextConnection(&connection, &cookie) == B_OK)
{
_addWireFor(connection);
}
// create default groups
NodeGroup* group;
NodeRef* videoIn = manager->videoInputNode();
if (videoIn)
{
group = manager->createGroup("Video Input");
group->setRunMode(BMediaNode::B_RECORDING);
group->addNode(videoIn);
}
NodeRef* audioIn = manager->audioInputNode();
if (audioIn)
{
group = manager->createGroup("Audio Input");
group->setRunMode(BMediaNode::B_RECORDING);
group->addNode(audioIn);
}
NodeRef* videoOut = manager->videoOutputNode();
if (videoOut)
{
group = manager->createGroup("Video Output");
group->addNode(videoOut);
}
}
示例2: nodeCreated
void RouteAppNodeManager::nodeCreated(
NodeRef* ref) {
// prepare the log message
BMessage logMsg(M_LOG);
BString title = "Node '";
title << ref->name() << "' created";
logMsg.AddString("title", title);
// create a default group for the node
// [em 8feb00]
NodeGroup* g = createGroup(ref->name());
if(ref->kind() & B_TIME_SOURCE) {
// notify observers
BMessage m(M_TIME_SOURCE_CREATED);
m.AddInt32("nodeID", ref->id());
notify(&m);
}
// adopt node's time source if it's not the system clock (the default)
// [em 20mar00]
media_node systemClock;
status_t err = roster->GetSystemTimeSource(&systemClock);
if(err == B_OK)
{
BTimeSource* ts = roster->MakeTimeSourceFor(ref->node());
if(ts->Node() != systemClock)
{
g->setTimeSource(ts->Node());
logMsg.AddString("line", "Synced to system clock");
}
ts->Release();
}
g->addNode(ref);
m_logTarget.SendMessage(&logMsg);
}
示例3: cr
Connector *CircuitICNDocument::createConnector(Connector *con1, Connector *con2, const QPoint &pos1, const QPoint &pos2, QPointList *pointList )
{
if ( !canConnect( con1, con2 ) ) return 0;
const bool con1UsedManual = con1->usesManualPoints();
const bool con2UsedManual = con2->usesManualPoints();
QList<QPointList> oldCon1Points = con1->splitConnectorPoints(pos1);
QList<QPointList> oldCon2Points = con2->splitConnectorPoints(pos2);
ECNode *node1a = dynamic_cast<ECNode*> ( con1->startNode() );
ECNode *node1b = dynamic_cast<ECNode*> ( con1->endNode( ) );
ECNode *node2a = dynamic_cast<ECNode*> ( con2->startNode() );
ECNode *node2b = dynamic_cast<ECNode*> ( con2->endNode( ) );
if ( !node1a || !node1b || !node2a || !node2b ) return 0;
con1->hide();
con2->hide();
// from this point forward, we are dealing with a circuit document -> all nodes are electronic
ECNode *newNode1 = new JunctionNode( this, 0, pos1 );
ECNode *newNode2 = new JunctionNode( this, 0, pos2 );
Connector *con1a = newNode1->createConnector(node1a);
node1a->addConnector(con1a);
Connector *con1b = newNode1->createConnector(node1b);
node1b->addConnector(con1b);
Connector *newCon = newNode1->createConnector(newNode2);
newNode2->addConnector(newCon);
Connector *con2a = node2a->createConnector(newNode2);
newNode2->addConnector(con2a);
Connector *con2b = node2b->createConnector(newNode2);
newNode2->addConnector(con2b);
if(!con1a || !con1b || !con2a || !con2b ) {
// This should never happen, as the canConnect function should strictly
// determine whether the connectors could be created before hand.
kWarning() << k_funcinfo << "Not all the connectors were created, this should never happen" << endl;
if(con1a) con1a->removeConnector();
if(con1b) con1b->removeConnector();
if(con2a) con2a->removeConnector();
if(con2b) con2b->removeConnector();
newNode1->removeNode();
newNode2->removeNode();
flushDeleteList();
return 0;
}
con1a->setRoutePoints(oldCon1Points.at(0), con1UsedManual );
con1b->setRoutePoints(oldCon1Points.at(1), con1UsedManual );
con2a->setRoutePoints(oldCon2Points.at(0), con2UsedManual );
con2b->setRoutePoints(oldCon2Points.at(1), con2UsedManual );
QPointList autoPoints;
if (!pointList) {
addAllItemConnectorPoints();
ConRouter cr(this);
cr.mapRoute( pos1.x(), pos1.y(), pos2.x(), pos2.y() );
autoPoints = cr.pointList(false);
pointList = &autoPoints;
}
newCon->setRoutePoints(*pointList,true);
// Avoid flicker: tell them to update their draw lists now
con1->updateConnectorPoints(false);
con2->updateConnectorPoints(false);
newCon->updateDrawList();
con1a->updateDrawList();
con1b->updateDrawList();
con2a->updateDrawList();
con2b->updateDrawList();
// Now it's safe to remove the connectors
con1->removeConnector();
con2->removeConnector();
flushDeleteList();
deleteNodeGroup(node1a);
deleteNodeGroup(node1b);
deleteNodeGroup(node2a);
deleteNodeGroup(node2b);
NodeGroup *ng = createNodeGroup(newNode1);
ng->addNode( newNode2, true );
ng->init();
//.........这里部分代码省略.........
示例4: connectionMade
void RouteAppNodeManager::connectionMade(
Connection* connection) {
D_HOOK((
"@ RouteAppNodeManager::connectionMade()\n"));
status_t err;
// prepare the log message
BMessage logMsg(M_LOG);
BString title = "Connection ";
if (strcmp(connection->outputName(), connection->inputName()) == 0) {
title << "'" << connection->outputName() << "' ";
}
title << "made";
logMsg.AddString("title", title);
if(!(connection->flags() & Connection::INTERNAL))
// don't react to connection Cortex didn't make
return;
// create or merge groups
NodeRef *producer, *consumer;
err = getNodeRef(connection->sourceNode(), &producer);
if(err < B_OK) {
D_HOOK((
"!!! RouteAppNodeManager::connectionMade():\n"
" sourceNode (%ld) not found\n",
connection->sourceNode()));
return;
}
err = getNodeRef(connection->destinationNode(), &consumer);
if(err < B_OK) {
D_HOOK((
"!!! RouteAppNodeManager::connectionMade():\n"
" destinationNode (%ld) not found\n",
connection->destinationNode()));
return;
}
// add node names to log messages
BString line = "Between:";
logMsg.AddString("line", line);
line = " ";
line << producer->name() << " and ";
line << consumer->name();
logMsg.AddString("line", line);
// add format to log message
line = "Negotiated format:";
logMsg.AddString("line", line);
line = " ";
line << MediaString::getStringFor(connection->format(), false);
logMsg.AddString("line", line);
NodeGroup *group = 0;
BString groupName = "Untitled group ";
if(_canGroup(producer) && _canGroup(consumer))
{
if (producer->group() && consumer->group() &&
!(producer->group()->groupFlags() & NodeGroup::GROUP_LOCKED) &&
!(consumer->group()->groupFlags() & NodeGroup::GROUP_LOCKED))
{
// merge into consumers group
group = consumer->group();
mergeGroups(producer->group(), group);
}
else if (producer->group() &&
!(producer->group()->groupFlags() & NodeGroup::GROUP_LOCKED))
{ // add consumer to producers group
group = producer->group();
group->addNode(consumer);
}
else if (consumer->group() &&
!(consumer->group()->groupFlags() & NodeGroup::GROUP_LOCKED))
{ // add producer to consumers group
group = consumer->group();
group->addNode(producer);
}
else
{ // make new group for both
groupName << m_nextGroupNumber++;
group = createGroup(groupName.String());
group->addNode(producer);
group->addNode(consumer);
}
}
else if(_canGroup(producer) && !producer->group())
{ // make new group for producer
groupName << m_nextGroupNumber++;
group = createGroup(groupName.String());
group->addNode(producer);
}
else if(_canGroup(consumer) && !consumer->group())
{ // make new group for consumer
groupName << m_nextGroupNumber++;
group = createGroup(groupName.String());
group->addNode(consumer);
}
//.........这里部分代码省略.........