Exemplo n.º 1
0
/* Detects the source component of the connection */
bool AddConnection::DetectSourceComponent() {
	Component* comp = mAppManager->GetOutput()->GetComponentAtPin(mGfxInfo.x1, mGfxInfo.y1);

	if (comp == NULL) {
		return false;
	}
	else {
		Gate* gate;

		if (dynamic_cast<Gate*>(comp) != NULL)
			gate = (Gate*)comp;
		else
			gate = ((Connection*)comp)->GetSourcePin()->GetGate();

		gate->GetOutputPinCoordinates(mGfxInfo.x1, mGfxInfo.y1);
		mSrcPin = gate->GetOutputPin();

		if (mSrcPin == NULL || mSrcPin->IsFull()) {
			return false;
		}
	}

	return true;
}