The easiest way is to combine your FieldOfViewDetector with an ElevationDetector thanks to the BooleanDetector. You could try something like:
final FieldOfViewDetector fd = new FieldOfViewDetector(tcf, fov);
final ElevationDetector ed = new ElevationDetector(tcf).withConstantElevation(0.);
final BooleanDetector detector = BooleanDetector.andCombine(ed, BooleanDetector.notCombine(fd)).withMaxCheck(maxCheckingInterval).withHandler(new EventHandler<BooleanDetector>() {
private AbsoluteDate start;
@Override
public Action eventOccurred(SpacecraftState s, BooleanDetector detector, boolean increasing) throws OrekitException {
if (increasing) {
// Entering Area
start = s.getDate();
return Action.CONTINUE;
} else {
// Leaving Area
final double duration = s.getDate().durationFrom(start);
System.out.println("Pass duration: " + duration);
return Action.CONTINUE;
}
}
});
Note that the boolean combination of the detectors requires to change the sign of the g function from the FieldOfViewDetector, which is done through BooleanDetector.notCombine(fd)
.
With your data, no pass is found, but with a wider timespan, I’ve got the following pass:
Start visibility: 2018-11-23T04:06:39.373
End visibility: 2018-11-23T04:06:47.250
Pass duration: 7.877595829517514