}
//=========================================================================
- void GPortModel::registerInBox(GBlackBoxModel *blackBox,int portType)
+ void GPortModel::registerInBox(GBlackBoxModel *blackBox,int portType, int pos)
{
_parentBox = blackBox;
_portType = portType;
+ updatePortPosition(pos);
+
+ }
+
+ //=========================================================================
+
+ void GPortModel::updatePortPosition(int pos)
+ {
double xInic, yInic,zInic,xFin,yFin,zFin;
_parentBox->getInicPoint(xInic,yInic,zInic);
_parentBox->getFinalPoint(xFin, yFin,zFin);
-
- int cant = 0;
+
double posX=xInic,posY=yInic,posZ=zInic;
if(_portType==GOUTPUTPORT)
{
- cant = _parentBox->getNumOutputPorts();
posY = yInic+PORT_HEIGHT;
}
else if(_portType==GINPUTPORT)
{
- cant = _parentBox->getNumInputPorts();
posY = yFin;
}
- posX = xInic + PORT_WIDTH + cant*2*PORT_WIDTH;
+ //Usually pos begins in 0
+ posX = xInic + PORT_WIDTH + pos*2*PORT_WIDTH;
setInicPoint(posX,posY,posZ);
posX=posX+PORT_WIDTH;
posY=posY-PORT_HEIGHT;
- setFinalPoint(posX,posY,posZ);
-
+ setFinalPoint(posX,posY,posZ);
+
+ setChanged();
+ notifyObservers();
}
//=========================================================================
+
+ int GPortModel::getPortType()
+ {
+ return _portType;
+ }
+
} // EO namespace bbtk
// EOF