void MainWindow::on_actionInsertRandomPoints_triggered() { QRectF rect = CGAL::Qt::viewportsBbox(&m_scene); CGAL::Qt::Converter<Kernel> convert; Iso_rectangle_2 isor = convert(rect); CGAL::Random_points_in_iso_rectangle_2<Point_2> pg((isor.min)(), (isor.max)()); bool ok = false; const int number_of_points = QInputDialog::getInteger(this, tr("Number of random points"), tr("Enter number of random points"), 100, 0, (std::numeric_limits<int>::max)(), 1, &ok); if(!ok) { return; } // wait cursor QApplication::setOverrideCursor(Qt::WaitCursor); for(int i = 0; i < number_of_points; ++i){ m_sites.push_back(*pg++); } calculate_envelope(); // default cursor QApplication::restoreOverrideCursor(); emit(changed()); }
void ParametricEQ::reconfigure() { if(fft && config.window_size != fft->window_size) { //printf("ParametricEQ::reconfigure %d %d\n", __LINE__, config.window_size); delete fft; fft = 0; } if(!fft) { //printf("ParametricEQ::reconfigure %d %d\n", __LINE__, config.window_size); fft = new ParametricFFT(this); fft->initialize(config.window_size); } // Reset envelope //printf("ParametricEQ::reconfigure %f\n", wetness); calculate_envelope(); for(int i = 0; i < config.window_size / 2; i++) { if(envelope[i] < 0) envelope[i] = 0; } need_reconfigure = 0; }
void MainWindow::on_actionClear_triggered() { m_sites.clear(); calculate_envelope(); emit(changed()); }
void MainWindow::processInput(CGAL::Object o) { Point_2 p; if(CGAL::assign(p, o)){ m_sites.push_back(p); calculate_envelope(); } emit(changed()); }
void MainWindow::open(QString fileName) { // wait cursor QApplication::setOverrideCursor(Qt::WaitCursor); m_sites.clear(); std::ifstream ifs(qPrintable(fileName)); Kernel::Point_2 p; while(ifs >> p) { m_sites.push_back(p); } calculate_envelope(); // default cursor QApplication::restoreOverrideCursor(); this->addToRecentFiles(fileName); actionRecenter->trigger(); emit(changed()); }
void GraphicEQ::reconfigure() { if(fft && fft->window_size != config.window_size) { delete fft; fft = 0; } if(!fft) { fft = new GraphicFFT(this); fft->initialize(config.window_size); } calculate_envelope(&config.points, envelope); for(int i = 0; i < config.window_size / 2; i++) { if(envelope[i] < 0) envelope[i] = 0; } need_reconfigure = 0; }
void ParametricEQ::update_gui() { if(thread) { if(load_configuration()) { ((ParametricWindow*)thread->window)->lock_window("ParametricEQ::update_gui"); calculate_envelope(); ((ParametricWindow*)thread->window)->update_gui(); ((ParametricWindow*)thread->window)->unlock_window(); } else { int total_frames = get_gui_update_frames(); //printf("ParametricEQ::update_gui %d %d\n", __LINE__, total_frames); if(total_frames) { ((ParametricWindow*)thread->window)->lock_window("ParametricEQ::update_gui"); ((ParametricWindow*)thread->window)->update_canvas(); ((ParametricWindow*)thread->window)->unlock_window(); } } } }