Index: trunk/StdDbtPlayerComponents/DbtPlyGgaManager.cpp
===================================================================
--- trunk/StdDbtPlayerComponents/DbtPlyGgaManager.cpp	(revision 82)
+++ trunk/StdDbtPlayerComponents/DbtPlyGgaManager.cpp	(revision 103)
@@ -15,29 +15,110 @@
 #include <qapplication.h>
 
-//#include "kernel/ComponentManager.h"
-
-namespace pacpus {
-
-//////////////////////////////////////////////////////////////////////////
-// Construction de la fabrique de composant DbtPlyGgaManager
-//////////////////////////////////////////////////////////////////////////
+using namespace pacpus;
+using namespace std;
+
+/************************************************************************
+ * Construction de la fabrique de composant DbtPlyGgaManager
+ ************************************************************************/
 static ComponentFactory<DbtPlyGgaManager> sFactory("DbtPlyGgaManager"); 
 
-// double dist1[2];
-// double dist2[2];
-
+
+/************************************************************************
+ * Constructor
+ ************************************************************************/
+DbtPlyGgaManager::DbtPlyGgaManager(QString name)
+    : DbtPlyFileManager(name)
+{
+
+}
+
+
+/************************************************************************
+ * Destructor
+ ************************************************************************/
+DbtPlyGgaManager::~DbtPlyGgaManager()
+{
+	
+}
+
+
+/************************************************************************
+ * Process GGA data
+ ************************************************************************/
+void DbtPlyGgaManager::processData(road_time_t t, road_timerange_t tr , void * buffer)
+{
+    // no data available
+    if (!buffer) {
+        LOG_DEBUG("no data available: NULL buffer");
+        return;
+    }
+
+    // make local copy of GGA frame
+    memcpy(&mGga.frame, buffer, sizeof(trame_gga_dbl));
+    mGga.time = t;
+    mGga.timerange = tr;
+
+    // send GGA data to output
+    checkedSend(outGga, mGga);
+}
+
+
+/************************************************************************
+ * Start function, called by the ComponentManager when a start()
+ * command is received
+ ************************************************************************/
+void DbtPlyGgaManager::startActivity()
+{ 
+  DbtPlyFileManager::startActivity();
+
+  outGga = getTypedOutput<TimestampedGgaFrame, DbtPlyGgaManager>("gga");
+  // user interface 
+}
+
+
+/************************************************************************
+ * Stop function, called by the ComponentManager when a stop()
+ * command is received
+ ************************************************************************/
+void DbtPlyGgaManager::stopActivity()
+{
+  DbtPlyFileManager::stopActivity();
+}
+
+
+/************************************************************************
+ * Called by the framework at initialization
+ ************************************************************************/
+void DbtPlyGgaManager::addInputs()
+{
+  // uncomment to add an input
+}
+
+
+/************************************************************************
+ * Called by the framework at initialization
+ ************************************************************************/
+void DbtPlyGgaManager::addOutputs()
+{
+  // empty: no output
+  addOutput<TimestampedGgaFrame, DbtPlyGgaManager>("gga");
+}
+
+
+/************************************************************************
+ * Graphical user interface
+ ************************************************************************/
+
+/*
 double atanh(double  z)
 {
-	return (0.5 * log((z+1)/(1-z)));
+    return (0.5 * log((z+1)/(1-z)));
 }
 
 double  abs_me(double x)
 {
-	if(x<0) x=-x;
-	return x;
-}
-
-
-
+    if(x<0) x=-x;
+    return x;
+}
 
 //////////////////////////////////////////////////////////////////////////
@@ -48,15 +129,15 @@
   double GRS_a = 6378137;
   double GRS_f = 1/298.257222101;
-  
+
   double GRS_b = GRS_a*(1-GRS_f);
   double GRS_bb= GRS_b*GRS_b;
   double GRS_aa= 40680631590769.0;
   double GRS_e = sqrt((GRS_aa - GRS_bb) / (GRS_aa));
-  
+
   double n = 0.725607765053267;
   double C = 11754255.4261;
   double XS = 700000;
   double YS = 12655612.0499;
-  
+
   double latiso;
   latiso = atanh(sin(lat)) - GRS_e*atanh(GRS_e*sin(lat));
@@ -65,13 +146,9 @@
   double R;
   R = C * exp(-n*latiso);
-  
+
   lam93x = R *sin(gamma)+XS;
   lam93y = -R *cos(gamma)+YS;
 }
 
-
-
-
-
 //////////////////////////////////////////////////////////////////////////
 //Transformation des coordonnees de Lambert93 en Longitude lattitude
@@ -79,121 +156,59 @@
 void lamtolonlat(double lamx, double lamy, double & lon, double & lat)
 {
-	double GRS_a = 6378137;
-	double GRS_f = 1/298.257222101;
-	double GRS_b = GRS_a*(1-GRS_f);
-	double GRS_bb= GRS_b*GRS_b;
-	double GRS_aa= 40680631590769.0;
-	double GRS_e = sqrt((GRS_aa - GRS_bb) / (GRS_aa));
-
-	//double n = 0.725607765053267;
-	//double C = 11754255.4261;
-	//double XS = 700000;
-	//double YS = 12655612.0499;
-
-	
-	//lamx = lamx-700000;
-	//lamy = lamy-12655612.0499;
-
-	double gamma;
-	gamma = atan(-(lamx-700000)/(lamy-12655612.0499));
-
-
-	lon = gamma/0.725607765053267 + 0.0523598775598299;
-	double R;
-	R = sqrt((lamx-700000) * (lamx-700000) + (lamy-12655612.0499) * (lamy-12655612.0499));
-
-	double latiso;
-	latiso = log((11754255.4261)/R)/(0.725607765053267);
-
-	double phiNew, phiOld;
-	phiOld =1;
-	phiNew= asin (tanh ( latiso + GRS_e * atanh(GRS_e * sin(phiOld)))); 
-	//printf("\nphiNew: %.20lf",phiNew);
-	while (abs_me(phiOld-phiNew) > 1e-10)
-	{
-		
-		if(abs_me(phiOld-phiNew) > 1e-10)
-		{
-	
-			phiOld = phiNew;
-			phiNew = asin(tanh(latiso+GRS_e*atanh(GRS_e*sin(phiOld))));
-		}
-		else
-			phiOld = phiNew;
-	}
-	
-	lat = phiNew;
-}
-
-
-
-
-
-//////////////////////////////////////////////////////////////////////////
-/// Constructor
-DbtPlyGgaManager::DbtPlyGgaManager(QString name)
-    : DbtPlyFileManager(name)
-{
-
-}
-
-//////////////////////////////////////////////////////////////////////////
-/// Destructor 
-DbtPlyGgaManager::~DbtPlyGgaManager()
-{
-	
-}
-
-//////////////////////////////////////////////////////////////////////////
-// displayData 
-//////////////////////////////////////////////////////////////////////////
-void DbtPlyGgaManager::processData(road_time_t t, road_timerange_t /*tr*/ , void * buf)
-{
-    // no data available
-    if (buf == NULL) {
-        printf("NULL");
-        emit displayLat(0);
-        emit displayLon(0);
+    double GRS_a = 6378137;
+    double GRS_f = 1/298.257222101;
+    double GRS_b = GRS_a*(1-GRS_f);
+    double GRS_bb= GRS_b*GRS_b;
+    double GRS_aa= 40680631590769.0;
+    double GRS_e = sqrt((GRS_aa - GRS_bb) / (GRS_aa));
+
+    //double n = 0.725607765053267;
+    //double C = 11754255.4261;
+    //double XS = 700000;
+    //double YS = 12655612.0499;
+
+
+    //lamx = lamx-700000;
+    //lamy = lamy-12655612.0499;
+
+    double gamma;
+    gamma = atan(-(lamx-700000)/(lamy-12655612.0499));
+
+
+    lon = gamma/0.725607765053267 + 0.0523598775598299;
+    double R;
+    R = sqrt((lamx-700000) * (lamx-700000) + (lamy-12655612.0499) * (lamy-12655612.0499));
+
+    double latiso;
+    latiso = log((11754255.4261)/R)/(0.725607765053267);
+
+    double phiNew, phiOld;
+    phiOld =1;
+    phiNew= asin (tanh ( latiso + GRS_e * atanh(GRS_e * sin(phiOld))));
+    //printf("\nphiNew: %.20lf",phiNew);
+    while (abs_me(phiOld-phiNew) > 1e-10)
+    {
+
+        if(abs_me(phiOld-phiNew) > 1e-10)
+        {
+
+            phiOld = phiNew;
+            phiNew = asin(tanh(latiso+GRS_e*atanh(GRS_e*sin(phiOld))));
+        }
+        else
+            phiOld = phiNew;
     }
-  
-  val = (trame_gga_dbl*)(buf);
-
-
-  emit displayLat(val->lat);
-  emit displayLon(val->lon);
-
-}
-
-ComponentBase::COMPONENT_CONFIGURATION DbtPlyGgaManager::configureComponent(XmlComponentConfig config)
-{
-  DbtPlyFileManager::configureComponent(config);
-
-  return ComponentBase::CONFIGURED_OK;
-}
-
-
-
-
-void DbtPlyGgaManager::startActivity()
-{ 
-  DbtPlyFileManager::startActivity();
-  // user interface 
-}
-
-
-
-
-void DbtPlyGgaManager::stopActivity()
-{
-  DbtPlyFileManager::stopActivity();
-}
-
+
+    lat = phiNew;
+}*/
 
 void DbtPlyGgaManager::displayUI()
 {
-  // todo
+    // TODO
+    LOG_WARN("GUI not implemented");
+
 	// afficher lat lon
 	// voir dans DbtPlyUserInterface§.cpp
-	w = new QWidget();
+    /*w = new QWidget();
 	w->setWindowTitle(name());
 	w->show();
@@ -223,6 +238,17 @@
 	lonVal->setFixedSize(50,20);
 	lonVal->show();
-	connect (this, SIGNAL(displayLon(double)) , lonVal , SLOT(display(double)));
-}
-
-} // namespace pacpus
+    connect (this, SIGNAL(displayLon(double)) , lonVal , SLOT(display(double)));*/
+}
+
+
+/************************************************************************
+ * Configuration of the component, called by the ComponentManager after
+ * the construction of the object
+ ************************************************************************/
+ComponentBase::COMPONENT_CONFIGURATION DbtPlyGgaManager::configureComponent(XmlComponentConfig config)
+{
+  DbtPlyFileManager::configureComponent(config);
+
+  return ComponentBase::CONFIGURED_OK;
+}
+
