Example #1
0
/**
 * Edge destructor.
 * delete edge from graph's list of edges
 */
Edge::~Edge()
{
    //out("Deleted edge");
    element.parentNode().removeChild( element);
    graph_p->detachEdge( this);
    detachFromNode( GRAPH_DIR_UP);
    detachFromNode( GRAPH_DIR_DOWN);
}
//-----------------------------------------------------------------------
void OrthoCameraGizmo::attachToNode(Ogre::SceneNode* node)
{
	if (!node)
		return;

	// First remove the old node
	detachFromNode();

	// Recreate the nodes
	mOrthoCameraNodeBox = node->createChildSceneNode();
	mOrthoCameraNodeX = node->createChildSceneNode();
	mOrthoCameraNodeMinX = node->createChildSceneNode();
	mOrthoCameraNodeY = node->createChildSceneNode();
	mOrthoCameraNodeZ = node->createChildSceneNode();
	mOrthoCameraNodeMinZ = node->createChildSceneNode();

	mOrthoCameraNodeBox->setInheritScale(false);
	mOrthoCameraNodeX->setInheritScale(false);
	mOrthoCameraNodeMinX->setInheritScale(false);
	mOrthoCameraNodeY->setInheritScale(false);
	mOrthoCameraNodeZ->setInheritScale(false);
	mOrthoCameraNodeMinZ->setInheritScale(false);

	mOrthoCameraNodeBox->setInheritOrientation(false);
	mOrthoCameraNodeX->setInheritOrientation(false);
	mOrthoCameraNodeMinX->setInheritOrientation(false);
	mOrthoCameraNodeY->setInheritOrientation(false);
	mOrthoCameraNodeZ->setInheritOrientation(false);
	mOrthoCameraNodeMinZ->setInheritOrientation(false);

	mOrthoCameraNodeBox->attachObject(mOrthoCameraEntityBox);
	mOrthoCameraNodeX->attachObject(mOrthoCameraEntityX);
	mOrthoCameraNodeMinX->attachObject(mOrthoCameraEntityMinX);
	mOrthoCameraNodeY->attachObject(mOrthoCameraEntityY);
	mOrthoCameraNodeZ->attachObject(mOrthoCameraEntityZ);
	mOrthoCameraNodeMinZ->attachObject(mOrthoCameraEntityMinZ);

	// Set scale
	setScale(SCALE_NODE_ORTHO_CAMERA);
//	mOrthoCameraNodeBox->setScale(0.5, 0.5, 0.5); // TEST
//	mOrthoCameraNodeX->setScale(0.5, 0.5, 0.5);// TEST
//	mOrthoCameraNodeMinX->setScale(0.5, 0.5, 0.5);// TEST
//	mOrthoCameraNodeY->setScale(0.5, 0.5, 0.5);// TEST
//	mOrthoCameraNodeZ->setScale(0.5, 0.5, 0.5);// TEST
//	mOrthoCameraNodeMinZ->setScale(0.5, 0.5, 0.5);// TEST

	// Set orientation
	Ogre::Real sqrt0dot5 = sqrt(0.5);
	Ogre::Quaternion xQ(sqrt0dot5, 0, 0, sqrt0dot5);
	Ogre::Quaternion minXQ(-sqrt0dot5, 0, 0, sqrt0dot5);
	Ogre::Quaternion yQ(1, 0, 0, 0);
	Ogre::Quaternion zQ(-sqrt0dot5, sqrt0dot5, 0, 0);
	Ogre::Quaternion minZQ(sqrt0dot5, sqrt0dot5, 0, 0);
	mOrthoCameraNodeX->setOrientation(xQ);
	mOrthoCameraNodeMinX->setOrientation(minXQ);
	mOrthoCameraNodeY->setOrientation(yQ);
	mOrthoCameraNodeZ->setOrientation(zQ);
	mOrthoCameraNodeMinZ->setOrientation(minZQ);

	// Set visible
	setVisible(true);
}