コード例 #1
0
ファイル: VectorPort.cpp プロジェクト: torc-isi/torc
/**
 * Connect a Net to this object.
 *
 * @note This metod can be overridden by derived classes. However, the method must call the
 * on_connected() method after this. The sigConnected_ signal must also be invoked in the
 * overriding method.
 *
 * @param[in] net A pointer to the Net object that eeds to be connected
 * @return A connection that has been established. This can be used later for disconnection.
 */
Connectable::Connection VectorPort::connect(const NetSharedPtr& inNet) throw (Error) {
	if(!inNet) {
		Error e(eMessageIdErrorPointerToItemDoesNotExist, __FUNCTION__, __FILE__, __LINE__);
		e.saveContextData("Pointer to the Net object does not exist", inNet);
		throw e;
	}
	if(inNet->getSize() != getSize()) {
		Error e(eMessageIdErrorItemSizeMismatch, __FUNCTION__, __FILE__, __LINE__);
		e.saveContextData("Net Size", inNet->getSize());
		e.saveContextData("Vector Net Size", getSize());
		throw e;
	}
	Connectable::Connection newConnection;
	try {
		ConnectionHandler handler(inNet);
		handler.connectPortToNet(getSharedThis());
		newConnection = Connectable::connect(inNet);
	} catch(Error& e) {
		e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
		throw;
	}
	return newConnection;
}
コード例 #2
0
ファイル: PolygonNode.cpp プロジェクト: bluscr33n/libavg
void PolygonNode::getElementsByPos(const glm::vec2& pos, vector<NodePtr>& pElements)
{
    if (reactsToMouseEvents() && pointInPolygon(pos, m_Pts)) {
        pElements.push_back(getSharedThis());
    }
}