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


C++ scene函数代码示例

本文整理汇总了C++中scene函数的典型用法代码示例。如果您正苦于以下问题:C++ scene函数的具体用法?C++ scene怎么用?C++ scene使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: scene

QColor UBAbstractDrawRuler::middleFillColor() const
{
    return scene()->isDarkBackground() ? sDarkBackgroundMiddleFillColor : sLightBackgroundMiddleFillColor;
}
开发者ID:199901,项目名称:Sankore-3.1,代码行数:4,代码来源:UBAbstractDrawRuler.cpp

示例2: scene

void StelMainView::resizeEvent(QResizeEvent* event)
{
	scene()->setSceneRect(QRect(QPoint(0, 0), event->size()));
	rootItem->setGeometry(0,0,event->size().width(),event->size().height());
	QGraphicsView::resizeEvent(event);
}
开发者ID:magnific0,项目名称:stellarium,代码行数:6,代码来源:StelMainView.cpp

示例3: StelGui

void StelMainView::init(QSettings* conf)
{
	gui = new StelGui();

#if STEL_USE_NEW_OPENGL_WIDGETS
	//glWidget->initializeGL(); // protected...
	//Q_ASSERT(glWidget->isValid());
#else
	Q_ASSERT(glWidget->isValid());
	glWidget->makeCurrent();
#endif

	// Should be check of requirements disabled?
	if (conf->value("main/check_requirements", true).toBool())
	{
		// Find out lots of debug info about supported version of OpenGL and vendor/renderer.
		processOpenGLdiagnosticsAndWarnings(conf, glWidget);
	}


	stelApp= new StelApp();
	stelApp->setGui(gui);
	stelApp->init(conf);
	StelActionMgr *actionMgr = stelApp->getStelActionManager();
	actionMgr->addAction("actionSave_Screenshot_Global", N_("Miscellaneous"), N_("Save screenshot"), this, "saveScreenShot()", "Ctrl+S");
	actionMgr->addAction("actionSet_Full_Screen_Global", N_("Display Options"), N_("Full-screen mode"), this, "fullScreen", "F11");
	
	StelPainter::initGLShaders();

	skyItem = new StelSkyItem();
	guiItem = new StelGuiItem();
	QGraphicsAnchorLayout* l = new QGraphicsAnchorLayout(rootItem);
	l->setSpacing(0);
	l->setContentsMargins(0,0,0,0);
	l->addCornerAnchors(skyItem, Qt::TopLeftCorner, l, Qt::TopLeftCorner);
	l->addCornerAnchors(skyItem, Qt::BottomRightCorner, l, Qt::BottomRightCorner);
	l->addCornerAnchors(guiItem, Qt::BottomLeftCorner, l, Qt::BottomLeftCorner);
	l->addCornerAnchors(guiItem, Qt::TopRightCorner, l, Qt::TopRightCorner);
	rootItem->setLayout(l);
	scene()->addItem(rootItem);
	nightModeEffect = new NightModeGraphicsEffect(this);
	updateNightModeProperty();
	rootItem->setGraphicsEffect(nightModeEffect);

	QSize size = glWidget->windowHandle()->screen()->size();
	size = QSize(conf->value("video/screen_w", size.width()).toInt(),
		     conf->value("video/screen_h", size.height()).toInt());

	bool fullscreen = conf->value("video/fullscreen", true).toBool();

	// Without this, the screen is not shown on a Mac + we should use resize() for correct work of fullscreen/windowed mode switch. --AW WTF???
	resize(size);

	QDesktopWidget *desktop = QApplication::desktop();
	int screen = conf->value("video/screen_number", 0).toInt();
	if (screen < 0 || screen >= desktop->screenCount())
	{
		qWarning() << "WARNING: screen" << screen << "not found";
		screen = 0;
	}
	QRect screenGeom = desktop->screenGeometry(screen);

	if (fullscreen)
	{
		// The "+1" below is to work around Linux/Gnome problem with mouse focus.
		move(screenGeom.x()+1, screenGeom.y()+1);
		// The fullscreen window appears on screen where is the majority of
		// the normal window. Therefore we crop the normal window to the
		// screen area to ensure that the majority is not on another screen.
		setGeometry(geometry() & screenGeom);
		setFullScreen(true);
	}
	else
	{
		setFullScreen(false);
		int x = conf->value("video/screen_x", 0).toInt();
		int y = conf->value("video/screen_y", 0).toInt();
		move(x + screenGeom.x(), y + screenGeom.y());
	}

	flagInvertScreenShotColors = conf->value("main/invert_screenshots_colors", false).toBool();
	setFlagCursorTimeout(conf->value("gui/flag_mouse_cursor_timeout", false).toBool());
	setCursorTimeout(conf->value("gui/mouse_cursor_timeout", 10.f).toFloat());
	maxfps = conf->value("video/maximum_fps",10000.f).toFloat();
	minfps = conf->value("video/minimum_fps",10000.f).toFloat();
	flagMaxFpsUpdatePending = false;

	// XXX: This should be done in StelApp::init(), unfortunately for the moment we need init the gui before the
	// plugins, because the gui create the QActions needed by some plugins.
	StelApp::getInstance().initPlugIns();

	// activate DE430/431 
	StelApp::getInstance().getCore()->initEphemeridesFunctions();

	// The script manager can only be fully initialized after the plugins have loaded.
	StelApp::getInstance().initScriptMgr();

	// Set the global stylesheet, this is only useful for the tooltips.
	StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui());
	if (gui!=NULL)
//.........这里部分代码省略.........
开发者ID:magnific0,项目名称:stellarium,代码行数:101,代码来源:StelMainView.cpp

示例4:

MapScene *MapView::mapScene() const
{
    return qobject_cast<MapScene *>(scene());
}
开发者ID:zmeyc,项目名称:mapmaker,代码行数:4,代码来源:MapView.cpp

示例5: frame

//!
//! Changes the viewing transformation so that all items are visible at maximum
//! zoom level.
//!
void GraphicsView::frameAll ()
{
    frame(scene()->itemsBoundingRect());
}
开发者ID:banduladh,项目名称:levelfour,代码行数:8,代码来源:GraphicsView.cpp

示例6: GET_PRESSURE

void ProfileGraphicsView::plot_cylinder_pressure(struct divecomputer *dc)
{
	int i;
	int last = -1, last_index = -1;
	int lift_pen = FALSE;
	int first_plot = TRUE;
	int sac = 0;
	struct plot_data *last_entry = NULL;

	if (!get_cylinder_pressure_range(&gc))
		return;

	QPointF from, to;
	for (i = 0; i < gc.pi.nr; i++) {
		int mbar;
		struct plot_data *entry = gc.pi.entry + i;

		mbar = GET_PRESSURE(entry);
		if (entry->cylinderindex != last_index) {
			lift_pen = TRUE;
			last_entry = NULL;
		}
		if (!mbar) {
			lift_pen = TRUE;
			continue;
		}
		if (!last_entry) {
			last = i;
			last_entry = entry;
			sac = get_local_sac(entry, gc.pi.entry + i + 1, dive);
		} else {
			int j;
			sac = 0;
			for (j = last; j < i; j++)
				sac += get_local_sac(gc.pi.entry + j, gc.pi.entry + j + 1, dive);
			sac /= (i - last);
			if (entry->sec - last_entry->sec >= SAC_WINDOW) {
				last++;
				last_entry = gc.pi.entry + last;
			}
		}

		QColor c = get_sac_color(sac, dive->sac);

		if (lift_pen) {
			if (!first_plot && entry->cylinderindex == last_index) {
				/* if we have a previous event from the same tank,
				 * draw at least a short line */
				int prev_pr;
				prev_pr = GET_PRESSURE(entry - 1);

				QGraphicsLineItem *item = new QGraphicsLineItem(SCALEGC((entry-1)->sec, prev_pr), SCALEGC(entry->sec, mbar));
				QPen pen(defaultPen);
				pen.setColor(c);
				item->setPen(pen);
				scene()->addItem(item);
			} else {
				first_plot = FALSE;
				from = QPointF(SCALEGC(entry->sec, mbar));
			}
			lift_pen = FALSE;
		} else {
			to = QPointF(SCALEGC(entry->sec, mbar));
			QGraphicsLineItem *item = new QGraphicsLineItem(from.x(), from.y(), to.x(), to.y());
			QPen pen(defaultPen);
			pen.setColor(c);
			item->setPen(pen);
			scene()->addItem(item);
		}


		from = QPointF(SCALEGC(entry->sec, mbar));
		last_index = entry->cylinderindex;
	}
}
开发者ID:kuldipem,项目名称:subsurface,代码行数:75,代码来源:profilegraphics.cpp

示例7: thememanager

// Animation loop
void DisplayIntro::loop()
{
  int no = mCards.size();
  // Catch no card error
  if (no<1) return;

  // Retrieve theme data
  KConfigGroup cardconfig = thememanager()->config(QLatin1String( "card" ));
  double card_width       = cardconfig.readEntry("width", 1.0);
  KConfigGroup config     = thememanager()->config(id());
  QPointF start_shift     = config.readEntry("start-shift", QPointF(1.0,1.0));
  QPointF start_pos       = config.readEntry("start-pos", QPointF(1.0,1.0));
  double time_clear_in    = config.readEntry("time-clear-in", 1.0);
  double time_clear_out   = config.readEntry("time-clear-out", 1.0);
  double aspectRatio      = thememanager()->aspectRatio();


  // Display the intro text delayed
  if (mAnimCnt == 2  && mState == Putting && !mTextShown)
  {
    mTextShown = true;
    QString s1 = i18nc("Title of the game - line 1", "Lieutenant Skat");
    QString s2 = i18nc("Title of the game - line 2", "for");
    QString s3 = i18nc("Title of the game - line 3", "K D E");

    // Text sprite title foreground
    TextSprite* text1a = new TextSprite(s1, QLatin1String( "name-front" ), mTheme, scene());
    mSprites.append(text1a);
    text1a->show();

    // Text sprite title background
    TextSprite* text1b = new TextSprite(s1, QLatin1String( "name-back" ), mTheme, scene());
    mSprites.append(text1b);
    text1b->show();

    // Text sprite title foreground
    TextSprite* text2a = new TextSprite(s2, QLatin1String( "for-front" ), mTheme, scene());
    mSprites.append(text2a);
    text2a->show();

    // Text sprite title background
    TextSprite* text2b = new TextSprite(s2, QLatin1String( "for-back" ), mTheme, scene());
    mSprites.append(text2b);
    text2b->show();

    // Text sprite title foreground
    TextSprite* text3a = new TextSprite(s3, QLatin1String( "kde-front" ), mTheme, scene());
    mSprites.append(text3a);
    text3a->show();

    // Text sprite title background
    TextSprite* text3b = new TextSprite(s3, QLatin1String( "kde-back" ), mTheme, scene());
    mSprites.append(text3b);
    text3b->show();
  }

  // Display a card
  if (mAnimCnt < no && mState == Putting)
  {
    double factor = double(mAnimCnt)/double(no-1);
    double fsin = sin(factor*M_PI);

    CardSprite* sprite = mCards[mAnimCnt];

    QPointF pos;
    if (mAnimCnt %2 == 0)
    {
      pos  = QPointF(start_pos.x(), start_pos.y());
      pos += QPointF(start_shift.x() * fsin, start_shift.y() * factor);
    }
    else
    {
      pos  = QPointF(1.0-start_pos.x()-card_width, start_pos.y());
      pos += QPointF(-start_shift.x() * fsin, start_shift.y() * factor);
    }
    sprite->setBackside();
    sprite->setPosition(pos);
    sprite->setZValue(50+mAnimCnt);
    sprite->show();
    mAnimCnt++;
  }
  // Change state to turning
  else if (mState == Putting)
  {
    mState   = Turning;
    mAnimCnt = 0;
  }
  // Turn cards
  else if (mAnimCnt < no && mState == Turning)
  {
    CardSprite* sprite = mCards[mAnimCnt];
    sprite->setTurning(true);
    mAnimCnt++;
  }
  // Change state to waiting
  else if (mState == Turning)
  {
    mState   = Waiting;
    mAnimCnt = 0;
//.........这里部分代码省略.........
开发者ID:jsj2008,项目名称:kdegames,代码行数:101,代码来源:display_intro.cpp

示例8: CleanMe

void ribi::cmap::QtConceptMap::BuildQtConceptMap()
{
  CleanMe();
  assert(m_concept_map);
  assert(m_concept_map->IsValid());
  assert(this->scene());
  //This std::vector keeps the QtNodes in the same order as the nodes in the concept map
  //You cannot rely on Collect<QtConceptMapNodeConcept*>(scene), as this shuffles the order
  std::vector<QtNode*> qtnodes;

  assert(Collect<QtNode>(scene()).empty());

  //Add the nodes to the scene, if there are any
  if (!m_concept_map->GetNodes().empty())
  {
    //Add the main question as the first node
    const boost::shared_ptr<Node> node = m_concept_map->GetFocalNode();

    QtNode * qtnode = nullptr;
    if (IsCenterNode(node))
    {
      const boost::shared_ptr<CenterNode> centernode
        = boost::dynamic_pointer_cast<CenterNode>(node);
      qtnode = new QtCenterNode(centernode);
    }
    else
    {
      qtnode = new QtNode(node,this->GetDisplayStrategy(node->GetConcept()));
    }
    assert(qtnode);
    //Let the center node respond to mouse clicks
    qtnode->m_signal_request_scene_update.connect(
      boost::bind(&ribi::cmap::QtConceptMap::OnRequestSceneUpdate,this));
    qtnode->m_signal_item_has_updated.connect(
      boost::bind(&ribi::cmap::QtConceptMap::OnItemRequestsUpdate,this,boost::lambda::_1));
    //Add the center node to scene
    assert(!qtnode->scene());
    this->scene()->addItem(qtnode);
    qtnodes.push_back(qtnode);
    assert(Collect<QtNode>(scene()).size() == 1);

    //Add the regular nodes to the scene
    const std::vector<boost::shared_ptr<ribi::cmap::Node> > nodes = m_concept_map->GetNodes();
    const std::size_t n_nodes = nodes.size();
    assert(n_nodes >= 1);
    for (std::size_t i=1; i!=n_nodes; ++i) //+1 to skip focal node
    {
      assert(Collect<QtNode>(scene()).size() == i && "Node not yet added to scene");
      assert(i < nodes.size());
      boost::shared_ptr<Node> node = nodes[i];
      assert(node);
      assert( (IsCenterNode(node) || !IsCenterNode(node))
        && "focal node != center node");
      QtNode * const qtnode = AddNode(node);
      qtnodes.push_back(qtnode);
      assert(Collect<QtNode>(scene()).size() == i + 1 && "Node is added to scene");
    }
  }

  #ifndef NDEBUG
  {
    //Check the number of
    const auto qtnodes = Collect<QtNode>(scene());
    const auto n_qtnodes = qtnodes.size();
    const auto nodes = m_concept_map->GetNodes();
    const auto n_nodes = nodes.size();
    assert(n_qtnodes == n_nodes
      && "There must as much nodes in the scene as there were in the concept map");
  }
  #endif
  //Add the Concepts on the Edges
  {
    const std::vector<boost::shared_ptr<ribi::cmap::Edge> > edges = m_concept_map->GetEdges();
    std::for_each(edges.begin(),edges.end(),
      [this,qtnodes](const boost::shared_ptr<Edge> edge)
      {
        assert(edge->GetFrom());
        assert(edge->GetTo());
        assert(edge->GetFrom() != edge->GetTo());
        this->AddEdge(edge);
      }
    );
  }

  #ifndef NDEBUG
  {
    //Check the number of edges
    const auto qtedges = Collect<QtEdge>(scene());
    const auto n_qtedges = qtedges.size();
    const auto edges = m_concept_map->GetEdges();
    const auto n_edges = edges.size();
    assert(n_qtedges == n_edges
      && "There must as much edges in the scene as there were in the concept map");
  }
  #endif

  //Put the nodes around the focal question in an initial position
  if (MustReposition(AddConst(m_concept_map->GetNodes())))
  {
    RepositionItems();
//.........这里部分代码省略.........
开发者ID:RLED,项目名称:ProjectRichelBilderbeek,代码行数:101,代码来源:qtconceptmap.cpp

示例9: s2o

XYView* View::new_view(Coord x1, Coord y1, Coord x2, Coord y2) {
    Coord l,b,r,t;
    s2o().inverse_transform(x1,y1,l,b);
    s2o().inverse_transform(x2,y2,r,t);
    return new View( (x1+x2)/2, (y1+y2)/2, x2-x1, scene(), r-l, t-b);
}
开发者ID:vortexlaboratory,项目名称:neuron,代码行数:6,代码来源:xyview.cpp

示例10: scene

void Forest::drawSelf()
{
	if( mPriority >= 99-quality() )
		mModel->draw( scene()->eye()->viewMatrix(), mInstances );
}
开发者ID:splatterlinge,项目名称:Splatterlinge,代码行数:5,代码来源:Forest.cpp

示例11: scene

XYView::~XYView() {
//	printf("~XYView\n");
    scene()->remove_view(this);
}
开发者ID:vortexlaboratory,项目名称:neuron,代码行数:4,代码来源:xyview.cpp

示例12: main

int
main (int argc, char *argv[])
{
  parseCommandLine (argc, argv);

  pcl::PointCloud<PointType>::Ptr model (new pcl::PointCloud<PointType> ());
  pcl::PointCloud<PointType>::Ptr model_keypoints (new pcl::PointCloud<PointType> ());
  pcl::PointCloud<PointType>::Ptr scene (new pcl::PointCloud<PointType> ());
  pcl::PointCloud<PointType>::Ptr scene_keypoints (new pcl::PointCloud<PointType> ());
  pcl::PointCloud<NormalType>::Ptr model_normals (new pcl::PointCloud<NormalType> ());
  pcl::PointCloud<NormalType>::Ptr scene_normals (new pcl::PointCloud<NormalType> ());
  pcl::PointCloud<DescriptorType>::Ptr model_descriptors (new pcl::PointCloud<DescriptorType> ());
  pcl::PointCloud<DescriptorType>::Ptr scene_descriptors (new pcl::PointCloud<DescriptorType> ());

  //
  //  Load clouds
  //
  if (pcl::io::loadPCDFile (model_filename_, *model) < 0)
  {
    std::cout << "Error loading model cloud." << std::endl;
    showHelp (argv[0]);
    return (-1);
  }
  if (pcl::io::loadPCDFile (scene_filename_, *scene) < 0)
  {
    std::cout << "Error loading scene cloud." << std::endl;
    showHelp (argv[0]);
    return (-1);
  }

  //
  //  Set up resolution invariance
  //
  if (use_cloud_resolution_)
  {
    float resolution = static_cast<float> (computeCloudResolution (model));
    if (resolution != 0.0f)
    {
      model_ss_   *= resolution;
      scene_ss_   *= resolution;
      rf_rad_     *= resolution;
      descr_rad_  *= resolution;
      cg_size_    *= resolution;
    }

    std::cout << "Model resolution:       " << resolution << std::endl;
    std::cout << "Model sampling size:    " << model_ss_ << std::endl;
    std::cout << "Scene sampling size:    " << scene_ss_ << std::endl;
    std::cout << "LRF support radius:     " << rf_rad_ << std::endl;
    std::cout << "SHOT descriptor radius: " << descr_rad_ << std::endl;
    std::cout << "Clustering bin size:    " << cg_size_ << std::endl << std::endl;
  }

  //
  //  Compute Normals
  //
  pcl::NormalEstimationOMP<PointType, NormalType> norm_est;
  norm_est.setKSearch (10);
  norm_est.setInputCloud (model);
  norm_est.compute (*model_normals);

  norm_est.setInputCloud (scene);
  norm_est.compute (*scene_normals);

  //
  //  Downsample Clouds to Extract keypoints
  //
  pcl::PointCloud<int> sampled_indices;

  pcl::UniformSampling<PointType> uniform_sampling;
  uniform_sampling.setInputCloud (model);
  uniform_sampling.setRadiusSearch (model_ss_);
  uniform_sampling.compute (sampled_indices);
  pcl::copyPointCloud (*model, sampled_indices.points, *model_keypoints);
  std::cout << "Model total points: " << model->size () << "; Selected Keypoints: " << model_keypoints->size () << std::endl;

  uniform_sampling.setInputCloud (scene);
  uniform_sampling.setRadiusSearch (scene_ss_);
  uniform_sampling.compute (sampled_indices);
  pcl::copyPointCloud (*scene, sampled_indices.points, *scene_keypoints);
  std::cout << "Scene total points: " << scene->size () << "; Selected Keypoints: " << scene_keypoints->size () << std::endl;


  //
  //  Compute Descriptor for keypoints
  //
  pcl::SHOTEstimationOMP<PointType, NormalType, DescriptorType> descr_est;
  descr_est.setRadiusSearch (descr_rad_);

  descr_est.setInputCloud (model_keypoints);
  descr_est.setInputNormals (model_normals);
  descr_est.setSearchSurface (model);
  descr_est.compute (*model_descriptors);

  descr_est.setInputCloud (scene_keypoints);
  descr_est.setInputNormals (scene_normals);
  descr_est.setSearchSurface (scene);
  descr_est.compute (*scene_descriptors);

  //
//.........这里部分代码省略.........
开发者ID:iKrishneel,项目名称:sample_programs,代码行数:101,代码来源:correspondence_grouping.cpp

示例13: scene

void ribi::cmap::QtConceptMap::OnRequestSceneUpdate()
{
  scene()->update();
}
开发者ID:RLED,项目名称:ProjectRichelBilderbeek,代码行数:4,代码来源:qtconceptmap.cpp

示例14: done

GFXLib::GFXLib() : done(false) {
    initialize();
    scene();
    render();
}
开发者ID:samowitsch,项目名称:sdl2-demos,代码行数:5,代码来源:GFXLib.cpp

示例15: Sort

void ribi::cmap::QtConceptMap::RepositionItems()
{

  {
    //The ray of the upcoming circle of nodes, is the larger of
    //(1) half of the diagonal of the focal question (e.g. for short concepts)
    //(2) calculated from the circumference by adding the nodes' length
    const std::vector<QtNode *> qtnode_concepts_unsorted = Collect<QtNode>(scene());

    if (qtnode_concepts_unsorted.empty()) return;

    const std::vector<QtNode *> qtnode_concepts = Sort(qtnode_concepts_unsorted);
    assert(!qtnode_concepts.empty());
    assert(!qtnode_concepts.empty());
    assert(qtnode_concepts[0]);
    const QtNode * const qtcenter_node
      = dynamic_cast<const QtNode *>(qtnode_concepts[0]);
    assert(qtcenter_node);
    assert(qtcenter_node->pos().x() > -0.5);
    assert(qtcenter_node->pos().x() <  0.5);
    assert(qtcenter_node->pos().y() > -0.5);
    assert(qtcenter_node->pos().y() <  0.5);

    const double r1
      = 0.5 * ribi::cmap::GetDistance(
        qtcenter_node->boundingRect().width(),
        qtcenter_node->boundingRect().height());
    const double r3 = 50.0;
    const double r = std::max(r1,r3);
    assert(r > 10.0);
    const int n_nodes = qtnode_concepts.size();
    for (int i = 1; i!=n_nodes; ++i) //+1 to skip center node
    {
      //Added +0 (instead of -1) to n_nodes, to prevent, in a setup with two concepts and
      //one edge, the edge to overlap the central question
      const double pi = boost::math::constants::pi<double>();
      const double angle
        = 2.0 * pi * boost::numeric_cast<double>(i)
        / boost::numeric_cast<double>(n_nodes - 1);
      const double x =  std::cos(angle) * r;
      const double y = -std::sin(angle) * r;
      QtNode * const qtnode = qtnode_concepts[i];
      qtnode->GetNode()->SetPos(x,y);
      //qtnode->setPos(x,y);
      #ifndef NDEBUG
      const double epsilon = 0.000001;
      #endif
      assert(std::abs(x - qtnode->pos().x()) < epsilon);
      assert(std::abs(x - qtnode->GetNode()->GetX()) < epsilon);
      assert(std::abs(x - qtnode->GetDisplayStrategy()->pos().x()) < epsilon);
      assert(std::abs(y - qtnode->pos().y()) < epsilon);
      assert(std::abs(y - qtnode->GetNode()->GetY()) < epsilon);
      assert(std::abs(y - qtnode->GetDisplayStrategy()->pos().y()) < epsilon);

    }
  }

  {
    //Put the edge concepts in the middle of the nodes
    const std::vector<QtEdge *> qtedge_concepts = Collect<QtEdge>(scene());
    std::for_each(qtedge_concepts.begin(), qtedge_concepts.end(),
      [](QtEdge * const qtedge)
      {
        const QPointF p((qtedge->GetFrom()->pos() + qtedge->GetTo()->pos()) / 2.0);
        const double new_x = p.x();
        const double new_y = p.y();
        //qtedge->GetEdge()->SetX(new_x);
        //qtedge->GetEdge()->SetY(new_y);
        qtedge->GetEdge()->SetPos(new_x,new_y);
        #ifndef NDEBUG
        const double epsilon = 0.000001;
        #endif
        assert(std::abs(qtedge->pos().x() - qtedge->GetEdge()->GetX()) < epsilon);
        assert(std::abs(qtedge->pos().y() - qtedge->GetEdge()->GetY()) < epsilon);
      }
    );
  }

  //Put the nodes around the focal question in their improved position
  //If there is no focal node, the non-focal nodes are put around an empty spot
  while (1)
  {
    bool done = true;
    const std::vector<QtNode *> qtnodes = Sort(Collect<QtNode>(scene()));
    assert(!qtnodes.empty());
    assert(qtnodes[0]);
    //assert(IsCenterNode(qtnodes[0]));
    const std::vector<QtEdge* > qtedges = Collect<QtEdge>(scene());

    //First node
    //const bool is_first_node_center_node {
    //  boost::dynamic_pointer_cast<QtCenterNode>(qtnodes[0])
    //};
    const QtNode * const first_node { qtnodes[0] };
    assert(first_node);

    std::vector<QtRoundedEditRectItem*> nodes_and_edges;
    std::copy(qtnodes.begin(),qtnodes.end(),std::back_inserter(nodes_and_edges));
    std::copy(qtedges.begin(),qtedges.end(),std::back_inserter(nodes_and_edges));

//.........这里部分代码省略.........
开发者ID:RLED,项目名称:ProjectRichelBilderbeek,代码行数:101,代码来源:qtconceptmap.cpp


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