Inputs of build for measurement builders in Orekit 12.0

Hi,

@Serrof maybe if you change this line:

public SpacecraftState getInterpolatedState(AbsoluteDate date) { return spacecraftState; }

With something like:

public SpacecraftState getInterpolatedState(AbsoluteDate date) { return spacecraftState.shiftedBy(date.durationFrom(spacecraftState.getDate())); }

It will work like before no?

I’m not sure about the public boolean isForward() { return true; } though.

@luc I know you"re not happy with using “shiftedBys” but we already have had two questions on this new API. I understand Orekit should be as accurate as possible but it should also be accessible to users :wink:
We did cope with “shiftedBy” for years in the OD and the measurement generation, so why not add a default method in the MeasurementBuilder interface that would allow the old code to work?
It would look like this (Not sure about all the methods in the interpolator, I haven’t thought this through very much).

    /** Generate a single measurement.<p>
     * 
     * Warning: This method uses "shiftedBy" so it is not as accurate as the method above that uses interpolators.
     * 
     * @param states all spacecraft states (i.e. including ones that may not be relevant for the current builder)
     * @return generated measurement
     */
    default T build(AbsoluteDate date, SpacecraftState[] states) {
        final Map<ObservableSatellite, OrekitStepInterpolator> interpolators = new ConcurrentHashMap<>();
        
        for (int i = 0; i < states.length; i++) {
            final ObservableSatellite sat = getSatellites()[i];
            final SpacecraftState state = states[i];
            
            final OrekitStepInterpolator interpolator = new OrekitStepInterpolator() {
                public OrekitStepInterpolator restrictStep(SpacecraftState newPreviousState, SpacecraftState newCurrentState) { return null; }
                public boolean isPreviousStateInterpolated() { return false; }
                public boolean isForward() { return true; }
                public boolean isCurrentStateInterpolated() { return false; }
                public SpacecraftState getPreviousState() { return state; }
                public SpacecraftState getInterpolatedState(AbsoluteDate date) { return state.shiftedBy(date.durationFrom(state.getDate())); }
                public SpacecraftState getCurrentState() { return state; }
            };
            interpolators.put(sat, interpolator);
        }
        
        return build( date, interpolators);
    }

What do you think?