From 2f96d893a2309e233c78fa36edf24a519c3cb571 Mon Sep 17 00:00:00 2001 From: Luc Maisonobe <luc@orekit.org> Date: Sun, 9 Mar 2014 17:25:31 +0100 Subject: [PATCH] Added API for global context initialization. --- .../rugged/api/LineOfSightAlgorithm.java | 33 ----------- .../java/org/orekit/rugged/api/Rugged.java | 57 ++++++++++++++++--- .../orekit/rugged/api/RuggedException.java | 1 - .../org/orekit/rugged/api/RuggedMessages.java | 3 +- .../org/orekit/rugged/RuggedMessages_en.utf8 | 3 + .../org/orekit/rugged/RuggedMessages_fr.utf8 | 5 +- .../orekit/rugged/api/RuggedMessagesTest.java | 2 +- 7 files changed, 59 insertions(+), 45 deletions(-) delete mode 100644 rugged-api/src/main/java/org/orekit/rugged/api/LineOfSightAlgorithm.java diff --git a/rugged-api/src/main/java/org/orekit/rugged/api/LineOfSightAlgorithm.java b/rugged-api/src/main/java/org/orekit/rugged/api/LineOfSightAlgorithm.java deleted file mode 100644 index 2fcf9af5..00000000 --- a/rugged-api/src/main/java/org/orekit/rugged/api/LineOfSightAlgorithm.java +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright 2013-2014 CS Systèmes d'Information - * Licensed to CS Systèmes d'Information (CS) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * CS licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.orekit.rugged.api; - -/** Enumerate for line-of-sight intersection algorithm. - * @author Luc Maisonobe - */ -public enum LineOfSightAlgorithm { - - /** Bernardt Duvenhage's algorithm. - * <p> - * The algorithm is described in the 2009 paper: - * <a href="http://researchspace.csir.co.za/dspace/bitstream/10204/3041/1/Duvenhage_2009.pdf">Using - * An Implicit Min/Max KD-Tree for Doing Efficient Terrain Line of Sight Calculations</a>. - * </p> - */ - DUVENHAGE; - -} diff --git a/rugged-api/src/main/java/org/orekit/rugged/api/Rugged.java b/rugged-api/src/main/java/org/orekit/rugged/api/Rugged.java index 94781701..9ada0eee 100644 --- a/rugged-api/src/main/java/org/orekit/rugged/api/Rugged.java +++ b/rugged-api/src/main/java/org/orekit/rugged/api/Rugged.java @@ -16,11 +16,50 @@ */ package org.orekit.rugged.api; +import java.io.File; +import java.util.List; + /** Main interface to Rugged library. * @author Luc Maisonobe */ public interface Rugged { + /** Enumerate for ellipsoid. */ + enum Ellipsoid { + GRS80, WGS84, IERS96, IERS2003 + } + + /** Enumerate for inertial frames. */ + enum InertialFrame { + GCRF, EME2000, MOD, TOD, VEIS1950 + } + + /** Enumerate for body rotating frames. */ + enum BodyRotatingFrame { + ITRF, GTOD + } + + /** Set up general context. + * <p> + * This method is the first one that must be called, otherwise the + * other methods will fail due to uninitialized context. + * </p> + * @param orekitDataDir top directory for Orekit data + * @param ellipsoid reference ellipsoid + * @param inertialFrameName inertial frame + * @param bodyRotatingFrame body rotating frame + * @param positionsVelocities satellite position and velocity + * @param pvInterpolationOrder order to use for position/velocity interpolation + * @param quaternions satellite quaternions + * @param aInterpolationOrder order to use for attitude interpolation + * @exception RuggedException if data needed for some frame cannot be loaded + */ + void setGeneralContext(File orekitDataDir, Ellipsoid ellipsoid, + InertialFrame inertialFrame, BodyRotatingFrame bodyRotatingFrame, + List<SatellitePV> positionsVelocities, int pvInterpolationOrder, + List<SatelliteQ> quaternions, int aInterpolationOrder) + throws RuggedException; + /** Set up the tiles management. * @param updater updater used to load Digital Elevation Model tiles * @param maxCachedTiles maximum number of tiles stored in the cache @@ -30,23 +69,25 @@ public interface Rugged { /** Direct localization of a sensor line. * @param sensorName name of the sensor * @param lineNumber number of the line to localize on ground - * @param algorithm algorithm to use for line-of-sight/DEM intersection computation * @return ground position of all pixels of the specified sensor line - * @exception RuggedException if line cannot be localized + * @exception RuggedException if line cannot be localized, + * if {@link #setGeneralContext(File, InertialFrame, BodyRotatingFrame, Ellipsoid)} has + * not been called beforehand, or if {@link #setOrbitAndAttitude(List, List)} has not + * been called beforehand */ - GroundPoint[] directLocalization(String sensorName, int lineNumber, - LineOfSightAlgorithm algorithm) + GroundPoint[] directLocalization(String sensorName, int lineNumber) throws RuggedException; /** Inverse localization of a ground point. * @param sensorName name of the sensor * @param ground point to localize - * @param algorithm algorithm to use for line-of-sight/DEM intersection computation * @return sensor pixel seeing ground point - * @exception RuggedException if line cannot be localized + * @exception RuggedException if line cannot be localized, + * if {@link #setGeneralContext(File, InertialFrame, BodyRotatingFrame, Ellipsoid)} has + * not been called beforehand, or if {@link #setOrbitAndAttitude(List, List)} has not + * been called beforehand */ - SensorPixel inverseLocalization(String sensorName, GroundPoint groundPoint, - LineOfSightAlgorithm algorithm) + SensorPixel inverseLocalization(String sensorName, GroundPoint groundPoint) throws RuggedException; } diff --git a/rugged-api/src/main/java/org/orekit/rugged/api/RuggedException.java b/rugged-api/src/main/java/org/orekit/rugged/api/RuggedException.java index 8dd97382..13e0ea9f 100644 --- a/rugged-api/src/main/java/org/orekit/rugged/api/RuggedException.java +++ b/rugged-api/src/main/java/org/orekit/rugged/api/RuggedException.java @@ -62,7 +62,6 @@ public class RuggedException extends Exception { /** Copy constructor. * @param exception exception to copy from - * @since 5.1 */ public RuggedException(final RuggedException exception) { super(exception); diff --git a/rugged-api/src/main/java/org/orekit/rugged/api/RuggedMessages.java b/rugged-api/src/main/java/org/orekit/rugged/api/RuggedMessages.java index 4a26ad38..12c81576 100644 --- a/rugged-api/src/main/java/org/orekit/rugged/api/RuggedMessages.java +++ b/rugged-api/src/main/java/org/orekit/rugged/api/RuggedMessages.java @@ -51,7 +51,8 @@ public enum RuggedMessages implements Localizable { // CHECKSTYLE: stop JavadocVariable check INTERNAL_ERROR("internal error, contact maintenance at {0}"), - OUT_OF_TILE_INDICES("no data at indices [{0}, {1}], tile only covers from [0, 0] to [{2}, {3}] (inclusive)"); + OUT_OF_TILE_INDICES("no data at indices [{0}, {1}], tile only covers from [0, 0] to [{2}, {3}] (inclusive)"), + UNINITIALIZED_CONTEXT("general context has not been initialized"); // CHECKSTYLE: resume JavadocVariable check diff --git a/rugged-api/src/main/resources/assets/org/orekit/rugged/RuggedMessages_en.utf8 b/rugged-api/src/main/resources/assets/org/orekit/rugged/RuggedMessages_en.utf8 index ba3b3ef6..6e089d03 100644 --- a/rugged-api/src/main/resources/assets/org/orekit/rugged/RuggedMessages_en.utf8 +++ b/rugged-api/src/main/resources/assets/org/orekit/rugged/RuggedMessages_en.utf8 @@ -3,3 +3,6 @@ INTERNAL_ERROR = internal error, contact maintenance at {0} # no data at indices [{0}, {1}], tile only covers from [0, 0] to [{2}, {3}] (inclusive) OUT_OF_TILE_INDICES = no data at indices [{0}, {1}], tile only covers from [0, 0] to [{2}, {3}] (inclusive) + +# general context has not been initialized +UNINITIALIZED_CONTEXT = general context has not been initialized diff --git a/rugged-api/src/main/resources/assets/org/orekit/rugged/RuggedMessages_fr.utf8 b/rugged-api/src/main/resources/assets/org/orekit/rugged/RuggedMessages_fr.utf8 index 64af7571..3f7baea9 100644 --- a/rugged-api/src/main/resources/assets/org/orekit/rugged/RuggedMessages_fr.utf8 +++ b/rugged-api/src/main/resources/assets/org/orekit/rugged/RuggedMessages_fr.utf8 @@ -2,4 +2,7 @@ INTERNAL_ERROR = erreur interne, contactez la maintenance à {0} # no data at indices [{0}, {1}], tile only covers from [0, 0] to [{2}, {3}] (inclusive) -OUT_OF_TILE_INDICES = aucune donnée aux indices {0}, {1}], la tuile ne couvre que de [0, 0] à [{2}, {3}] inclus +OUT_OF_TILE_INDICES = aucune donnée aux indices [{0}, {1}], la tuile ne couvre que de [0, 0] à [{2}, {3}] inclus + +# general context has not been initialized +UNINITIALIZED_CONTEXT = le contexte général n''a pas été initialisé diff --git a/rugged-api/src/test/java/org/orekit/rugged/api/RuggedMessagesTest.java b/rugged-api/src/test/java/org/orekit/rugged/api/RuggedMessagesTest.java index 384a488a..543ac50c 100644 --- a/rugged-api/src/test/java/org/orekit/rugged/api/RuggedMessagesTest.java +++ b/rugged-api/src/test/java/org/orekit/rugged/api/RuggedMessagesTest.java @@ -29,7 +29,7 @@ public class RuggedMessagesTest { @Test public void testMessageNumber() { - Assert.assertEquals(2, RuggedMessages.values().length); + Assert.assertEquals(3, RuggedMessages.values().length); } @Test -- GitLab