[QGIS-Developer] Temporal ranges, default to 'include' both beginning and end?

Nyall Dawson nyall.dawson at gmail.com
Wed Aug 26 16:00:53 PDT 2020


On Thu, 27 Aug 2020 at 01:54, Richard Duivenvoorde <rdmailings at duif.net> wrote:

> Searching in the code:
> https://github.com/qgis/QGIS/blob/master/src/core/qgsrange.h#L228-L238
> it looks like both limits are taken into account by default.
> Which in my case does not reflect my intention...

Actually it doesn't -- the ranges for an individual frame are
constructed so that they include the start, but not the end.

See qgstemporalnavigationobject.cpp:102 :

   return QgsDateTimeRange( frameStart, end, true, false );

The "false" argument on the end indicates that the "end" time of the
frame is not included in the range.

If you're seeing duplicate points, then something else is at play...

Nyall



>
> So I am not sure what a good default is.
> In most ranges (for example in style rules, the starting limit/border is taken into account, and the upper limit is NOT)
> if I would do a PR in which for example the default is like that:
>  QgsTemporalRange( const T &begin, const T &end, bool includeBeginning = true, bool includeEnd = false );
> But I am not sure if this would break things.
>
> I am aware that (for example in your code) you can SET these params, but in my experience (try the data) the are both included.
> Mmm,
> https://github.com/qgis/QGIS/blob/master/src/core/qgsvectorlayertemporalproperties.cpp#L427-L448
> shows that (at least for accumulated features) it should work like this...
>
> Please test with attached mini dataset, you will see several dots at once.
>
> Is this a bug, or do I make a mistake somewhere?
>
> Regards,
>
> Richard Duivenvoorde
>
> PS
> I'm currently trying to 'registre' a layer programmatically as a temporal layer, and then want to start the control in a python plugin.
> I could not find example code, so I am heavily looking at
> https://github.com/qgis/QGIS/blob/master/src/gui/qgsvectorlayertemporalpropertieswidget.cpp#L101
> but if somebody knows a better example, please let me know
>
>
>
>
>
>
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer


More information about the QGIS-Developer mailing list