boost::shared_ptr<PointCloud> CloudList::loadFile(QString filename) { if(!QFileInfo(filename).exists()) return nullptr; boost::shared_ptr<PointCloud> pc; pc.reset(new PointCloud()); pc->moveToThread(QApplication::instance()->thread()); connect(pc.get(), SIGNAL(progress(int)), this, SIGNAL(progressUpdate(int))); pc->load_ptx(filename.toLocal8Bit().constData()); emit progressUpdate(0); disconnect(pc.get(), SIGNAL(progress(int)), this, SIGNAL(progressUpdate(int))); emit startNonDetJob(); addCloud(pc); emit endNonDetJob(); emit listModified(); return pc; }
//virtual override to move the item in our array and in the list // called after a successful drag and drop void CWListCtrl::finishDrag(int iFrom, int iTo) { CWListRowItem *p = (CWListRowItem *) GetItemData(iFrom); ASSERTX(p); // JDH 6/2/99 changed this check from an assert, so that if the user // drags a ListRowItem that is not an entry (e.g. an environment), we // just ignore the drag if(!p->IsKindOf(RUNTIME_CLASS(CWListEntry))) return; { CWListEntry *pEntry = (CWListEntry *) p; pEntry->doMoveToSlot(*this, iTo); listModified(); this->SetItemState(iTo, LVIS_SELECTED, LVIS_SELECTED); this->RedrawItems(iFrom<iTo?iFrom:iTo, this->GetItemCount()+1); } // CEditListCtrl::finishDrag(iFrom, iTo);// actually fix the display list now }
void CloudList::removeCloud(int idx) { boost::shared_ptr<PointCloud> pc = clouds_[idx]; if(pc == active_) active_.reset(); pc->deleting_ = true; emit deletingCloud(pc); //disconnect(pc.get(), SIGNAL(flagUpdate()), this, SIGNAL(updated())); //disconnect(pc.get(), SIGNAL(labelUpdate()), this, SIGNAL(updated())); disconnect(pc.get(), SIGNAL(transformed()), this, SIGNAL(updated())); beginRemoveRows(QModelIndex(), idx, idx); clouds_.erase(clouds_.begin()+idx); endRemoveRows(); active_.reset(); if(clouds_.size() > 0) active_ = clouds_.at(0); emit listModified(); emit updated(); }