当前位置: 首页>>代码示例>>C++>>正文


C++ Graph::getEdges方法代码示例

本文整理汇总了C++中data::Graph::getEdges方法的典型用法代码示例。如果您正苦于以下问题:C++ Graph::getEdges方法的具体用法?C++ Graph::getEdges怎么用?C++ Graph::getEdges使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在data::Graph的用法示例。


在下文中一共展示了Graph::getEdges方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: handleKeyDown

bool PickHandler::handleKeyDown( const osgGA::GUIEventAdapter& ea, GUIActionAdapter& aa)
{
	if(ea.getKey() == osgGA::GUIEventAdapter::KEY_Control_R || ea.getKey() == osgGA::GUIEventAdapter::KEY_Control_L)
	{
		isCtrlPressed = true;
	}
	else if(ea.getKey() == osgGA::GUIEventAdapter::KEY_Shift_L || ea.getKey() == osgGA::GUIEventAdapter::KEY_Shift_R)
	{
		isShiftPressed = true;
	}
	else if(ea.getKey() == osgGA::GUIEventAdapter::KEY_Alt_L || ea.getKey() == osgGA::GUIEventAdapter::KEY_Alt_R)
	{
		isAltPressed = true;
	}
	else if(ea.getKey() == 'q')
	{
		Data::Graph * currentGraph = Manager::GraphManager::getInstance()->getActiveGraph();
		Util::ElementSelector::randomElementSelector(currentGraph->getNodes(), currentGraph->getEdges(), appConf->getValue("Viewer.PickHandler.AutopickedNodes").toInt(), this);
	}
	else if(ea.getKey() == 'w')
	{
		Data::Graph * currentGraph = Manager::GraphManager::getInstance()->getActiveGraph();
		Util::ElementSelector::weightedElementSelector(currentGraph->getNodes(), appConf->getValue("Viewer.PickHandler.AutopickedNodes").toInt(), this);
	}

	return false;
}
开发者ID:VolovarMartin,项目名称:3dsoftviz,代码行数:27,代码来源:PickHandler.cpp

示例2: handleKeyDown

bool PickHandler::handleKeyDown( const osgGA::GUIEventAdapter& ea, GUIActionAdapter& aa)
{
	if(ea.getKey() == osgGA::GUIEventAdapter::KEY_Control_R || ea.getKey() == osgGA::GUIEventAdapter::KEY_Control_L)
	{
		isCtrlPressed = true;
	}
	else if(ea.getKey() == osgGA::GUIEventAdapter::KEY_Shift_L || ea.getKey() == osgGA::GUIEventAdapter::KEY_Shift_R)
	{
		isShiftPressed = true;
	}
	else if(ea.getKey() == osgGA::GUIEventAdapter::KEY_Alt_L || ea.getKey() == osgGA::GUIEventAdapter::KEY_Alt_R)
	{
		isAltPressed = true;
	}
	else if(ea.getKey() == 'q')
	{
		Data::Graph * currentGraph = Manager::GraphManager::getInstance()->getActiveGraph();
		Util::ElementSelector::randomElementSelector(currentGraph->getNodes(), currentGraph->getEdges(), appConf->getValue("Viewer.PickHandler.AutopickedNodes").toInt(), this);
	}
	else if(ea.getKey() == 'w')
	{
		Data::Graph * currentGraph = Manager::GraphManager::getInstance()->getActiveGraph();
		Util::ElementSelector::weightedElementSelector(currentGraph->getNodes(), appConf->getValue("Viewer.PickHandler.AutopickedNodes").toInt(), this);
	}

	// FULLSCREEN
	else if(ea.getKey() == 'l' || ea.getKey() == 'L')
	{
		bool hideToolbars = appConf->getValue("Viewer.Fullscreen").toInt();

		if( AppCore::Core::getInstance()->getCoreWindow()->isFullScreen()){
			AppCore::Core::getInstance()->getCoreWindow()->menuBar()->show();
			AppCore::Core::getInstance()->getCoreWindow()->statusBar()->show();
			AppCore::Core::getInstance()->getCoreWindow()->showNormal();

			if(hideToolbars){
				QList<QToolBar *> toolbars = AppCore::Core::getInstance()->getCoreWindow()->findChildren<QToolBar *>();
				QListIterator<QToolBar *> i(toolbars);
				while (i.hasNext()){
					i.next()->show();
				}
			}
		} else {
			AppCore::Core::getInstance()->getCoreWindow()->menuBar()->hide();
			AppCore::Core::getInstance()->getCoreWindow()->statusBar()->hide();
			AppCore::Core::getInstance()->getCoreWindow()->showFullScreen();

			if(hideToolbars){
				QList<QToolBar *> toolbars = AppCore::Core::getInstance()->getCoreWindow()->findChildren<QToolBar *>();
				QListIterator<QToolBar *> i(toolbars);
				while (i.hasNext()){
					i.next()->hide();
				}
			}

		}
	}

	// toolbars only
	else if(ea.getKey() == 't' || ea.getKey() == 'T')
	{
		static bool toolbars = true;
		if( toolbars ){
			toolbars = !toolbars;
			QList<QToolBar *> toolbars = AppCore::Core::getInstance()->getCoreWindow()->findChildren<QToolBar *>();
			QListIterator<QToolBar *> i(toolbars);
			while (i.hasNext()){
				i.next()->show();
			}

		} else {
			toolbars = !toolbars;
			QList<QToolBar *> toolbars = AppCore::Core::getInstance()->getCoreWindow()->findChildren<QToolBar *>();
			QListIterator<QToolBar *> i(toolbars);
			while (i.hasNext()){
				i.next()->hide();
			}
		}

	}


	return false;
}
开发者ID:FilipMikle,项目名称:Arvis,代码行数:84,代码来源:PickHandler.cpp

示例3: add_EdgeClick

bool CoreWindow::add_EdgeClick()
{
	Data::Type *edgeType = NULL;
	Data::Type *nodeType = NULL;
	Data::Graph * currentGraph = Manager::GraphManager::getInstance()->getActiveGraph();
	
	
	QLinkedList<osg::ref_ptr<Data::Node> > * selectedNodes = viewerWidget->getPickHandler()->getSelectedNodes();
	QLinkedList<osg::ref_ptr<Data::Node> >::const_iterator ni = selectedNodes->constBegin();
	
	if (
		selectedNodes==NULL
			) {
				AppCore::Core::getInstance()->messageWindows->showMessageBox("Upozornenie","Žiadny uzol oznaèený",false);
				return false;
			}

	osg::ref_ptr<Data::Node> node1, node2;
	int i=0;
	
	while (ni != selectedNodes->constEnd()) 
	{
		osg::ref_ptr<Data::Node> existingNode = (* ni);
		++ni;i++;
	}
		if (	
			i!=2
			) {
				AppCore::Core::getInstance()->messageWindows->showMessageBox("Upozornenie","Musite vybrat práve 2 vrcholy",false);
				return false;
			}
	ni = selectedNodes->constBegin();
	node2=(* ni);
	++ni;
	node1=(* ni);
	++ni;
	QMap<qlonglong, osg::ref_ptr<Data::Edge> > *mapa = currentGraph->getEdges();
	Data::Type* type = currentGraph->addType(Data::GraphLayout::META_EDGE_TYPE);
	for (QMap<qlonglong, osg::ref_ptr<Data::Edge> >::iterator it = mapa->begin (); it != mapa->end (); ++it) {
			osg::ref_ptr<Data::Edge> existingEdge = it.value ();
			if (
				existingEdge->getSrcNode () ->getName () == node1 ->getName () && 
				existingEdge->getDstNode () ->getName () == node2 ->getName ()
			) {
				AppCore::Core::getInstance()->messageWindows->showMessageBox("Hrana najdená","Medzi vrcholmi nesmie byt hrana",false);
				return false;
			}
			if (
				existingEdge->getSrcNode () ->getName () == node2 ->getName () && 
				existingEdge->getDstNode () ->getName () == node1 ->getName ()
			) {
				AppCore::Core::getInstance()->messageWindows->showMessageBox("Hrana najdená","Medzi vrcholmi nesmie byt hrana",false);
				return false;
			}
		}

	
	currentGraph->addEdge("GUI_edge", node1, node2, type, false);
	if (isPlaying)
			layout->play();
	QString nodename1 = QString(node1->getName());
	QString nodename2 = QString(node2->getName());
	return true;
	//context.getGraph ().addEdge (QString (""), node1[1], node1[2], edgeType, true);

}
开发者ID:gerdaholubova,项目名称:3dsoftviz,代码行数:66,代码来源:CoreWindow.cpp


注:本文中的data::Graph::getEdges方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。