void ProgressDialog::showProgressDialog(QOpenGLWidget *parent) { progressDialog = new QProgressDialog(parent); progressDialog->setWindowTitle("Image rendering progress"); progressDialog->setMinimumSize(300, 40); progressDialog->setCancelButton(NULL); progressDialog->show(); }
void FilesystemWidget::CheckIntegrity(const DiscIO::Partition& partition) { QProgressDialog* dialog = new QProgressDialog(this); std::future<bool> is_valid = std::async( std::launch::async, [this, partition] { return m_volume->CheckIntegrity(partition); }); dialog->setLabelText(tr("Verifying integrity of partition...")); dialog->setWindowFlags(dialog->windowFlags() & ~Qt::WindowContextHelpButtonHint); dialog->setWindowTitle(tr("Verifying partition")); dialog->setMinimum(0); dialog->setMaximum(0); dialog->show(); while (is_valid.wait_for(std::chrono::milliseconds(50)) != std::future_status::ready) QCoreApplication::processEvents(); dialog->close(); if (is_valid.get()) QMessageBox::information(nullptr, tr("Success"), tr("Integrity check completed. No errors have been found.")); else QMessageBox::critical(nullptr, tr("Error"), tr("Integrity check for partition failed. The disc image is most " "likely corrupted or has been patched incorrectly.")); }
bool downloadTracksFromOSM(QWidget* Main, const QString& aWeb, const QString& aUser, const QString& aPassword, const CoordBox& aBox , Document* theDocument) { Downloader theDownloader(aUser, aPassword); QList<TrackLayer*> theTracklayers; //TrackMapLayer* trackLayer = new TrackMapLayer(QApplication::translate("Downloader","Downloaded tracks")); //theDocument->add(trackLayer); IProgressWindow* aProgressWindow = dynamic_cast<IProgressWindow*>(Main); if (!aProgressWindow) return false; QProgressDialog* dlg = aProgressWindow->getProgressDialog(); dlg->setWindowTitle(QApplication::translate("Downloader","Parsing...")); QProgressBar* Bar = aProgressWindow->getProgressBar(); Bar->setTextVisible(false); Bar->setMaximum(11); QLabel* Lbl = aProgressWindow->getProgressLabel(); Lbl->setText(QApplication::translate("Downloader","Parsing XML")); if (dlg) dlg->show(); theDownloader.setAnimator(dlg,Lbl,Bar,true); for (int Page=0; ;++Page) { Lbl->setText(QApplication::translate("Downloader","Downloading trackpoints %1-%2").arg(Page*5000+1).arg(Page*5000+5000)); QString URL = theDownloader.getURLToTrackPoints(); URL = URL.arg(aBox.bottomLeft().x()). arg(aBox.bottomLeft().y()). arg(aBox.topRight().x()). arg(aBox.topRight().y()). arg(Page); QUrl theUrl(aWeb+URL); if (!theDownloader.go(theUrl)) return false; if (theDownloader.resultCode() != 200) return false; int Before = theTracklayers.size(); QByteArray Ar(theDownloader.content()); bool OK = importGPX(Main, Ar, theDocument, theTracklayers, true); if (!OK) return false; if (Before == theTracklayers.size()) break; theTracklayers[theTracklayers.size()-1]->setName(QApplication::translate("Downloader", "Downloaded track - nodes %1-%2").arg(Page*5000+1).arg(Page*5000+5000)); } return true; }
void Demo::OpenDialog() { QProgressDialog* dialog = new QProgressDialog(this); dialog->setLabelText("Nyan nyan nyan nyan"); dialog->setWindowTitle("Nyan nyan nyan nyan"); dialog->setCancelButtonText("Nooooooooo!"); dialog->setMinimumWidth(350); QTimer* timer = new QTimer(dialog); timer->setInterval(100); connect(timer, SIGNAL(timeout()), SLOT(DialogTimerFired())); connect(dialog, SIGNAL(canceled()), dialog, SLOT(deleteLater())); dialog->show(); timer->start(); }
void DatabaseWidget::readCsvBase(QString openFilename) { // QString currTime=QDateTime::currentDateTime().toString("dd.MM.yyyy hh:mm:ss.zzz"); // qDebug().noquote() << "readCsvBase BEGIN" // << currTime // << this->thread()->currentThreadId(); emit toDebug(objectName(), QString("Открывается файл '%1'.").arg(openFilename)); QString name = QFileInfo(openFilename).fileName(); if(!QFileInfo(openFilename).exists()) { emit toDebug(objectName(), QString("Файл '%1' не найден").arg(openFilename)); return; } QProgressDialog *dialog = new QProgressDialog; dialog->setWindowTitle(trUtf8("Обработка базы (1/3)")); dialog->setLabelText(trUtf8("Открывается файл \"%1\". \nОжидайте ...") .arg(name)); dialog->setCancelButtonText(trUtf8("Отмена")); QObject::connect(dialog, SIGNAL(canceled()), &_futureWatcher, SLOT(cancel())); QObject::connect(&_futureWatcher, SIGNAL(progressRangeChanged(int,int)), dialog, SLOT(setRange(int,int))); QObject::connect(&_futureWatcher, SIGNAL(progressValueChanged(int)), dialog, SLOT(setValue(int))); QObject::connect(&_futureWatcher, SIGNAL(finished()), dialog, SLOT(deleteLater())); QObject::connect(&_futureWatcher, SIGNAL(finished()), dialog, SLOT(hide())); QFuture<ListAddress> f1 = QtConcurrent::run( readFile, openFilename, MAX_OPEN_ROWS); // Start the computation. _futureWatcher.setFuture(f1); dialog->exec(); // currTime=QDateTime::currentDateTime().toString("dd.MM.yyyy hh:mm:ss.zzz"); // qDebug().noquote() << "readCsvBase END" // << currTime // << this->thread()->currentThreadId(); }
void TomahawkApp::onShutdownDelayed() { QProgressDialog* d = new QProgressDialog( tr( "Tomahawk is updating the database. Please wait, this may take a minute!" ), QString(), 0, 0, 0, Qt::Tool | Qt::WindowTitleHint | Qt::CustomizeWindowHint ); d->setModal( true ); d->setAutoClose( false ); d->setAutoReset( false ); d->setWindowTitle( tr( "Tomahawk" ) ); #ifdef Q_OS_MAC d->setAttribute( Qt::WA_MacAlwaysShowToolWindow ); #endif d->show(); }
void DatabaseWidget::onProcessOfOpenFinished() { if(_futureWatcher.isFinished() && !_futureWatcher.isCanceled()) { _paddr.reset(new ListAddress(_futureWatcher.future().result())); emit toDebug(objectName(), QString("Открытие файла успешно завершено. Прочитано строк = %1") .arg(_paddr.data()->size())); if(!_paddr.data()->isEmpty()) { // QString currTime=QDateTime::currentDateTime().toString("dd.MM.yyyy hh:mm:ss.zzz"); // qDebug().noquote() << "onProcessOfOpenFinished BEGIN" // << currTime // << this->thread()->currentThreadId(); emit toDebug(objectName(), QString("Начало обработки прочитанной базы.")); QProgressDialog *dialog = new QProgressDialog; dialog->setWindowTitle(trUtf8("Обработка базы (2/3)")); dialog->setLabelText(trUtf8("Обрабатывается файл. Строк: \"%1\". \nОжидайте ...") .arg(_paddr.data()->size())); dialog->setCancelButtonText(trUtf8("Отмена")); QObject::connect(dialog, SIGNAL(canceled()), &_futureWatcherParser, SLOT(cancel())); QObject::connect(&_futureWatcherParser, SIGNAL(progressRangeChanged(int,int)), dialog, SLOT(setRange(int,int))); QObject::connect(&_futureWatcherParser, SIGNAL(progressValueChanged(int)), dialog, SLOT(setValue(int))); QObject::connect(&_futureWatcherParser, SIGNAL(finished()), dialog, SLOT(deleteLater())); QFuture<void> f1 = QtConcurrent::map(*_paddr, parsingAddress ); // Start the computation. _futureWatcherParser.setFuture(f1); dialog->exec(); // currTime=QDateTime::currentDateTime().toString("dd.MM.yyyy hh:mm:ss.zzz"); // qDebug().noquote() << "onProcessOfOpenFinished END" // << currTime // << this->thread()->currentThreadId(); }
void MountainViewWidgetPrivate::update_clips_view(SSTimeSeriesWidget *W,SSTimeSeriesView *V,int label) { QProgressDialog dlg; dlg.setWindowTitle(QString("Extracting clips for template %1").arg(label)); dlg.setRange(0,100); dlg.show(); dlg.setLabelText(QString("Extracting clips for template %1...").arg(label)); dlg.setValue(0); dlg.repaint(); qApp->processEvents(); Mda clips=extract_clips(m_raw,m_times,m_labels,label); dlg.setLabelText("Formatting clips..."); dlg.setValue(50); dlg.repaint(); qApp->processEvents(); Mda clips2=format_clips(clips,m_template_view_padding); DiskArrayModel *MM=new DiskArrayModel; MM->setFromMda(clips2); dlg.setLabelText("Initializing..."); dlg.setValue(75); dlg.repaint(); qApp->processEvents(); V->setData(MM,true); V->initialize(); W->setClipData(clips); W->setWindowTitle(QString("Spike Clips -- template %1 -- %2 spikes").arg(label).arg(clips.N3())); }
bool AirportsData::import(QProgressDialog &progress, MainObject *mainObject){ QHash<QString, QString> airports; QString msg; QTime tm; int ms; progress.setValue(0); progress.setWindowTitle("Scanning Airport Directories"); progress.setRange(0, 50000); int c = 0; int found = 0; int air_added = 0; ms = tm.restart(); // Removing cache file, if exists() if (QFile::exists(mainObject->data_file("airports.txt"))) { outLog("*** FGx airportsdata reload: cache file exists!"); QFile::remove(mainObject->data_file("airports.txt")); outLog("*** FGx airportsdata reload: REMOVED AIRPORTS CACHE FILE"); } //= Cache File QFile cacheFile( mainObject->data_file("airports.txt") ); if(!cacheFile.open(QIODevice::WriteOnly | QIODevice::Text)){ //qDebug() << "TODO Open error cachce file="; return true; } QTextStream out(&cacheFile); msg = "FGx airportsdata reload: Scanning apt.dat.gz in " + mainObject->X->fgroot() + "/Airports/apt.dat.gz"; outLog(msg); airports = getAirportNameMap(mainObject); //================================================ //* Lets Loop the directories //* Get out aiports path from setings and get the the subdir also QDirIterator loopAirportsFiles( mainObject->X->airports_path(), QDirIterator::Subdirectories ); QString xFileName; msg = "FGx airportsdata reload: Scanning XML files in "+mainObject->X->airports_path(); outLog(msg); progress.setWindowTitle(msg); progress.setRange(0, 50000); // Check the fgfs additional argument list, // and/or any additional scenery path inputs // *** take care NOT to duplicate *** QStringList fgfs_args = mainObject->X->get_fgfs_args(); int i, ind; QDir d; QString path; #ifdef Q_OS_WIN QChar psep(';'); #else QChar psep(':'); #endif // AIIIIII, found the doubler !, said yves very very loud - well done said pete ;-) for (i = 0; i < fgfs_args.size(); i++) { msg = fgfs_args.at(i); ind = msg.indexOf(QChar('"')); if (ind == 0) msg = msg.mid(1,msg.length()-2); if (msg.indexOf("--fg-scenery=") == 0) { // got a scenery folder to scan msg = msg.mid(13); ind = msg.indexOf(QChar('"')); if (ind == 0) msg = msg.mid(1,msg.length()-2); QStringList path_list = msg.split(psep); int pathnumber = 0; for( QStringList::ConstIterator entry = path_list.begin(); entry != path_list.end(); entry++) { path = *entry; pathnumber = pathnumber + 1; if (d.exists(path)) { // we have a PATH to check, but we are ONLY checking 'Airports' if ( !(path.indexOf(QChar('/')) == (path.size()-1)) && !(path.indexOf(QChar('\\')) == (path.size()-1)) ) path.append("/"); path.append("Airports"); // XML is only in here if (!d.exists(path)) continue; QDirIterator loopFiles( path, QDirIterator::Subdirectories ); while (loopFiles.hasNext()) { //= Get file handle if there is one xFileName = loopFiles.next(); //= Check if file entry is a *.threshold.xml - cos this is what we want if(xFileName.endsWith(".threshold.xml") ){ //= Split out "CODE.threshold.xml" with a "." QFileInfo fileInfoThreshold(xFileName); QString airport_code = fileInfoThreshold.fileName().split(".").at(0); //* Update progress if(c % 100 == 0){ progress.setValue(c); progress.setLabelText(xFileName); progress.repaint(); } QString airport_name(""); if(airports.contains(airport_code)){ airport_name = airports.value(airport_code); } QStringList cols; // missing in middle is description ?? cols << airport_code << airport_name << fileInfoThreshold.absoluteDir().absolutePath() << QString::number(pathnumber); out << cols.join("\t").append("\n"); air_added++; found++; } if(progress.wasCanceled()){ progress.hide(); return true; } c++; } } } } } cacheFile.close(); msg.sprintf("*** FGx airportsdata reload: Walked %d files, found %d threshold.xml, appended %d to cache", c, found, air_added); outLog(msg+", in "+getElapTimeStg(tm.elapsed())); progress.hide(); return false; }
void createFakeData() { QStringList names; names << "Eabha Biddell" << "Prentice Hutchison" << "Rameesha Davidge" << "Digby Roson" << "Nettah Newarch" << "Lewisha Middleton" << "Ahmed Hanmer" << "Jordyn-Leigh Lamant" << "Lindsay Bigham" << "Kaylay Weir" << "Sofia Weir" << "Coel Spurlock" << "Youcef Culpan" << "Lucy-Jasmine Blanchard" << "Ally Hodgkin" << "Ara Collinge" << "Luka Dempster" << "Samanta Winster" << "Keri Palin" << "Ruiridh Bisset" << "Norman Epworth" << "Kezia Raw" << "Kaylan-Thomas Swynford" << "Kashaf Benning" << "Norma Yair" << "Edan Bassett" << "Akshat Mcglasson" << "Philippa Upton" << "Tylor Rockliff" << "Aqdas Buckman" << "Briana Dowell" << "Querida North" << "Chelsay Botts" << "Kishanth Calloway" << "Jan Covington" << "Teighan Monson" << "Claudia Mendel" << "Kerra Doe" << "Kara Depp" << "Harlie Soole" << "Viggo Streeter" << "Ava Cofel" << "Catherine Balderston" << "Brendan Gosnay" << "Zhaoyun Haygarth" << "Deri Pepler" << "Vicki Hopwood" << "Amitra Bindless" << "Cerhys Hayton" << "Gwendoline Westall"; QProgressDialog progress; progress.setWindowModality(Qt::WindowModal); progress.setWindowTitle(QObject::tr("Staff Manager")); progress.setLabelText(QObject::tr("Creating database...")); progress.setMinimum(0); progress.setMaximum(names.count() + 6); progress.setValue(1); qApp->processEvents(); QSqlQuery query; query.exec("DROP TABLE department"); query.exec("DROP TABLE employee"); query.exec("DROP TABLE location"); progress.setValue(2); qApp->processEvents(); query.exec("CREATE TABLE location (" "id INTEGER PRIMARY KEY AUTOINCREMENT, " "name VARCHAR(40) NOT NULL)"); progress.setValue(3); qApp->processEvents(); query.exec("CREATE TABLE department (" "id INTEGER PRIMARY KEY AUTOINCREMENT, " "name VARCHAR(40) NOT NULL, " "locationid INTEGER NOT NULL, " "FOREIGN KEY (locationid) REFERENCES location)"); progress.setValue(4); qApp->processEvents(); query.exec("CREATE TABLE employee (" "id INTEGER PRIMARY KEY AUTOINCREMENT, " "name VARCHAR(40) NOT NULL, " "departmentid INTEGER NOT NULL, " "extension INTEGER NOT NULL, " "email VARCHAR(40) NOT NULL, " "startdate DATE NOT NULL, " "FOREIGN KEY (departmentid) REFERENCES department)"); progress.setValue(5); qApp->processEvents(); query.exec("INSERT INTO location (name) VALUES (" "'Floor 18, 1129 Evanston Heights, New York, NY')"); query.exec("INSERT INTO location (name) VALUES (" "'The Shed, Elmtree Drive, Boston, MA')"); query.exec("INSERT INTO location (name) VALUES (" "'14 Valentine Buildings, Amor Street, Cambridge, MA')"); query.exec("INSERT INTO location (name) VALUES (" "'Bunker Building, Silo Avenue, Los Angeles, CA')"); query.exec("INSERT INTO department (name, locationid) VALUES (" "'Sales', 1)"); query.exec("INSERT INTO department (name, locationid) VALUES (" "'Marketing', 2)"); query.exec("INSERT INTO department (name, locationid) VALUES (" "'Processing', 1)"); query.exec("INSERT INTO department (name, locationid) VALUES (" "'Support', 4)"); query.exec("INSERT INTO department (name, locationid) VALUES (" "'Research', 3)"); progress.setValue(6); qApp->processEvents(); int count = 0; query.prepare("INSERT INTO employee (name, departmentid, " "extension, email, startdate) " "VALUES (:name, :departmentid, :extension, " ":email, :startdate)"); foreach (QString name, names) { query.bindValue(":name", name); query.bindValue(":departmentid", 1 + (std::rand() % 5)); query.bindValue(":extension", 400 + (std::rand() % 100)); query.bindValue(":email", name.toLower().replace(" ", ".") + "@company.com"); query.bindValue(":startdate", QDate::currentDate().addDays(-(std::rand() % 3600))); query.exec(); ++count; progress.setValue(count + 6); }
int QgsImageWarper::warpFile( const QString& input, const QString& output, const QgsGeorefTransform &georefTransform, ResamplingMethod resampling, bool useZeroAsTrans, const QString& compression, const QString &projection, double destResX, double destResY ) { if ( !georefTransform.parametersInitialized() ) return false; CPLErr eErr; GDALDatasetH hSrcDS, hDstDS; GDALWarpOptions *psWarpOptions; if ( !openSrcDSAndGetWarpOpt( input, resampling, georefTransform.GDALTransformer(), hSrcDS, psWarpOptions ) ) { // TODO: be verbose about failures return false; } double adfGeoTransform[6]; int destPixels, destLines; eErr = GDALSuggestedWarpOutput( hSrcDS, georefTransform.GDALTransformer(), georefTransform.GDALTransformerArgs(), adfGeoTransform, &destPixels, &destLines ); if ( eErr != CE_None ) { GDALClose( hSrcDS ); GDALDestroyWarpOptions( psWarpOptions ); return false; } // If specified, override the suggested resolution with user values if ( destResX != 0.0 || destResY != 0.0 ) { // If only one scale has been specified, fill in the other from the GDAL suggestion if ( destResX == 0.0 ) destResX = adfGeoTransform[1]; if ( destResY == 0.0 ) destResY = adfGeoTransform[5]; // Make sure user-specified coordinate system has canonical orientation if ( destResX < 0.0 ) destResX = -destResX; if ( destResY > 0.0 ) destResY = -destResY; // Assert that the north-up convention is fullfiled by GDALSuggestedWarpOutput (should always be the case) assert( adfGeoTransform[0] > 0.0 ); assert( adfGeoTransform[5] < 0.0 ); // Find suggested output image extent (in georeferenced units) double minX = adfGeoTransform[0]; double maxX = adfGeoTransform[0] + adfGeoTransform[1] * destPixels; double maxY = adfGeoTransform[3]; double minY = adfGeoTransform[3] + adfGeoTransform[5] * destLines; // Update line and pixel count to match extent at user-specified resolution destPixels = ( int )((( maxX - minX ) / destResX ) + 0.5 ); destLines = ( int )((( minY - maxY ) / destResY ) + 0.5 ); adfGeoTransform[0] = minX; adfGeoTransform[3] = maxY; adfGeoTransform[1] = destResX; adfGeoTransform[5] = destResY; } if ( !createDestinationDataset( output, hSrcDS, hDstDS, destPixels, destLines, adfGeoTransform, useZeroAsTrans, compression, projection ) ) { GDALClose( hSrcDS ); GDALDestroyWarpOptions( psWarpOptions ); return false; } // Create a QT progress dialog QProgressDialog *progressDialog = new QProgressDialog( mParent ); progressDialog->setWindowTitle( tr( "Progress indication" ) ); progressDialog->setRange( 0, 100 ); progressDialog->setAutoClose( true ); progressDialog->setModal( true ); progressDialog->setMinimumDuration( 0 ); // Set GDAL callbacks for the progress dialog psWarpOptions->pProgressArg = createWarpProgressArg( progressDialog ); psWarpOptions->pfnProgress = updateWarpProgress; psWarpOptions->hSrcDS = hSrcDS; psWarpOptions->hDstDS = hDstDS; // Create a transformer which transforms from source to destination pixels (and vice versa) psWarpOptions->pfnTransformer = GeoToPixelTransform; psWarpOptions->pTransformerArg = addGeoToPixelTransform( georefTransform.GDALTransformer(), georefTransform.GDALTransformerArgs(), adfGeoTransform ); // Initialize and execute the warp operation. GDALWarpOperation oOperation; oOperation.Initialize( psWarpOptions ); progressDialog->show(); progressDialog->raise(); progressDialog->activateWindow(); eErr = oOperation.ChunkAndWarpImage( 0, 0, destPixels, destLines ); // eErr = oOperation.ChunkAndWarpMulti(0, 0, destPixels, destLines); destroyGeoToPixelTransform( psWarpOptions->pTransformerArg ); GDALDestroyWarpOptions( psWarpOptions ); delete progressDialog; GDALClose( hSrcDS ); GDALClose( hDstDS ); return mWarpCanceled ? -1 : eErr == CE_None ? 1 : 0; }
void qCSF::doAction() { //m_app should have already been initialized by CC when plugin is loaded! //(--> pure internal check) assert(m_app); if (!m_app) return; if ( !m_app->haveOneSelection() ) { m_app->dispToConsole("Select only one cloud!", ccMainAppInterface::ERR_CONSOLE_MESSAGE); return; } const ccHObject::Container& selectedEntities = m_app->getSelectedEntities(); ccHObject* ent = selectedEntities[0]; assert(ent); if (!ent || !ent->isA(CC_TYPES::POINT_CLOUD)) { m_app->dispToConsole("Select a real point cloud!", ccMainAppInterface::ERR_CONSOLE_MESSAGE); return; } //to get the point cloud from selected entity. ccPointCloud* pc = static_cast<ccPointCloud*>(ent); //Convert CC point cloud to CSF type unsigned count = pc->size(); wl::PointCloud csfPC; try { csfPC.reserve(count); } catch (const std::bad_alloc&) { m_app->dispToConsole("Not enough memory!", ccMainAppInterface::ERR_CONSOLE_MESSAGE); return; } for (unsigned i = 0; i < count; i++) { const CCVector3* P = pc->getPoint(i); wl::Point tmpPoint; //tmpPoint.x = P->x; //tmpPoint.y = P->y; //tmpPoint.z = P->z; tmpPoint.x = P->x; tmpPoint.y = -P->z; tmpPoint.z = P->y; csfPC.push_back(tmpPoint); } //initial dialog parameters static bool csf_postprocessing = false; static double cloth_resolution = 2; static double class_threshold = 0.5; static int csf_rigidness = 2; static int MaxIteration = 500; static bool ExportClothMesh = false; // display the dialog { ccCSFDlg csfDlg(m_app->getMainWindow()); csfDlg.postprocessingcheckbox->setChecked(csf_postprocessing); csfDlg.rig1->setChecked(csf_rigidness == 1); csfDlg.rig2->setChecked(csf_rigidness == 2); csfDlg.rig3->setChecked(csf_rigidness == 3); csfDlg.MaxIterationSpinBox->setValue(MaxIteration); csfDlg.cloth_resolutionSpinBox->setValue(cloth_resolution); csfDlg.class_thresholdSpinBox->setValue(class_threshold); csfDlg.exportClothMeshCheckBox->setChecked(ExportClothMesh); if (!csfDlg.exec()) { return; } //save the parameters for next time csf_postprocessing = csfDlg.postprocessingcheckbox->isChecked(); if (csfDlg.rig1->isChecked()) csf_rigidness = 1; else if (csfDlg.rig2->isChecked()) csf_rigidness = 2; else csf_rigidness = 3; MaxIteration = csfDlg.MaxIterationSpinBox->value(); cloth_resolution = csfDlg.cloth_resolutionSpinBox->value(); class_threshold = csfDlg.class_thresholdSpinBox->value(); ExportClothMesh = csfDlg.exportClothMeshCheckBox->isChecked(); } //display the progress dialog QProgressDialog pDlg; pDlg.setWindowTitle("CSF"); pDlg.setLabelText("Computing...."); pDlg.setCancelButton(0); pDlg.show(); QApplication::processEvents(); QElapsedTimer timer; timer.start(); //instantiation a CSF class CSF csf(csfPC); // setup parameter csf.params.k_nearest_points = 1; csf.params.bSloopSmooth = csf_postprocessing; csf.params.time_step = 0.65; csf.params.class_threshold = class_threshold; csf.params.cloth_resolution = cloth_resolution; csf.params.rigidness = csf_rigidness; csf.params.iterations = MaxIteration; //to do filtering std::vector<int> groundIndexes, offGroundIndexes; ccMesh* clothMesh = 0; if (!csf.do_filtering(groundIndexes, offGroundIndexes, ExportClothMesh, clothMesh, m_app)) { m_app->dispToConsole("Process failed", ccMainAppInterface::ERR_CONSOLE_MESSAGE); return; } m_app->dispToConsole(QString("[CSF] %1% of points classified as ground points").arg((groundIndexes.size() * 100.0) / count, 0, 'f', 2), ccMainAppInterface::STD_CONSOLE_MESSAGE); m_app->dispToConsole(QString("[CSF] Timing: %1 s.").arg(timer.elapsed() / 1000.0, 0, 'f', 1), ccMainAppInterface::STD_CONSOLE_MESSAGE); //extract ground subset ccPointCloud* groundpoint = 0; { CCLib::ReferenceCloud groundpc(pc); if (groundpc.reserve(static_cast<unsigned>(groundIndexes.size()))) { for (unsigned j = 0; j < groundIndexes.size(); ++j) { groundpc.addPointIndex(groundIndexes[j]); } groundpoint = pc->partialClone(&groundpc); } } if (!groundpoint) { m_app->dispToConsole("Failed to extract the ground subset (not enough memory)", ccMainAppInterface::WRN_CONSOLE_MESSAGE); } //extract off-ground subset ccPointCloud* offgroundpoint = 0; { CCLib::ReferenceCloud offgroundpc(pc); if (offgroundpc.reserve(static_cast<unsigned>(offGroundIndexes.size()))) { for (unsigned k = 0; k < offGroundIndexes.size(); ++k) { offgroundpc.addPointIndex(offGroundIndexes[k]); } offgroundpoint = pc->partialClone(&offgroundpc); } } if (!offgroundpoint) { m_app->dispToConsole("Failed to extract the off-ground subset (not enough memory)", ccMainAppInterface::WRN_CONSOLE_MESSAGE); if (!groundpoint) { //nothing to do! return; } } pDlg.hide(); QApplication::processEvents(); //hide the original cloud pc->setEnabled(false); //we add new group to DB/display ccHObject* cloudContainer = new ccHObject(pc->getName() + QString("_csf")); if (groundpoint) { groundpoint->setVisible(true); groundpoint->setName("ground points"); cloudContainer->addChild(groundpoint); } if (offgroundpoint) { offgroundpoint->setVisible(true); offgroundpoint->setName("off-ground points"); cloudContainer->addChild(offgroundpoint); } if (clothMesh) { clothMesh->computePerVertexNormals(); clothMesh->showNormals(true); cloudContainer->addChild(clothMesh); } m_app->addToDB(cloudContainer); m_app->refreshAll(); }
bool AircraftData::import(QProgressDialog &progress, MainObject *mainObject){ int c = 0; int found = 0; progress.setRange(0, 2000); progress.setWindowTitle("Scanning Aircraft Directories"); progress.show(); progress.repaint(); //= Cache File QFile cacheFile( mainObject->data_file("aircraft.txt") ); if(!cacheFile.open(QIODevice::WriteOnly | QIODevice::Text)){ //qDebug() << "TODO Open error cachce file="; return true; } QTextStream out(&cacheFile); //= Get files Entries from Aircaft/ directory QDir aircraftDir( mainObject->X->aircraft_path() ); aircraftDir.setFilter( QDir::Dirs | QDir::NoSymLinks | QDir::NoDotAndDotDot); QStringList entries = aircraftDir.entryList(); progress.setRange(0, entries.size() + 20); for( QStringList::ConstIterator entry=entries.begin(); entry!=entries.end(); ++entry ){ // Filter out default dir names, should be a QDir name filter? if (*entry != "Instruments" && *entry != "Instruments-3d" && *entry != "Generic") { progress.setValue(c); progress.setLabelText(*entry); progress.repaint(); //** get the List of *-set.xml files in dir QDir dir( mainObject->X->aircraft_path(*entry) ); QStringList filters; filters << "*-set.xml"; QStringList list_xml = dir.entryList(filters); if(list_xml.count() > 0){ // << Scan MOdels QString directory; QString description; QString author; QString fdm; QString xml_file; QString aero; //** Add Path Node directory = QString(*entry); //** Add Models for (int i = 0; i < list_xml.size(); ++i){ xml_file = QString(list_xml.at(i)); aero = QString(xml_file); aero.chop(8); //*=parse the Xml file - f&*& long winded QString file_path = mainObject->X->aircraft_path(*entry); file_path.append("/"); file_path.append(list_xml.at(i)); QFile xmlFile( file_path); if (xmlFile.open(QIODevice::ReadOnly | QIODevice::Text)){ /* The file content is converted to UTF-8. Some files are Windows, encoding and throw error with QxmlQuery etc Its a hack and don't quite understand whats happening.. said pedro */ QString xmlString = QString(xmlFile.readAll()).toUtf8(); QXmlQuery query; query.setFocus(xmlString); //query.setFocus(&xmlFile); << Because file is not QTF8 using sting instead query.setQuery("PropertyList/sim"); if (query.isValid()){ QString res; query.evaluateTo(&res); xmlFile.close(); QDomDocument dom; dom.setContent("" + res + ""); QDomNodeList nodes = dom.elementsByTagName("sim"); QDomNode n = nodes.at(0); description = n.firstChildElement("description").text(); author = n.firstChildElement("author").text().trimmed().replace(("\n"),""); fdm = n.firstChildElement("flight-model").text(); } /* !query.isValid() */ } /* xmlFile.open() */ QStringList lines; lines << directory << aero << xml_file << description << fdm << author << file_path; out << lines.join("\t") << "\n"; found++; if(progress.wasCanceled()){ //qDebug() << "Progress cancelled!"; progress.hide(); return true; } c++; } } /* list_xml.count() > 0 */ } /* entry != INstruments etc */ } /* loop entries.() */ cacheFile.close(); return false; }
void Uploading::uploadingProcess(const QString &actionId) { { QProgressDialog progressDialog; progressDialog.setWindowModality(Qt::WindowModal); progressDialog.setWindowTitle(tr("Выгрузка базы данных")); progressDialog.setLabelText(tr("Процесс выгрузки базы данных")); progressDialog.setCancelButton(0); progressDialog.setMinimumDuration(0); progressDialog.setMaximum(6); progressDialog.setValue(0); QSqlDatabase db = QSqlDatabase::database(UPLOADING); createDBScheme(); progressDialog.setValue(1); QApplication::processEvents(QEventLoop::ExcludeUserInputEvents); QSqlQuery selectDataQuery(QSqlDatabase::database(mConnection)); QSqlQuery insertDataQuery(db); if(selectDataQuery.exec("SELECT id, title, performer FROM Actions WHERE id = " + actionId)) { insertDataQuery.prepare("INSERT INTO Actions VALUES(:id, :title, :performer);"); while(selectDataQuery.next()) { insertDataQuery.bindValue(":id", selectDataQuery.value(0)); insertDataQuery.bindValue(":title", selectDataQuery.value(1)); insertDataQuery.bindValue(":performer", selectDataQuery.value(2)); insertDataQuery.exec(); } } progressDialog.setValue(2); QList<int> placeSchemeIds; QList<int> clientIds; if(selectDataQuery.exec("SELECT id, id_action, id_placeScheme, id_client, identifier FROM Tickets WHERE id_action = " + actionId)) { insertDataQuery.prepare("INSERT INTO Tickets VALUES(NULL, :id_action, :id_placeScheme, :id_client, :identifier, :passedFlag);"); while(selectDataQuery.next()) { insertDataQuery.bindValue(":id_action", selectDataQuery.value(1)); insertDataQuery.bindValue(":id_placeScheme", selectDataQuery.value(2)); insertDataQuery.bindValue(":id_client", selectDataQuery.value(3)); insertDataQuery.bindValue(":identifier", selectDataQuery.value(4)); insertDataQuery.bindValue(":passedFlag", "false"); insertDataQuery.exec(); if(selectDataQuery.isNull(2) == false) placeSchemeIds.append(selectDataQuery.value(2).toInt()); if(selectDataQuery.isNull(3) == false) clientIds.append(selectDataQuery.value(4).toInt()); } } progressDialog.setValue(3); if(placeSchemeIds.isEmpty() == false) { if(selectDataQuery.exec("SELECT id, seatNumber, row FROM PlaceSchemes")) { insertDataQuery.prepare("INSERT INTO PlaceSchemes VALUES(:id, :seatNumber, :row)"); while(selectDataQuery.next()) { if(placeSchemeIds.contains( selectDataQuery.value(0).toInt()) ) { insertDataQuery.bindValue(":id", selectDataQuery.value(0)); insertDataQuery.bindValue(":seatNumber", selectDataQuery.value(1)); insertDataQuery.bindValue(":row", selectDataQuery.value(2)); insertDataQuery.exec(); } } } } progressDialog.setValue(4); if(clientIds.isEmpty() == false) { if(selectDataQuery.exec("SELECT id, name, login FROM Clients")) { insertDataQuery.prepare("INSERT INTO Clients VALUES(:id, :name, :login)"); while(selectDataQuery.next()) { if(clientIds.contains( selectDataQuery.value(0).toInt() )) { insertDataQuery.bindValue(":id", selectDataQuery.value(0)); insertDataQuery.bindValue(":name", selectDataQuery.value(1)); insertDataQuery.bindValue(":login", selectDataQuery.value(2)); insertDataQuery.exec(); } } } } progressDialog.setValue(5); if(selectDataQuery.exec("SELECT id, id_client, identifier FROM ReturnedTickets WHERE id_action = " + actionId)) { insertDataQuery.prepare("INSERT INTO ReturnedTickets VALUES(NULL, :id_client, :identifier);"); while(selectDataQuery.next()) { insertDataQuery.bindValue(":id_client", selectDataQuery.value(1)); insertDataQuery.bindValue(":identifier", selectDataQuery.value(2)); insertDataQuery.exec(); } } progressDialog.setValue(6); progressDialog.close(); db.close(); } QSqlDatabase::removeDatabase(UPLOADING); }
void MainWindow::importFile() { QFile loadfile(filename); loadfile.open(QIODevice::ReadOnly); QDataStream ls(&loadfile); ls.setByteOrder(QDataStream::BigEndian); ls.device()->seek(3200); Reel.ReadREEL(ls); //Max_XLine=Max_YLine=Min_XLine=Min_YLine=0; DBTrace t; int xLine; //主测线号XLINE int oldxLine; int inLine; //inLine 号 int temp,_temp,N; temp =_temp=0; N=0; QFile writefile(filename+tr("_db")); writefile.open(QIODevice::WriteOnly); QDataStream ws(&writefile); QProgressDialog *pdg = new QProgressDialog(this); QFont font("Times",10,QFont::Bold); pdg->setFont(font); pdg->setWindowModality(Qt::WindowModal); pdg->setWindowTitle(tr("导入SEGY文件")); pdg->setLabelText(tr("扫描SEGY数据")); pdg->setCancelButtonText(tr("取消")); pdg->setRange(0,Reel.TotalTraces); pdg->setMinimumDuration(500); int HNS = Reel.hns; int DataType = Reel.DataType; xLine = oldxLine = 0; pdg->setValue(0); qApp->processEvents(); for( int i = 0; i < Reel.TotalTraces; i ++) { double fp = 3600.0 + 8.0 + double(i)*double(HNS*DataType + 240.0); pdg->setValue(i+1); qApp->processEvents(); if (pdg->wasCanceled()) { break; } ws<<i; ls.device()->seek(fp); ls >>xLine; ls.device()->seek(fp+12.0); ls>>inLine; t.fp = i; t.in = xLine; t.cross = inLine; t.st = 0; t.et = Reel.hns*Reel.hdt/1000; CdbTrace->AddData(t); if( i == 0 ) { Max_XLine = xLine; Min_XLine = xLine; Max_YLine = inLine; Min_YLine = inLine; } else { if( xLine > Max_XLine ) Max_XLine = xLine; if( xLine < Min_XLine ) Min_XLine = xLine; if( inLine > Max_YLine ) Max_YLine = inLine; if( inLine < Min_YLine ) Min_YLine = inLine; } } loadfile.close(); /**/ reelAction->setEnabled(true); traceAction->setEnabled(true); dataAction->setEnabled(true); }
bool QgsSLConnectionItem::handleDrop( const QMimeData * data, Qt::DropAction ) { if ( !QgsMimeDataUtils::isUriList( data ) ) return false; // TODO: probably should show a GUI with settings etc QgsDataSourceURI destUri; destUri.setDatabase( mDbPath ); qApp->setOverrideCursor( Qt::WaitCursor ); QProgressDialog *progress = new QProgressDialog( tr( "Copying features..." ), tr( "Abort" ), 0, 0, nullptr ); progress->setWindowTitle( tr( "Import layer" ) ); progress->setWindowModality( Qt::WindowModal ); progress->show(); QStringList importResults; bool hasError = false; bool cancelled = false; QgsMimeDataUtils::UriList lst = QgsMimeDataUtils::decodeUriList( data ); Q_FOREACH ( const QgsMimeDataUtils::Uri& u, lst ) { if ( u.layerType != "vector" ) { importResults.append( tr( "%1: Not a vector layer!" ).arg( u.name ) ); hasError = true; // only vectors can be imported continue; } // open the source layer QgsVectorLayer* srcLayer = new QgsVectorLayer( u.uri, u.name, u.providerKey ); if ( srcLayer->isValid() ) { destUri.setDataSource( QString(), u.name, srcLayer->geometryType() != Qgis::NoGeometry ? "geom" : QString() ); QgsDebugMsg( "URI " + destUri.uri() ); QgsVectorLayerImport::ImportError err; QString importError; err = QgsVectorLayerImport::importLayer( srcLayer, destUri.uri(), "spatialite", srcLayer->crs(), false, &importError, false, nullptr, progress ); if ( err == QgsVectorLayerImport::NoError ) importResults.append( tr( "%1: OK!" ).arg( u.name ) ); else if ( err == QgsVectorLayerImport::ErrUserCancelled ) cancelled = true; else { importResults.append( QString( "%1: %2" ).arg( u.name, importError ) ); hasError = true; } } else { importResults.append( tr( "%1: OK!" ).arg( u.name ) ); hasError = true; } delete srcLayer; } delete progress; qApp->restoreOverrideCursor(); if ( cancelled ) { QMessageBox::information( nullptr, tr( "Import to SpatiaLite database" ), tr( "Import cancelled." ) ); refresh(); } else if ( hasError ) { QgsMessageOutput *output = QgsMessageOutput::createMessageOutput(); output->setTitle( tr( "Import to SpatiaLite database" ) ); output->setMessage( tr( "Failed to import some layers!\n\n" ) + importResults.join( "\n" ), QgsMessageOutput::MessageText ); output->showMessage(); } else { QMessageBox::information( nullptr, tr( "Import to SpatiaLite database" ), tr( "Import was successful." ) ); refresh(); } return true; }
void scan3d::reconstruct_model_simple(Pointcloud & pointcloud, CalibrationData const& calib, cv::Mat const& pattern_image, cv::Mat const& min_max_image, cv::Mat const& color_image, cv::Size const& projector_size, int threshold, double max_dist, QWidget * parent_widget) { if (!pattern_image.data || pattern_image.type()!=CV_32FC2) { //pattern not correctly decoded std::cerr << "[reconstruct_model] ERROR invalid pattern_image\n"; return; } if (!min_max_image.data || min_max_image.type()!=CV_8UC2) { //pattern not correctly decoded std::cerr << "[reconstruct_model] ERROR invalid min_max_image\n"; return; } if (color_image.data && color_image.type()!=CV_8UC3) { //not standard RGB image std::cerr << "[reconstruct_model] ERROR invalid color_image\n"; return; } if (!calib.is_valid()) { //invalid calibration return; } //parameters //const unsigned threshold = config.value("main/shadow_threshold", 70).toUInt(); //const double max_dist = config.value("main/max_dist_threshold", 40).toDouble(); //const bool remove_background = config.value("main/remove_background", true).toBool(); //const double plane_dist = config.value("main/plane_dist", 100.0).toDouble(); double plane_dist = 100.0; /* background removal cv::Point2i plane_coord[3]; plane_coord[0] = cv::Point2i(config.value("background_plane/x1").toUInt(), config.value("background_plane/y1").toUInt()); plane_coord[1] = cv::Point2i(config.value("background_plane/x2").toUInt(), config.value("background_plane/y2").toUInt()); plane_coord[2] = cv::Point2i(config.value("background_plane/x3").toUInt(), config.value("background_plane/y3").toUInt()); if (plane_coord[0].x<=0 || plane_coord[0].x>=pattern_local.cols || plane_coord[0].y<=0 || plane_coord[0].y>=pattern_local.rows) { plane_coord[0] = cv::Point2i(50, 50); config.setValue("background_plane/x1", plane_coord[0].x); config.setValue("background_plane/y1", plane_coord[0].y); } if (plane_coord[1].x<=0 || plane_coord[1].x>=pattern_local.cols || plane_coord[1].y<=0 || plane_coord[1].y>=pattern_local.rows) { plane_coord[1] = cv::Point2i(50, pattern_local.rows-50); config.setValue("background_plane/x2", plane_coord[1].x); config.setValue("background_plane/y2", plane_coord[1].y); } if (plane_coord[2].x<=0 || plane_coord[2].x>=pattern_local.cols || plane_coord[2].y<=0 || plane_coord[2].y>=pattern_local.rows) { plane_coord[2] = cv::Point2i(pattern_local.cols-50, 50); config.setValue("background_plane/x3", plane_coord[2].x); config.setValue("background_plane/y3", plane_coord[2].y); } */ //init point cloud int scale_factor = 1; int out_cols = pattern_image.cols/scale_factor; int out_rows = pattern_image.rows/scale_factor; pointcloud.clear(); pointcloud.init_points(out_rows, out_cols); pointcloud.init_color(out_rows, out_cols); //progress QProgressDialog * progress = NULL; if (parent_widget) { progress = new QProgressDialog("Reconstruction in progress.", "Abort", 0, pattern_image.rows, parent_widget, Qt::Dialog|Qt::CustomizeWindowHint|Qt::WindowCloseButtonHint); progress->setWindowModality(Qt::WindowModal); progress->setWindowTitle("Processing"); progress->setMinimumWidth(400); } //take 3 points in back plane /*cv::Mat plane; if (remove_background) { cv::Point3d p[3]; for (unsigned i=0; i<3;i++) { for (unsigned j=0; j<10 && ( INVALID(pattern_local.at<cv::Vec2f>(plane_coord[i].y, plane_coord[i].x)[0]) || INVALID(pattern_local.at<cv::Vec2f>(plane_coord[i].y, plane_coord[i].x)[1])); j++) { plane_coord[i].x += 1.f; } const cv::Vec2f & pattern = pattern_local.at<cv::Vec2f>(plane_coord[i].y, plane_coord[i].x); const float col = pattern[0]; const float row = pattern[1]; if (projector_size.width<=static_cast<int>(col) || projector_size.height<=static_cast<int>(row)) { //abort continue; } //shoot a ray through the image: u=\lambda*v + q cv::Point3d u1 = camera.to_world_coord(plane_coord[i].x, plane_coord[i].y); cv::Point3d v1 = camera.world_ray(plane_coord[i].x, plane_coord[i].y); //shoot a ray through the projector: u=\lambda*v + q cv::Point3d u2 = projector.to_world_coord(col, row); cv::Point3d v2 = projector.world_ray(col, row); //compute ray-ray approximate intersection double distance = 0.0; p[i] = geometry::approximate_ray_intersection(v1, u1, v2, u2, &distance); std::cout << "Plane point " << i << " distance " << distance << std::endl; } plane = geometry::get_plane(p[0], p[1], p[2]); if (cv::Mat(plane.rowRange(0,3).t()*cv::Mat(cv::Point3d(p[0].x, p[0].y, p[0].z-1.0)) + plane.at<double>(3,0)).at<double>(0,0) <0.0) { plane = -1.0*plane; } std::cout << "Background plane: " << plane << std::endl; } */ cv::Mat Rt = calib.R.t(); unsigned good = 0; unsigned bad = 0; unsigned invalid = 0; unsigned repeated = 0; for (int h=0; h<pattern_image.rows; h+=scale_factor) { if (progress && h%4==0) { progress->setValue(h); progress->setLabelText(QString("Reconstruction in progress: %1 good points/%2 bad points").arg(good).arg(bad)); QApplication::instance()->processEvents(); } if (progress && progress->wasCanceled()) { //abort pointcloud.clear(); return; } register const cv::Vec2f * curr_pattern_row = pattern_image.ptr<cv::Vec2f>(h); register const cv::Vec2b * min_max_row = min_max_image.ptr<cv::Vec2b>(h); for (register int w=0; w<pattern_image.cols; w+=scale_factor) { double distance = max_dist; //quality meassure cv::Point3d p; //reconstructed point //cv::Point3d normal(0.0, 0.0, 0.0); const cv::Vec2f & pattern = curr_pattern_row[w]; const cv::Vec2b & min_max = min_max_row[w]; if (sl::INVALID(pattern) || pattern[0]<0.f || pattern[1]<0.f || (min_max[1]-min_max[0])<static_cast<int>(threshold)) { //skip invalid++; continue; } const float col = pattern[0]; const float row = pattern[1]; if (projector_size.width<=static_cast<int>(col) || projector_size.height<=static_cast<int>(row)) { //abort continue; } cv::Vec3f & cloud_point = pointcloud.points.at<cv::Vec3f>(h/scale_factor, w/scale_factor); if (!sl::INVALID(cloud_point[0])) { //point already reconstructed! repeated++; continue; } //standard cv::Point2d p1(w, h); cv::Point2d p2(col, row); triangulate_stereo(calib.cam_K, calib.cam_kc, calib.proj_K, calib.proj_kc, Rt, calib.T, p1, p2, p, &distance); //save texture coordinates /* normal.x = static_cast<float>(w)/static_cast<float>(color_image.cols); normal.y = static_cast<float>(h)/static_cast<float>(color_image.rows); normal.z = 0; */ if (distance < max_dist) { //good point //evaluate the plane double d = plane_dist+1; /*if (remove_background) { d = cv::Mat(plane.rowRange(0,3).t()*cv::Mat(p) + plane.at<double>(3,0)).at<double>(0,0); }*/ if (d>plane_dist) { //object point, keep good++; cloud_point[0] = p.x; cloud_point[1] = p.y; cloud_point[2] = p.z; //normal /*cpoint.normal_x = normal.x; cpoint.normal_y = normal.y; cpoint.normal_z = normal.z;*/ if (color_image.data) { const cv::Vec3b & vec = color_image.at<cv::Vec3b>(h, w); cv::Vec3b & cloud_color = pointcloud.colors.at<cv::Vec3b>(h/scale_factor, w/scale_factor); cloud_color[0] = vec[0]; cloud_color[1] = vec[1]; cloud_color[2] = vec[2]; } } } else { //skip bad++; //std::cout << " d = " << distance << std::endl; } } //for each column } //for each row if (progress) { progress->setValue(pattern_image.rows); progress->close(); delete progress; progress = NULL; } std::cout << "Reconstructed points[simple]: " << good << " (" << bad << " skipped, " << invalid << " invalid) " << std::endl << " - repeated points: " << repeated << " (ignored) " << std::endl; }
bool downloadOpenstreetbugs(MainWindow* Main, const CoordBox& aBox, Document* theDocument, SpecialLayer* theLayer) { QUrl osbUrl; osbUrl.setUrl(M_PREFS->getOpenStreetBugsUrl()); osbUrl.setPath(osbUrl.path() + "getGPX"); if (Main) Main->view()->setUpdatesEnabled(false); Downloader theDownloader("", ""); QList<TrackLayer*> theTracklayers; SpecialLayer* trackLayer = theLayer; if (!trackLayer) { SpecialLayer* trackLayer = new SpecialLayer(QApplication::translate("Downloader","OpenStreetBugs"),Layer::OsmBugsLayer); trackLayer->setUploadable(false); theDocument->add(trackLayer); } theTracklayers << trackLayer; IProgressWindow* aProgressWindow = dynamic_cast<IProgressWindow*>(Main); if (!aProgressWindow) return false; QProgressDialog* dlg = aProgressWindow->getProgressDialog(); dlg->setWindowTitle(QApplication::translate("Downloader","Parsing...")); QProgressBar* Bar = aProgressWindow->getProgressBar(); Bar->setTextVisible(false); Bar->setMaximum(11); QLabel* Lbl = aProgressWindow->getProgressLabel(); Lbl->setText(QApplication::translate("Downloader","Parsing XML")); if (dlg) dlg->show(); theDownloader.setAnimator(dlg,Lbl,Bar,true); Lbl->setText(QApplication::translate("Downloader","Downloading points")); #if QT_VERSION >= QT_VERSION_CHECK(5,0,0) QUrlQuery theQuery(osbUrl); #define theQuery theQuery #else #define theQuery osbUrl #endif theQuery.addQueryItem("t", COORD2STRING(aBox.topRight().y())); theQuery.addQueryItem("l", COORD2STRING(aBox.bottomLeft().x())); theQuery.addQueryItem("b", COORD2STRING(aBox.bottomLeft().y())); theQuery.addQueryItem("r", COORD2STRING(aBox.topRight().x())); theQuery.addQueryItem("open", "yes"); #if QT_VERSION >= QT_VERSION_CHECK(5,0,0) osbUrl.setQuery(theQuery); #endif #undef theQuery if (!theDownloader.go(osbUrl)) return false; if (theDownloader.resultCode() != 200) return false; QByteArray Ar(theDownloader.content()); bool OK = importGPX(Main, Ar, theDocument, theTracklayers, true); if (Main) Main->view()->setUpdatesEnabled(true); if (OK) { if (Main) Main->invalidateView(); } return OK; }
bool downloadMapdust(MainWindow* Main, const CoordBox& aBox, Document* theDocument, SpecialLayer* theLayer) { QUrl url; url.setUrl(M_PREFS->getMapdustUrl()); if (Main) Main->view()->setUpdatesEnabled(false); Downloader theDownloader("", ""); SpecialLayer* trackLayer = theLayer; if (!trackLayer) { trackLayer = new SpecialLayer(QApplication::translate("Downloader","MapDust"), Layer::MapDustLayer); trackLayer->setUploadable(false); theDocument->add(trackLayer); } IProgressWindow* aProgressWindow = dynamic_cast<IProgressWindow*>(Main); if (!aProgressWindow) return false; QProgressDialog* dlg = aProgressWindow->getProgressDialog(); dlg->setWindowTitle(QApplication::translate("Downloader","Parsing...")); QProgressBar* Bar = aProgressWindow->getProgressBar(); Bar->setTextVisible(false); Bar->setMaximum(11); QLabel* Lbl = aProgressWindow->getProgressLabel(); Lbl->setText(QApplication::translate("Downloader","Parsing XML")); if (dlg) dlg->show(); theDownloader.setAnimator(dlg,Lbl,Bar,true); Lbl->setText(QApplication::translate("Downloader","Downloading points")); #if QT_VERSION >= QT_VERSION_CHECK(5,0,0) QUrlQuery theQuery(url); #define theQuery theQuery #else #define theQuery url #endif theQuery.addQueryItem("t", COORD2STRING(aBox.topRight().y())); theQuery.addQueryItem("l", COORD2STRING(aBox.bottomLeft().x())); theQuery.addQueryItem("b", COORD2STRING(aBox.bottomLeft().y())); theQuery.addQueryItem("r", COORD2STRING(aBox.topRight().x())); #if QT_VERSION >= QT_VERSION_CHECK(5,0,0) url.setQuery(theQuery); #endif #undef theQuery if (!theDownloader.go(url)) return false; if (theDownloader.resultCode() != 200) return false; QByteArray Ar(theDownloader.content()); ImportExportGdal gdal(theDocument); bool OK = gdal.import(trackLayer, Ar, false); if (Main) Main->view()->setUpdatesEnabled(true); if (OK) { if (Main) Main->invalidateView(); } return OK; }
bool downloadOSM(QWidget* aParent, const QUrl& theUrl, const QString& aUser, const QString& aPassword, Document* theDocument, Layer* theLayer) { Downloader Rcv(aUser, aPassword); IProgressWindow* aProgressWindow = dynamic_cast<IProgressWindow*>(aParent); if (aProgressWindow) { QProgressDialog* dlg = aProgressWindow->getProgressDialog(); if (dlg) { dlg->setWindowTitle(QApplication::translate("Downloader","Downloading...")); dlg->setWindowFlags(dlg->windowFlags() & ~Qt::WindowContextHelpButtonHint); dlg->setWindowFlags(dlg->windowFlags() | Qt::MSWindowsFixedSizeDialogHint); } QProgressBar* Bar = aProgressWindow->getProgressBar(); Bar->setTextVisible(false); Bar->setMaximum(11); QLabel* Lbl = aProgressWindow->getProgressLabel(); Lbl->setText(QApplication::translate("Downloader","Downloading from OSM (connecting)")); if (dlg) dlg->show(); Rcv.setAnimator(dlg, Lbl, Bar, true); } if (!Rcv.go(theUrl)) { #ifndef _MOBILE aParent->setCursor(QCursor(Qt::ArrowCursor)); #endif return false; } int x = Rcv.resultCode(); switch (x) { case 200: break; case 301: case 302: case 307: { QString aWeb = Rcv.locationText(); if (!aWeb.isEmpty()) { QUrl aURL(aWeb); return downloadOSM(aParent, aURL, aUser, aPassword, theDocument, theLayer); } else { QString msg = QApplication::translate("Downloader","Unexpected http status code (%1)\nServer message is '%2'").arg(x).arg(Rcv.resultText()); if (!Rcv.errorText().isEmpty()) msg += QApplication::translate("Downloader", "\nAPI message is '%1'").arg(Rcv.errorText()); QMessageBox::warning(aParent,QApplication::translate("Downloader","Download failed"), msg); return false; } break; } case 401: QMessageBox::warning(aParent,QApplication::translate("Downloader","Download failed"),QApplication::translate("Downloader","Username/password invalid")); return false; default: QString msg = QApplication::translate("Downloader","Unexpected http status code (%1)\nServer message is '%2'").arg(x).arg(Rcv.resultText()); if (!Rcv.errorText().isEmpty()) msg += QApplication::translate("Downloader", "\nAPI message is '%1'").arg(Rcv.errorText()); QMessageBox::warning(aParent,QApplication::translate("Downloader","Download failed"), msg); return false; } Downloader Down(aUser, aPassword); bool OK = importOSM(aParent, Rcv.content(), theDocument, theLayer, &Down); return OK; }
void QTAIMCriticalPointLocator::locateNuclearCriticalPoints() { QString temporaryFileName=QTAIMCriticalPointLocator::temporaryFileName(); QList<QList<QVariant> > inputList; const qint64 numberOfNuclei = m_wfn->numberOfNuclei(); for( qint64 n=0 ; n < numberOfNuclei ; ++n) { QList<QVariant> input; input.append( temporaryFileName ); input.append( n ); input.append( m_wfn->xNuclearCoordinate(n) ); input.append( m_wfn->yNuclearCoordinate(n) ); input.append( m_wfn->zNuclearCoordinate(n) ); inputList.append(input); } m_wfn->saveToBinaryFile(temporaryFileName); QProgressDialog dialog; dialog.setWindowTitle("QTAIM"); dialog.setLabelText(QString("Nuclear Critical Points Search")); QFutureWatcher<void> futureWatcher; QObject::connect(&futureWatcher, SIGNAL(finished()), &dialog, SLOT(reset())); QObject::connect(&dialog, SIGNAL(canceled()), &futureWatcher, SLOT(cancel())); QObject::connect(&futureWatcher, SIGNAL(progressRangeChanged(int,int)), &dialog, SLOT(setRange(int,int))); QObject::connect(&futureWatcher, SIGNAL(progressValueChanged(int)), &dialog, SLOT(setValue(int))); QFuture<QList<QVariant> > future=QtConcurrent::mapped(inputList, QTAIMLocateNuclearCriticalPoint); futureWatcher.setFuture(future); dialog.exec(); futureWatcher.waitForFinished(); QList<QList<QVariant> > results; if( futureWatcher.future().isCanceled() ) { results.clear(); } else { results=future.results(); } QFile file; file.remove(temporaryFileName); for( qint64 n=0 ; n < results.length() ; ++n ) { bool correctSignature = results.at(n).at(0).toBool(); if (correctSignature) { QVector3D result( results.at(n).at(1).toReal(), results.at(n).at(2).toReal(), results.at(n).at(3).toReal() ); m_nuclearCriticalPoints.append( result ); } } }
void QTAIMCriticalPointLocator::locateBondCriticalPoints() { if( m_nuclearCriticalPoints.length() < 1 ) { return; } const qint64 numberOfNuclei = m_wfn->numberOfNuclei(); if( numberOfNuclei < 2) { return; } QString temporaryFileName=QTAIMCriticalPointLocator::temporaryFileName(); QString nuclearCriticalPointsFileName=QTAIMCriticalPointLocator::temporaryFileName(); QFile nuclearCriticalPointsFile(nuclearCriticalPointsFileName); nuclearCriticalPointsFile.open(QIODevice::WriteOnly); QDataStream nuclearCriticalPointsOut(&nuclearCriticalPointsFile); nuclearCriticalPointsOut << m_nuclearCriticalPoints; nuclearCriticalPointsFile.close(); QList<QList<QVariant> > inputList; for( qint64 M=0 ; M < numberOfNuclei - 1 ; ++M ) { for( qint64 N=M+1 ; N < numberOfNuclei ; ++N ) { const qreal distanceCutoff = 8.0 ; Matrix<qreal,3,1> a; Matrix<qreal,3,1> b; a << m_wfn->xNuclearCoordinate(M), m_wfn->yNuclearCoordinate(M), m_wfn->zNuclearCoordinate(M) ; b << m_wfn->xNuclearCoordinate(N), m_wfn->yNuclearCoordinate(N), m_wfn->zNuclearCoordinate(N) ; if( QTAIMMathUtilities::distance(a,b) < distanceCutoff ) { QVector3D x0y0z0( ( m_wfn->xNuclearCoordinate(M) + m_wfn->xNuclearCoordinate(N) ) / 2.0 , ( m_wfn->yNuclearCoordinate(M) + m_wfn->yNuclearCoordinate(N) ) / 2.0, ( m_wfn->zNuclearCoordinate(M) + m_wfn->zNuclearCoordinate(N) ) / 2.0 ); QList<QVariant> input; input.append( temporaryFileName ); input.append( nuclearCriticalPointsFileName ); input.append( M ); input.append( N ); input.append( x0y0z0.x() ); input.append( x0y0z0.y() ); input.append( x0y0z0.z() ); inputList.append(input); } } // end N } // end M m_wfn->saveToBinaryFile(temporaryFileName); QProgressDialog dialog; dialog.setWindowTitle("QTAIM"); dialog.setLabelText(QString("Bond Critical Points Search")); QFutureWatcher<void> futureWatcher; QObject::connect(&futureWatcher, SIGNAL(finished()), &dialog, SLOT(reset())); QObject::connect(&dialog, SIGNAL(canceled()), &futureWatcher, SLOT(cancel())); QObject::connect(&futureWatcher, SIGNAL(progressRangeChanged(int,int)), &dialog, SLOT(setRange(int,int))); QObject::connect(&futureWatcher, SIGNAL(progressValueChanged(int)), &dialog, SLOT(setValue(int))); QFuture<QList<QVariant> > future=QtConcurrent::mapped(inputList, QTAIMLocateBondCriticalPoint);; futureWatcher.setFuture(future); dialog.exec(); futureWatcher.waitForFinished(); QList<QList<QVariant> > results; if( futureWatcher.future().isCanceled() ) { results.clear(); } else { results=future.results(); } QFile file; file.remove(temporaryFileName); file.remove(nuclearCriticalPointsFileName); for( qint64 i=0 ; i < results.length() ; ++i ) { QList<QVariant> thisCriticalPoint=results.at(i); bool success=thisCriticalPoint.at(0).toBool(); if(success) { QPair<qint64,qint64> bondedAtoms; bondedAtoms.first=thisCriticalPoint.at(1).toInt(); bondedAtoms.second=thisCriticalPoint.at(2).toInt(); m_bondedAtoms.append( bondedAtoms ); QVector3D coordinates(thisCriticalPoint.at(3).toReal(), thisCriticalPoint.at(4).toReal(), thisCriticalPoint.at(5).toReal()); m_bondCriticalPoints.append( coordinates ); m_laplacianAtBondCriticalPoints.append(thisCriticalPoint.at(6).toReal()); m_ellipticityAtBondCriticalPoints.append(thisCriticalPoint.at(7).toReal()); qint64 pathLength=thisCriticalPoint.at(8).toInt(); QList<QVector3D> bondPath; for( qint64 i=0 ; i < pathLength ; ++i ) { QVector3D pathPoint(thisCriticalPoint.at(9 + i ).toReal(), thisCriticalPoint.at(9 + i + pathLength ).toReal(), thisCriticalPoint.at(9 + i + 2*pathLength ).toReal()); bondPath.append(pathPoint); } m_bondPaths.append(bondPath); } } }
KOnlineBankingSetupWizard::KOnlineBankingSetupWizard(QWidget *parent): QWizard(parent), d(new Private), m_fDone(false), m_fInit(false), m_appId(0) { setupUi(this); m_applicationEdit->hide(); m_headerVersionEdit->hide(); #ifndef LIBOFX_HAVE_CLIENTUID m_editClientUid->setEnabled(false); m_clientUidLabel->setEnabled(false); #endif m_appId = new OfxAppVersion(m_applicationCombo, m_applicationEdit, ""); m_headerVersion = new OfxHeaderVersion(m_headerVersionCombo, ""); // fill the list view with banks QProgressDialog* dlg = new QProgressDialog(this); dlg->setWindowTitle(i18n("Loading banklist")); dlg->setLabelText(i18n("Getting list of banks from http://moneycentral.msn.com/\nThis may take some time depending on the available bandwidth.")); dlg->setModal(true); dlg->setCancelButton(0); // force to show immediately as the call to OfxPartner::BankNames() // does not call the processEvents() loop dlg->setMinimumDuration(0); QCoreApplication::processEvents(); //set password field according to KDE preferences m_editPassword->setPasswordMode(true); KListWidgetSearchLine* searchLine = new KListWidgetSearchLine(autoTab, m_listFi); vboxLayout1->insertWidget(0, searchLine); QTimer::singleShot(20, searchLine, SLOT(setFocus())); OfxPartner::setDirectory(QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + ""); m_listFi->addItems(OfxPartner::BankNames()); m_fInit = true; delete dlg; checkNextButton(); connect(this, SIGNAL(currentIdChanged(int)), this, SLOT(checkNextButton())); connect(this, SIGNAL(currentIdChanged(int)), this, SLOT(newPage(int))); connect(m_listFi, SIGNAL(itemSelectionChanged()), this, SLOT(checkNextButton())); connect(m_listAccount, SIGNAL(itemSelectionChanged()), this, SLOT(checkNextButton())); connect(m_selectionTab, SIGNAL(currentChanged(int)), this, SLOT(checkNextButton())); connect(m_fid, SIGNAL(userTextChanged(QString)), this, SLOT(checkNextButton())); connect(m_bankName, SIGNAL(userTextChanged(QString)), this, SLOT(checkNextButton())); connect(m_url, SIGNAL(textChanged(QString)), this, SLOT(checkNextButton())); connect(m_editUsername, SIGNAL(userTextChanged(QString)), this, SLOT(checkNextButton())); connect(m_editPassword, SIGNAL(userTextChanged(QString)), this, SLOT(checkNextButton())); connect(m_applicationEdit, SIGNAL(userTextChanged(QString)), this, SLOT(checkNextButton())); connect(m_applicationCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(applicationSelectionChanged())); // setup text on buttons setButtonText(QWizard::NextButton, i18nc("Go to next page of the wizard", "&Next")); setButtonText(QWizard::BackButton, KStandardGuiItem::back().text()); // setup icons button(QWizard::FinishButton)->setIcon(KStandardGuiItem::ok().icon()); button(QWizard::CancelButton)->setIcon(KStandardGuiItem::cancel().icon()); button(QWizard::NextButton)->setIcon(KStandardGuiItem::forward(KStandardGuiItem::UseRTL).icon()); button(QWizard::BackButton)->setIcon(KStandardGuiItem::back(KStandardGuiItem::UseRTL).icon()); }
void QTAIMCriticalPointLocator::locateElectronDensitySinks() { QString temporaryFileName=QTAIMCriticalPointLocator::temporaryFileName(); QList<QList<QVariant> > inputList; qreal xmin,ymin,zmin; qreal xmax,ymax,zmax; qreal xstep,ystep,zstep; // TODO: if only we were using Eigen data structures... QList<qreal> xNuclearCoordinates; QList<qreal> yNuclearCoordinates; QList<qreal> zNuclearCoordinates; for( qint64 i=0; i < m_wfn->numberOfNuclei() ; ++i ) { xNuclearCoordinates.append( m_wfn->xNuclearCoordinate(i) ); yNuclearCoordinates.append( m_wfn->yNuclearCoordinate(i) ); zNuclearCoordinates.append( m_wfn->zNuclearCoordinate(i) ); } xmin=xNuclearCoordinates.first(); xmax=xNuclearCoordinates.first(); for( qint64 i=1 ; i < m_wfn->numberOfNuclei() ; ++i) { if( xNuclearCoordinates.at(i) < xmin ) { xmin=xNuclearCoordinates.at(i); } if( xNuclearCoordinates.at(i) > xmax ) { xmax=xNuclearCoordinates.at(i); } } ymin=yNuclearCoordinates.first(); ymax=yNuclearCoordinates.first(); for( qint64 i=1 ; i < yNuclearCoordinates.count() ; ++i) { if( yNuclearCoordinates.at(i) < ymin ) { ymin=yNuclearCoordinates.at(i); } if( yNuclearCoordinates.at(i) > ymax ) { ymax=yNuclearCoordinates.at(i); } } zmin=zNuclearCoordinates.first(); zmax=zNuclearCoordinates.first(); for( qint64 i=1 ; i < zNuclearCoordinates.count() ; ++i) { if( zNuclearCoordinates.at(i) < zmin ) { zmin=zNuclearCoordinates.at(i); } if( zNuclearCoordinates.at(i) > zmax ) { zmax=zNuclearCoordinates.at(i); } } xmin= -2.0 + xmin; ymin= -2.0 + ymin; zmin= -2.0 + zmin; xmax = 2.0 + xmax; ymax = 2.0 + ymax; zmax = 2.0 + zmax; xstep=ystep=zstep= 0.5; for( qreal x=xmin ; x < xmax+xstep ; x=x+xstep) { for( qreal y=ymin ; y < ymax+ystep ; y=y+ystep) { for( qreal z=zmin ; z < zmax+zstep ; z=z+zstep) { QList<QVariant> input; input.append( temporaryFileName ); // input.append( n ); input.append( x ); input.append( y ); input.append( z ); inputList.append(input); } } } m_wfn->saveToBinaryFile(temporaryFileName); QProgressDialog dialog; dialog.setWindowTitle("QTAIM"); dialog.setLabelText(QString("Electron Density Sinks Search")); QFutureWatcher<void> futureWatcher; QObject::connect(&futureWatcher, SIGNAL(finished()), &dialog, SLOT(reset())); QObject::connect(&dialog, SIGNAL(canceled()), &futureWatcher, SLOT(cancel())); QObject::connect(&futureWatcher, SIGNAL(progressRangeChanged(int,int)), &dialog, SLOT(setRange(int,int))); QObject::connect(&futureWatcher, SIGNAL(progressValueChanged(int)), &dialog, SLOT(setValue(int))); QFuture<QList<QVariant> > future=QtConcurrent::mapped(inputList, QTAIMLocateElectronDensitySink ); futureWatcher.setFuture(future); dialog.exec(); futureWatcher.waitForFinished(); QList<QList<QVariant> > results; if( futureWatcher.future().isCanceled() ) { results.clear(); } else { results=future.results(); } QFile file; file.remove(temporaryFileName); for( qint64 n=0 ; n < results.length() ; ++n ) { qint64 counter=0; bool correctSignature = results.at(n).at(counter).toBool(); counter++; if( correctSignature ) { qreal x=results.at(n).at(counter).toReal(); counter++; qreal y=results.at(n).at(counter).toReal(); counter++; qreal z=results.at(n).at(counter).toReal(); counter++; if( (xmin < x && x < xmax) && (ymin < y && y < ymax) && (zmin < z && z < zmax) ) { QVector3D result(x,y,z); qreal smallestDistance=HUGE_REAL_NUMBER; for(qint64 i=0 ; i < m_electronDensitySinks.length() ; ++i ) { Matrix<qreal,3,1> a(x,y,z); Matrix<qreal,3,1> b(m_electronDensitySinks.at(i).x(), m_electronDensitySinks.at(i).y(), m_electronDensitySinks.at(i).z()); qreal distance=QTAIMMathUtilities::distance(a,b); if( distance < smallestDistance ) { smallestDistance=distance; } } if( smallestDistance > 1.e-2 ) { m_electronDensitySinks.append( result ); } } } } // qDebug() << "SINKS" << m_electronDensitySinks; }
void ShortestPathComputer::init(ccMesh *mesh, QWidget *parentWidget/* = NULL*/) { mMesh = mesh; ccGenericPointCloud *cloud = mesh->getAssociatedCloud(); const unsigned vertexNum = cloud->size(); const unsigned triangleNum = mesh->size(); const unsigned edgeNum = triangleNum * 3; //半边 Edge *edges = new Edge[edgeNum]; float *edgeWeights = new float[edgeNum]; const unsigned triangleEdgeVertexIndexs[3][2] = { 0, 1, 1, 2, 2, 0 }; unsigned edgeIndexBase, edgeIndex; mesh->placeIteratorAtBegining(); for (unsigned i = 0; i < triangleNum; i++) { CCLib::TriangleSummitsIndexes* indexs = mesh->getNextTriangleIndexes(); assert(indexs->i[0] < vertexNum && indexs->i[1] < vertexNum && indexs->i[2] < vertexNum); const CCVector3 *triangleVertices[3] = { cloud->getPoint(indexs->i[0]), cloud->getPoint(indexs->i[1]), cloud->getPoint(indexs->i[2]) }; edgeIndexBase = i * 3; for (unsigned j = 0; j < 3; j++) { edgeIndex = edgeIndexBase + j; edges[edgeIndex].first = indexs->i[triangleEdgeVertexIndexs[j][0]]; edges[edgeIndex].second = indexs->i[triangleEdgeVertexIndexs[j][1]]; edgeWeights[edgeIndex] = CCVector3::vdistance(triangleVertices[triangleEdgeVertexIndexs[j][0]]->u, triangleVertices[triangleEdgeVertexIndexs[j][1]]->u); } } //开启新线程初始化BGL图并显示进度条 BoostGraphInitThread thread; thread.setGraphData(&mGraph, edges, edgeNum, edgeWeights, vertexNum); thread.start(); QProgressDialog progress; if (parentWidget) { progress.setParent(parentWidget); } progress.setWindowModality(Qt::WindowModal); progress.setWindowFlags(Qt::SubWindow | Qt::Popup); progress.setMinimumWidth(200); progress.setCancelButton(0); progress.setWindowTitle(QString::fromAscii("BGL图初始化")); progress.setLabelText(QString::fromAscii("BGL图初始化中,请稍后...")); progress.setRange(0, 0); progress.show(); while (thread.isRunning()) { QApplication::processEvents(); } progress.close(); //mGraph = MyGraph(edges, edges + edgeNum, edgeWeights, vertexNum); }
void MainWindow::on_computeButton_clicked() { //disabling actions that could make the application crash ui->openButton->setEnabled(false); ui->computeButton->setEnabled(false); QPrincipalAxisGenerator generator; if( computedMeshes ){ //cleaning previous calculation for( int i=1;i<nViewers; i++ ){ leftWidgets[i]->deleteMeshes(); rightWidgets[i]->deleteMeshes(); } } vector<Method> methods2compute; //add them in the order of the tabs methods2compute.push_back( JUST_PCA ); methods2compute.push_back( ROBUS_DETERMINATION ); int progressIt=0; QProgressDialog progress; progress.setWindowTitle("Loading"); progress.setLabelText("Computing meshes..."); progress.setCancelButton(NULL); progress.setMinimum(0); progress.setMaximum(100); progress.show(); for( int i=0; i< leftWidgets[0]->getNumberOfMeshes(); i++ ){ generator.setMesh( leftWidgets[0]->getMesh(i) ); for( int j=0; j<methods2compute.size(); j++ ){ generator.setMethod( methods2compute.at(j) );//selecting method to generate axis generator.start();//computing on other thread not to freeze the main window while(generator.isRunning()){ //forcing window refresh events so the window not freezes during the wait qApp->processEvents(); update(); repaint(); ui->centralWidget->repaint(); } //tab position, 0 is the original tab leftWidgets[j+1]->insert_mesh( leftWidgets[0]->getMesh(i),generator.getAxis() ); rightWidgets[j+1]->insert_mesh( rightWidgets[0]->getMesh(i),generator.getAxis() ); leftWidgets[j+1]->setMeshVisiblility( i,leftWidgets[0]->isMeshVisible(i) ); rightWidgets[j+1]->setMeshVisiblility( i,leftWidgets[0]->isMeshVisible(i) ); progressIt++; progress.setValue( progressIt*100/(leftWidgets[0]->getNumberOfMeshes()*2) ); progress.update(); } /* //stating way, just for debuging generator.setMethod( JUST_PCA );//selecting method to generate axis generator.start();//computing on other thread not to freeze the main window while(generator.isRunning()){ //forcing window refresh events so the window not freezes during the wait qApp->processEvents(); update(); repaint(); ui->centralWidget->repaint(); } leftWidgets[1]->insert_mesh( leftWidgets[0]->getMesh(i),generator.getAxis() ); rightWidgets[1]->insert_mesh( rightWidgets[0]->getMesh(i),generator.getAxis() ); leftWidgets[1]->setMeshVisiblility( i,leftWidgets[0]->isMeshVisible(i) ); rightWidgets[1]->setMeshVisiblility( i,leftWidgets[0]->isMeshVisible(i) ); progressIt++; progress.setValue( progressIt*100/(leftWidgets[0]->getNumberOfMeshes()*2) ); progress.update(); //sleep(2); generator.setMethod( ROBUS_DETERMINATION ); generator.start(); while(generator.isRunning()){ //forcing window refresh events so the window not freezes during the wait qApp->processEvents(); update(); repaint(); ui->centralWidget->repaint(); } leftWidgets[2]->insert_mesh( leftWidgets[0]->getMesh(i),generator.getAxis() ); rightWidgets[2]->insert_mesh( rightWidgets[0]->getMesh(i),generator.getAxis() ); leftWidgets[2]->setMeshVisiblility( i,leftWidgets[0]->isMeshVisible(i) ); rightWidgets[2]->setMeshVisiblility( i,leftWidgets[0]->isMeshVisible(i) ); progressIt++; progress.setValue( progressIt*100/(leftWidgets[0]->getNumberOfMeshes()*2) ); progress.update(); */ //sleep(2); } progress.setValue(100); progress.close(); //apply translation and rotation cout <<"Computing axis completed"<<endl; computedMeshes=true; ui->openButton->setEnabled(true); ui->computeButton->setEnabled(true); ui->alignButton->setEnabled(true); }