Пример #1
0
TimelineContainer::TimelineContainer(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::TimelineContainer)
{
    ui->setupUi(this);

    mCurrentLayerIdx = -1;
    mPlaybackWidget = findChild<PlaybackWidget*>("playback_widget");
    mTimelineWidget = findChild<TimelineWidget*>("timeline_widget");

    mLayerScrollArea = findChild<QScrollArea*>("scroll_layers");
    mLayerLayout = dynamic_cast<QVBoxLayout*>(mLayerScrollArea->widget()->layout());

    QObject::connect(mPlaybackWidget, &PlaybackWidget::positionChanged,
                     mTimelineWidget, &TimelineWidget::setCursor);
    QObject::connect(mPlaybackWidget, &PlaybackWidget::durationChanged,
                     mTimelineWidget, &TimelineWidget::setLength);
    QObject::connect(mTimelineWidget, &TimelineWidget::timeClicked,
                     mPlaybackWidget, &PlaybackWidget::setPosition);
    QObject::connect(mPlaybackWidget, &PlaybackWidget::snappingChanged,
                     [this] (double step) {
        if (!timeline())
            return;
        emit snapIntervalChanged(snapInterval(timeline()->bpm(), step));
    });
}
Пример #2
0
void Animation::setCompositorPending(bool effectChanged)
{
    // FIXME: KeyframeEffect could notify this directly?
    if (!hasActiveAnimationsOnCompositor()) {
        destroyCompositorPlayer();
        m_compositorState.release();
    }
    if (effectChanged && m_compositorState) {
        m_compositorState->effectChanged = true;
    }
    if (m_compositorPending || m_isPausedForTesting) {
        return;
    }
#if !ENABLE(OILPAN)
    if (!timeline() || !timeline()->document()) {
        return;
    }
#endif

    if (!m_compositorState || m_compositorState->effectChanged
        || m_compositorState->playbackRate != m_playbackRate
        || m_compositorState->startTime != m_startTime) {
        m_compositorPending = true;
        timeline()->document()->compositorPendingAnimations().add(this);
    }
}
void ExperimentalTrajectory::precalculateTrajectory(double DT, Eigen::MatrixXd& _path, Eigen::VectorXd& _timeline)
{
    double currentTime = 0.0;

    int numberOfDataPoints = ceil((pointToPointDurationVector.sum() / DT)*2);

    Eigen::MatrixXd path(numberOfDataPoints, nDoF);
    Eigen::VectorXd timeline(numberOfDataPoints);


    int index = 0;
    startTrigger = true;
    currentWaypointIndex = 0;
    while (!trajectoryFinished)
    {
        path.row(index) = getDesiredValues(currentTime).col(POS_INDEX).transpose();
        timeline(index) = currentTime;
        currentTime += DT;
        index++;
    }
    //  reset values to their original state
    startTrigger = true;
    currentWaypointIndex = 0;
    trajectoryFinished = false;

    _path = path.topRows(index);
    _timeline = timeline.head(index);


}
Пример #4
0
void Global::resolveAmbiguousShortcuts(const QKeySequence & key)
{
    if(key == QKeySequence(Qt::Key_Home))
    {
        timeline()->goToFirstFrame();
    }
    else if(key == QKeySequence(Qt::Key_End))
    {
        timeline()->goToLastFrame();
    }
}
Пример #5
0
bool AnimationPlayer::canStartAnimationOnCompositor()
{
    // FIXME: Timeline playback rates should be compositable
    if (m_playbackRate == 0 || (std::isinf(sourceEnd()) && m_playbackRate < 0) || (timeline() && timeline()->playbackRate() != 1))
        return false;

    return m_timeline && m_content && m_content->isAnimation() && playing();
}
Пример #6
0
void Screen_game::draw(string gender, float rotate, bool leftside, bool rightside){
    
    background.draw(Left, Right);
    
    timeline();
    lives(gender);
    
    Left = leftside;
    Right = rightside;
    
    if(Left) rotation = -(rotate*122);
    if(Right) rotation = rotate*120;
    
    if(gender == "boy"){
        
        if(fabs(rotation) > 50.0 || robotFalling){
            robotFalling = true;
            boy_fell();
        }else{
            boy();
            prevRotation = rotation;
            fallPositionX = 0;
            fallPositionY = 0;
            
            if(new_num_lives <= 0){
                background.timer = 0;
                background.pause = 0;
                background.init();
            }
            
            if(num_lives > new_num_lives) num_lives = new_num_lives;
        }
        
    }else{
        
        if(fabs(rotation) > 50.0 || robotFalling){
            robotFalling = true;
            girl_fell();
        }else{
            girl();
            prevRotation = rotation;
            fallPositionX = 0;
            fallPositionY = 0;
            
            if(new_num_lives <= 0){
                background.timer = 0;
                background.pause = 0;
                background.init();
            }
            
            if(num_lives > new_num_lives) num_lives = new_num_lives;
            
            
        }
        
    }
    
}
Пример #7
0
void StatsManager::writeTimeline(const QString& filename) {
    QFile timeline(filename);
    if (!timeline.open(QIODevice::WriteOnly | QIODevice::Text)) {
        qDebug() << "Could not open timeline file for writing:"
                 << timeline.fileName();
        return;
    }

    if (m_events.isEmpty()) {
        qDebug() << "No events recorded.";
        return;
    }

    // Sort by time.
    qSort(m_events.begin(), m_events.end(), OrderByTime());

    mixxx::Duration last_time = m_events[0].m_time;

    QMap<QString, qint64> startTimes;
    QMap<QString, qint64> endTimes;
    QMap<QString, Stat> tagStats;

    QTextStream out(&timeline);
    foreach (const Event& event, m_events) {
        qint64 last_start = startTimes.value(event.m_tag, -1);
        qint64 last_end = endTimes.value(event.m_tag, -1);

        qint64 duration_since_last_start = last_start == -1 ? 0 :
                event.m_time.toIntegerNanos() - last_start;
        qint64 duration_since_last_end = last_end == -1 ? 0 :
                event.m_time.toIntegerNanos() - last_end;

        if (event.m_type == Stat::EVENT_START) {
            // We last saw a start and we just saw another start.
            if (last_start > last_end) {
                qDebug() << "Mismatched start/end pair" << event.m_tag;
            }
            startTimes[event.m_tag] = event.m_time.toIntegerNanos();
        } else if (event.m_type == Stat::EVENT_END) {
            // We last saw an end and we just saw another end.
            if (last_end > last_start) {
                qDebug() << "Mismatched start/end pair" << event.m_tag;
            }
            endTimes[event.m_tag] = event.m_time.toIntegerNanos();
        }

        // TODO(rryan): CSV escaping
        qint64 elapsed = (event.m_time - last_time).toIntegerNanos();
        out << event.m_time.toIntegerNanos() << ","
            << "+" << humanizeNanos(elapsed) << ","
            << "+" << humanizeNanos(duration_since_last_start) << ","
            << "+" << humanizeNanos(duration_since_last_end) << ","
            << Stat::statTypeToString(event.m_type) << ","
            << event.m_tag << "\n";
        last_time = event.m_time;
    }
Пример #8
0
void TimelineIndicator::setPosition (double time, bool musical)
{
    if (musical) {
        const float bpm = (float) timeline()->timeScale().getTempo();
        time = (time * (60.0f / bpm));
    }

    pos.setValue (time);
    parentSizeChanged();
}
Пример #9
0
bool Animation::canStartAnimationOnCompositor() const
{
    if (m_isCompositedAnimationDisabledForTesting)
        return false;

    // FIXME: Timeline playback rates should be compositable
    if (m_playbackRate == 0 || (std::isinf(effectEnd()) && m_playbackRate < 0) || (timeline() && timeline()->playbackRate() != 1))
        return false;

    return m_timeline && m_content && m_content->isKeyframeEffect() && playing();
}
Пример #10
0
void TimelineIndicator::mouseDrag (const MouseEvent& ev)
{
    if (! dragable())
        return;

    Rectangle<int> r (getBoundsInParent());

    dragger.dragComponent (this, ev, nullptr);
    int snap = shouldSnap ? timeline()->pixelSnap (getBoundsInParent().getX())
                          : getBoundsInParent().getX();

    setBounds (r); // reset it back to normal

    if (snap != lastSnap || ! shouldSnap)
    {
        setBounds (snap, 0, 1, timeline()->getHeight());
        pos.setValue (getUnits());
        lastSnap = snap;
    }
}
Пример #11
0
 void PretzelColorPicker::contract() {
     mBounds = mCollapsedRect;
     timeline().apply(&mArrowRotation, 0.0f, 0.1f);
     bExpanded = false;
     
     BasePretzel *bp = mParent;
     while( bp->getParent() != NULL ){
         bp = bp->getParent();
     }
     bp->updateChildrenBounds();
 }
Пример #12
0
bool AnimationPlayer::maybeStartAnimationOnCompositor()
{
    if (!canStartAnimationOnCompositor())
        return false;

    double startTime = timeline()->zeroTime() + startTimeInternal();
    double timeOffset = 0;
    if (std::isnan(startTime)) {
        timeOffset = currentTimeInternal();
    }
    return toAnimation(m_content.get())->maybeStartAnimationOnCompositor(startTime, timeOffset);
}
Пример #13
0
void AnimationPlayer::setCompositorPending(bool sourceChanged)
{
    // FIXME: Animation could notify this directly?
    if (!hasActiveAnimationsOnCompositor()) {
        m_compositorState.release();
    }
    if (!m_compositorPending) {
        m_compositorPending = true;
        if (sourceChanged && m_compositorState)
            m_compositorState->sourceChanged = true;
        timeline()->document()->compositorPendingAnimations().add(this);
    }
}
Пример #14
0
		void shakeCamera(TimelineManager& mTimelineManager, Camera& mCamera)
		{
			int s{7};
			Vector2f oldCenter{mCamera.getCenter()};
			Timeline& timeline(mTimelineManager.create());

			for(int i{s}; i > 0; --i)
			{
				timeline.append<Do>([&mCamera, oldCenter, i]{ mCamera.centerOn(oldCenter + Vector2f(getRnd(-i, i), getRnd(-i, i))); });
				timeline.append<Wait>(1); timeline.append<Go>(0, 3);
			}

			timeline.append<Do>([&mCamera, oldCenter]{ mCamera.centerOn(oldCenter); });
		}
Пример #15
0
void AnimationPlayer::setCompositorPending(bool sourceChanged)
{
    // FIXME: Animation could notify this directly?
    if (!hasActiveAnimationsOnCompositor()) {
        m_compositorState.release();
    }
    if (sourceChanged && m_compositorState) {
        m_compositorState->sourceChanged = true;
    }
    if (m_compositorPending || m_isPausedForTesting) {
        return;
    }

    if (sourceChanged || !m_compositorState
        || !playing() || m_compositorState->playbackRate != m_playbackRate
        || m_compositorState->startTime != m_startTime) {
        m_compositorPending = true;
        timeline()->document()->compositorPendingAnimations().add(this);
    }
}
Пример #16
0
bool AnimationPlayer::maybeStartAnimationOnCompositor()
{
    if (!canStartAnimationOnCompositor())
        return false;

    bool reversed = m_playbackRate < 0;

    double startTime = timeline()->zeroTime() + startTimeInternal();
    if (reversed) {
        startTime -= sourceEnd() / fabs(m_playbackRate);
    }

    double timeOffset = 0;
    if (std::isnan(startTime)) {
        timeOffset = reversed ? sourceEnd() - currentTimeInternal() : currentTimeInternal();
        timeOffset = timeOffset / fabs(m_playbackRate);
    }
    ASSERT(m_compositorGroup != 0);
    return toAnimation(m_content.get())->maybeStartAnimationOnCompositor(m_compositorGroup, startTime, timeOffset, m_playbackRate);
}
Пример #17
0
bool AnimationPlayer::update(TimingUpdateReason reason)
{
    if (!m_timeline)
        return false;

    PlayStateUpdateScope updateScope(*this, reason, DoNotSetCompositorPending);

    m_outdated = false;
    bool idle = playStateInternal() == Idle;

    if (m_content) {
        double inheritedTime = idle || isNull(m_timeline->currentTimeInternal()) ? nullValue() : currentTimeInternal();
        // Special case for end-exclusivity when playing backwards.
        if (inheritedTime == 0 && m_playbackRate < 0)
            inheritedTime = -1;
        m_content->updateInheritedTime(inheritedTime, reason);
    }

    if ((idle || finished()) && !m_finished) {
        if (reason == TimingUpdateForAnimationFrame && (idle || hasStartTime())) {
            const AtomicString& eventType = EventTypeNames::finish;
            if (executionContext() && hasEventListeners(eventType)) {
                double eventCurrentTime = currentTimeInternal() * 1000;
                m_pendingFinishedEvent = AnimationPlayerEvent::create(eventType, eventCurrentTime, timeline()->currentTime());
                m_pendingFinishedEvent->setTarget(this);
                m_pendingFinishedEvent->setCurrentTarget(this);
                m_timeline->document()->enqueueAnimationFrameEvent(m_pendingFinishedEvent);
            }
            m_finished = true;
        }
    }
    ASSERT(!m_outdated);
    return !m_finished;
}
Пример #18
0
bool Animation::update(TimingUpdateReason reason)
{
    if (!m_timeline)
        return false;

    PlayStateUpdateScope updateScope(*this, reason, DoNotSetCompositorPending);

    clearOutdated();
    bool idle = playStateInternal() == Idle;

    if (m_content) {
        double inheritedTime = idle || isNull(m_timeline->currentTimeInternal())
            ? nullValue()
            : currentTimeInternal();

        if (!isNull(inheritedTime)) {
            double timeForClipping = m_held && (!limited(inheritedTime) || isNull(m_startTime))
                // Use hold time when there is no start time.
                ? inheritedTime
                // Use calculated current time when the animation is limited.
                : calculateCurrentTime();
            if (clipped(timeForClipping))
                inheritedTime = nullValue();
        }
        // Special case for end-exclusivity when playing backwards.
        if (inheritedTime == 0 && m_playbackRate < 0)
            inheritedTime = -1;
        m_content->updateInheritedTime(inheritedTime, reason);
    }

    if ((idle || limited()) && !m_finished) {
        if (reason == TimingUpdateForAnimationFrame && (idle || hasStartTime())) {
            if (idle) {
                // TODO(dstockwell): Fire the cancel event.
            } else {
                const AtomicString& eventType = EventTypeNames::finish;
                if (executionContext() && hasEventListeners(eventType)) {
                    double eventCurrentTime = currentTimeInternal() * 1000;
                    m_pendingFinishedEvent = AnimationPlayerEvent::create(eventType, eventCurrentTime, timeline()->currentTime());
                    m_pendingFinishedEvent->setTarget(this);
                    m_pendingFinishedEvent->setCurrentTarget(this);
                    m_timeline->document()->enqueueAnimationFrameEvent(m_pendingFinishedEvent);
                }
            }
            m_finished = true;
        }
    }
    ASSERT(!m_outdated);
    return !m_finished || std::isfinite(timeToEffectChange());
}
Пример #19
0
void Animation::notifyAnimationStarted(double monotonicTime, int group)
{
    ASSERT(RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled());
    timeline()->document()->compositorPendingAnimations().notifyCompositorAnimationStarted(monotonicTime, group);
}
Пример #20
0
bool read_timelines( const string fname, vector<Timeline>& timelines, int &max_step )
{
	timelines.clear();
	ifstream fin(fname.c_str());
	if(!fin) 
	{  
    	return false; 
   } 
	string line;
	max_step = 0;
	int num = 0;
	size_t found;
	while(getline(fin, line) ) 
	{
		num += 1;
		found = line.find(":");
		if( found == string::npos )
		{
			continue;
		}
		line = line.substr(found+1);
		stringstream ss(line);
		string temp;
		vector<int> steps;
		vector<int> cluster_indices;
	   while (getline(ss, temp, ',')) 
		{  
			found = temp.find("=");
			if( found == string::npos )
			{
				cerr << "Error: unexpected timeline definition on line " << num << endl;
				return false;
			}
			int step;
			stringstream is(temp.substr(0,found));
			if( (is >> step).fail() || step < 1 )
			{
				cerr << "Error: Invalid step index '" << is << "' on line " << num << endl;
				return false;
			}
			int step_cluster_index;
			stringstream ic(temp.substr(found+1));
			if( (ic >> step_cluster_index).fail() || step_cluster_index < 1 )
			{
				cerr << "Error: Invalid cluster index '" << ic << "' on line " << num << endl;
				return false;
			}
			steps.push_back(step);
			cluster_indices.push_back(step_cluster_index);
			max_step = max(max_step, step);
	   }
		if( steps.size() > 0 )
		{
			Timeline timeline( steps, cluster_indices );
			timelines.push_back(timeline);
		}
	}
	if( timelines.empty() )
	{
		cerr << "Error: file contained no valid timelines" << endl;
		return false;
	}
	return true;
}
Пример #21
0
bool AnimationPlayer::update(TimingUpdateReason reason)
{
    if (!m_timeline)
        return false;

    updateCurrentTimingState(reason);
    m_outdated = false;

    if (m_content) {
        double inheritedTime = isNull(m_timeline->currentTimeInternal()) ? nullValue() : currentTimeInternal();
        m_content->updateInheritedTime(inheritedTime, reason);
    }

    if (finished() && !m_finished) {
        if (reason == TimingUpdateForAnimationFrame && hasStartTime()) {
            const AtomicString& eventType = EventTypeNames::finish;
            if (executionContext() && hasEventListeners(eventType)) {
                m_pendingFinishedEvent = AnimationPlayerEvent::create(eventType, currentTime(), timeline()->currentTime());
                m_pendingFinishedEvent->setTarget(this);
                m_pendingFinishedEvent->setCurrentTarget(this);
                m_timeline->document()->enqueueAnimationFrameEvent(m_pendingFinishedEvent);
            }
            m_finished = true;
        }
    }
    ASSERT(!m_outdated);
    return !m_finished || !finished();
}
Пример #22
0
void QRcode::initAnim()
{
	timeline().apply( &startQRCodeHolderXY,	Vec2f(1270.0f,-971.0f), Vec2f(1270.f, 0.f), 0.6f, EaseOutQuad() );
}
Пример #23
0
double TimelineIndicator::getUnits() const
{
    return timeline()->xToTime (getBoundsInParent().getX());
}
Пример #24
0
extern void aprstat_wxgraph(maptool_pIMAGE * img, aprsdecode_pOPHIST op,
                unsigned long stime, unsigned short * what,
                struct aprstat_LASTVAL * lastval)
{
   aprsdecode_pFRAMEHIST fr;
   unsigned long Maxx;
   unsigned long step;
   unsigned long xt;
   unsigned long xi;
   float XStep;
   float yax1;
   float yax0;
   float vh;
   struct WX min0;
   struct WX max0;
   char hh[256];
   char h[256];
   char s[256];
   struct aprsdecode_DAT dat;
   float temp[1440];
   float hyg[1440];
   float baro[1440];
   float winds[1440];
   float windd[1440];
   float gust[1440];
   float rain1[1440];
   float rain24[1440];
   float rain0[1440];
   float lumi[1440];
   unsigned short have;
   char dirvalid;
   struct WX * anonym;
   if (op==0 || op->frames==0) {
      /*OR (op^.lastinftyp<100)*/
      return;
   }
   Maxx = dynmaxx(8UL, 320UL, 720UL);
   XStep = X2C_DIVR((float)Maxx,1440.0f);
   *img = 0;
   for (xi = 0UL; xi<=1439UL; xi++) {
      temp[xi] = (-1.E+4f);
      hyg[xi] = (-1.E+4f);
      baro[xi] = (-1.E+4f);
      winds[xi] = (-1.E+4f);
      windd[xi] = (-1.E+4f);
      gust[xi] = (-1.E+4f);
      rain1[xi] = (-1.E+4f);
      rain24[xi] = (-1.E+4f);
      rain0[xi] = (-1.E+4f);
      lumi[xi] = (-1.E+4f);
   } /* end for */
   { /* with */
      struct WX * anonym = &max0;
      anonym->temp = (-1.E+4f);
      anonym->hyg = (-1.E+4f);
      anonym->baro = (-1.E+4f);
      anonym->wind = (-1.E+4f);
      anonym->rain = (-1.E+4f);
      anonym->lumi = (-1.E+4f);
      anonym->siev = (-1.E+4f);
   }
   dirvalid = 0;
   min0.temp = X2C_max_real;
   min0.baro = X2C_max_real;
   memset((char *)lastval,(char)0,sizeof(struct aprstat_LASTVAL));
   fr = op->frames;
   do {
      if (((fr->time0>stime-86400UL && fr->time0<=stime)
                && aprsdecode_Decode(fr->vardat->raw, 500ul,
                &dat)>=0L) && dat.sym=='_') {
         xt = aprsdecode_trunc((float)(fr->time0-(stime-86400UL))
                *1.6666666666667E-2f);
         if (xt>=1440UL) xt = 1439UL;
         vh = X2C_DIVR(dat.wx.temp-32.0f,1.8f);
         if (vh>=(-99.0f) && vh<=99.0f) {
            temp[xt] = vh;
            if (vh>max0.temp) max0.temp = vh;
            if (vh<min0.temp) min0.temp = vh;
            lastval->temp = vh;
         }
         if (dat.wx.hygro>=0.0f && dat.wx.hygro<=100.0f) {
            hyg[xt] = dat.wx.hygro;
            if (dat.wx.hygro>max0.hyg) max0.hyg = dat.wx.hygro;
            lastval->hyg = dat.wx.hygro;
         }
         vh = dat.wx.baro*0.1f;
         if (vh>=900.0f && vh<=1100.0f) {
            baro[xt] = vh;
            if (vh>max0.baro) max0.baro = vh;
            if (vh<min0.baro) min0.baro = vh;
            lastval->baro = vh;
         }
         vh = dat.wx.rain24*0.254f;
         if (vh>=0.0f && vh<300.0f) {
            rain24[xt] = vh;
            if (vh>max0.rain) max0.rain = vh;
            lastval->rain24 = vh;
         }
         vh = dat.wx.raintoday*0.254f;
         if (vh>=0.0f && vh<300.0f) {
            rain0[xt] = vh;
            if (vh>max0.rain) max0.rain = vh;
         }
         vh = dat.wx.rain1*0.254f;
         if (vh>=0.0f && vh<300.0f) {
            rain1[xt] = vh;
            if (vh>max0.rain) max0.rain = vh;
            lastval->rain = vh;
         }
         if (dat.wx.lum>=0.0f && dat.wx.lum<=2000.0f) {
            lumi[xt] = dat.wx.lum;
            if (dat.wx.lum>max0.lumi) max0.lumi = dat.wx.lum;
            lastval->lumi = dat.wx.lum;
         }
         if (dat.wx.sievert>=0.0f && dat.wx.sievert<1000.0f) {
            /*        siev[xt]:=dat.wx.sievert; */
            if (dat.wx.sievert>max0.siev) max0.siev = dat.wx.sievert;
            lastval->siev = dat.wx.sievert;
         }
         if (dat.course>0UL && dat.course<=360UL) {
            lastval->winddir = (float)(dat.course%360UL);
            windd[xt] = lastval->winddir;
            dirvalid = 1;
         }
         vh = (float)dat.speed*1.609f;
         if (vh>=0.0f && vh<=1000.0f) {
            winds[xt] = vh;
            lastval->winds = vh;
            if (vh>max0.wind) max0.wind = vh;
         }
         vh = dat.wx.gust*1.609f;
         if (vh>=0.0f && vh<=1000.0f) {
            gust[xt] = vh;
            lastval->gust = vh;
            if (vh>max0.wind) max0.wind = vh;
         }
      }
      fr = fr->next;
   } while (fr);
   aprstext_DateLocToStr(stime, h, 256ul);
   aprsstr_Append(h, 256ul, " ", 2ul);
   aprsstr_Append(h, 256ul, op->call, 9ul);
   have = 0U;
   if (max0.temp!=(-1.E+4f)) {
      have |= 0x1U;
      if ((0x1U & *what)) {
         if (!newimg(Maxx, img)) return;
         scale(temp, 1440ul, min0.temp, max0.temp, 120.0f, 10.0f, &yax0,
                &yax1, &step);
         aprsstr_FixToStr(lastval->temp, 2UL, s, 256ul);
         aprsstr_Append(s, 256ul, "\177C ", 4ul);
         aprsstr_Append(s, 256ul, h, 256ul);
         paper(img, yax0, yax1, step, 8UL, Maxx, 120UL, s, 256ul);
         timeline(stime, img, Maxx);
         dots(XStep, img, temp, 1440ul, 1, 200UL, 700UL, 40UL);
      }
   }
   if (max0.baro!=(-1.E+4f)) {
      have |= 0x2U;
      if ((0x2U & *what)) {
         if (!newimg(Maxx, img)) return;
         scale(baro, 1440ul, min0.baro, max0.baro, 120.0f, 2.0f, &yax0,
                &yax1, &step);
         aprsstr_FixToStr(lastval->baro, 2UL, s, 256ul);
         aprsstr_Append(s, 256ul, "hPa ", 5ul);
         aprsstr_Append(s, 256ul, h, 256ul);
         paper(img, yax0, yax1, step, 8UL, Maxx, 120UL, s, 256ul);
         timeline(stime, img, Maxx);
         dots(XStep, img, baro, 1440ul, 1, 500UL, 400UL, 500UL);
      }
   }
   if (max0.wind!=(-1.E+4f) && max0.wind>0.0f) {
      have |= 0x8U;
      if ((0x8U & *what)) {
         if (!newimg(Maxx, img)) return;
         scale(winds, 1440ul, (-1.E+4f), max0.wind, 120.0f, 20.0f, &yax0,
                &yax1, &step);
         scale(gust, 1440ul, (-1.E+4f), max0.wind, 120.0f, 20.0f, &yax0,
                &yax1, &step);
         s[0U] = 0;
         if (lastval->winds!=0.0f || lastval->gust==0.0f) {
            aprsstr_FixToStr(lastval->winds, 2UL, hh, 256ul);
            aprsstr_Append(hh, 256ul, "km/h Wind  ", 12ul);
            aprsstr_Append(s, 256ul, hh, 256ul);
         }
         if (lastval->gust!=0.0f) {
            aprsstr_FixToStr(lastval->gust, 2UL, hh, 256ul);
            aprsstr_Append(hh, 256ul, "km/h Gust  ", 12ul);
            aprsstr_Append(s, 256ul, hh, 256ul);
         }
         aprsstr_Append(s, 256ul, h, 256ul);
         paper(img, yax0, yax1, step, 8UL, Maxx, 120UL, s, 256ul);
         timeline(stime, img, Maxx);
         dots(XStep, img, winds, 1440ul, 1, 100UL, 500UL, 700UL);
         dots(XStep, img, gust, 1440ul, 1, 600UL, 100UL, 0UL);
      }
      if (dirvalid) {
         have |= 0x10U;
         if ((0x10U & *what)) {
            if (!newimg(Maxx, img)) return;
            scale(windd, 1440ul, (-1.E+4f), 360.0f, 120.0f, 365.0f, &yax0,
                &yax1, &step);
            aprsstr_FixToStr(lastval->winddir, 0UL, s, 256ul);
            aprsstr_Append(s, 256ul, "deg Wind Direction ", 20ul);
            aprsstr_Append(s, 256ul, h, 256ul);
            paper(img, yax0, yax1, 90UL, 8UL, Maxx, 120UL, s, 256ul);
            timeline(stime, img, Maxx);
            dots(XStep, img, windd, 1440ul, 0, 200UL, 700UL, 700UL);
         }
      }
   }
   if (max0.hyg!=(-1.E+4f)) {
      have |= 0x4U;
      if ((0x4U & *what)) {
         if (!newimg(Maxx, img)) return;
         scale(hyg, 1440ul, (-1.E+4f), 100.0f, 120.0f, 101.0f, &yax0, &yax1,
                &step);
         aprsstr_FixToStr(lastval->hyg, 0UL, s, 256ul);
         aprsstr_Append(s, 256ul, "% Humidty ", 11ul);
         aprsstr_Append(s, 256ul, h, 256ul);
         paper(img, yax0, yax1, step, 8UL, Maxx, 120UL, s, 256ul);
         timeline(stime, img, Maxx);
         dots(XStep, img, hyg, 1440ul, 1, 0UL, 500UL, 700UL);
      }
   }
   if (max0.lumi!=(-1.E+4f)) {
      have |= 0x40U;
      if ((0x40U & *what)) {
         if (!newimg(Maxx, img)) return;
         scale(lumi, 1440ul, (-1.E+4f), max0.lumi, 120.0f, 50.0f, &yax0,
                &yax1, &step);
         aprsstr_FixToStr(lastval->lumi, 0UL, s, 256ul);
         aprsstr_Append(s, 256ul, "W/m^2 Luminosity ", 18ul);
         aprsstr_Append(s, 256ul, h, 256ul);
         paper(img, yax0, yax1, step, 8UL, Maxx, 120UL, s, 256ul);
         timeline(stime, img, Maxx);
         dots(XStep, img, lumi, 1440ul, 1, 600UL, 600UL, 0UL);
      }
   }
   if (max0.rain!=(-1.E+4f)) {
      have |= 0x20U;
      if ((0x20U & *what)) {
         if (!newimg(Maxx, img)) return;
         scale(rain1, 1440ul, (-1.E+4f), max0.rain, 120.0f, 5.0f, &yax0,
                &yax1, &step);
         scale(rain24, 1440ul, (-1.E+4f), max0.rain, 120.0f, 5.0f, &yax0,
                &yax1, &step);
         scale(rain0, 1440ul, (-1.E+4f), max0.rain, 120.0f, 5.0f, &yax0,
                &yax1, &step);
         aprsstr_FixToStr(lastval->rain, 2UL, s, 256ul);
         aprsstr_Append(s, 256ul, "mm Rain ", 9ul);
         aprsstr_Append(s, 256ul, h, 256ul);
         paper(img, yax0, yax1, step, 8UL, Maxx, 120UL, s, 256ul);
         timeline(stime, img, Maxx);
         dots(XStep, img, rain1, 1440ul, 1, 500UL, 100UL, 0UL);
         dots(XStep, img, rain24, 1440ul, 1, 50UL, 600UL, 50UL);
         dots(XStep, img, rain0, 1440ul, 1, 100UL, 100UL, 700UL);
      }
   }
   if (max0.siev>0.0f) have |= 0x400U;
   *what = have;
/*
  IF img<>NIL THEN DISPOSE(img) END;
*/
} /* end wxgraph() */
Пример #25
0
void TimelineIndicator::parentSizeChanged()
{
    // DBG ("TimelineIndicator::parentSizeChanged: pos = " + String (position()) + " x = " + String(timeline()->timeToX (position())));
    setBounds (timeline()->timeToX (position()),
               0, 1, timeline()->getHeight());
}