Open tischi opened 2 years ago
That is a bug,..
Hmm, actually...
I don't see how this could be a problem.
The method in Source
is
void getSourceTransform( int t, int level, AffineTransform3D transform );
So you already get the pre-allocated transform.
So if you just do nothing if isPresent(t)==false
all should be fine.
I'll probably change ScaleBarOverlayRenderer
to handle isPresent()==false
as a separate case.
But I think it also wouldn't hurt if Source
implementations were robust to non-existing t
(and/or level
) arguments
So you already get the pre-allocated transform. So if you just do nothing if isPresent(t)==false all should be fine.
Yeah, good point, we could do this... Whether "all should be fine" though depends on the consumer of this function :-) For example, depending on the implementation the scale bar may be all over the place at non-existing time points.
What I mean is: if something calls this function and interprets the transform
as the actual sourceTransform
at that time point then it would lead to a wrong result.
But I get your point: we could say it is the responsibility of the calling code to check whether this time point is present, before calling that function.
@tpietzsch I tried your suggestion of just returning the pre-allocated transform for missing time-points, but it looks like as if the current implementation in BDV does not handle this correctly. I get weird behavior: When hovering with the mouse across BDV the scale bar is changing.
Even though my
Source
returnsfalse
forisPresent( 0 )
, the below code still tries to get the source transform at time point0
. And in my case crashed because mySource
only has source transforms for existing time points.Question: Should a
Source
provide a source transform also for missing time points or is that maybe a bug in BDV?