From b662c7f49294cce22c06903aa299031e8e19905c Mon Sep 17 00:00:00 2001
From: Luc Maisonobe <luc@orekit.org>
Date: Tue, 11 Mar 2014 17:56:32 +0100
Subject: [PATCH] Started implementation of direct localization ...

---
 .../orekit/rugged/core/AbstractRugged.java    | 21 ++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/rugged-core/src/main/java/org/orekit/rugged/core/AbstractRugged.java b/rugged-core/src/main/java/org/orekit/rugged/core/AbstractRugged.java
index 4864b7fb..732fa085 100644
--- a/rugged-core/src/main/java/org/orekit/rugged/core/AbstractRugged.java
+++ b/rugged-core/src/main/java/org/orekit/rugged/core/AbstractRugged.java
@@ -304,15 +304,26 @@ public abstract class AbstractRugged implements Rugged {
 
     /** {@inheritDoc} */
     @Override
-    public GroundPoint[] directLocalization(String sensorName, int lineNumber)
+    public GroundPoint[] directLocalization(String sensorName, double lineNumber)
         throws RuggedException {
+        try {
 
-        checkContext();
-        final Sensor sensor = getSensor(sensorName);
+            checkContext();
 
-        // TODO: implement direct localization
-        throw RuggedException.createInternalError(null);
+            // select the sensor
+            final Sensor sensor = getSensor(sensorName);
 
+            // find the spacecraft state when line is active
+            final AbsoluteDate date = referenceDate.shiftedBy(sensor.getDatationModel().getDate(lineNumber));
+            final PVCoordinates pv  = pvProvider.getPVCoordinates(date, shape.getBodyFrame());
+            final Attitude attitude = aProvider.getAttitude(pvProvider, date, shape.getBodyFrame());
+
+            // TODO: implement direct localization
+            throw RuggedException.createInternalError(null);
+
+        } catch (OrekitException oe) {
+            throw new RuggedException(oe, oe.getSpecifier(), oe.getParts());
+        }
     }
 
     /** {@inheritDoc} */
-- 
GitLab