From 0a641496ebd312b5cdf008423e79126dd4d6b5a9 Mon Sep 17 00:00:00 2001 From: Guylaine Prat <guylaine.prat@c-s.fr> Date: Fri, 14 Dec 2018 16:43:54 +0100 Subject: [PATCH] Checkstyle corrections. --- .../rugged/adjustment/AdjustmentContext.java | 22 +-- .../GroundOptimizationProblemBuilder.java | 96 ++++----- .../java/org/orekit/rugged/api/Rugged.java | 32 +-- .../org/orekit/rugged/api/RuggedBuilder.java | 80 ++++---- .../java/org/orekit/rugged/errors/Dump.java | 4 +- .../orekit/rugged/errors/DumpReplayer.java | 186 +++++++++--------- .../duvenhage/DuvenhageAlgorithm.java | 2 +- .../linesensor/SensorMeanPlaneCrossing.java | 2 +- .../org/orekit/rugged/los/FixedRotation.java | 2 +- .../orekit/rugged/los/FixedZHomothety.java | 2 +- .../org/orekit/rugged/raster/SimpleTile.java | 2 +- .../refraction/AtmosphericRefraction.java | 2 +- .../rugged/refraction/MultiLayerModel.java | 3 +- .../rugged/utils/ExtendedEllipsoid.java | 2 +- 14 files changed, 218 insertions(+), 219 deletions(-) diff --git a/src/main/java/org/orekit/rugged/adjustment/AdjustmentContext.java b/src/main/java/org/orekit/rugged/adjustment/AdjustmentContext.java index bea9eb7b..91be6567 100644 --- a/src/main/java/org/orekit/rugged/adjustment/AdjustmentContext.java +++ b/src/main/java/org/orekit/rugged/adjustment/AdjustmentContext.java @@ -136,17 +136,17 @@ public class AdjustmentContext { // builder switch (ruggedList.size()) { - case 1: - final Rugged rugged = ruggedList.get(0); - final GroundOptimizationProblemBuilder groundOptimizationProblem = new GroundOptimizationProblemBuilder(selectedSensors, measurements, rugged); - theProblem = groundOptimizationProblem.build(maxEvaluations, parametersConvergenceThreshold); - break; - case 2: - final InterSensorsOptimizationProblemBuilder interSensorsOptimizationProblem = new InterSensorsOptimizationProblemBuilder(selectedSensors, measurements, ruggedList); - theProblem = interSensorsOptimizationProblem.build(maxEvaluations, parametersConvergenceThreshold); - break; - default : - throw new RuggedException(RuggedMessages.UNSUPPORTED_REFINING_CONTEXT, ruggedList.size()); + case 1: + final Rugged rugged = ruggedList.get(0); + final GroundOptimizationProblemBuilder groundOptimizationProblem = new GroundOptimizationProblemBuilder(selectedSensors, measurements, rugged); + theProblem = groundOptimizationProblem.build(maxEvaluations, parametersConvergenceThreshold); + break; + case 2: + final InterSensorsOptimizationProblemBuilder interSensorsOptimizationProblem = new InterSensorsOptimizationProblemBuilder(selectedSensors, measurements, ruggedList); + theProblem = interSensorsOptimizationProblem.build(maxEvaluations, parametersConvergenceThreshold); + break; + default : + throw new RuggedException(RuggedMessages.UNSUPPORTED_REFINING_CONTEXT, ruggedList.size()); } return adjuster.optimize(theProblem); diff --git a/src/main/java/org/orekit/rugged/adjustment/GroundOptimizationProblemBuilder.java b/src/main/java/org/orekit/rugged/adjustment/GroundOptimizationProblemBuilder.java index dcbec62d..dd123b94 100644 --- a/src/main/java/org/orekit/rugged/adjustment/GroundOptimizationProblemBuilder.java +++ b/src/main/java/org/orekit/rugged/adjustment/GroundOptimizationProblemBuilder.java @@ -147,59 +147,59 @@ public class GroundOptimizationProblemBuilder extends OptimizationProblemBuilder // model function final MultivariateJacobianFunction model = point -> { - // set the current parameters values - int i = 0; - for (final ParameterDriver driver : this.getDrivers()) { - driver.setNormalizedValue(point.getEntry(i++)); - } + // set the current parameters values + int i = 0; + for (final ParameterDriver driver : this.getDrivers()) { + driver.setNormalizedValue(point.getEntry(i++)); + } - final double[] target = this.targetAndWeight.get(TARGET); - - // compute inverse loc and its partial derivatives - final RealVector value = new ArrayRealVector(target.length); - final RealMatrix jacobian = new Array2DRowRealMatrix(target.length, this.getNbParams()); - int l = 0; - for (final SensorToGroundMapping reference : this.sensorToGroundMappings) { - for (final Map.Entry<SensorPixel, GeodeticPoint> mapping : reference.getMapping()) { - final GeodeticPoint gp = mapping.getValue(); - final DerivativeStructure[] ilResult = this.rugged.inverseLocationDerivatives(reference.getSensorName(), gp, minLine, maxLine, this.getGenerator()); - - if (ilResult == null) { - value.setEntry(l, minLine - 100.0); // arbitrary - // line far - // away - value.setEntry(l + 1, -100.0); // arbitrary - // pixel far away - } else { - // extract the value - value.setEntry(l, ilResult[0].getValue()); - value.setEntry(l + 1, ilResult[1].getValue()); - - // extract the Jacobian - final int[] orders = new int[this.getNbParams()]; - int m = 0; - for (final ParameterDriver driver : this.getDrivers()) { - final double scale = driver.getScale(); - orders[m] = 1; - jacobian.setEntry(l, m, - ilResult[0] - .getPartialDerivative(orders) * - scale); - jacobian.setEntry(l + 1, m, - ilResult[1] - .getPartialDerivative(orders) * - scale); - orders[m] = 0; - m++; - } + final double[] target = this.targetAndWeight.get(TARGET); + + // compute inverse loc and its partial derivatives + final RealVector value = new ArrayRealVector(target.length); + final RealMatrix jacobian = new Array2DRowRealMatrix(target.length, this.getNbParams()); + int l = 0; + for (final SensorToGroundMapping reference : this.sensorToGroundMappings) { + for (final Map.Entry<SensorPixel, GeodeticPoint> mapping : reference.getMapping()) { + final GeodeticPoint gp = mapping.getValue(); + final DerivativeStructure[] ilResult = this.rugged.inverseLocationDerivatives(reference.getSensorName(), gp, minLine, maxLine, this.getGenerator()); + + if (ilResult == null) { + value.setEntry(l, minLine - 100.0); // arbitrary + // line far + // away + value.setEntry(l + 1, -100.0); // arbitrary + // pixel far away + } else { + // extract the value + value.setEntry(l, ilResult[0].getValue()); + value.setEntry(l + 1, ilResult[1].getValue()); + + // extract the Jacobian + final int[] orders = new int[this.getNbParams()]; + int m = 0; + for (final ParameterDriver driver : this.getDrivers()) { + final double scale = driver.getScale(); + orders[m] = 1; + jacobian.setEntry(l, m, + ilResult[0] + .getPartialDerivative(orders) * + scale); + jacobian.setEntry(l + 1, m, + ilResult[1] + .getPartialDerivative(orders) * + scale); + orders[m] = 0; + m++; } - - l += 2; } + + l += 2; } + } - // inverse loc result with Jacobian for all reference points - return new Pair<RealVector, RealMatrix>(value, jacobian); + // inverse loc result with Jacobian for all reference points + return new Pair<RealVector, RealMatrix>(value, jacobian); }; return model; diff --git a/src/main/java/org/orekit/rugged/api/Rugged.java b/src/main/java/org/orekit/rugged/api/Rugged.java index 7b988034..9aa356d3 100644 --- a/src/main/java/org/orekit/rugged/api/Rugged.java +++ b/src/main/java/org/orekit/rugged/api/Rugged.java @@ -70,7 +70,7 @@ public class Rugged { /** Threshold for pixel convergence in fixed point method * (for inverse location with atmospheric refraction correction). */ private static final double PIXEL_CV_THRESHOLD = 1.e-4; - + /** Threshold for line convergence in fixed point method * (for inverse location with atmospheric refraction correction). */ private static final double LINE_CV_THRESHOLD = 1.e-4; @@ -450,7 +450,7 @@ public class Rugged { public AbsoluteDate dateLocation(final String sensorName, final double latitude, final double longitude, final int minLine, final int maxLine) { - + final GeodeticPoint groundPoint = new GeodeticPoint(latitude, longitude, algorithm.getElevation(latitude, longitude)); return dateLocation(sensorName, groundPoint, minLine, maxLine); @@ -529,7 +529,7 @@ public class Rugged { public SensorPixel inverseLocation(final String sensorName, final double latitude, final double longitude, final int minLine, final int maxLine) { - + final GeodeticPoint groundPoint = new GeodeticPoint(latitude, longitude, algorithm.getElevation(latitude, longitude)); return inverseLocation(sensorName, groundPoint, minLine, maxLine); } @@ -814,7 +814,7 @@ public class Rugged { for (int uIndex = 0; uIndex < nbPixelGrid; uIndex++) { for (int vIndex = 0; vIndex < nbLineGrid; vIndex++) { - + // Check if the geodetic point exists if (groundGridWithAtmosphere[uIndex][vIndex] != null) { final GeodeticPoint groundPoint = groundGridWithAtmosphere[uIndex][vIndex]; @@ -828,9 +828,9 @@ 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) ) { - + sensorPixelGrid[uIndex][vIndex].getPixelNumber() > (INVLOC_MARGIN + sensor.getNbPixels() - 1))) || + (sensorPixelGrid[uIndex][vIndex] == null) ) { + // Impossible to find the point in the given min line throw new RuggedException(RuggedMessages.INVALID_RANGE_FOR_LINES, minLine, maxLine, ""); } @@ -839,13 +839,13 @@ public class Rugged { } } else { // groundGrid[uIndex][vIndex] == null: impossible to compute inverse loc because ground point not defined - + sensorPixelGrid[uIndex][vIndex] = null; - + } // groundGrid[uIndex][vIndex] != null } // end loop vIndex } // end loop uIndex - + // The sensor grid computed WITHOUT atmospheric refraction correction return sensorPixelGrid; } @@ -858,7 +858,7 @@ public class Rugged { * @return the ground grid computed with atmosphere * @since 2.1 */ - private GeodeticPoint[][] computeDirectLocOnGridWithAtmosphere(final double[] pixelGrid, final double[] lineGrid, + private GeodeticPoint[][] computeDirectLocOnGridWithAtmosphere(final double[] pixelGrid, final double[] lineGrid, final LineSensor sensor) { final int nbPixelGrid = pixelGrid.length; @@ -875,14 +875,14 @@ public class Rugged { try { // Compute the direct location for the current node groundGridWithAtmosphere[uIndex][vIndex] = directLocation(date, sensorPosition, los); - + } catch (RuggedException re) { // This should never happen throw RuggedException.createInternalError(re); } } // end loop vIndex } // end loop uIndex - - // The ground grid computed WITH atmospheric refraction correction + + // The ground grid computed WITH atmospheric refraction correction return groundGridWithAtmosphere; } @@ -1050,7 +1050,7 @@ public class Rugged { */ private SensorMeanPlaneCrossing getPlaneCrossing(final String sensorName, final int minLine, final int maxLine) { - + final LineSensor sensor = getLineSensor(sensorName); SensorMeanPlaneCrossing planeCrossing = finders.get(sensorName); if (planeCrossing == null || @@ -1184,7 +1184,7 @@ public class Rugged { * @return selected sensor */ public LineSensor getLineSensor(final String sensorName) { - + final LineSensor sensor = sensors.get(sensorName); if (sensor == null) { throw new RuggedException(RuggedMessages.UNKNOWN_SENSOR, sensorName); diff --git a/src/main/java/org/orekit/rugged/api/RuggedBuilder.java b/src/main/java/org/orekit/rugged/api/RuggedBuilder.java index 9f969594..24c18e19 100644 --- a/src/main/java/org/orekit/rugged/api/RuggedBuilder.java +++ b/src/main/java/org/orekit/rugged/api/RuggedBuilder.java @@ -424,7 +424,7 @@ public class RuggedBuilder { final CartesianDerivativesFilter pvFilter, final List<TimeStampedAngularCoordinates> quaternions, final int aInterpolationNumber, final AngularDerivativesFilter aFilter) { - + return setTrajectory(selectInertialFrame(inertialFrameId), positionsVelocities, pvInterpolationNumber, pvFilter, quaternions, aInterpolationNumber, aFilter); @@ -580,7 +580,7 @@ public class RuggedBuilder { * @see #storeInterpolator(OutputStream) */ public RuggedBuilder setTrajectoryAndTimeSpan(final InputStream storageStream) { - + try { this.inertial = null; this.pvSample = null; @@ -599,7 +599,7 @@ public class RuggedBuilder { this.overshootTolerance = scToBody.getOvershootTolerance(); checkFramesConsistency(); return this; - + } catch (ClassNotFoundException cnfe) { throw new RuggedException(cnfe, RuggedMessages.NOT_INTERPOLATOR_DUMP_DATA); } catch (ClassCastException cce) { @@ -697,7 +697,7 @@ public class RuggedBuilder { final List<TimeStampedAngularCoordinates> quaternions, final int aInterpolationNumber, final AngularDerivativesFilter aFilter) { - + return new SpacecraftToObservedBody(inertialFrame, bodyFrame, minDate, maxDate, tStep, overshootTolerance, positionsVelocities, pvInterpolationNumber, @@ -871,19 +871,19 @@ public class RuggedBuilder { // set up the inertial frame switch (inertialFrameId) { - case GCRF : - return FramesFactory.getGCRF(); - case EME2000 : - return FramesFactory.getEME2000(); - case MOD : - return FramesFactory.getMOD(IERSConventions.IERS_1996); - case TOD : - return FramesFactory.getTOD(IERSConventions.IERS_1996, true); - case VEIS1950 : - return FramesFactory.getVeis1950(); - default : - // this should never happen - throw RuggedException.createInternalError(null); + case GCRF : + return FramesFactory.getGCRF(); + case EME2000 : + return FramesFactory.getEME2000(); + case MOD : + return FramesFactory.getMOD(IERSConventions.IERS_1996); + case TOD : + return FramesFactory.getTOD(IERSConventions.IERS_1996, true); + case VEIS1950 : + return FramesFactory.getVeis1950(); + default : + // this should never happen + throw RuggedException.createInternalError(null); } } @@ -895,15 +895,15 @@ public class RuggedBuilder { // set up the rotating frame switch (bodyRotatingFrame) { - case ITRF : - return FramesFactory.getITRF(IERSConventions.IERS_2010, true); - case ITRF_EQUINOX : - return FramesFactory.getITRFEquinox(IERSConventions.IERS_1996, true); - case GTOD : - return FramesFactory.getGTOD(IERSConventions.IERS_1996, true); - default : - // this should never happen - throw RuggedException.createInternalError(null); + case ITRF : + return FramesFactory.getITRF(IERSConventions.IERS_2010, true); + case ITRF_EQUINOX : + return FramesFactory.getITRFEquinox(IERSConventions.IERS_1996, true); + case GTOD : + return FramesFactory.getGTOD(IERSConventions.IERS_1996, true); + default : + // this should never happen + throw RuggedException.createInternalError(null); } } @@ -946,19 +946,19 @@ public class RuggedBuilder { // set up the algorithm switch (algorithmID) { - case DUVENHAGE : - return new DuvenhageAlgorithm(updater, maxCachedTiles, false); - case DUVENHAGE_FLAT_BODY : - return new DuvenhageAlgorithm(updater, maxCachedTiles, true); - case BASIC_SLOW_EXHAUSTIVE_SCAN_FOR_TESTS_ONLY : - return new BasicScanAlgorithm(updater, maxCachedTiles); - case CONSTANT_ELEVATION_OVER_ELLIPSOID : - return new ConstantElevationAlgorithm(constantElevation); - case IGNORE_DEM_USE_ELLIPSOID : - return new IgnoreDEMAlgorithm(); - default : - // this should never happen - throw RuggedException.createInternalError(null); + case DUVENHAGE : + return new DuvenhageAlgorithm(updater, maxCachedTiles, false); + case DUVENHAGE_FLAT_BODY : + return new DuvenhageAlgorithm(updater, maxCachedTiles, true); + case BASIC_SLOW_EXHAUSTIVE_SCAN_FOR_TESTS_ONLY : + return new BasicScanAlgorithm(updater, maxCachedTiles); + case CONSTANT_ELEVATION_OVER_ELLIPSOID : + return new ConstantElevationAlgorithm(constantElevation); + case IGNORE_DEM_USE_ELLIPSOID : + return new IgnoreDEMAlgorithm(); + default : + // this should never happen + throw RuggedException.createInternalError(null); } } @@ -966,7 +966,7 @@ public class RuggedBuilder { * @return built instance */ public Rugged build() { - + if (algorithmID == null) { throw new RuggedException(RuggedMessages.UNINITIALIZED_CONTEXT, "RuggedBuilder.setAlgorithmID()"); } diff --git a/src/main/java/org/orekit/rugged/errors/Dump.java b/src/main/java/org/orekit/rugged/errors/Dump.java index 6420fa25..071c5ca5 100644 --- a/src/main/java/org/orekit/rugged/errors/Dump.java +++ b/src/main/java/org/orekit/rugged/errors/Dump.java @@ -237,7 +237,7 @@ class Dump { /** Dump a sensor mean plane. * @param meanPlane mean plane associated with sensor */ - public void dumpSensorMeanPlane(final SensorMeanPlaneCrossing meanPlane){ + public void dumpSensorMeanPlane(final SensorMeanPlaneCrossing meanPlane) { getSensorData(meanPlane.getSensor()).setMeanPlane(meanPlane); } @@ -481,7 +481,7 @@ class Dump { * @param meanPlane mean plane finder */ public void setMeanPlane(final SensorMeanPlaneCrossing meanPlane) { - + if (this.meanPlane == null) { this.meanPlane = meanPlane; final long nbResults = meanPlane.getCachedResults().count(); diff --git a/src/main/java/org/orekit/rugged/errors/DumpReplayer.java b/src/main/java/org/orekit/rugged/errors/DumpReplayer.java index 085abcf8..feac1be7 100644 --- a/src/main/java/org/orekit/rugged/errors/DumpReplayer.java +++ b/src/main/java/org/orekit/rugged/errors/DumpReplayer.java @@ -529,41 +529,41 @@ public class DumpReplayer { /** {@inheritDoc} */ @Override public void parse(final int l, final File file, final String line, final String[] fields, final DumpReplayer global) { - if (fields.length < 14 || + if (fields.length < 14 || !fields[0].equals(DATE) || !fields[2].equals(POSITION) || !fields[6].equals(LOS) || !fields[10].equals(LIGHT_TIME) || !fields[12].equals(ABERRATION)) { - throw new RuggedException(RuggedMessages.CANNOT_PARSE_LINE, l, file, line); + throw new RuggedException(RuggedMessages.CANNOT_PARSE_LINE, l, file, line); + } + final AbsoluteDate date = new AbsoluteDate(fields[1], TimeScalesFactory.getUTC()); + final Vector3D position = new Vector3D(Double.parseDouble(fields[3]), + Double.parseDouble(fields[4]), + Double.parseDouble(fields[5])); + final Vector3D los = new Vector3D(Double.parseDouble(fields[7]), + Double.parseDouble(fields[8]), + Double.parseDouble(fields[9])); + if (global.calls.isEmpty()) { + global.lightTimeCorrection = Boolean.parseBoolean(fields[11]); + global.aberrationOfLightCorrection = Boolean.parseBoolean(fields[13]); + } else { + if (global.lightTimeCorrection != Boolean.parseBoolean(fields[11])) { + throw new RuggedException(RuggedMessages.LIGHT_TIME_CORRECTION_REDEFINED, + l, file.getAbsolutePath(), line); } - final AbsoluteDate date = new AbsoluteDate(fields[1], TimeScalesFactory.getUTC()); - final Vector3D position = new Vector3D(Double.parseDouble(fields[3]), - Double.parseDouble(fields[4]), - Double.parseDouble(fields[5])); - final Vector3D los = new Vector3D(Double.parseDouble(fields[7]), - Double.parseDouble(fields[8]), - Double.parseDouble(fields[9])); - if (global.calls.isEmpty()) { - global.lightTimeCorrection = Boolean.parseBoolean(fields[11]); - global.aberrationOfLightCorrection = Boolean.parseBoolean(fields[13]); - } else { - if (global.lightTimeCorrection != Boolean.parseBoolean(fields[11])) { - throw new RuggedException(RuggedMessages.LIGHT_TIME_CORRECTION_REDEFINED, - l, file.getAbsolutePath(), line); - } - if (global.aberrationOfLightCorrection != Boolean.parseBoolean(fields[13])) { - throw new RuggedException(RuggedMessages.ABERRATION_OF_LIGHT_CORRECTION_REDEFINED, - l, file.getAbsolutePath(), line); - } + if (global.aberrationOfLightCorrection != Boolean.parseBoolean(fields[13])) { + throw new RuggedException(RuggedMessages.ABERRATION_OF_LIGHT_CORRECTION_REDEFINED, + l, file.getAbsolutePath(), line); } - global.calls.add(new DumpedCall() { + } + global.calls.add(new DumpedCall() { - /** {@inheritDoc} */ - @Override - public Object execute(final Rugged rugged) { - return rugged.directLocation(date, position, los); - } + /** {@inheritDoc} */ + @Override + public Object execute(final Rugged rugged) { + return rugged.directLocation(date, position, los); + } - }); + }); } }, @@ -592,22 +592,22 @@ public class DumpReplayer { /** {@inheritDoc} */ @Override public void parse(final int l, final File file, final String line, final String[] fields, final DumpReplayer global) { - if (fields.length < 10 || + if (fields.length < 10 || !fields[0].equals(MIN_DATE) || !fields[2].equals(MAX_DATE) || !fields[4].equals(T_STEP) || !fields[6].equals(TOLERANCE) || !fields[8].equals(INERTIAL_FRAME)) { - throw new RuggedException(RuggedMessages.CANNOT_PARSE_LINE, l, file, line); - } - global.minDate = new AbsoluteDate(fields[1], TimeScalesFactory.getUTC()); - global.maxDate = new AbsoluteDate(fields[3], TimeScalesFactory.getUTC()); - global.tStep = Double.parseDouble(fields[5]); - global.tolerance = Double.parseDouble(fields[7]); - global.bodyToInertial = new TreeMap<Integer, Transform>(); - global.scToInertial = new TreeMap<Integer, Transform>(); - try { - global.inertialFrame = FramesFactory.getFrame(Predefined.valueOf(fields[9])); - } catch (IllegalArgumentException iae) { - throw new RuggedException(RuggedMessages.CANNOT_PARSE_LINE, l, file, line); - } + throw new RuggedException(RuggedMessages.CANNOT_PARSE_LINE, l, file, line); + } + global.minDate = new AbsoluteDate(fields[1], TimeScalesFactory.getUTC()); + global.maxDate = new AbsoluteDate(fields[3], TimeScalesFactory.getUTC()); + global.tStep = Double.parseDouble(fields[5]); + global.tolerance = Double.parseDouble(fields[7]); + global.bodyToInertial = new TreeMap<Integer, Transform>(); + global.scToInertial = new TreeMap<Integer, Transform>(); + try { + global.inertialFrame = FramesFactory.getFrame(Predefined.valueOf(fields[9])); + } catch (IllegalArgumentException iae) { + throw new RuggedException(RuggedMessages.CANNOT_PARSE_LINE, l, file, line); + } } }, @@ -814,44 +814,44 @@ public class DumpReplayer { /** {@inheritDoc} */ @Override public void parse(final int l, final File file, final String line, final String[] fields, final DumpReplayer global) { - if (fields.length < 16 || !fields[0].equals(SENSOR_NAME) || + if (fields.length < 16 || !fields[0].equals(SENSOR_NAME) || !fields[2].equals(MIN_LINE) || !fields[4].equals(MAX_LINE) || !fields[6].equals(MAX_EVAL) || !fields[8].equals(ACCURACY) || !fields[10].equals(NORMAL) || !fields[14].equals(CACHED_RESULTS)) { - throw new RuggedException(RuggedMessages.CANNOT_PARSE_LINE, l, file, line); - } - final String sensorName = fields[1]; - final int minLine = Integer.parseInt(fields[3]); - final int maxLine = Integer.parseInt(fields[5]); - final int maxEval = Integer.parseInt(fields[7]); - final double accuracy = Double.parseDouble(fields[9]); - final Vector3D normal = new Vector3D(Double.parseDouble(fields[11]), - Double.parseDouble(fields[12]), - Double.parseDouble(fields[13])); - final int n = Integer.parseInt(fields[15]); - final CrossingResult[] cachedResults = new CrossingResult[n]; - int base = 16; - for (int i = 0; i < n; ++i) { - if (fields.length < base + 15 || !fields[base].equals(LINE_NUMBER) || + throw new RuggedException(RuggedMessages.CANNOT_PARSE_LINE, l, file, line); + } + final String sensorName = fields[1]; + final int minLine = Integer.parseInt(fields[3]); + final int maxLine = Integer.parseInt(fields[5]); + final int maxEval = Integer.parseInt(fields[7]); + final double accuracy = Double.parseDouble(fields[9]); + final Vector3D normal = new Vector3D(Double.parseDouble(fields[11]), + Double.parseDouble(fields[12]), + Double.parseDouble(fields[13])); + final int n = Integer.parseInt(fields[15]); + final CrossingResult[] cachedResults = new CrossingResult[n]; + int base = 16; + for (int i = 0; i < n; ++i) { + if (fields.length < base + 15 || !fields[base].equals(LINE_NUMBER) || !fields[base + 2].equals(DATE) || !fields[base + 4].equals(TARGET) || !fields[base + 8].equals(TARGET_DIRECTION)) { - throw new RuggedException(RuggedMessages.CANNOT_PARSE_LINE, l, file, line); - } - final double ln = Double.parseDouble(fields[base + 1]); - final AbsoluteDate date = new AbsoluteDate(fields[base + 3], TimeScalesFactory.getUTC()); - final Vector3D target = new Vector3D(Double.parseDouble(fields[base + 5]), - Double.parseDouble(fields[base + 6]), - Double.parseDouble(fields[base + 7])); - final Vector3D targetDirection = new Vector3D(Double.parseDouble(fields[base + 9]), - Double.parseDouble(fields[base + 10]), - Double.parseDouble(fields[base + 11])); - final Vector3D targetDirectionDerivative = new Vector3D(Double.parseDouble(fields[base + 12]), - Double.parseDouble(fields[base + 13]), - Double.parseDouble(fields[base + 14])); - cachedResults[i] = new CrossingResult(date, ln, target, targetDirection, targetDirectionDerivative); - base += 15; + throw new RuggedException(RuggedMessages.CANNOT_PARSE_LINE, l, file, line); } - global.getSensor(sensorName).setMeanPlane(new ParsedMeanPlane(minLine, maxLine, maxEval, accuracy, normal, cachedResults)); + final double ln = Double.parseDouble(fields[base + 1]); + final AbsoluteDate date = new AbsoluteDate(fields[base + 3], TimeScalesFactory.getUTC()); + final Vector3D target = new Vector3D(Double.parseDouble(fields[base + 5]), + Double.parseDouble(fields[base + 6]), + Double.parseDouble(fields[base + 7])); + final Vector3D targetDirection = new Vector3D(Double.parseDouble(fields[base + 9]), + Double.parseDouble(fields[base + 10]), + Double.parseDouble(fields[base + 11])); + final Vector3D targetDirectionDerivative = new Vector3D(Double.parseDouble(fields[base + 12]), + Double.parseDouble(fields[base + 13]), + Double.parseDouble(fields[base + 14])); + cachedResults[i] = new CrossingResult(date, ln, target, targetDirection, targetDirectionDerivative); + base += 15; + } + global.getSensor(sensorName).setMeanPlane(new ParsedMeanPlane(minLine, maxLine, maxEval, accuracy, normal, cachedResults)); } }, @@ -861,18 +861,18 @@ public class DumpReplayer { /** {@inheritDoc} */ @Override public void parse(final int l, final File file, final String line, final String[] fields, final DumpReplayer global) { - if (fields.length < 10 || !fields[0].equals(SENSOR_NAME) || - !fields[2].equals(DATE) || !fields[4].equals(PIXEL_NUMBER) || - !fields[6].equals(LOS)) { - throw new RuggedException(RuggedMessages.CANNOT_PARSE_LINE, l, file, line); - } - final String sensorName = fields[1]; - final AbsoluteDate date = new AbsoluteDate(fields[3], TimeScalesFactory.getUTC()); - final int pixelNumber = Integer.parseInt(fields[5]); - final Vector3D los = new Vector3D(Double.parseDouble(fields[7]), - Double.parseDouble(fields[8]), - Double.parseDouble(fields[9])); - global.getSensor(sensorName).setLOS(date, pixelNumber, los); + if (fields.length < 10 || !fields[0].equals(SENSOR_NAME) || + !fields[2].equals(DATE) || !fields[4].equals(PIXEL_NUMBER) || + !fields[6].equals(LOS)) { + throw new RuggedException(RuggedMessages.CANNOT_PARSE_LINE, l, file, line); + } + final String sensorName = fields[1]; + final AbsoluteDate date = new AbsoluteDate(fields[3], TimeScalesFactory.getUTC()); + final int pixelNumber = Integer.parseInt(fields[5]); + final Vector3D los = new Vector3D(Double.parseDouble(fields[7]), + Double.parseDouble(fields[8]), + Double.parseDouble(fields[9])); + global.getSensor(sensorName).setLOS(date, pixelNumber, los); } }, @@ -882,14 +882,14 @@ public class DumpReplayer { /** {@inheritDoc} */ @Override public void parse(final int l, final File file, final String line, final String[] fields, final DumpReplayer global) { - if (fields.length < 6 || !fields[0].equals(SENSOR_NAME) || + if (fields.length < 6 || !fields[0].equals(SENSOR_NAME) || !fields[2].equals(LINE_NUMBER) || !fields[4].equals(DATE)) { - throw new RuggedException(RuggedMessages.CANNOT_PARSE_LINE, l, file, line); - } - final String sensorName = fields[1]; - final double lineNumber = Double.parseDouble(fields[3]); - final AbsoluteDate date = new AbsoluteDate(fields[5], TimeScalesFactory.getUTC()); - global.getSensor(sensorName).setDatation(lineNumber, date); + throw new RuggedException(RuggedMessages.CANNOT_PARSE_LINE, l, file, line); + } + final String sensorName = fields[1]; + final double lineNumber = Double.parseDouble(fields[3]); + final AbsoluteDate date = new AbsoluteDate(fields[5], TimeScalesFactory.getUTC()); + global.getSensor(sensorName).setDatation(lineNumber, date); } }, diff --git a/src/main/java/org/orekit/rugged/intersection/duvenhage/DuvenhageAlgorithm.java b/src/main/java/org/orekit/rugged/intersection/duvenhage/DuvenhageAlgorithm.java index b88a52f0..f3ac486c 100644 --- a/src/main/java/org/orekit/rugged/intersection/duvenhage/DuvenhageAlgorithm.java +++ b/src/main/java/org/orekit/rugged/intersection/duvenhage/DuvenhageAlgorithm.java @@ -199,7 +199,7 @@ public class DuvenhageAlgorithm implements IntersectionAlgorithm { /** {@inheritDoc} */ @Override public double getElevation(final double latitude, final double longitude) { - + DumpManager.dumpAlgorithm(flatBody ? AlgorithmId.DUVENHAGE_FLAT_BODY : AlgorithmId.DUVENHAGE); final Tile tile = cache.getTile(latitude, longitude); return tile.interpolateElevation(latitude, longitude); diff --git a/src/main/java/org/orekit/rugged/linesensor/SensorMeanPlaneCrossing.java b/src/main/java/org/orekit/rugged/linesensor/SensorMeanPlaneCrossing.java index 7b5ad762..2579cbc9 100644 --- a/src/main/java/org/orekit/rugged/linesensor/SensorMeanPlaneCrossing.java +++ b/src/main/java/org/orekit/rugged/linesensor/SensorMeanPlaneCrossing.java @@ -516,7 +516,7 @@ public class SensorMeanPlaneCrossing { * or null if search interval does not bracket a solution */ private CrossingResult slowFind(final PVCoordinates targetPV, final double initialGuess) { - + try { // safety check final double startValue; diff --git a/src/main/java/org/orekit/rugged/los/FixedRotation.java b/src/main/java/org/orekit/rugged/los/FixedRotation.java index 0035ae89..d953c250 100644 --- a/src/main/java/org/orekit/rugged/los/FixedRotation.java +++ b/src/main/java/org/orekit/rugged/los/FixedRotation.java @@ -64,7 +64,7 @@ public class FixedRotation implements TimeIndependentLOSTransform { * @param angle rotation angle */ public FixedRotation(final String name, final Vector3D axis, final double angle) { - + this.axis = axis; this.rotation = null; this.rDS = null; diff --git a/src/main/java/org/orekit/rugged/los/FixedZHomothety.java b/src/main/java/org/orekit/rugged/los/FixedZHomothety.java index a00406ae..cb163f38 100644 --- a/src/main/java/org/orekit/rugged/los/FixedZHomothety.java +++ b/src/main/java/org/orekit/rugged/los/FixedZHomothety.java @@ -60,7 +60,7 @@ public class FixedZHomothety implements TimeIndependentLOSTransform { * @param factorvalue homothety factor */ public FixedZHomothety(final String name, final double factorvalue) { - + this.factor = factorvalue; this.factorDS = null; this.factorDriver = new ParameterDriver(name, factorvalue, SCALE, 0, Double.POSITIVE_INFINITY); diff --git a/src/main/java/org/orekit/rugged/raster/SimpleTile.java b/src/main/java/org/orekit/rugged/raster/SimpleTile.java index 1fc234a8..975da366 100644 --- a/src/main/java/org/orekit/rugged/raster/SimpleTile.java +++ b/src/main/java/org/orekit/rugged/raster/SimpleTile.java @@ -229,7 +229,7 @@ public class SimpleTile implements Tile { /** {@inheritDoc} */ @Override public void setElevation(final int latitudeIndex, final int longitudeIndex, final double elevation) { - + if (latitudeIndex < 0 || latitudeIndex > (latitudeRows - 1) || longitudeIndex < 0 || longitudeIndex > (longitudeColumns - 1)) { throw new RuggedException(RuggedMessages.OUT_OF_TILE_INDICES, diff --git a/src/main/java/org/orekit/rugged/refraction/AtmosphericRefraction.java b/src/main/java/org/orekit/rugged/refraction/AtmosphericRefraction.java index 93811fae..d65c9955 100644 --- a/src/main/java/org/orekit/rugged/refraction/AtmosphericRefraction.java +++ b/src/main/java/org/orekit/rugged/refraction/AtmosphericRefraction.java @@ -186,7 +186,7 @@ public abstract class AtmosphericRefraction { final int nbLineGrid = atmosphericParams.getNbLineGrid(); final double[] pixelGrid = atmosphericParams.getUgrid(); final double[] lineGrid = atmosphericParams.getVgrid(); - + // Initialize the needed diff functions final double[][] gridDiffPixel = new double[nbPixelGrid][nbLineGrid]; final double[][] gridDiffLine = new double[nbPixelGrid][nbLineGrid]; diff --git a/src/main/java/org/orekit/rugged/refraction/MultiLayerModel.java b/src/main/java/org/orekit/rugged/refraction/MultiLayerModel.java index 0d8bedad..52bc3c1f 100644 --- a/src/main/java/org/orekit/rugged/refraction/MultiLayerModel.java +++ b/src/main/java/org/orekit/rugged/refraction/MultiLayerModel.java @@ -236,8 +236,7 @@ public class MultiLayerModel extends AtmosphericRefraction { @Override public NormalizedGeodeticPoint applyCorrection(final Vector3D satPos, final Vector3D satLos, final NormalizedGeodeticPoint rawIntersection, - final IntersectionAlgorithm algorithm) - { + final IntersectionAlgorithm algorithm) { final IntersectionLOS intersectionLOS = computeToLowestAtmosphereLayer(satPos, satLos, rawIntersection); final Vector3D pos = intersectionLOS.getIntersectionPos(); diff --git a/src/main/java/org/orekit/rugged/utils/ExtendedEllipsoid.java b/src/main/java/org/orekit/rugged/utils/ExtendedEllipsoid.java index c95060af..d4100f64 100644 --- a/src/main/java/org/orekit/rugged/utils/ExtendedEllipsoid.java +++ b/src/main/java/org/orekit/rugged/utils/ExtendedEllipsoid.java @@ -188,7 +188,7 @@ public class ExtendedEllipsoid extends OneAxisEllipsoid { */ public NormalizedGeodeticPoint pointOnGround(final Vector3D position, final Vector3D los, final double centralLongitude) { - + DumpManager.dumpEllipsoid(this); final GeodeticPoint gp = getIntersectionPoint(new Line(position, new Vector3D(1, position, 1e6, los), 1.0e-12), -- GitLab