diff --git a/pom.xml b/pom.xml index 02776e1c1066f814cc218f32682bd3fbfb2d37d6..6f9517726f27314621c183eae45d36f2d7e85b81 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ <modelVersion>4.0.0</modelVersion> <groupId>org.orekit</groupId> <artifactId>rugged</artifactId> - <version>2.3-SNAPSHOT</version> + <version>3.0-SNAPSHOT</version> <packaging>jar</packaging> <name>Rugged</name> <url>https://www.orekit.org/rugged</url> @@ -19,8 +19,8 @@ <!-- COTS version --> - <rugged.orekit.version>10.2</rugged.orekit.version> - <rugged.junit.version>4.12</rugged.junit.version> + <rugged.orekit.version>11.0.1</rugged.orekit.version> + <rugged.junit.version>4.13.2</rugged.junit.version> <!-- Compilers and Tools version --> <rugged.compiler.source>1.8</rugged.compiler.source> @@ -32,21 +32,21 @@ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> - <rugged.spotbugs-maven-plugin.version>4.0.4</rugged.spotbugs-maven-plugin.version> - <rugged.jacoco-maven-plugin.version>0.8.5</rugged.jacoco-maven-plugin.version> - <rugged.maven-bundle-plugin.version>4.2.1</rugged.maven-bundle-plugin.version> + <rugged.spotbugs-maven-plugin.version>4.1.4</rugged.spotbugs-maven-plugin.version> + <rugged.jacoco-maven-plugin.version>0.8.7</rugged.jacoco-maven-plugin.version> + <rugged.maven-bundle-plugin.version>5.1.2</rugged.maven-bundle-plugin.version> <rugged.maven-changes-plugin.version>2.12.1</rugged.maven-changes-plugin.version> - <rugged.maven-checkstyle-plugin.version>3.1.1</rugged.maven-checkstyle-plugin.version> - <rugged.checkstyle.version>8.33</rugged.checkstyle.version> + <rugged.maven-checkstyle-plugin.version>3.1.2</rugged.maven-checkstyle-plugin.version> + <rugged.checkstyle.version>9.0</rugged.checkstyle.version> <rugged.maven-clean-plugin.version>3.1.0</rugged.maven-clean-plugin.version> <rugged.maven-compiler-plugin.version>3.8.1</rugged.maven-compiler-plugin.version> <rugged.maven-javadoc-plugin.version>3.2.0</rugged.maven-javadoc-plugin.version> <rugged.maven-jar-plugin.version>3.2.0</rugged.maven-jar-plugin.version> - <rugged.maven-jxr-plugin.version>3.0.0</rugged.maven-jxr-plugin.version> + <rugged.maven-jxr-plugin.version>3.1.1</rugged.maven-jxr-plugin.version> <rugged.plantuml-maven-plugin.version>1.2</rugged.plantuml-maven-plugin.version> - <rugged.plantuml.version>1.2020.14</rugged.plantuml.version> - <rugged.maven-project-info-reports-plugin.version>3.1.0</rugged.maven-project-info-reports-plugin.version> - <rugged.maven-resources-plugin.version>3.1.0</rugged.maven-resources-plugin.version> + <rugged.plantuml.version>1.2021.10</rugged.plantuml.version> + <rugged.maven-project-info-reports-plugin.version>3.1.2</rugged.maven-project-info-reports-plugin.version> + <rugged.maven-resources-plugin.version>3.2.0</rugged.maven-resources-plugin.version> <rugged.maven-site-plugin.version>3.9.1</rugged.maven-site-plugin.version> <rugged.maven-source-plugin.version>3.2.1</rugged.maven-source-plugin.version> <!-- Surefire 2.22.2 is the last to support CentOS/RedHat 7 due to @@ -56,7 +56,7 @@ <rugged.jgit.buildnumber.version>1.2.10</rugged.jgit.buildnumber.version> <rugged.build-helper-maven-plugin.version>3.2.0</rugged.build-helper-maven-plugin.version> <rugged.nexus-staging-maven-plugin.version>1.6.8</rugged.nexus-staging-maven-plugin.version> - <rugged.maven-gpg-plugin.version>1.6</rugged.maven-gpg-plugin.version> + <rugged.maven-gpg-plugin.version>3.0.1</rugged.maven-gpg-plugin.version> <rugged.maven-install-plugin.version>3.0.0-M1</rugged.maven-install-plugin.version> </properties> diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 8510a3b315e5730d9c19926fdc7662c50f4d6b38..fbc9ab788a6f931f00f3d17f5dc6395280b05883 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -20,7 +20,10 @@ <title>Rugged Changes</title> </properties> <body> - <release version="2.3" date="TBD" description="TBD"> + <release version="3.0" date="TBD" description="TBD"> + <action dev="luc" type="update" issue="387"> + Updated dependencies to Orekit 11.0.1 (and Hipparchus 2.0). + </action> </release> <release version="2.2" date="2020-07-31" description="This is a minor release. It adds access to algorithm identifier, diff --git a/src/main/java/org/orekit/rugged/api/Rugged.java b/src/main/java/org/orekit/rugged/api/Rugged.java index 6e767b1737f4b1fd7d6298e8eb9c48b0f5705def..2f5a169564f60284975346c0c865ccedb3ddc314 100644 --- a/src/main/java/org/orekit/rugged/api/Rugged.java +++ b/src/main/java/org/orekit/rugged/api/Rugged.java @@ -686,7 +686,7 @@ public class Rugged { // =========================================== // Need to be computed only once for a given sensor (with the same minLine and maxLine) if (atmosphericRefraction.getBifPixel() == null || atmosphericRefraction.getBifLine() == null || // lazy evaluation - (!atmosphericRefraction.isSameContext(sensorName, minLine, maxLine))) { // Must be recomputed if the context changed + !atmosphericRefraction.isSameContext(sensorName, minLine, maxLine)) { // Must be recomputed if the context changed // Definition of a regular grid (at sensor level) atmosphericRefraction.configureCorrectionGrid(sensor, minLine, maxLine); @@ -814,10 +814,10 @@ public class Rugged { } // Check if the pixel is inside the sensor (with a margin) OR if the inverse location was impossible (null result) - if ((sensorPixelGrid[uIndex][vIndex] != null && - (sensorPixelGrid[uIndex][vIndex].getPixelNumber() < (-INVLOC_MARGIN) || - sensorPixelGrid[uIndex][vIndex].getPixelNumber() > (INVLOC_MARGIN + sensor.getNbPixels() - 1))) || - (sensorPixelGrid[uIndex][vIndex] == null) ) { + if (sensorPixelGrid[uIndex][vIndex] != null && + (sensorPixelGrid[uIndex][vIndex].getPixelNumber() < -INVLOC_MARGIN || + sensorPixelGrid[uIndex][vIndex].getPixelNumber() > (INVLOC_MARGIN + sensor.getNbPixels() - 1)) || + sensorPixelGrid[uIndex][vIndex] == null) { // In order for the dump to end nicely DumpManager.endNicely(); // Impossible to find the point in the given min line diff --git a/src/main/java/org/orekit/rugged/api/RuggedBuilder.java b/src/main/java/org/orekit/rugged/api/RuggedBuilder.java index b1ffd05dc0a186e715f96dd846da65abc90c0728..7c4f9c7dfab5966954e62188080c070262b6eafb 100644 --- a/src/main/java/org/orekit/rugged/api/RuggedBuilder.java +++ b/src/main/java/org/orekit/rugged/api/RuggedBuilder.java @@ -32,8 +32,6 @@ import org.orekit.bodies.OneAxisEllipsoid; import org.orekit.frames.Frame; import org.orekit.frames.FramesFactory; import org.orekit.propagation.Propagator; -import org.orekit.propagation.SpacecraftState; -import org.orekit.propagation.sampling.OrekitFixedStepHandler; import org.orekit.rugged.errors.RuggedException; import org.orekit.rugged.errors.RuggedInternalError; import org.orekit.rugged.errors.RuggedMessages; @@ -733,19 +731,14 @@ public class RuggedBuilder { new ArrayList<TimeStampedPVCoordinates>(); final List<TimeStampedAngularCoordinates> quaternions = new ArrayList<TimeStampedAngularCoordinates>(); - propagator.setMasterMode(interpolationStep, new OrekitFixedStepHandler() { - - /** {@inheritDoc} */ - @Override - public void handleStep(final SpacecraftState currentState, final boolean isLast) { - final AbsoluteDate date = currentState.getDate(); - final PVCoordinates pv = currentState.getPVCoordinates(inertialFrame); - final Rotation q = currentState.getAttitude().getRotation(); - positionsVelocities.add(new TimeStampedPVCoordinates(date, pv.getPosition(), pv.getVelocity(), Vector3D.ZERO)); - quaternions.add(new TimeStampedAngularCoordinates(date, q, Vector3D.ZERO, Vector3D.ZERO)); - } - - }); + propagator.getMultiplexer().add(interpolationStep, + currentState -> { + final AbsoluteDate date = currentState.getDate(); + final PVCoordinates pv = currentState.getPVCoordinates(inertialFrame); + final Rotation q = currentState.getAttitude().getRotation(); + positionsVelocities.add(new TimeStampedPVCoordinates(date, pv.getPosition(), pv.getVelocity(), Vector3D.ZERO)); + quaternions.add(new TimeStampedAngularCoordinates(date, q, Vector3D.ZERO, Vector3D.ZERO)); + }); propagator.propagate(minDate.shiftedBy(-interpolationStep), maxDate.shiftedBy(interpolationStep)); // orbit/attitude to body converter diff --git a/src/main/java/org/orekit/rugged/errors/DumpReplayer.java b/src/main/java/org/orekit/rugged/errors/DumpReplayer.java index fb22fd5d58c4322e0f935a74126c9842b4298328..2308472f7cd28059a2435011ed4781e192c1582e 100644 --- a/src/main/java/org/orekit/rugged/errors/DumpReplayer.java +++ b/src/main/java/org/orekit/rugged/errors/DumpReplayer.java @@ -1072,8 +1072,8 @@ public class DumpReplayer { public boolean isInterpolable(final double latitude, final double longitude) { final int latitudeIndex = (int) FastMath.floor((latitude - minLatitude) / latitudeStep); final int longitudeIndex = (int) FastMath.floor((longitude - minLongitude) / longitudeStep); - return (latitudeIndex >= 0) && (latitudeIndex <= latitudeRows - 2) && - (longitudeIndex >= 0) && (longitudeIndex <= longitudeColumns - 2); + return latitudeIndex >= 0 && latitudeIndex <= latitudeRows - 2 && + longitudeIndex >= 0 && longitudeIndex <= longitudeColumns - 2; } /** Update the tile according to the Digital Elevation Model. diff --git a/src/main/java/org/orekit/rugged/errors/RuggedMessages.java b/src/main/java/org/orekit/rugged/errors/RuggedMessages.java index 98accfea1a8d160274ffda1df62ead21d62997bc..d4e4233712f770d87078de92551a4c85f95e5a06 100644 --- a/src/main/java/org/orekit/rugged/errors/RuggedMessages.java +++ b/src/main/java/org/orekit/rugged/errors/RuggedMessages.java @@ -116,9 +116,9 @@ public enum RuggedMessages implements Localizable { ResourceBundle.getBundle(RESOURCE_BASE_NAME, locale, new UTF8Control()); if (bundle.getLocale().getLanguage().equals(locale.getLanguage())) { final String translated = bundle.getString(name()); - if ((translated != null) && - (translated.length() > 0) && - (!translated.toLowerCase(locale).contains("missing translation"))) { + if (translated != null && + translated.length() > 0 && + !translated.toLowerCase(locale).contains("missing translation")) { // the value of the resource is the translated format return translated; } diff --git a/src/main/java/org/orekit/rugged/refraction/AtmosphericRefraction.java b/src/main/java/org/orekit/rugged/refraction/AtmosphericRefraction.java index 17aaf40fb7ac0c4e67fd495a2af944196f4575c8..f7a6ba09e6c318da3933319069704415ee4a697d 100644 --- a/src/main/java/org/orekit/rugged/refraction/AtmosphericRefraction.java +++ b/src/main/java/org/orekit/rugged/refraction/AtmosphericRefraction.java @@ -120,9 +120,9 @@ public abstract class AtmosphericRefraction { */ public Boolean isSameContext(final String sensorName, final int minLine, final int maxLine) { - return (Double.compare(atmosphericParams.getMinLineSensor(), minLine) == 0) && - (Double.compare(atmosphericParams.getMaxLineSensor(), maxLine) == 0) && - (atmosphericParams.getSensorName().compareTo(sensorName) == 0); + return Double.compare(atmosphericParams.getMinLineSensor(), minLine) == 0 && + Double.compare(atmosphericParams.getMaxLineSensor(), maxLine) == 0 && + atmosphericParams.getSensorName().compareTo(sensorName) == 0; } /** Get the computation parameters. diff --git a/src/main/java/org/orekit/rugged/utils/SpacecraftToObservedBody.java b/src/main/java/org/orekit/rugged/utils/SpacecraftToObservedBody.java index decb81efaec6ae5c664585fbd09fbd67a207ae4b..829148b61a9983536aa7bb11a6ddebb17d59298f 100644 --- a/src/main/java/org/orekit/rugged/utils/SpacecraftToObservedBody.java +++ b/src/main/java/org/orekit/rugged/utils/SpacecraftToObservedBody.java @@ -300,8 +300,8 @@ public class SpacecraftToObservedBody implements Serializable { * @return true if date is in the supported range */ public boolean isInRange(final AbsoluteDate date) { - return (minDate.durationFrom(date) <= overshootTolerance) && - (date.durationFrom(maxDate) <= overshootTolerance); + return minDate.durationFrom(date) <= overshootTolerance && + date.durationFrom(maxDate) <= overshootTolerance; } } diff --git a/src/site/markdown/index.md b/src/site/markdown/index.md index da4f937de519388509304be8c0573628a82769ae..01ee8f9b7ab8c535aeb9528b93b2017f8f727e07 100644 --- a/src/site/markdown/index.md +++ b/src/site/markdown/index.md @@ -98,7 +98,7 @@ interoperability in space systems. ## Maintained library -Rugged has been in development since 2014 inside [CS GROUP](http://www.c-s.fr/ "CS GROUP homepage") +Rugged has been in development since 2014 inside [CS GROUP](https://www.csgroup.eu/ "CS GROUP homepage") and is still used and maintained by its dual teams of space dynamics and image processing experts. diff --git a/src/test/java/org/orekit/rugged/TestUtils.java b/src/test/java/org/orekit/rugged/TestUtils.java index 418a9a1b3b9288e447ebadca51284889d6c1f9ce..baaea0d93dcd5ac572c0f8882e66076af14ebcbe 100644 --- a/src/test/java/org/orekit/rugged/TestUtils.java +++ b/src/test/java/org/orekit/rugged/TestUtils.java @@ -58,7 +58,6 @@ import org.orekit.propagation.Propagator; import org.orekit.propagation.SpacecraftState; import org.orekit.propagation.analytical.KeplerianPropagator; import org.orekit.propagation.numerical.NumericalPropagator; -import org.orekit.propagation.sampling.OrekitFixedStepHandler; import org.orekit.propagation.semianalytical.dsst.utilities.JacobiPolynomials; import org.orekit.propagation.semianalytical.dsst.utilities.NewcombOperators; import org.orekit.rugged.linesensor.SensorPixel; @@ -302,14 +301,10 @@ public class TestUtils { propagator.setAttitudeProvider(new YawCompensation(orbit.getFrame(), new NadirPointing(orbit.getFrame(), earth))); propagator.propagate(minDate); final List<TimeStampedPVCoordinates> list = new ArrayList<TimeStampedPVCoordinates>(); - propagator.setMasterMode(step, new OrekitFixedStepHandler() { - public void handleStep(SpacecraftState currentState, boolean isLast) { - list.add(new TimeStampedPVCoordinates(currentState.getDate(), - currentState.getPVCoordinates().getPosition(), - currentState.getPVCoordinates().getVelocity(), - Vector3D.ZERO)); - } - }); + propagator.getMultiplexer().add(step, currentState -> list.add(new TimeStampedPVCoordinates(currentState.getDate(), + currentState.getPVCoordinates().getPosition(), + currentState.getPVCoordinates().getVelocity(), + Vector3D.ZERO))); propagator.propagate(maxDate); return list; } @@ -325,13 +320,9 @@ public class TestUtils { propagator.setAttitudeProvider(new YawCompensation(orbit.getFrame(), new NadirPointing(orbit.getFrame(), earth))); propagator.propagate(minDate); final List<TimeStampedAngularCoordinates> list = new ArrayList<TimeStampedAngularCoordinates>(); - propagator.setMasterMode(step, new OrekitFixedStepHandler() { - public void handleStep(SpacecraftState currentState, boolean isLast) { - list.add(new TimeStampedAngularCoordinates(currentState.getDate(), - currentState.getAttitude().getRotation(), - Vector3D.ZERO, Vector3D.ZERO)); - } - }); + propagator.getMultiplexer().add(step, currentState -> list.add(new TimeStampedAngularCoordinates(currentState.getDate(), + currentState.getAttitude().getRotation(), + Vector3D.ZERO, Vector3D.ZERO))); propagator.propagate(maxDate); return list; } diff --git a/src/test/java/org/orekit/rugged/adjustment/util/PleiadesOrbitModel.java b/src/test/java/org/orekit/rugged/adjustment/util/PleiadesOrbitModel.java index 5f76ebb808a0f108adb6a8eea66650655959c8e3..cca8dbc4d0a7e557a8f0ca387aeeab0826b79243 100644 --- a/src/test/java/org/orekit/rugged/adjustment/util/PleiadesOrbitModel.java +++ b/src/test/java/org/orekit/rugged/adjustment/util/PleiadesOrbitModel.java @@ -166,12 +166,11 @@ public class PleiadesOrbitModel { propagator.propagate(minDate); final List<TimeStampedPVCoordinates> list = new ArrayList<TimeStampedPVCoordinates>(); - propagator.setMasterMode(step, - (currentState, isLast) -> - list.add(new TimeStampedPVCoordinates(currentState.getDate(), - currentState.getPVCoordinates().getPosition(), - currentState.getPVCoordinates().getVelocity(), - Vector3D.ZERO))); + propagator.getMultiplexer().add(step, + currentState -> list.add(new TimeStampedPVCoordinates(currentState.getDate(), + currentState.getPVCoordinates().getPosition(), + currentState.getPVCoordinates().getVelocity(), + Vector3D.ZERO))); propagator.propagate(maxDate); return list; @@ -187,12 +186,11 @@ public class PleiadesOrbitModel { propagator.setAttitudeProvider(createAttitudeProvider(earth, orbit)); propagator.propagate(minDate); final List<TimeStampedAngularCoordinates> list = new ArrayList<>(); - propagator.setMasterMode(step, - (currentState, isLast) -> - list.add(new TimeStampedAngularCoordinates(currentState.getDate(), - currentState.getAttitude().getRotation(), - Vector3D.ZERO, - Vector3D.ZERO))); + propagator.getMultiplexer().add(step, + currentState -> list.add(new TimeStampedAngularCoordinates(currentState.getDate(), + currentState.getAttitude().getRotation(), + Vector3D.ZERO, + Vector3D.ZERO))); propagator.propagate(maxDate); return list; diff --git a/src/test/java/org/orekit/rugged/api/RuggedBuilderTest.java b/src/test/java/org/orekit/rugged/api/RuggedBuilderTest.java index f24730bda5eee803bbd53af9ca1afa73f77473f8..825e85ae17108c2672ea285f8151452f1e17a8a7 100644 --- a/src/test/java/org/orekit/rugged/api/RuggedBuilderTest.java +++ b/src/test/java/org/orekit/rugged/api/RuggedBuilderTest.java @@ -63,7 +63,6 @@ import org.orekit.propagation.Propagator; import org.orekit.propagation.SpacecraftState; import org.orekit.propagation.analytical.KeplerianPropagator; import org.orekit.propagation.numerical.NumericalPropagator; -import org.orekit.propagation.sampling.OrekitFixedStepHandler; import org.orekit.rugged.errors.RuggedException; import org.orekit.rugged.errors.RuggedMessages; import org.orekit.rugged.linesensor.LineDatation; @@ -825,14 +824,10 @@ public class RuggedBuilderTest { propagator.setAttitudeProvider(new YawCompensation(orbit.getFrame(), new NadirPointing(orbit.getFrame(), earth))); propagator.propagate(minDate); final List<TimeStampedPVCoordinates> list = new ArrayList<TimeStampedPVCoordinates>(); - propagator.setMasterMode(step, new OrekitFixedStepHandler() { - public void handleStep(SpacecraftState currentState, boolean isLast) { - list.add(new TimeStampedPVCoordinates(currentState.getDate(), - currentState.getPVCoordinates().getPosition(), - currentState.getPVCoordinates().getVelocity(), - Vector3D.ZERO)); - } - }); + propagator.getMultiplexer().add(step, currentState -> list.add(new TimeStampedPVCoordinates(currentState.getDate(), + currentState.getPVCoordinates().getPosition(), + currentState.getPVCoordinates().getVelocity(), + Vector3D.ZERO))); propagator.propagate(maxDate); return list; } @@ -845,13 +840,9 @@ public class RuggedBuilderTest { propagator.setAttitudeProvider(new YawCompensation(orbit.getFrame(), new NadirPointing(orbit.getFrame(), earth))); propagator.propagate(minDate); final List<TimeStampedAngularCoordinates> list = new ArrayList<TimeStampedAngularCoordinates>(); - propagator.setMasterMode(step, new OrekitFixedStepHandler() { - public void handleStep(SpacecraftState currentState, boolean isLast) { - list.add(new TimeStampedAngularCoordinates(currentState.getDate(), - currentState.getAttitude().getRotation(), - Vector3D.ZERO, Vector3D.ZERO)); - } - }); + propagator.getMultiplexer().add(step, currentState -> list.add(new TimeStampedAngularCoordinates(currentState.getDate(), + currentState.getAttitude().getRotation(), + Vector3D.ZERO, Vector3D.ZERO))); propagator.propagate(maxDate); return list; } diff --git a/src/test/java/org/orekit/rugged/api/RuggedTest.java b/src/test/java/org/orekit/rugged/api/RuggedTest.java index cd8aae3f4f3f95bc64e7b56894fc2eb6032b2c78..29ea82e5da514c9ab0bb7c3a861ca7e0e61d8791 100644 --- a/src/test/java/org/orekit/rugged/api/RuggedTest.java +++ b/src/test/java/org/orekit/rugged/api/RuggedTest.java @@ -59,6 +59,7 @@ import org.orekit.forces.gravity.potential.NormalizedSphericalHarmonicsProvider; import org.orekit.frames.Frame; import org.orekit.frames.FramesFactory; import org.orekit.orbits.Orbit; +import org.orekit.propagation.EphemerisGenerator; import org.orekit.propagation.Propagator; import org.orekit.rugged.TestUtils; import org.orekit.rugged.adjustment.GroundOptimizationProblemBuilder; @@ -136,9 +137,9 @@ public class RuggedTest { Propagator propagator = TestUtils.createPropagator(earth, gravityField, orbit); propagator.propagate(lineDatation.getDate(firstLine).shiftedBy(-1.0)); - propagator.setEphemerisMode(); + final EphemerisGenerator generator = propagator.getEphemerisGenerator(); propagator.propagate(lineDatation.getDate(lastLine).shiftedBy(+1.0)); - Propagator ephemeris = propagator.getGeneratedEphemeris(); + Propagator ephemeris = generator.getGeneratedEphemeris(); Rugged rugged = new RuggedBuilder(). setDigitalElevationModel(updater, 8). diff --git a/src/test/java/org/orekit/rugged/linesensor/SensorMeanPlaneCrossingTest.java b/src/test/java/org/orekit/rugged/linesensor/SensorMeanPlaneCrossingTest.java index 9107078602bfd311812dc4fd407ff33d9d07f6c9..3b051ac62423b75f0738c812ba32bbe9451ac403 100644 --- a/src/test/java/org/orekit/rugged/linesensor/SensorMeanPlaneCrossingTest.java +++ b/src/test/java/org/orekit/rugged/linesensor/SensorMeanPlaneCrossingTest.java @@ -44,9 +44,7 @@ import org.orekit.orbits.CircularOrbit; import org.orekit.orbits.Orbit; import org.orekit.orbits.PositionAngle; import org.orekit.propagation.Propagator; -import org.orekit.propagation.SpacecraftState; import org.orekit.propagation.analytical.KeplerianPropagator; -import org.orekit.propagation.sampling.OrekitFixedStepHandler; import org.orekit.rugged.TestUtils; import org.orekit.rugged.linesensor.SensorMeanPlaneCrossing.CrossingResult; import org.orekit.rugged.los.LOSBuilder; @@ -316,14 +314,10 @@ public class SensorMeanPlaneCrossingTest { propagator.setAttitudeProvider(new YawCompensation(orbit.getFrame(), new NadirPointing(orbit.getFrame(), earth))); propagator.propagate(minDate); final List<TimeStampedPVCoordinates> list = new ArrayList<TimeStampedPVCoordinates>(); - propagator.setMasterMode(step, new OrekitFixedStepHandler() { - public void handleStep(SpacecraftState currentState, boolean isLast) { - list.add(new TimeStampedPVCoordinates(currentState.getDate(), - currentState.getPVCoordinates().getPosition(), - currentState.getPVCoordinates().getVelocity(), - Vector3D.ZERO)); - } - }); + propagator.getMultiplexer().add(step, currentState -> list.add(new TimeStampedPVCoordinates(currentState.getDate(), + currentState.getPVCoordinates().getPosition(), + currentState.getPVCoordinates().getVelocity(), + Vector3D.ZERO))); propagator.propagate(maxDate); return list; } @@ -336,13 +330,9 @@ public class SensorMeanPlaneCrossingTest { propagator.setAttitudeProvider(new YawCompensation(orbit.getFrame(), new NadirPointing(orbit.getFrame(), earth))); propagator.propagate(minDate); final List<TimeStampedAngularCoordinates> list = new ArrayList<TimeStampedAngularCoordinates>(); - propagator.setMasterMode(step, new OrekitFixedStepHandler() { - public void handleStep(SpacecraftState currentState, boolean isLast) { - list.add(new TimeStampedAngularCoordinates(currentState.getDate(), - currentState.getAttitude().getRotation(), - Vector3D.ZERO, Vector3D.ZERO)); - } - }); + propagator.getMultiplexer().add(step, currentState -> list.add(new TimeStampedAngularCoordinates(currentState.getDate(), + currentState.getAttitude().getRotation(), + Vector3D.ZERO, Vector3D.ZERO))); propagator.propagate(maxDate); return list; } diff --git a/src/test/java/org/orekit/rugged/utils/RoughVisibilityEstimatorTest.java b/src/test/java/org/orekit/rugged/utils/RoughVisibilityEstimatorTest.java index e26b8eaf21381954906f9a64544905e0116e9b14..ccca03bc6e44494026ad98ffb1b425378c00e5f0 100644 --- a/src/test/java/org/orekit/rugged/utils/RoughVisibilityEstimatorTest.java +++ b/src/test/java/org/orekit/rugged/utils/RoughVisibilityEstimatorTest.java @@ -50,7 +50,6 @@ import org.orekit.orbits.PositionAngle; import org.orekit.propagation.Propagator; import org.orekit.propagation.SpacecraftState; import org.orekit.propagation.numerical.NumericalPropagator; -import org.orekit.propagation.sampling.OrekitFixedStepHandler; import org.orekit.time.AbsoluteDate; import org.orekit.time.TimeScalesFactory; import org.orekit.utils.Constants; @@ -69,18 +68,17 @@ public class RoughVisibilityEstimatorTest { Orbit orbit = createOrbit(gravityField.getMu()); Propagator propagator = createPropagator(earth, gravityField, orbit); final List<TimeStampedPVCoordinates> pv = new ArrayList<TimeStampedPVCoordinates>(); - propagator.setMasterMode(1.0, new OrekitFixedStepHandler() { - public void handleStep(SpacecraftState currentState, boolean isLast) { - pv.add(currentState.getPVCoordinates()); - } - }); + propagator.getMultiplexer().add(1.0, currentState -> pv.add(currentState.getPVCoordinates())); propagator.propagate(orbit.getDate().shiftedBy(3 * orbit.getKeplerianPeriod())); RoughVisibilityEstimator estimator = new RoughVisibilityEstimator(ellipsoid, orbit.getFrame(), pv); AbsoluteDate d = estimator.estimateVisibility(new GeodeticPoint(FastMath.toRadians(-81.5), FastMath.toRadians(-2.0), 0.0)); - Assert.assertEquals("2012-01-01T03:47:08.814", d.toString(TimeScalesFactory.getUTC())); + Assert.assertEquals(0.0, + new AbsoluteDate("2012-01-01T03:47:08.814121623", + TimeScalesFactory.getUTC()).durationFrom(d), + 1.0e-9); } @@ -94,18 +92,17 @@ public class RoughVisibilityEstimatorTest { Orbit orbit = createOrbit(gravityField.getMu()); Propagator propagator = createPropagator(earth, gravityField, orbit); final List<TimeStampedPVCoordinates> pv = new ArrayList<TimeStampedPVCoordinates>(); - propagator.setMasterMode(1.0, new OrekitFixedStepHandler() { - public void handleStep(SpacecraftState currentState, boolean isLast) { - pv.add(currentState.getPVCoordinates()); - } - }); + propagator.getMultiplexer().add(1.0, currentState -> pv.add(currentState.getPVCoordinates())); propagator.propagate(orbit.getDate().shiftedBy(orbit.getKeplerianPeriod())); RoughVisibilityEstimator estimator = new RoughVisibilityEstimator(ellipsoid, orbit.getFrame(), pv); AbsoluteDate d = estimator.estimateVisibility(new GeodeticPoint(FastMath.toRadians(43.303), FastMath.toRadians(-46.126), 0.0)); - Assert.assertEquals("2012-01-01T01:02:39.123", d.toString(TimeScalesFactory.getUTC())); + Assert.assertEquals(0.0, + new AbsoluteDate("2012-01-01T01:02:39.122526662", + TimeScalesFactory.getUTC()).durationFrom(d), + 1.0e-9); }