void d8_flow_directions( const Array2D<T> &elevations, Array2D<U> &flowdirs ){ ProgressBar progress; std::cerr<<"A D8 Flow Directions"<<std::endl; std::cerr<<"C TODO"<<std::endl; std::cerr<<"p Setting up the flow directions matrix..."<<std::endl; flowdirs.resize(elevations); flowdirs.setAll(NO_FLOW); flowdirs.setNoData(FLOWDIR_NO_DATA); std::cerr<<"p Calculating D8 flow directions..."<<std::endl; progress.start( elevations.width()*elevations.height() ); #pragma omp parallel for for(int y=0;y<elevations.height();y++){ progress.update( y*elevations.width() ); for(int x=0;x<elevations.width();x++) if(elevations(x,y)==elevations.noData()) flowdirs(x,y) = flowdirs.noData(); else flowdirs(x,y) = d8_FlowDir(elevations,x,y); } std::cerr<<"t Succeeded in = "<<progress.stop()<<" s"<<std::endl; }
void OutputArrayPositions( std::ofstream& in_mfw, CDoubleArray& in_array, MATH::CTransformation& localTransform) { MATH::CVector3 position; MATH::CVector3 worldPosition; double x, y, z; bar.PutMinimum(0); bar.PutMaximum(in_array.GetCount()/3); for ( LONG i=0; i<in_array.GetCount(); i += 3 ) { bar.PutValue(i); CString str; position.PutX(in_array[i]); position.PutY(in_array[i+1]); position.PutZ(in_array[i+2]); worldPosition = MATH::MapObjectPositionToWorldSpace(localTransform, position); x = worldPosition.GetX(); y = worldPosition.GetY(); z = worldPosition.GetZ(); str = L"v " + FormatNumber(x) + L" " + FormatNumber(y) + L" " + FormatNumber(z); in_mfw << str.GetAsciiString(); in_mfw << "\n"; gV++; //bar.Increment(); } }
void updateData() { fileName.set_markup("<b>" + Markup::escape_text(finfo->getFileName()) + "</b>"); fileName.set_justify(JUSTIFY_LEFT); peerName.set_markup("<small>" + Markup::escape_text(finfo->getPeerName()) + "</small>"); peerName.set_justify(JUSTIFY_LEFT); switch(finfo->getStatus()) { case 1: progress.set_text("Connecting"); progress.pulse(); break; case 2: progress.set_text("Waiting for accept"); progress.pulse(); break; case 3: progress.set_text(ustring("Sending (") + intToStr(finfo->getProgress()) + "%)"); progress.set_fraction((float)finfo->getProgress() / 100); break; case 4: progress.set_text(ustring("Receiving (") + intToStr(finfo->getProgress()) + "%)"); progress.set_fraction((float)finfo->getProgress() / 100); break; case 5: progress.set_text(ustring("Paused (") + intToStr(finfo->getProgress()) + "%)"); progress.set_fraction((float)finfo->getProgress() / 100); break; } /*mainBox.queue_draw();*/ printf("Data updated, progress: %d\n", finfo->getProgress()); }
void d8_flow_directions( const array2d<T> &elevations, array2d<U> &flowdirs ){ ProgressBar progress; diagnostic("Setting up the flow directions matrix..."); flowdirs.copyprops(elevations); flowdirs.init(NO_FLOW); flowdirs.no_data=d8_NO_DATA; diagnostic("succeeded.\n"); diagnostic("%%Calculating D8 flow directions...\n"); progress.start( elevations.width()*elevations.height() ); #pragma omp parallel for for(int x=0;x<elevations.width();x++){ progress.update( x*elevations.height() ); for(int y=0;y<elevations.height();y++) if(elevations(x,y)==elevations.no_data) flowdirs(x,y)=flowdirs.no_data; else flowdirs(x,y)=d8_FlowDir(elevations,x,y); } diagnostic_arg(SUCCEEDED_IN,progress.stop()); }
void OutputArray( std::ofstream& in_mfw, CFloatArray& in_array, int in_nDims, const CString& in_str ) { if (!in_nDims) return; LONG nVals = in_array.GetCount()/in_nDims; double s; bar.PutMinimum(0); bar.PutMaximum(nVals); for ( LONG i=0, nCurrent=0; i<nVals; i++ ) { bar.PutValue(i); CString str; s = in_array[nCurrent]; str += FormatNumber(s); for (LONG j = 1; j < in_nDims; j++) { str += L" "; s = in_array[nCurrent+j]; str += FormatNumber(s); } in_mfw << in_str.GetAsciiString(); in_mfw << str.GetAsciiString(); in_mfw << "\n"; nCurrent += in_nDims; gVn++; //bar.Increment(); } }
static progdlg_t * common_create_progress_dlg(bool animate, const gpointer top_level_window, gboolean terminate_is_stop, gboolean *stop_flag, int value) { ProgressBar *pb; QWidget *main_window; if (!top_level_window) { return NULL; } main_window = qobject_cast<QWidget *>((QObject *)top_level_window); if (!main_window) { return NULL; } pb = main_window->findChild<ProgressBar *>(); if (!pb) { return NULL; } return pb->show(animate, terminate_is_stop, stop_flag, value); }
void GenericSolver::buildInteractionMatrix(ReactiveSet& R) { if(verbose) printf("Building interaction matrix for %i DF...\n", R.nDF()); ProgressBar pb = ProgressBar(R.nDF(),1,verbose); #ifdef WITH_LAPACKE the_ixn = mmat(R.nDF(),R.nDF()); #else the_GF = gsl_matrix_alloc(R.nDF(),R.nDF()); #endif R.startInteractionScan(); for(unsigned int DF=0; DF<R.nDF(); DF++) { R.setInteractionDF(DF,1.0); for(unsigned int phi=0; phi<R.nPhi; phi++) { mvec v = R.getReactionTo(&R,phi); assert(v.size() == R.nDF()/R.nPhi); for(unsigned int i=0; i<v.size(); i++) #ifdef WITH_LAPACKE the_ixn(i*R.nPhi+phi, DF) = v[i]; #else gsl_matrix_set(the_GF, i*R.nPhi+phi, DF, (i*R.nPhi+phi==DF) ? 1-v[i] : -v[i]); #endif } pb.update(DF); } R.setInteractionDF(R.nDF(),0); }
MainFrame() : Dialog(L"ProgressBars") , m_progressBar1(this) , m_progressBar2(this, ProgressBar::Styles::Default + ProgressBar::Styles::Smooth) , m_progressBar3(this, ProgressBar::Styles::Default + ProgressBar::Styles::Marquee) , m_start(L"Start", this) , m_close(L"Close", this) { // a box layout manager with vertical orientation and no-homogeneous setLayout(new BoxLayout(Orientation::Vertical, false)); // set the ranges of the progress bars m_progressBar1.setRange(0, 100); m_progressBar2.setRange(0, 100); m_progressBar3.setMarquee(0); // the "Start" button is the default one m_start.setDefault(true); // call "onStart" when the "Start" button is pressed m_start.Click.connect(Bind(&MainFrame::onStart, this)); // the Dialog::onCancel generates an onClose event m_close.Click.connect(Bind(&MainFrame::onCancel, this)); // the application is waiting to work (the user should press the // "Start" button) m_state = WaitingToWork; // set the size of the Frame setSize(Size(256, getPreferredSize().h)); center(); }
ProgressBar* ProgressBar::create(ProgressDelegate* target, CCSprite *sprite) { ProgressBar* progress = new ProgressBar(); progress->init(target, sprite); progress->autorelease(); return progress; }
MainFrame() : Dialog("ProgressBars") , m_progressBar1(this) , m_progressBar2(this, ProgressBarStyle + SmoothProgressBarStyle) , m_start("Start", this) , m_close("Close", this) { // a box layout manager with vertical orientation and no-homogeneous setLayout(new BoxLayout(Orientation::Vertical, false)); // set the ranges of the progress bars m_progressBar1.setRange(0, 100); m_progressBar2.setRange(0, 100); // the "Start" button is the default one m_start.setDefault(true); // call "onStart" when the "Start" button is pressed m_start.Action.connect(Bind(&MainFrame::onStart, this)); // the defaultCancelAction of dialogs generates an "WM_CLOSE" // message that is converted to the "onClose" event m_close.Action.connect(Bind(&MainFrame::defaultCancelAction, this)); // the application is waiting to work (the user should press the // "Start" button) m_state = WaitingToWork; // set the size of the Frame setSize(Size(256, getPreferredSize().h)); center(); }
void ProgressBarTheme::installTheme(Component *comp) { ProgressBar *progressBar = static_cast<ProgressBar*>(comp); // progressBar->setBackground(&background); // progressBar->setForeground(&foreground); progressBar->setFont(SchemeManager::getInstance().getScheme()->getDefaultFont()); // default font progressBar->setBorder(&border); }
TEST(ProgressBar, BasicTest) { ProgressBar pb; for (int i = 0; i <= 100; ++i){ pb.setValue(i); EXPECT_EQ(i, pb.value()); System::msleep(10); } }
void ProgressBar_Impl::on_marquee_progress() { marquee_position += marquee_step_size; if(marquee_position > progressbar->get_width()) marquee_position = -marquee_box_width; progressbar->request_repaint(); }
void tst_QProgressBar::setMinMaxRepaint() { ProgressBar pbar; pbar.setMinimum(0); pbar.setMaximum(10); pbar.setFormat("%v"); pbar.show(); QVERIFY(QTest::qWaitForWindowActive(&pbar)); // No repaint when setting minimum to the current minimum pbar.repainted = false; pbar.setMinimum(0); QTest::qWait(50); QTRY_VERIFY(!pbar.repainted); // No repaint when setting maximum to the current maximum pbar.repainted = false; pbar.setMaximum(10); QTest::qWait(50); QTRY_VERIFY(!pbar.repainted); // Repaint when setting minimum for (int i = 9; i >= 0; i--) { pbar.repainted = false; pbar.setMinimum(i); QTRY_VERIFY(pbar.repainted); } // Repaint when setting maximum for (int i = 0; i < 10; ++i) { pbar.repainted = false; pbar.setMaximum(i); QTRY_VERIFY(pbar.repainted); } }
void FalagardProgressBarEx::render() { const StateImagery* imagery; // get WidgetLookFeel for the assigned look. const WidgetLookFeel& wlf = getLookNFeel(); // try and get imagery for our current state imagery = &wlf.getStateImagery(d_window->isDisabled() ? "Disabled" : "Enabled"); // peform the rendering operation. imagery->render(*d_window); // get imagery for actual progress rendering imagery = &wlf.getStateImagery(d_window->isDisabled() ? "DisabledProgress" : "EnabledProgress"); // get target rect for this imagery Rect progressRect(wlf.getNamedArea("ProgressArea").getArea().getPixelRect(*d_window)); // calculate a clipper according to the current progress. Rect progressClipper(progressRect); ProgressBar* w = (ProgressBar*)d_window; if (d_vertical) { float height = PixelAligned(progressClipper.getHeight() * w->getProgress()); if (d_reversed) { progressClipper.setHeight(height); } else { progressClipper.d_top = progressClipper.d_bottom - height; } } else { float width = PixelAligned(progressClipper.getWidth() * w->getProgress()); if (d_reversed) { progressClipper.d_left = progressClipper.d_right - width; } else { progressClipper.setWidth(width); } } // peform the rendering operation. imagery->render(*d_window, progressRect, 0, &progressClipper); // perform the text rendering operation imagery = &wlf.getStateImagery("Label"); imagery->render(*d_window); }
//.static ProgressBar * ProgressBar::create( const CCRect &area ) { ProgressBar* bar = new ProgressBar(); if(!bar->init(area)) { delete bar; return NULL; } bar->autorelease(); return bar; }
int main (int argc, char ** argv) { H.init ("Random triangulation", argc,argv, "n=10,t=-1"); int t = H['t']; if (t==-1) t=50*int(H['n'])*int(H['n']); Triangulation T (H['n']); T.inscribe(T.face(Edge(0,1))); { ProgressBar P (t); for (int i=0; i<t; ++i) { T.flip(T.random_edge()); P.set(i); } } T.show(); T.inscribe (T.face (Edge (0,*(T.v[0]->adj.begin())))); T.balance_old(); T.pause(); std::cout << T; }
TEST(ProgressBar, BasicTest) { if (!Application::instance().hasApplication()){ Application::instance().application(true); } if (Application::instance().hasGUI()){ ProgressBar pb; for (int i = 0; i <= 100; ++i){ pb.setValue(i); EXPECT_EQ(i, pb.value()); System::msleep(10); } } }
void ProgressBar_Impl::on_render(Canvas &canvas, const Rect &update_rect) { Rect rect = progressbar->get_size(); if (marquee_mode) { if (rect.get_width() > 0) { Rect content_box = progressbar->get_content_box(); Rect progress_rect; progress_rect.left = content_box.left + marquee_position; progress_rect.top = content_box.top; progress_rect.bottom = content_box.bottom; progress_rect.right = content_box.left + marquee_position + marquee_box_width; if (progress_rect.left < content_box.left) { progress_rect.left = 0; progress_rect.right -= (content_box.left - progress_rect.left); } if (progress_rect.right > content_box.right) { progress_rect.right -= (progress_rect.right - content_box.right); } part_progress.render_box(canvas, progress_rect); } } else { if (progress_max >= progress_min && position >= progress_min && position <= progress_max && progress_min != progress_max && rect.get_width() > 0) { Rect content_box = progressbar->get_content_box(); Rect progress_rect; progress_rect.left = content_box.left; progress_rect.top = content_box.top; progress_rect.bottom = content_box.bottom; progress_rect.right = content_box.left + (position - progress_min) * content_box.get_width() / (progress_max - progress_min); part_progress.render_box(canvas, progress_rect); } } }
void Simulator::run() { ProgressBar progressBar; for(int i = 0; i < step; ++i) { oneStep(); progressBar.update(i/double(step)); // print the result std::stringstream filename; filename << "./output/boids_" << i << ".xyz"; if (write) save(filename.str()); } }
void VolumeURLListProperty::loadVolume(const std::string& url, bool invalidateUI /*=true*/) throw (tgt::FileException, std::bad_alloc) { if (!containsURL(url)) { LWARNING("loadVolume(): passed URL not contained by this property: " << url); return; } // delete volume, if already loaded and owned by the property if (getVolume(url) && isOwner(url)) delete getVolume(url); handleMap_.erase(url); ownerMap_.erase(url); ProgressBar* progressBar = getProgressBar(); if (progressBar) { progressBar->setTitle("Loading volume"); progressBar->setProgressMessage("Loading volume ..."); } VolumeSerializerPopulator serializerPopulator(progressBar); VolumeBase* handle = serializerPopulator.getVolumeSerializer()->read(VolumeURL(url)); if (progressBar) progressBar->hide(); if (handle) { // url may have been altered by loading routine if (url != handle->getOrigin().getURL()) { bool selected = isSelected(url); selectionMap_.erase(url); selectionMap_[handle->getOrigin().getURL()] = selected; for (size_t i=0; i<value_.size(); i++) { if (value_[i] == url) { value_[i] = handle->getOrigin().getURL(); break; } } } handleMap_[handle->getOrigin().getURL()] = handle; ownerMap_[handle->getOrigin().getURL()] = true; } if(invalidateUI) invalidate(); }
ProgressBar* ProgressBar::createWithSpriteFrameName(const char *fgName, const char *bgName){ ProgressBar *ret = new ProgressBar(); if (ret != nullptr){ ret->fg_spriteFrameName = fgName; ret->bg_spriteFrameName = bgName; } if (ret != nullptr && ret->init()){ ret->autorelease(); return ret; } CC_SAFE_DELETE(ret); return nullptr; }
void OldSchoolLookAndFeel::drawProgressBar (Graphics& g, ProgressBar& progressBar, int width, int height, double progress, const String& textToShow) { if (progress < 0 || progress >= 1.0) { LookAndFeel::drawProgressBar (g, progressBar, width, height, progress, textToShow); } else { const Colour background (progressBar.findColour (ProgressBar::backgroundColourId)); const Colour foreground (progressBar.findColour (ProgressBar::foregroundColourId)); g.fillAll (background); g.setColour (foreground); g.fillRect (1, 1, jlimit (0, width - 2, roundToInt (progress * (width - 2))), height - 2); if (textToShow.isNotEmpty()) { g.setColour (Colour::contrasting (background, foreground)); g.setFont (height * 0.6f); g.drawText (textToShow, 0, 0, width, height, Justification::centred, false); } } }
void SymmetricSolver::buildInteractionMatrix(ReactiveSet& R) { if(verbose) printf("Building interaction matrix for %i = %i x %i DF...\n", R.nDF(), R.nDF()/R.nPhi, R.nPhi); ProgressBar pb = ProgressBar(R.nDF(), R.nPhi, verbose); the_ixn = BlockCMat(R.nDF()/R.nPhi, R.nDF()/R.nPhi, CMatrix(R.nPhi)); R.startInteractionScan(); for(unsigned int DF=0; DF<R.nDF(); DF++) { R.setInteractionDF(DF,1.0); mvec v = R.getReactionTo(&R); assert(v.size() == R.nDF()/R.nPhi); for(unsigned int i=0; i<v.size(); i++) the_ixn(i, DF/R.nPhi)[DF%R.nPhi] = v[i]; pb.update(DF); } R.setInteractionDF(R.nDF(),0); }
//========================================================= // Reinicio //========================================================= void CInventoryPanel::Reset() { BackpackItems->RemoveAll(); BackpackItems->RemoveAllSections(); BackpackItems->AddSection(0, ""); BackpackItems->AddColumnToSection(0, "name", "#Inventory_Backpack", 0, 300); BackpackItems->AddColumnToSection(0, "count", "", 0, 100); PocketItems->RemoveAll(); PocketItems->RemoveAllSections(); PocketItems->AddSection(0, ""); PocketItems->AddColumnToSection(0, "name", "#Inventory_Pocket", 0, 300); PocketItems->AddColumnToSection(0, "count", "", 0, 100); BackpackProgress->SetProgress(0.0); InventoryProgress->SetProgress(0.0); }
// when the "Start/Pause/Continue/Restart" button is pressed... void onStart() { switch (m_state) { case WaitingToWork: case Paused: { m_state = Working; m_start.setText("Pause"); // convert the button to "Pause"... // this is "The Loop", where the real work is done do { // when we pump the message queue, we can get events like onClose() Thread::pumpMessageQueue(); // work done if (m_progressBar1.getValue() == m_progressBar1.getMaximum()) { m_state = WorkDone; m_start.setText("Restart"); // convert the button to "Restart" } else { m_progressBar1.addValue(1); m_progressBar2.addValue(1); // in our case, the "real work" is sleep :) ...but for // your application this could be "loading a file"... Sleep(10); } // still working? } while (m_state == Working); // aborting work? hide the frame... if (m_state == Aborting) setVisible(false); break; } case Working: m_state = Paused; m_start.setText("Continue"); // convert the button to "Continue" break; // the work is done? the user press the "Restart" button case WorkDone: // restart progress bars m_progressBar1.setValue(m_progressBar1.getMinimum()); m_progressBar2.setValue(m_progressBar2.getMinimum()); m_start.setText("Start"); // convert the button to "Start" m_state = WaitingToWork; break; case Aborting: assert(false); // impossible break; } }
void MoleculeURLListProperty::loadMolecule(const std::string& url) throw (tgt::FileException, std::bad_alloc) { if (!containsURL(url)) { LWARNING("loadMolecule(): passed URL not contained by this property: " << url); return; } // delete molecule, if already loaded and owned by the property if (getMolecule(url) && isOwner(url)) delete getMolecule(url); handleMap_.erase(url); ownerMap_.erase(url); ProgressBar* progressBar = getProgressBar(); if (progressBar) { progressBar->setTitle("Loading molecule"); progressBar->setMessage("Loading molecule ..."); } Molecule* handle = MoleculeIO::read(MoleculeURL(url)); if (handle) { // url may have been altered by loading routine if (url != handle->getOrigin().getURL()) { bool selected = isSelected(url); selectionMap_.erase(url); selectionMap_[handle->getOrigin().getURL()] = selected; for (size_t i=0; i<value_.size(); i++) { if (value_[i] == url) { value_[i] = handle->getOrigin().getURL(); break; } } } handleMap_[handle->getOrigin().getURL()] = handle; ownerMap_[handle->getOrigin().getURL()] = true; } invalidate(); }
static inline void TerrainProcessor(F func, const Array2D<T> &elevations, const float zscale, Array2D<float> &output){ if(elevations.getCellLengthX()!=elevations.getCellLengthY()) RDLOG_WARN<<"Cell X and Y dimensions are not equal!"; output.resize(elevations); ProgressBar progress; progress.start(elevations.size()); #pragma omp parallel for for(int y=0;y<elevations.height();y++){ progress.update(y*elevations.width()); for(int x=0;x<elevations.width();x++) if(elevations.isNoData(x,y)) output(x,y) = output.noData(); else output(x,y) = func(elevations,x,y,zscale); } RDLOG_TIME_USE<<"Wall-time = "<<progress.stop(); }
MiniStatusWindow::~MiniStatusWindow() { delete2(mTextPopup); delete2(mStatusPopup); delete_all(mIcons); mIcons.clear(); Inventory *const inv = PlayerInfo::getInventory(); if (inv) inv->removeInventoyListener(this); FOR_EACH (ProgressBarVectorCIter, it, mBars) { ProgressBar *bar = *it; if (!bar) continue; if (!bar->isVisibleLocal()) delete bar; }
void BrowserMessageArea::newProgressOperation( QObject *sender, const QString &text, int maximum, QObject *obj, const char *slot, Qt::ConnectionType type ) { ProgressBar *newBar = new ProgressBar( 0 ); newBar->setDescription( text ); newBar->setMaximum( maximum ); connect( sender, SIGNAL(destroyed( QObject * )), m_progressBar, SLOT(endProgressOperation( QObject * )) ); connect( sender, SIGNAL(endProgressOperation( QObject * )), m_progressBar, SLOT(endProgressOperation( QObject * )) ); connect( sender, SIGNAL(incrementProgress()), m_progressBar, SLOT(slotIncrementProgress()) ); connect( sender, SIGNAL(totalSteps( int )), newBar, SLOT(slotTotalSteps( int )) ); newBar->setAbortSlot( obj, slot, type ); m_progressBar->addProgressBar( newBar, sender ); m_progressBar->show(); m_busy = true; }