Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temporal gui fixes #40787

Closed
wants to merge 10 commits into from
Closed

Temporal gui fixes #40787

wants to merge 10 commits into from

Conversation

rduivenvoorde
Copy link
Contributor

These 3 commits fix some smaller glitches in the temporal GUI part of QGIS.

  • The first one fixes the fact that you can create a step of zero time-units in the gui.
    Either by editing the input: type 0 and enter.
    Or by using the little down-arrow when Step is 1.000:
    Screenshot-20201229171003-712x144
    Setting a timestep of zero makes no sense (as at that moment you have a TimeFrame of zero, and you cannot step through your data anymore with the slider).

  • The second one a makes working with MilliSeconds actually work.
    In the code the amount of 'seconds' was added to the earlier step datetime. But if you had choosen that the timestep-unit was milliseconds the logic added 'zero' to the step.
    Also in the gui you could not see the 'size' of the frame because the start- and end-datetime were formatted WITHOUT milliseconds:
    Screenshot-20201229171620-666x123
    Now the code takes ms into account AND actually shows them (but only IF the step unit is actually ms):
    Screenshot-20201229171754-794x116

  • The third one fixes Temporal Controller ends with a Frame with Step size == zero #40777: if you moved the slider to the last timeframe, the size of the timeframe shrunk to a zerosize timeframe:
    Screenshot-20201229171947-713x145
    this was because the logic did not add the 'timestep' to the last datetime of the project extents (because it is indeed 'outside' the project extent....). Now IF we are the last frame we add the actual timestep to it, so it looks better and creates a real filter:
    Screenshot-20201229172422-708x125

Because the spinbox had it's number of  decimals set to 3 (in ui file)
BUT the minimum set (in code)was much smaller, it was possible to set
the spinbox to 0.000 (becoming zero) raising strange issues further on.

This commit sets both the number of decimals AND the minimum
of the spinbox in the code, so it is clear that they should stay
'in sync'
When using timestep < 1s did not work because logic was working
for seconds only (adding 0 sec in case of milliseconds).
With these changes we add milliseconds to the timeframe,
AND we show them in the Temporal Controller ui (only if the
timestep-units ARE milliseconds
Because the TimeSlider's last frame is the frame BEGINNING with
the last timestamp of the mTemporalExtents, we are actually requesting
a frame outside the mTemporalExtents.

This commit adds the amount of time to the calculated end so
it's size is actually not zero but the exact timestep size.
@github-actions github-actions bot added this to the 3.18.0 milestone Dec 29, 2020
@rduivenvoorde
Copy link
Contributor Author

Checking tests

@rduivenvoorde
Copy link
Contributor Author

Mmm, I fixed checks, but accidently added a file in which I was trying out something else. Tried to fix that by removing that commit and force pushing, and now... I'm lost :-(

@troopa81
Copy link
Contributor

I'm lost :-(

Regarding the CI, it looks not related to your modifications

toomanyrequests: You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: https://www.docker.com/increase-rate-limit

Anonymous and Free Docker Hub users are limited to 100 and 200 container image pull requests per six hours.

You can close and reopen the PR so the CI is triggered again.

@nyalldawson
Copy link
Collaborator

@rduivenvoorde first two commits look good, thanks

I'm not convinced on 78b374a though -- to me this makes the result misleading, as the animation won't actually respect the user-set maximum time value and will instead show a "bit more" past the end of this value. The consequences of that are hard to determine, but it potentially makes for misleading/inaccurate results, which should be avoided.

Will #40371 help with this?

@rduivenvoorde
Copy link
Contributor Author

Thanks for checking this!

@nyalldawson @Samweli about 78b374a I think this really all depends on the use and use-case.
In my case the 'data-time-extents' are based (automatically by QGIS) on the timestamps in the data.
The timestep (aka timeframes I will step through my data) do not necessarily match those. So yes they can go out of sync, which I think is fine. The old behavior, in my view, was also counter intuitive: it created a 'zero-sized' timestamp on the end (which behaves differently on different providers in my case). It is not clear to me how #40371 is related, sorry.
If I misunderstand this 'timestep' concept, please let me know.

I'm trying to think out the different (data) use cases myself here. And actually come to the conclusion that one of my older pull requests #39568 actually is also not fitting all use cases...
Eg when the data are singulairities (only one timestamp, as tweets in time) this pull does NOT behave intuitive.
I think I will propose to revert it. But II, but I do have to find a way to make #38468 work.
One way could be to make it easier/possible in api/gui to let the user determine if the boundaries/limits of the timesteps should be including/excluding (and defaulting to current: including begin, excluding end).

The old implementation of finding the best fit for the old timeframe
was by looping over ALL possible timeframes, raising issues when the
user selected milliseconds in a dataset with a rather large Range-extent

This new implementation finds a better rough frame to start so the
loop should be ended within a short time.
The service from #40786 issue is now super quick.
@rduivenvoorde
Copy link
Contributor Author

Last commit fixes the potentially huge loop from #40786

If 78b374a is really an issue for people then I'm happy to remove it.

// earlier we looped from frame 0 till totalFrameCount() here, but this loop grew gigantic if you switched to for example milliseconds
// that is why now we calculate a rough framestart
long long roughFrameStart = std::floor( ( frameStart - mTemporalExtents.begin() ).seconds() / mFrameDuration.seconds() );
for ( long i = roughFrameStart; i < totalFrameCount(); ++i )
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't we potentially need to check backwards in some circumstances here? Eg. if the initial guess was too large and the frame estimated actually sits after the desired frameStart, then we'd need to step backwards from the guess until the candidate frame start is <= frameStart...

But otherwise, good approach to fixing this!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nyalldawson my gut feeling is that this will never happen, because of the 'floor', AND the fact that you only use the begin of the old frame in combination with a timestep-frame with a length >0
BUT I'm not 100% sure... but in my experiments this all worked.
I can add a comment or todo?

@nyalldawson
Copy link
Collaborator

If 78b374a is really an issue for people then I'm happy to remove it.

Any chance you coudl remove it from this PR so that we can merge the rest? Then we can discuss its merits after @Samweli's work is merged, and we can determine whether it's still an issue

@rduivenvoorde
Copy link
Contributor Author

This is becoming a mess I think, will close it and create a new PR later with only:

  • fix the zero-timestep in the gui
  • make milliseconds work (and visible in gui) (though I think it already works now, just not visible)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Temporal Controller ends with a Frame with Step size == zero
3 participants