Dialog::Dialog(QWidget *parent) : QDialog(parent), ui(new Ui::Dialog) { ui->setupUi(this); ui->treeWidget->setColumnCount(2); ui->treeWidget->setHeaderLabels(QStringList() << "one" << "two"); addRoot("Hello","World"); addRoot("Name","Surname"); }
Dialog::Dialog(QWidget *parent) : QDialog(parent), ui(new Ui::Dialog) { ui->setupUi(this); ui->treeWidget->setColumnCount(2); addRoot("root", "one"); addRoot("root", "two"); addRoot("root", "three"); }
bool RootList::init(HandleObject debuggees) { MOZ_ASSERT(debuggees && JS::dbg::IsDebugger(ObjectValue(*debuggees))); js::Debugger *dbg = js::Debugger::fromJSObject(debuggees); ZoneSet debuggeeZones; if (!debuggeeZones.init()) return false; for (js::WeakGlobalObjectSet::Range r = dbg->allDebuggees(); !r.empty(); r.popFront()) { if (!debuggeeZones.put(r.front()->zone())) return false; } if (!init(debuggeeZones)) return false; // Ensure that each of our debuggee globals are in the root list. for (js::WeakGlobalObjectSet::Range r = dbg->allDebuggees(); !r.empty(); r.popFront()) { if (!addRoot(JS::ubi::Node(static_cast<JSObject *>(r.front())), MOZ_UTF16("debuggee global"))) { return false; } } return true; }
taoNodeRoot* taoGroup::unlinkFixed(taoNodeRoot* root, taoNode* node) { #ifdef TAO_CONTROL if (root->getController()) root->getController()->deleteParamTree(node); #endif taoNodeRoot* r = new taoNodeRoot(*node->frameGlobal()); node->unlink(); if (!root->getDChild()) delete removeRoot(root->getID()); deFrame home; home.identity(); node->link(r, &home); node->addABNode(); taoDynamics::initialize(r); addRoot(r, -999); return r; }
void serializeIn(SceneGraph_Data &scenegraph,LoadingContext &ctx,PrefabStore &prefabs) { for (const SceneGraphNode_Data & node_dat : scenegraph.Def ) addNode(node_dat, ctx,prefabs); for (const SceneRootNode_Data & root_dat : scenegraph.Ref) addRoot(root_dat, ctx,prefabs); }
TreeView::TreeView(QWidget *parent) : QTreeView(parent) { deleteNodeAction= new QAction("&Delete",this); insertNodeAction= new QAction("&insert",this); addNodeAction= new QAction("&add node",this); debugPaneAction = new QAction("debug",this); deleteRootAction= new QAction("&Delete",this); insertRootAction= new QAction("&insert",this); addRootAction= new QAction("&add Root",this); QObject::connect(this->deleteRootAction, SIGNAL(triggered()), this, SLOT(deleteRoot())); QObject::connect(this->insertRootAction, SIGNAL(triggered()), this, SLOT(insertRoot())); QObject::connect(this->addRootAction, SIGNAL(triggered()), this, SLOT(addRoot())); QObject::connect(this->deleteNodeAction, SIGNAL(triggered()), this, SLOT(deleteNode())); QObject::connect(this->insertNodeAction, SIGNAL(triggered()), this, SLOT(insertNode())); QObject::connect(this->addNodeAction, SIGNAL(triggered()), this, SLOT(addNode())); QObject::connect(this->debugPaneAction, SIGNAL(triggered()), this, SLOT(debugNode())); }
FieldObjectPtr ScriptContext::newFieldObject(BattleField *p) { JSContext *cx = (JSContext *)m_p; JS_BeginRequest(cx); JSObject *obj = JS_NewObject(cx, &fieldClass, NULL, NULL); FieldObjectPtr ptr = addRoot(new FieldObject(obj)); JS_DefineProperties(cx, obj, fieldProperties); JS_DefineFunctions(cx, obj, fieldFunctions); JS_SetPrivate(cx, obj, p); JS_EndRequest(cx); return ptr; }
void initHash(HashMap *hash, int logLen){ int len = 1<<logLen; hash->array = malloc(sizeof(Entry*)*len); _assert(hash->array!=NULL); hash->logLen=logLen; hash->len = len; memset(hash->array, 0, sizeof(Entry*)*len); #ifdef DAOA void addRoot(void **root, int len); addRoot((void **)hash->array, len); #endif }
void Xaman::listElement(QDomElement root, QString tagname, QString attribute){ //Listar cada lista de reproduccion QDomNodeList items= root.elementsByTagName(tagname); for(int i=0; i< items.count();i++){ QDomNode itemnode =items.at(i); if(itemnode.isElement()){ QDomElement element = itemnode.toElement(); //Metodo para agregarlos a la estructura addRoot(element,attribute); } } }
//------------------------------------------------------------------------------ //! CoreXGL::CoreXGL() : _dblClickDelay( 300 ) { DBG_BLOCK( os_xgl, "CoreXGL::CoreXGL" ); addRoot( "" ); _mainPointerID = Core::createPointer().id(); // Create window. initWin(); }
void initialize_ds(int initListSize, int elementsRange, ThreadGlobals *tg){ #if defined(DAOA) && !defined(HASH_OP) void addRoot(void **root, int len); addRoot((void**)&entryHead, 1); #endif entryHead=NULL; midkey=elementsRange/2; simSRandom(-1); for (int i = 0; i < initListSize; i++) { int key = simRandom() % elementsRange; #ifndef HASH_OP ListInsertFAST(&entryHead, tg, key, 0); #else HashInsertFAST(&hash, tg, key, 0); #endif } }
ProcessViewerDialog::ProcessViewerDialog(QWidget *parent) : QDialog(parent), ui(new Ui::ProcessViewerDialog) { ui->setupUi(this); setWindowTitle("Process Viewer"); // remove question mark from the title bar setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); ui->treeWidget->setColumnCount(2); ui->treeWidget->setColumnWidth(0, 130); ui->treeWidget->setColumnWidth(1, 90); // get process data in CSV format using a "Windows Management Instrumentation Commandline" query QString cmd = "wmic process where \"ExecutablePath LIKE '%server_main%'\" GET Name, ExecutablePath, ProcessId, ParentProcessId /format:csv"; QList<QStringList> list = execute(cmd); foreach(QStringList item, list) { // skip items if(item.first() == "") continue; // 1 empty list element if(item.first() == "Node") continue; // 2 list with keys //qDebug() << item; // add elements, which are always a root node if(item.at(2) == "spawn.exe" || item.at(2) != "php-cgi.exe") { addRoot(item.at(2), item.at(4)); continue; } // add PHP process as child, that's the case, when the spawner is used if(item.at(2) == "php-cgi.exe") { // find root by parentId QTreeWidgetItem *rootItem = ui->treeWidget->findItems(item.at(3), Qt::MatchExactly, 1).at(0); // add this PHP process as child of that root addChild(rootItem, item.at(2), item.at(4)); } } ui->treeWidget->expandAll(); }
/**************************************************************************** * Insert a new node * ****************************************************************************/ bst::Position bst::insert( Data_t k ) { Position p = search(k); if (!p.isValid()) { p = addRoot(k); return p; } else if(p.isExternal()) { expandExternal(p); *p = k; return p; } else { return p; } }
FileSystemWidget::FileSystemWidget(QWidget *parent) : QWidget(parent), ui(new Ui::FileSystemWidget) { ui->setupUi(this); m_delegate = new FileSystemItemDelegate(this); ui->listView->setItemDelegate(m_delegate); initModel(); ui->listView->setModel(m_sortModel); connect(ui->listView, SIGNAL(open(QModelIndex)),m_model, SLOT(cd(QModelIndex))); connect(ui->listView, SIGNAL(up()), m_model, SLOT(cdUp())); connect(ui->listView, SIGNAL(play(QStringList,bool,bool)), this, SLOT(play(QStringList,bool,bool))); initSearch(); ui->progressPanel->hide(); connect(ui->upButton, SIGNAL(clicked()), m_model, SLOT(cdUp())); connect(m_model, SIGNAL(upChanged(bool)),ui->upButton, SLOT(setEnabled(bool))); connect(m_model, SIGNAL(pathChanged()), this, SLOT(onPathChanged())); connect(ui->selectButton, SIGNAL(clicked()), this, SLOT(selectFolder())); connect(ui->playAllButton, SIGNAL(clicked()), this, SLOT(playAll())); connect(ui->playRootButton, SIGNAL(clicked()), this, SLOT(playRoot())); connect(ui->addAllButton, SIGNAL(clicked()), this, SLOT(addAll())); connect(ui->addRootButton, SIGNAL(clicked()), this, SLOT(addRoot())); m_scanDialog = new ScanProgressDialog(this); connect(m_scanDialog, SIGNAL(cancelled()), Player::instance()->folder(), SLOT(cancel())); connect(Player::instance()->folder(), SIGNAL(cancelled()), m_scanDialog, SLOT(onScanCancelled())); connect(Player::instance()->folder(), SIGNAL(scanPathChanged(QString)), m_scanDialog, SLOT(setScanPath(QString))); connect(Player::instance()->folder(), SIGNAL(finished(int)), m_scanDialog, SLOT(onScanFinished(int))); m_scanDialogTimer.setSingleShot(true); connect(&m_scanDialogTimer, SIGNAL(timeout()), this, SLOT(showScanDialog())); connect(Player::instance()->folder(), SIGNAL(finished(int)), &m_scanDialogTimer, SLOT(stop())); }
void makeLagrangePolynomial(Polynomial *polynomial, Table const *table) { size_t const size = table->xs.size; initPolynomial(polynomial, size - 1); setToScalar(polynomial, 0.0); Polynomial term; initPolynomial(&term, polynomial->deg); for (size_t k = 0; k < size; ++k) { setToScalar(&term, 1.0); for (size_t j = 0; j < size; ++j) { if (j != k) { addRoot(&term, table->xs.values[j]); } } long double denominator = 1.0; long double const xk = table->xs.values[k]; for (size_t j = 0; j < size; ++j) { denominator *= (j == k ? 1.0 : xk - table->xs.values[j]); } multiplyByScalar(&term, table->ys.values[k] / denominator); addPolynomial(polynomial, &term); } disposePolynomial(&term); }
void ChangeJournalWatcher::watchDir(const std::wstring &dir) { WCHAR volume_path[MAX_PATH]; BOOL ok = GetVolumePathNameW(dir.c_str(), volume_path, MAX_PATH); if(!ok) { Server->Log("GetVolumePathName(dir, volume_path, MAX_PATH) failed in ChangeJournalWatcher::watchDir", LL_ERROR); listener->On_ResetAll(dir); has_error=true; error_dirs.push_back(dir); return; } std::wstring vol=volume_path; if(vol.size()>0) { if(vol[vol.size()-1]=='\\') { vol.erase(vol.size()-1,1); } } std::map<std::wstring, SChangeJournal>::iterator it=wdirs.find(vol); if(it!=wdirs.end()) { it->second.path.push_back(dir); return; } bool do_index=false; _i64 rid=hasRoot(vol); if(rid==-1) { listener->On_ResetAll(vol); do_index=true; rid=addRoot(vol); setIndexDone(vol, 0); } HANDLE hVolume=CreateFileW((L"\\\\.\\"+vol).c_str(), GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if(hVolume==INVALID_HANDLE_VALUE) { Server->Log(L"CreateFile of volume '"+vol+L"' failed. - watchDir", LL_ERROR); listener->On_ResetAll(vol); error_dirs.push_back(vol); CloseHandle(hVolume); has_error=true; return; } USN_JOURNAL_DATA data; DWORD r_bytes; BOOL b=DeviceIoControl(hVolume, FSCTL_QUERY_USN_JOURNAL, NULL, 0, &data, sizeof(USN_JOURNAL_DATA), &r_bytes, NULL); if(b==0) { DWORD err=GetLastError(); if(err==ERROR_INVALID_FUNCTION) { Server->Log(L"Change Journals not supported for Volume '"+vol+L"'", LL_ERROR); listener->On_ResetAll(vol); error_dirs.push_back(vol); CloseHandle(hVolume); has_error=true; return; } else if(err==ERROR_JOURNAL_DELETE_IN_PROGRESS) { Server->Log(L"Change Journals for Volume '"+vol+L"' is being deleted", LL_ERROR); listener->On_ResetAll(vol); error_dirs.push_back(vol); CloseHandle(hVolume); has_error=true; return; } else if(err==ERROR_JOURNAL_NOT_ACTIVE) { CREATE_USN_JOURNAL_DATA dat; dat.AllocationDelta=10485760; //10 MB dat.MaximumSize=73400320; // 70 MB DWORD bret; BOOL r=DeviceIoControl(hVolume, FSCTL_CREATE_USN_JOURNAL, &dat, sizeof(CREATE_USN_JOURNAL_DATA), NULL, 0, &bret, NULL); if(r==0) { Server->Log(L"Error creating change journal for Volume '"+vol+L"'", LL_ERROR); listener->On_ResetAll(vol); error_dirs.push_back(vol); CloseHandle(hVolume); has_error=true; return; } b=DeviceIoControl(hVolume, FSCTL_QUERY_USN_JOURNAL, NULL, 0, &data, sizeof(USN_JOURNAL_DATA), &r_bytes, NULL); if(b==0) { Server->Log(L"Unknown error for Volume '"+vol+L"' after creation - watchDir", LL_ERROR); listener->On_ResetAll(vol); error_dirs.push_back(vol); CloseHandle(hVolume); has_error=true; return; } } else { Server->Log(L"Unknown error for Volume '"+vol+L"' - watchDir ec: "+convert((int)err), LL_ERROR); listener->On_ResetAll(vol); error_dirs.push_back(vol); CloseHandle(hVolume); has_error=true; return; } } SDeviceInfo info=getDeviceInfo(vol); if(info.has_info) { if(info.journal_id!=data.UsnJournalID) { Server->Log(L"Journal id for '"+vol+L"' wrong - reindexing", LL_WARNING); listener->On_ResetAll(vol); do_index=true; setIndexDone(vol, 0); info.last_record=data.NextUsn; q_update_journal_id->Bind((_i64)data.UsnJournalID); q_update_journal_id->Bind(vol); q_update_journal_id->Write(); q_update_journal_id->Reset(); } bool needs_reindex=false; if( do_index==false && (info.last_record<data.FirstUsn || info.last_record>data.NextUsn) ) { Server->Log(L"Last record not readable at '"+vol+L"' - reindexing", LL_WARNING); needs_reindex=true; } if( do_index==false && data.NextUsn-info.last_record>usn_reindex_num ) { Server->Log(L"There are "+convert(data.NextUsn-info.last_record)+L" new USN entries at '"+vol+L"' - reindexing", LL_WARNING); needs_reindex=true; } if(needs_reindex) { listener->On_ResetAll(vol); do_index=true; setIndexDone(vol, 0); info.last_record=data.NextUsn; } if(do_index==false && info.index_done==0) { Server->Log(L"Indexing was not finished at '"+vol+L"' - reindexing", LL_WARNING); do_index=true; setIndexDone(vol, 0); info.last_record=data.NextUsn; } } else { listener->On_ResetAll(vol); Server->Log(L"Info not found at '"+vol+L"' - reindexing", LL_WARNING); do_index=true; } SChangeJournal cj; cj.journal_id=data.UsnJournalID; if(!info.has_info) cj.last_record=data.NextUsn; else cj.last_record=info.last_record; cj.path.push_back(dir); cj.hVolume=hVolume; cj.rid=rid; cj.last_record_update=false; cj.vol_str=vol; if(!info.has_info) { q_add_journal->Bind((_i64)data.UsnJournalID); q_add_journal->Bind(vol); q_add_journal->Bind(cj.last_record); q_add_journal->Write(); q_add_journal->Reset(); setIndexDone(vol, 0); } wdirs.insert(std::pair<std::wstring, SChangeJournal>(vol, cj) ); if(do_index) { reindex(rid, vol, &cj); Server->Log(L"Reindexing of '"+vol+L"' done.", LL_INFO); } }
bool ompl::control::Syclop::solve(const base::PlannerTerminationCondition& ptc) { checkValidity(); if (!graphReady_) { numMotions_ = 0; setupRegionEstimates(); setupEdgeEstimates(); graphReady_ = true; } while (const base::State* s = pis_.nextStart()) { const int region = decomp_->locateRegion(s); startRegions_.insert(region); Motion* startMotion = addRoot(s); graph_[boost::vertex(region,graph_)].motions.push_back(startMotion); ++numMotions_; updateCoverageEstimate(graph_[boost::vertex(region,graph_)], s); } if (startRegions_.empty()) { msg_.error("There are no valid start states"); return false; } //We need at least one valid goal sample so that we can find the goal region if (goalRegions_.empty()) { if (const base::State* g = pis_.nextGoal(ptc)) goalRegions_.insert(decomp_->locateRegion(g)); else { msg_.error("Unable to sample a valid goal state"); return false; } } msg_.inform("Starting with %u states", numMotions_); std::vector<Motion*> newMotions; const Motion* solution = NULL; base::Goal* goal = pdef_->getGoal().get(); double goalDist = std::numeric_limits<double>::infinity(); bool solved = false; while (!ptc() && !solved) { const int chosenStartRegion = startRegions_.sampleUniform(); int chosenGoalRegion = -1; // if we have not sampled too many goal regions already if (pis_.haveMoreGoalStates() && goalRegions_.size() < numMotions_/2) { if (const base::State* g = pis_.nextGoal()) { chosenGoalRegion = decomp_->locateRegion(g); goalRegions_.insert(chosenGoalRegion); } } if (chosenGoalRegion == -1) chosenGoalRegion = goalRegions_.sampleUniform(); computeLead(chosenStartRegion, chosenGoalRegion); computeAvailableRegions(); for (int i = 0; i < numRegionExpansions_ && !solved && !ptc(); ++i) { const int region = selectRegion(); bool improved = false; for (int j = 0; j < numTreeSelections_ && !solved && !ptc(); ++j) { newMotions.clear(); selectAndExtend(graph_[boost::vertex(region,graph_)], newMotions); for (std::vector<Motion*>::const_iterator m = newMotions.begin(); m != newMotions.end() && !ptc(); ++m) { Motion* motion = *m; double distance; solved = goal->isSatisfied(motion->state, &distance); if (solved) { goalDist = distance; solution = motion; break; } // Check for approximate (best-so-far) solution if (distance < goalDist) { goalDist = distance; solution = motion; } const int newRegion = decomp_->locateRegion(motion->state); graph_[boost::vertex(newRegion,graph_)].motions.push_back(motion); ++numMotions_; Region& newRegionObj = graph_[boost::vertex(newRegion, graph_)]; improved |= updateCoverageEstimate(newRegionObj, motion->state); if (newRegion != region) { // If this is the first time the tree has entered this region, add the region to avail if (newRegionObj.motions.size() == 1) availDist_.add(newRegion, newRegionObj.weight); /* If the tree crosses an entire region and creates an edge (u,v) for which Proj(u) and Proj(v) are non-neighboring regions, then we do not update connection estimates. This is because Syclop's shortest-path lead computation only considers neighboring regions. */ if (regionsToEdge_.count(std::pair<int,int>(region, newRegion)) > 0) { Adjacency* adj = regionsToEdge_[std::pair<int,int>(region,newRegion)]; adj->empty = false; ++adj->numSelections; improved |= updateConnectionEstimate(graph_[boost::vertex(region,graph_)], newRegionObj, motion->state); } } } } if (!improved && rng_.uniform01() < probAbandonLeadEarly_) break; } } bool addedSolution = false; if (solution != NULL) { std::vector<const Motion*> mpath; while (solution != NULL) { mpath.push_back(solution); solution = solution->parent; } PathControl* path = new PathControl(si_); for (int i = mpath.size()-1; i >= 0; --i) if (mpath[i]->parent) path->append(mpath[i]->state, mpath[i]->control, mpath[i]->steps * siC_->getPropagationStepSize()); else path->append(mpath[i]->state); goal->addSolutionPath(base::PathPtr(path), !solved, goalDist); addedSolution = true; } return addedSolution; }
taoNodeRoot* taoGroup::unlinkFree(taoNodeRoot* root, taoNode* node, deFloat inertia, deFloat damping) { #ifdef TAO_CONTROL if (root->getController()) root->getController()->deleteParamTree(node); #endif deVector6 v = *node->velocity(); taoNodeRoot* r = new taoNodeRoot(*node->frameGlobal()); node->unlink(); if (!root->getDChild()) delete removeRoot(root->getID()); deFrame home; home.identity(); node->link(r, &home); taoJointDOF1* joint; joint = new taoJointPrismatic(TAO_AXIS_X); joint->setDamping(damping); joint->setInertia(inertia); joint->setDVar(new taoVarDOF1); joint->reset(); joint->getVarDOF1()->_dQ = v[0][TAO_AXIS_X]; node->addJoint(joint); joint = new taoJointPrismatic(TAO_AXIS_Y); joint->setDamping(damping); joint->setInertia(inertia); joint->setDVar(new taoVarDOF1); joint->reset(); joint->getVarDOF1()->_dQ = v[0][TAO_AXIS_Y]; node->addJoint(joint); joint = new taoJointPrismatic(TAO_AXIS_Z); joint->setDamping(damping); joint->setInertia(inertia); joint->setDVar(new taoVarDOF1); joint->reset(); joint->getVarDOF1()->_dQ = v[0][TAO_AXIS_Z]; node->addJoint(joint); taoJointSpherical* joint2 = new taoJointSpherical; joint2->setDamping(damping); joint2->setInertia(inertia); joint2->setDVar(new taoVarSpherical); joint2->reset(); joint2->getVarSpherical()->_dQ = v[1]; node->addJoint(joint2); node->addABNode(); taoDynamics::initialize(r); addRoot(r, -999); return r; }
ompl::base::PlannerStatus ompl::control::Syclop::solve(const base::PlannerTerminationCondition &ptc) { checkValidity(); if (!graphReady_) { numMotions_ = 0; setupRegionEstimates(); setupEdgeEstimates(); graphReady_ = true; } while (const base::State *s = pis_.nextStart()) { const int region = decomp_->locateRegion(s); startRegions_.insert(region); Motion *startMotion = addRoot(s); graph_[boost::vertex(region, graph_)].motions.push_back(startMotion); ++numMotions_; updateCoverageEstimate(graph_[boost::vertex(region, graph_)], s); } if (startRegions_.empty()) { OMPL_ERROR("%s: There are no valid start states", getName().c_str()); return base::PlannerStatus::INVALID_START; } // We need at least one valid goal sample so that we can find the goal region if (goalRegions_.empty()) { if (const base::State *g = pis_.nextGoal(ptc)) goalRegions_.insert(decomp_->locateRegion(g)); else { OMPL_ERROR("%s: Unable to sample a valid goal state", getName().c_str()); return base::PlannerStatus::INVALID_GOAL; } } OMPL_INFORM("%s: Starting planning with %u states already in datastructure", getName().c_str(), numMotions_); std::vector<Motion *> newMotions; const Motion *solution = nullptr; base::Goal *goal = pdef_->getGoal().get(); double goalDist = std::numeric_limits<double>::infinity(); bool solved = false; while (!ptc && !solved) { const int chosenStartRegion = startRegions_.sampleUniform(); int chosenGoalRegion = -1; // if we have not sampled too many goal regions already if (pis_.haveMoreGoalStates() && goalRegions_.size() < numMotions_ / 2) { if (const base::State *g = pis_.nextGoal()) { chosenGoalRegion = decomp_->locateRegion(g); goalRegions_.insert(chosenGoalRegion); } } if (chosenGoalRegion == -1) chosenGoalRegion = goalRegions_.sampleUniform(); leadComputeFn(chosenStartRegion, chosenGoalRegion, lead_); computeAvailableRegions(); for (int i = 0; i < numRegionExpansions_ && !solved && !ptc; ++i) { const int region = selectRegion(); bool improved = false; for (int j = 0; j < numTreeSelections_ && !solved && !ptc; ++j) { newMotions.clear(); selectAndExtend(graph_[boost::vertex(region, graph_)], newMotions); for (std::vector<Motion *>::const_iterator m = newMotions.begin(); m != newMotions.end() && !ptc; ++m) { Motion *motion = *m; double distance; solved = goal->isSatisfied(motion->state, &distance); if (solved) { goalDist = distance; solution = motion; break; } // Check for approximate (best-so-far) solution if (distance < goalDist) { goalDist = distance; solution = motion; } const int newRegion = decomp_->locateRegion(motion->state); graph_[boost::vertex(newRegion, graph_)].motions.push_back(motion); ++numMotions_; Region &newRegionObj = graph_[boost::vertex(newRegion, graph_)]; improved |= updateCoverageEstimate(newRegionObj, motion->state); /* If tree has just crossed from one region to its neighbor, update the connection estimates. If the tree has crossed an entire region, then region and newRegion are not adjacent, and so we do not update estimates. */ if (newRegion != region && regionsToEdge_.count(std::pair<int, int>(region, newRegion)) > 0) { Adjacency *adj = regionsToEdge_[std::pair<int, int>(region, newRegion)]; adj->empty = false; ++adj->numSelections; improved |= updateConnectionEstimate(graph_[boost::vertex(region, graph_)], newRegionObj, motion->state); } /* If this region already exists in availDist, update its weight. */ if (newRegionObj.pdfElem != nullptr) availDist_.update(newRegionObj.pdfElem, newRegionObj.weight); /* Otherwise, only add this region to availDist if it already exists in the lead. */ else if (std::find(lead_.begin(), lead_.end(), newRegion) != lead_.end()) { PDF<int>::Element *elem = availDist_.add(newRegion, newRegionObj.weight); newRegionObj.pdfElem = elem; } } } if (!improved && rng_.uniform01() < probAbandonLeadEarly_) break; } } bool addedSolution = false; if (solution != nullptr) { std::vector<const Motion *> mpath; while (solution != nullptr) { mpath.push_back(solution); solution = solution->parent; } auto path(std::make_shared<PathControl>(si_)); for (int i = mpath.size() - 1; i >= 0; --i) if (mpath[i]->parent != nullptr) path->append(mpath[i]->state, mpath[i]->control, mpath[i]->steps * siC_->getPropagationStepSize()); else path->append(mpath[i]->state); pdef_->addSolutionPath(path, !solved, goalDist, getName()); addedSolution = true; } return addedSolution ? base::PlannerStatus::EXACT_SOLUTION : base::PlannerStatus::TIMEOUT; }
void Dialog::on_pushButton_clicked() { addRoot("Hello", "world"); }
MoulKI::MoulKI(QWidget *parent) : QMainWindow(parent), ui(new Ui::MoulKIClass), gameClient(NULL), authClient(NULL) { resmgr = new plResManager(PlasmaVer::pvMoul); sdlmgr = new plSDLMgr(); ui->setupUi(this); qRegisterMetaType<plUuid>("plUuid"); qRegisterMetaType<plString>("plString"); qRegisterMetaType<uint32_t>("uint32_t"); connect(ui->actionLogin, SIGNAL(triggered()), this, SLOT(showLoginDialog())); connect(ui->actionSet_Active, SIGNAL(triggered()), this, SLOT(showPlayers())); connect(ui->actionFind_Node, SIGNAL(triggered()), this, SLOT(showFindDialog())); connect(ui->actionSubscribe, SIGNAL(triggered()), this, SLOT(showFetchDialog())); connect(ui->actionGet_Public_Ages, SIGNAL(triggered()), this, SLOT(getPublicAgeList())); connect(ui->actionSave_Vault, SIGNAL(triggered()), this, SLOT(writeVault())); connect(ui->actionLoad_Vault, SIGNAL(triggered()), this, SLOT(readVault())); connect(ui->actionJoin_Age, SIGNAL(triggered()), this, SLOT(showJoinAgeDialog())); connect(ui->vaultTree, SIGNAL(itemSelectionChanged()), this, SLOT(setShownNode())); connect(ui->applyButton, SIGNAL(clicked()), this, SLOT(saveNodeData())); connect(ui->revertButton, SIGNAL(clicked()), this, SLOT(revertNode())); connect(ui->nodeEditor, SIGNAL(isDirty(bool)), this, SLOT(nodeDirty(bool))); connect(ui->vaultTree, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showItemContextMenu(QPoint))); connect(ui->chatEntry, SIGNAL(returnPressed()), this, SLOT(sendGameChat())); connect(&vault, SIGNAL(addedNode(uint32_t, uint32_t)), this, SLOT(addNode(uint32_t,uint32_t))); connect(&vault, SIGNAL(removedNode(uint32_t, uint32_t)), this, SLOT(removeNode(uint32_t,uint32_t))); connect(&vault, SIGNAL(gotRootNode(uint32_t)), this, SLOT(addRoot(uint32_t))); connect(&vault, SIGNAL(updatedNode(uint32_t)), this, SLOT(updateNode(uint32_t))); connect(&vault, SIGNAL(fetchComplete()), this, SLOT(checkCurrentAge())); ui->vaultTree->setContextMenuPolicy(Qt::CustomContextMenu); // set up the player list agePlayersItem = new QTreeWidgetItem(ui->playersTree); agePlayersItem->setText(0, "AGE PLAYERS"); ui->playersTree->insertTopLevelItem(0, agePlayersItem); agePlayersItem->setExpanded(true); buddiesItem = new QTreeWidgetItem(ui->playersTree); buddiesItem->setText(0, "BUDDIES"); buddiesItem->setExpanded(true); ui->playersTree->insertTopLevelItem(0, buddiesItem); neighborsItem = new QTreeWidgetItem(ui->playersTree); neighborsItem->setText(0, "NEIGHBORS"); ui->playersTree->insertTopLevelItem(0, neighborsItem); neighborsItem->setExpanded(true); QList<int> chatSizes; chatSizes.append(350); chatSizes.append(100); ui->chatSplitter->setSizes(chatSizes); ui->nodeEditor->setMgrs(getSDLMgr(), getResManager()); }