Пример #1
0
bool GLC_3DViewCollection::select(GLC_uint key, bool primitive)
{
	if (!m_3DViewInstanceHash.contains(key)) return false;
	//qDebug() << "GLC_Collection::select " << key;

	GLC_3DViewInstance* pSelectedInstance;
	ViewInstancesHash::iterator iNode= m_3DViewInstanceHash.find(key);
	PointerViewInstanceHash::iterator iSelectedNode= m_SelectedInstances.find(key);

	if ((iNode != m_3DViewInstanceHash.end()) && (iSelectedNode == m_SelectedInstances.end()))
	{	// Ok, the key exist and the node is not selected
		pSelectedInstance= &(iNode.value());
		m_SelectedInstances.insert(pSelectedInstance->id(), pSelectedInstance);

		// Remove Selected Node from is previous collection
		if (isInAShadingGroup(key))
		{
			m_ShadedPointerViewInstanceHash.value(shadingGroup(key))->remove(key);
			//qDebug() << "remove from shader list";
		}
		else
		{
			m_MainInstances.remove(key);
		}
		pSelectedInstance->select(primitive);

		//qDebug("GLC_3DViewCollection::selectNode : Element succesfuly selected");
		return true;
	}
	else
	{	// KO, instance allready selected
		return false;
	}
}
bool GLC_3DViewCollection::add(const GLC_3DViewInstance& node, GLuint shaderID)
{
	bool result= false;
	const GLC_uint key= node.id();
	if (m_3DViewInstanceHash.contains(key))
	{
		return false;
	}

	m_3DViewInstanceHash.insert(key, node);
	// Create an GLC_3DViewInstance pointer of the inserted instance
	ViewInstancesHash::iterator iNode= m_3DViewInstanceHash.find(key);
	GLC_3DViewInstance* pInstance= &(iNode.value());
	// Chose the hash where instance is
	if(0 != shaderID)
	{
		// Test if shaderId group exist
		if (m_ShadedPointerViewInstanceHash.contains(shaderID))
		{
			m_ShaderGroup.insert(key, shaderID);

			if(pInstance->isSelected())
			{
				m_SelectedInstances.insert(key, pInstance);
			}
			else
			{
				m_ShadedPointerViewInstanceHash.value(shaderID)->insert(key, pInstance);
			}
			result=true;
		}
	}
	else if (!pInstance->isSelected())
	{
		m_MainInstances.insert(key, pInstance);
		result=true;
	}
	else
	{
		m_SelectedInstances.insert(key, pInstance);
		result=true;
	}

	if(result)
	{
		// Bounding box validity
		if (NULL != m_pBoundingBox)
		{
			delete m_pBoundingBox;
			m_pBoundingBox= NULL;
		}
	}
	return result;
}
Пример #3
0
//////////////////////////////////////////////////////////////////////
// Protected services functions
//////////////////////////////////////////////////////////////////////
void GLC_3DWidget::add3DViewInstance(const GLC_3DViewInstance& instance)
{
	m_pWidgetManagerHandle->add3DViewInstance(instance, m_Uid);
	const GLC_uint instanceId= instance.id();
	m_InstanceIdList.append(instanceId);
}