virtual void glRender(const magnet::GL::Camera& cam, RenderMode mode, const uint32_t offset) { if (mode == PICKING) { uint32_t obj_offset = offset; for (auto& child : _children) { uint32_t objs = child->pickableObjectCount(); if (objs) child->glRender(cam, RenderObj::PICKING, obj_offset); obj_offset += objs; } } else { for (auto& child : _children) if (child->visible() && (!(mode & SHADOW) || child->shadowCasting())) child->glRender(cam, mode); for (auto& data : _attributes) data.second->renderComplete(); rebuildGui(); } }
void nodeDock::centreNode( AEntity *ent ) // places the node in the centre of the view { nodeEntity *node( ent->castTo<nodeEntity*>() ); if( node ) { connect( node, SIGNAL(requestNetworkRedraw()), mScene, SLOT(update()), Qt::UniqueConnection ); if( qFuzzyCompare( node->property("nodeEntity/pos")->toVector3D(), QVector3D( 0, 0, 0 ) ) ) { // set pos to centre of screen QPointF pos; pos.setX(mView->rect().width()/2); pos.setY(mView->rect().height()/2); // get transformation matrix and invert it (viewMatrix moves the scene, so invert to move to view) QTransform viewMatrix = mView->getTransform(); viewMatrix = viewMatrix.inverted(); // map point to matrix pos = viewMatrix.map(pos); // set position QVector3D vectPos; vectPos.setX(pos.x()); vectPos.setY(pos.y()); node->property("nodeEntity/pos") = vectPos; } //Rebuild gui from here, rather than direct signal so only rebuild on NODE added, not just any entity rebuildGui(); } }
void DataSet::showControls(Gtk::ScrolledWindow* win) { win->remove(); _gtkOptList->unparent(); win->add(*_gtkOptList); win->show(); //Force a rebuild of the Gui when this object is selected, to //allow stuff like the data set statistics to be updated rebuildGui(); }
virtual void glRender(const magnet::GL::Camera& cam, RenderMode mode = DEFAULT) { for (std::vector<std::tr1::shared_ptr<DataSetChild> >::iterator iPtr = _children.begin(); iPtr != _children.end(); ++iPtr) if ((*iPtr)->visible() && (!(mode & SHADOW) || (*iPtr)->shadowCasting())) (*iPtr)->glRender(cam, mode); for (iterator iPtr = begin(); iPtr != end(); ++iPtr) iPtr->second->renderComplete(); rebuildGui(); }
void nodeDock::added() { connect( app(), SIGNAL(entityAdded(AEntity*)), this, SLOT(centreNode(AEntity*)) ); connect( app(), SIGNAL(entityRemoved(AEntity*)), this, SLOT(removeNode(AEntity*)) ); connect( app(), SIGNAL(entityRemoved(AEntity*)), this, SLOT(entityRemoved(AEntity*)) ); connect( app(), SIGNAL(selectionChanged()), this, SLOT(appSelectionChanged()) ); connect( app(), SIGNAL(insertState()), this, SLOT(rebuildGui()) ); connect( app(), SIGNAL(cleanState()), this, SLOT(rebuildGui()) ); connect( app(), SIGNAL(openState()), this, SLOT(rebuildGui()) ); connect( app(), SIGNAL(workingPathChanged()), this, SLOT(rebuildGui()) ); mView->setApp(app()); mScene->addItem( new propertiesWidget( app(), mView ) ); qRegisterMetaType<AEntityLocation>(); directoryListing *dir( new directoryListing( app(), mView ) ); mScene->addItem( dir ); connect( dir, SIGNAL(changeDirectory(AEntityLocation)), this, SLOT(changeDirectory(AEntityLocation)), Qt::QueuedConnection ); }
void DataSet::deleteChildWorker(DataSetChild* childtodelete) { for (auto iPtr = _children.begin(); iPtr != _children.end(); ++iPtr) if (iPtr->get() == childtodelete) { //Found the child to delete (*iPtr)->deinit(); _children.erase(iPtr); //Rebuild this objects gui rebuildGui(); //And the render object tree view _view->buildRenderView(); return; } }
nodeDock::nodeDock() { mLayout = new QVBoxLayout(base()); mLayout->setContentsMargins(0, 0, 0, 0); // tiny margins base()->setLayout(mLayout); // point the the base dock to the layout mView = new gfxview(base()); mScene = new gfxscene(base()); connect( mScene, SIGNAL(refreshScene()), this, SLOT(rebuildGui()) ); connect( mScene, SIGNAL(selectionChanged()), this, SLOT(selectionChanged()) ); connect( mScene, SIGNAL(changed(QList<QRectF>)), this, SLOT(nodesMoved(QList<QRectF>)) ); mView->setScene(mScene); mLayout->addWidget(mView); // add the gfxview as a widget to the layout _appSelecting = false; }
void DataSet::initGtk() { _gtkOptList.reset(new Gtk::VBox); {//The heading of the data set window Gtk::Frame* frame = Gtk::manage(new Gtk::Frame("Data Set Information")); frame->show(); _gtkOptList->pack_start(*frame, false, true, 5); Gtk::VBox* vbox = Gtk::manage(new Gtk::VBox); vbox->show(); frame->add(*vbox); _infolabel.reset(new Gtk::Label("Points: " + boost::lexical_cast<std::string>(_N))); _infolabel->show(); vbox->pack_start(*_infolabel, false, true, 5); } //Glyph adding mechanism { Gtk::HBox* box = Gtk::manage(new Gtk::HBox); box->show(); _gtkOptList->pack_start(*box, false, false, 5); _comboPointSet.reset(new Gtk::ComboBoxText); _comboPointSet->show(); box->pack_start(*_comboPointSet, false, false, 5); //Check the combo box is correct _comboPointSet->get_model().clear(); for (const auto& pointset: _pointSets) _comboPointSet->insert(-1, pointset.first); _comboPointSet->set_active(0); Gtk::Button* btn = Gtk::manage(new Gtk::Button("Add Glyphs")); btn->signal_clicked().connect(sigc::mem_fun(*this, &DataSet::addGlyphs)); btn->show(); box->pack_start(*btn, false, false, 5); _comboLinkSet.reset(new Gtk::ComboBoxText); _comboLinkSet->show(); box->pack_start(*_comboLinkSet, false, false, 5); //Check the combo box is correct _comboLinkSet->get_model().clear(); for (const auto& linkset: _linkSets) _comboLinkSet->insert(-1, linkset.first); _comboLinkSet->set_active(0); btn = Gtk::manage(new Gtk::Button("Add Links")); btn->signal_clicked().connect(sigc::mem_fun(*this, &DataSet::addLinkGlyphs)); btn->show(); box->pack_start(*btn, false, false, 5); } { _attrcolumns.reset(new ModelColumns); _attrtreestore = Gtk::TreeStore::create(*_attrcolumns); _attrtreestore->set_sort_column(_attrcolumns->components, Gtk::SORT_DESCENDING); _attrview.reset(new Gtk::TreeView); _attrview->set_model(_attrtreestore); _attrview->append_column("Name", _attrcolumns->name); _attrview->append_column("Components", _attrcolumns->components); _attrview->append_column("Min Values", _attrcolumns->min); _attrview->append_column("Max Values", _attrcolumns->max); _attrview->show(); Gtk::ScrolledWindow* win = Gtk::manage(new Gtk::ScrolledWindow); win->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); win->add(*_attrview); Gtk::Frame* frame = Gtk::manage(new Gtk::Frame("Available Attributes")); frame->show(); frame->add(*win); _gtkOptList->pack_start(*frame, true, true, 5); win->show(); } { _positionSel.reset(new AttributeSelector(false)); _gtkOptList->pack_start(*_positionSel, false, false); } _gtkOptList->show(); rebuildGui(); }