void PercentageCallback::callback() { if (m_done) return; double currPerc = getPercentComplete(); if (pdal::Utils::compare_distance<double>(currPerc, 100.0)) { std::cerr << ".100" << std::endl; m_done = true; } else if (currPerc >= m_lastMajorPerc + 10.0) { std::cerr << (int)currPerc << std::flush; m_lastMajorPerc = currPerc; m_lastMinorPerc = currPerc; } else if (currPerc >= m_lastMinorPerc + 2.0) { std::cerr << '.' << std::flush; m_lastMinorPerc = currPerc; } return; }
QString TTodo::toString() { QString out = Task::toString(); QString todoOut = QString("\n\tComplete: %1") .arg(getPercentComplete()); out.append(todoOut); return out; }
ofxTLPlaybackEventArgs ofxTimeline::createPlaybackEvent(){ ofxTLPlaybackEventArgs args; args.frameBased = isFrameBased; args.durationInFrames = durationInFrames; args.durationInSeconds = durationInSeconds; args.currentTime = currentTime; args.currentFrame = currentFrame; args.currentPercent = getPercentComplete(); return args; }
void ProgressBar::drawInternal(Graphics* const Graphics, Real32 Opacity) const { //Draw The ProgressBar UIDrawObjectCanvasRefPtr DrawObject(getDrawnDrawObject()); if(DrawObject != NULL) { if(DrawObject->getPosition() != _ProgressBarPosition) { DrawObject->setPosition(_ProgressBarPosition); } if(DrawObject->getSize() != _ProgressBarSize) { DrawObject->setSize(_ProgressBarSize); } DrawObject->draw(Graphics,getOpacity()*Opacity); } //Draw The Progress String if(getEnableProgressString() && getFont() != NULL) { Pnt2f TopLeft, BottomRight; getInsideBorderBounds(TopLeft, BottomRight); //Draw the progress String std::string StringToDraw; if(getProgressString().compare("") == 0) { if(!getIndeterminate()) { UInt32 Percent(static_cast<Int32>( osgFloor(getPercentComplete() * 100.0f) )); std::stringstream TempSStream; TempSStream << Percent; StringToDraw = TempSStream.str() + std::string("%"); } } else { StringToDraw = getProgressString(); } //Calculate Alignment Pnt2f AlignedPosition; Pnt2f TextTopLeft, TextBottomRight; getFont()->getBounds(StringToDraw, TextTopLeft, TextBottomRight); AlignedPosition = calculateAlignment(TopLeft, (BottomRight-TopLeft), (TextBottomRight - TextTopLeft),getAlignment().y(), getAlignment().x()); //Draw the Text Graphics->drawText(AlignedPosition, StringToDraw, getFont(), getDrawnTextColor(), getOpacity()*Opacity); } }
bool ofxTimeline::togglePlay(){ if(isPlaying){ stop(); } else{ if(loopType == OF_LOOP_NONE && getPercentComplete() == 1.0){ setPercentComplete(0.0); } play(); } return isPlaying; }
bool ofxTimeline::getSwitcherOn(string name){ if(elementNameToPage.find(name) == elementNameToPage.end()){ ofLogError("ofxTimeline -- Couldn't find element " + name); return false; } ofxTLSwitcher* switcher = (ofxTLSwitcher*)elementNameToPage[name]->getElement(name); if(switcher == NULL){ ofLogError("ofxTimeline -- Couldn't find switcher element " + name); return false; } return switcher->isOn(getPercentComplete()); }
bool PlanEntryModel::operator ==(PlanEntryModel &tem) { bool b = true; if(compareTo(&tem) != 0)b = false; else if(tem.getTaskID() != getTaskID())b = false; else if(tem.getTaskStart() != getTaskStart())b = false; else if(tem.getTaskStop() != getTaskStop())b = false; else if(tem.getPercentComplete() != getPercentComplete())b = false; else if(_tcscmp(tem.GetOwner(), GetOwner()) != 0)b = false; else if(_tcscmp(tem.getTaskName(), getTaskName()) != 0)b = false; else if(_tcscmp(tem.getAnnotation(), getAnnotation()) != 0)b = false; else if(GetEntryType() != tem.GetEntryType())b = false; return b; }
void ProgressBar::setupProgressBar(void) { Pnt2f TopLeft, BottomRight; getInsideBorderBounds(TopLeft, BottomRight); if(getIndeterminate()) { Real32 Pos; if(_IndeterminateBarPosition > 1.0) { Pos = 2.0 - _IndeterminateBarPosition; } else { Pos = _IndeterminateBarPosition; } switch(getOrientation()) { case ProgressBar::HORIZONTAL_ORIENTATION: _ProgressBarPosition.setValues((BottomRight.x() - TopLeft.x())*Pos*(1.0-getIndeterminateBarSize()), TopLeft.y()); _ProgressBarSize.setValues( (BottomRight.x() - TopLeft.x())*getIndeterminateBarSize(),BottomRight.y() - TopLeft.y()); break; case ProgressBar::VERTICAL_ORIENTATION: default: _ProgressBarPosition.setValues( Pos*(BottomRight.x() - TopLeft.x())*(1.0-getIndeterminateBarSize()), TopLeft.y()); _ProgressBarSize.setValues( TopLeft.x(), Pos*(BottomRight.y() - TopLeft.y())*(1.0-getIndeterminateBarSize())); break; } } else { if(getRangeModel() == NULL) {return;} Real32 Percent(getPercentComplete()); _ProgressBarPosition = TopLeft; switch(getOrientation()) { case ProgressBar::HORIZONTAL_ORIENTATION: _ProgressBarSize.setValues( (BottomRight.x() - TopLeft.x())*Percent,BottomRight.y() - TopLeft.y()); break; case ProgressBar::VERTICAL_ORIENTATION: default: _ProgressBarSize.setValues( BottomRight.x() - TopLeft.x(),(BottomRight.y() - TopLeft.y())*Percent); break; } } }
bool MetaGait::updateGaits() { if (newGaitSent) { //Make a hybrid gait from the currently selected gaits AbstractGait hybridGait; const double percComplete = getPercentComplete(); interpolateGaits(hybridGait, curGait, nextGait, percComplete); //Swap the gaits curGait = hybridGait; nextGait = newGait; //Reset the counters resetTransitioning(); newGaitSent = false; } else { transitionCounter = std::min(transitionCounter + 1, transitionFrames + 1); } //we still need more processing, return transitionCounter <= transitionFrames; }
void ShellScriptCallback::callback() { if (m_done) return; double currPerc = getPercentComplete(); if (pdal::Utils::compare_distance<double>(currPerc, 100.0)) { m_done = true; } else if (currPerc >= m_lastMajorPerc + 10.0) { std::string output; int stat = pdal::Utils::run_shell_command(m_command + " " + boost::lexical_cast<std::string>(static_cast<int>(currPerc)), output); m_lastMajorPerc = currPerc; m_lastMinorPerc = currPerc; } else if (currPerc >= m_lastMinorPerc + 2.0) { m_lastMinorPerc = currPerc; } return; }
void MetaGait::tick_gait() { if (updateGaits()) { interpolateGaits(*this, curGait, nextGait, getPercentComplete()); } }
void ofxTimeline::setCurrentTimeToOutPoint(){ inoutRange.max = getPercentComplete(); if(inoutRange.min > inoutRange.max){ inoutRange.min = 0.0; } }
void ofxTimeline::setCurrentTimeToInPoint(){ inoutRange.min = getPercentComplete(); if(inoutRange.max < inoutRange.min){ inoutRange.max = 1.0; } }