MCPcopy Create free account
hub / github.com/cpvrlab/ImagePlay / addEdge

Method addEdge

ImagePlay/src/IPProcessGridScene.cpp:111–148  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

109}
110
111bool IPProcessGridScene::addEdge(IPProcessEdge* edge)
112{
113 if(edge->from() == edge->to())
114 return false;
115
116 // check type
117 int indexOut = edge->indexFrom();
118 int indexIn = edge->indexTo();
119
120 if(indexOut >= edge->from()->process()->outputs()->size())
121 return false;
122 if(indexIn >= edge->to()->process()->inputs()->size())
123 return false;
124
125 IPLProcessIO output = edge->from()->process()->outputs()->at(indexOut);
126 IPLProcessIO input = edge->to()->process()->inputs()->at(indexIn);
127
128 // inputs can accept lower types
129 // COLOR accepts GRAY and BW
130 if(output.type > input.type)
131 return false;
132
133 /*IPLData* outputData = edge->from()->process()->getResultData(indexOut);
134 if (!outputData->isConvertibleTo(input.type))
135 return false;*/
136
137 _edges.append(edge);
138 addItem(edge);
139
140 //set outgoing and ingoing edges
141 edge->from()->addEdgeOut(edge);
142 edge->to()->addEdgeIn(edge);
143
144 // set input occupied
145 edge->to()->process()->inputs()->at(edge->indexTo()).occupied = true;
146
147 return true;
148}
149
150void IPProcessGridScene::removeEdge(IPProcessEdge* edge)
151{

Callers

nothing calls this directly

Calls 9

fromMethod · 0.80
toMethod · 0.80
indexFromMethod · 0.80
indexToMethod · 0.80
addEdgeOutMethod · 0.80
addEdgeInMethod · 0.80
sizeMethod · 0.45
processMethod · 0.45
atMethod · 0.45

Tested by

no test coverage detected