Skip to content
Snippets Groups Projects
Commit 974a6d5e authored by Clément Jonglez's avatar Clément Jonglez Committed by Clément Jonglez
Browse files

add valueSpanMapChanged​ method added to ParameterObserver in Orekit 12

parent f47e8cdf
No related branches found
No related tags found
No related merge requests found
...@@ -26,8 +26,10 @@ import org.hipparchus.geometry.euclidean.threed.RotationConvention; ...@@ -26,8 +26,10 @@ import org.hipparchus.geometry.euclidean.threed.RotationConvention;
import org.hipparchus.geometry.euclidean.threed.Vector3D; import org.hipparchus.geometry.euclidean.threed.Vector3D;
import org.hipparchus.util.FastMath; import org.hipparchus.util.FastMath;
import org.orekit.rugged.utils.DerivativeGenerator; import org.orekit.rugged.utils.DerivativeGenerator;
import org.orekit.time.AbsoluteDate;
import org.orekit.utils.ParameterDriver; import org.orekit.utils.ParameterDriver;
import org.orekit.utils.ParameterObserver; import org.orekit.utils.ParameterObserver;
import org.orekit.utils.TimeSpanMap;
/** {@link TimeIndependentLOSTransform LOS transform} based on a fixed rotation. /** {@link TimeIndependentLOSTransform LOS transform} based on a fixed rotation.
* @author Luc Maisonobe * @author Luc Maisonobe
...@@ -71,7 +73,14 @@ public class FixedRotation implements TimeIndependentLOSTransform { ...@@ -71,7 +73,14 @@ public class FixedRotation implements TimeIndependentLOSTransform {
this.angleDriver = new ParameterDriver(name, angle, SCALE, -2 * FastMath.PI, 2 * FastMath.PI); this.angleDriver = new ParameterDriver(name, angle, SCALE, -2 * FastMath.PI, 2 * FastMath.PI);
angleDriver.addObserver(new ParameterObserver() { angleDriver.addObserver(new ParameterObserver() {
@Override @Override
public void valueChanged(final double previousValue, final ParameterDriver driver) { public void valueChanged(final double previousValue, final ParameterDriver driver, AbsoluteDate date) {
// reset rotations to null, they will be evaluated lazily if needed
rotation = null;
rDS = null;
}
@Override
public void valueSpanMapChanged(TimeSpanMap<Double> previousValueSpanMap, ParameterDriver driver) {
// reset rotations to null, they will be evaluated lazily if needed // reset rotations to null, they will be evaluated lazily if needed
rotation = null; rotation = null;
rDS = null; rDS = null;
......
...@@ -23,8 +23,10 @@ import org.hipparchus.geometry.euclidean.threed.FieldVector3D; ...@@ -23,8 +23,10 @@ import org.hipparchus.geometry.euclidean.threed.FieldVector3D;
import org.hipparchus.geometry.euclidean.threed.Vector3D; import org.hipparchus.geometry.euclidean.threed.Vector3D;
import org.hipparchus.util.FastMath; import org.hipparchus.util.FastMath;
import org.orekit.rugged.utils.DerivativeGenerator; import org.orekit.rugged.utils.DerivativeGenerator;
import org.orekit.time.AbsoluteDate;
import org.orekit.utils.ParameterDriver; import org.orekit.utils.ParameterDriver;
import org.orekit.utils.ParameterObserver; import org.orekit.utils.ParameterObserver;
import org.orekit.utils.TimeSpanMap;
/** {@link TimeIndependentLOSTransform LOS transform} based on a homothety along the Z axis. /** {@link TimeIndependentLOSTransform LOS transform} based on a homothety along the Z axis.
* @author Lucie Labatallee * @author Lucie Labatallee
...@@ -65,7 +67,14 @@ public class FixedZHomothety implements TimeIndependentLOSTransform { ...@@ -65,7 +67,14 @@ public class FixedZHomothety implements TimeIndependentLOSTransform {
this.factorDriver = new ParameterDriver(name, factorvalue, SCALE, 0, Double.POSITIVE_INFINITY); this.factorDriver = new ParameterDriver(name, factorvalue, SCALE, 0, Double.POSITIVE_INFINITY);
factorDriver.addObserver(new ParameterObserver() { factorDriver.addObserver(new ParameterObserver() {
@Override @Override
public void valueChanged(final double previousValue, final ParameterDriver driver) { public void valueChanged(final double previousValue, final ParameterDriver driver, AbsoluteDate date) {
// reset factor to zero, they will be evaluated lazily if needed
factor = 0.0;
factorDS = null;
}
@Override
public void valueSpanMapChanged(TimeSpanMap<Double> previousValueSpanMap, ParameterDriver driver) {
// reset factor to zero, they will be evaluated lazily if needed // reset factor to zero, they will be evaluated lazily if needed
factor = 0.0; factor = 0.0;
factorDS = null; factorDS = null;
......
...@@ -28,6 +28,7 @@ import org.orekit.rugged.utils.DerivativeGenerator; ...@@ -28,6 +28,7 @@ import org.orekit.rugged.utils.DerivativeGenerator;
import org.orekit.time.AbsoluteDate; import org.orekit.time.AbsoluteDate;
import org.orekit.utils.ParameterDriver; import org.orekit.utils.ParameterDriver;
import org.orekit.utils.ParameterObserver; import org.orekit.utils.ParameterObserver;
import org.orekit.utils.TimeSpanMap;
/** Builder for lines-of-sight list. /** Builder for lines-of-sight list.
* <p> * <p>
...@@ -226,7 +227,13 @@ public class LOSBuilder { ...@@ -226,7 +227,13 @@ public class LOSBuilder {
final ParameterObserver resettingObserver = new ParameterObserver() { final ParameterObserver resettingObserver = new ParameterObserver() {
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public void valueChanged(final double previousValue, final ParameterDriver driver) { public void valueChanged(final double previousValue, final ParameterDriver driver, AbsoluteDate date) {
Arrays.fill(transformed, null);
}
/** {@inheritDoc} */
@Override
public void valueSpanMapChanged(TimeSpanMap<Double> previousValueSpanMap, ParameterDriver driver) {
Arrays.fill(transformed, null); Arrays.fill(transformed, null);
} }
}; };
......
...@@ -32,6 +32,7 @@ import org.orekit.rugged.utils.DerivativeGenerator; ...@@ -32,6 +32,7 @@ import org.orekit.rugged.utils.DerivativeGenerator;
import org.orekit.time.AbsoluteDate; import org.orekit.time.AbsoluteDate;
import org.orekit.utils.ParameterDriver; import org.orekit.utils.ParameterDriver;
import org.orekit.utils.ParameterObserver; import org.orekit.utils.ParameterObserver;
import org.orekit.utils.TimeSpanMap;
/** {@link LOSTransform LOS transform} based on a rotation with polynomial angle. /** {@link LOSTransform LOS transform} based on a rotation with polynomial angle.
* @author Luc Maisonobe * @author Luc Maisonobe
...@@ -87,7 +88,15 @@ public class PolynomialRotation implements LOSTransform { ...@@ -87,7 +88,15 @@ public class PolynomialRotation implements LOSTransform {
this.coefficientsDrivers = new ParameterDriver[angleCoeffs.length]; this.coefficientsDrivers = new ParameterDriver[angleCoeffs.length];
final ParameterObserver resettingObserver = new ParameterObserver() { final ParameterObserver resettingObserver = new ParameterObserver() {
@Override @Override
public void valueChanged(final double previousValue, final ParameterDriver driver) { public void valueChanged(final double previousValue, final ParameterDriver driver, AbsoluteDate date) {
// reset rotations to null, they will be evaluated lazily if needed
angle = null;
axisDS = null;
angleDS = null;
}
@Override
public void valueSpanMapChanged(TimeSpanMap<Double> previousValueSpanMap, ParameterDriver driver) {
// reset rotations to null, they will be evaluated lazily if needed // reset rotations to null, they will be evaluated lazily if needed
angle = null; angle = null;
axisDS = null; axisDS = null;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment