Index: trunk/SophyaPI/PIext/nobjmgr.cc
===================================================================
--- trunk/SophyaPI/PIext/nobjmgr.cc	(revision 586)
+++ trunk/SophyaPI/PIext/nobjmgr.cc	(revision 594)
@@ -955,6 +955,10 @@
 obja = GetObjAdapter(nom);
 if (obja == NULL)  return;
-
-string ctyp = typeid(*obja->GetDataObj()).name();
+AnyDataObj* ob = obja->GetDataObj();
+if (ob == NULL) {
+  cerr << "NamedObjMgr::PrintObj() / Error - NULL object ! in " << nom << endl;
+  return;
+  }
+string ctyp = typeid(*ob).name();
 cout << "NamedObjMgr::PrintObj(" << nom << ") Type: " << ctyp << endl;
 obja->Print(cout);
@@ -969,7 +973,11 @@
 obja = GetObjAdapter(nom);
 if (obja == NULL) {
-  cout << "NamedObjMgr::DisplayObj() Error , Pas d'objet de nom " << nom << endl; 
+  cout << "NamedObjMgr::DisplayObj() Error , No object with name " << nom << endl; 
   return;
 }
+if (obja->GetDataObj() == NULL) {
+  cerr << "NamedObjMgr::DisplayObj() / Error - NULL object ! in " << nom << endl;
+  return;
+  }
 if (!myImgApp)  return;
  
@@ -981,5 +989,5 @@
 if (!dr && !arr) { 
   string ctyp = typeid(*(obja->GetDataObj())).name();
-  cout << "NamedObjMgr::DisplayObj() Error , Pas de display pour " << ctyp << endl; 
+  cout << "NamedObjMgr::DisplayObj() Error , No display for " << ctyp << endl; 
   return;
   }
@@ -1017,4 +1025,8 @@
   return;
 }
+if (obja->GetDataObj() == NULL) {
+  cerr << "NamedObjMgr::DisplayImage() / Error - NULL object ! in " << nom << endl;
+  return;
+  }
 if (!myImgApp)  return;
  
@@ -1052,4 +1064,8 @@
   return;
 }
+if (obja->GetDataObj() == NULL) {
+  cerr << "NamedObjMgr::DisplaySurf3D() / Error - NULL object ! in " << nom << endl;
+  return;
+  }
 if (!myImgApp)  return;
  
Index: trunk/SophyaPI/PIext/nomskymapadapter.cc
===================================================================
--- trunk/SophyaPI/PIext/nomskymapadapter.cc	(revision 586)
+++ trunk/SophyaPI/PIext/nomskymapadapter.cc	(revision 594)
@@ -1,4 +1,5 @@
 #include "machdefs.h"
 #include <stdlib.h>
+#include <math.h>
 #include <typeinfo>
 #include <iostream.h>
@@ -10,5 +11,39 @@
 #include "spheregorski.h"
 #include "localmap.h"
-
+#include "pitvmaad.h"
+#include "complexios.h"
+
+//  Classe array adapter pour localMap
+template <class T> 
+class LocalMapArrAdapter : public P2DArrayAdapter {
+public:
+		LocalMapArrAdapter(LocalMap<T>* lm, bool d=false) :
+                    P2DArrayAdapter(lm->XSize(), lm->YSize())
+		    { ad = d; map = lm; }
+
+  virtual 	~LocalMapArrAdapter() { if (ad) delete map; }
+  virtual double  Value(int ix, int iy) { return((*map)(ix, iy)); }
+
+protected :
+  bool ad;
+  LocalMap<T>* map;
+};
+
+/* --Methode-- */
+double LocalMapArrAdapter< complex<float> >::Value(int ix, int iy) 
+{
+double re,im;
+re = (*map)(iy, ix).real();
+im = (*map)(iy, ix).imag();
+return(sqrt(re*re+im*im));
+}
+/* --Methode-- */
+double LocalMapArrAdapter< complex<double> >::Value(int ix, int iy) 
+{
+double re,im;
+re = (*map)(iy, ix).real();
+im = (*map)(iy, ix).imag();
+return(sqrt(re*re+im*im));
+}
 
 //----------------------------------------------------------------
@@ -20,5 +55,5 @@
 template <class T> 
 NOMAdapter_PixelMap<T>::NOMAdapter_PixelMap(PixelMap<T> * o)
-  : NObjMgrAdapter((AnyDataObj *)o)
+  : NObjMgrAdapter(o)
 {
 mMap = o;
@@ -84,5 +119,8 @@
 {
 string s = typeid(*mMap).name();
+T moy, sig;
+MeanSig(moy, sig);
 cout << "SkyMap Type: " << s << " NbPixels= " << mMap->NbPixels() << endl;
+cout << "  Mean= " << moy << "  Sig2= " << sig << endl;
 }
 
@@ -92,5 +130,13 @@
 P2DArrayAdapter* NOMAdapter_PixelMap<T>::Get2DArray(string &)
 {
-return(NULL);
+LocalMap<T>* lm = dynamic_cast< LocalMap<T> * >(mMap); 
+if (lm != NULL) return(new LocalMapArrAdapter<T>(lm, false));
+int nr = 250;
+int nc = 500;
+SphericalMap<T>* sm = dynamic_cast< SphericalMap<T> *>(mMap);
+if (sm != NULL) { nr = sqrt(0.75*mMap->NbPixels());  nc = 2*nr; }
+TMatrix<T> * mtx = new TMatrix<T>(nr, nc);
+Project_Mol(*mtx);
+return (new POTMatrixAdapter<T>(mtx, true) );
 }
 
@@ -103,5 +149,45 @@
 }
 
-
+/* --Methode-- */
+template <class T> 
+void NOMAdapter_PixelMap<T>::MeanSig(T& gmoy, T& gsig)
+{
+  gmoy=0.;
+  gsig = 0.;
+  T valok;
+  for(int k=0; k<mMap->NbPixels(); k++) {
+    valok = (*mMap)(k);
+    gmoy += valok;  gsig += valok*valok;
+  }
+  gmoy /= (T)mMap->NbPixels();
+  gsig = gsig/(T)mMap->NbPixels() - gmoy*gmoy;
+
+}
+
+/* --Methode-- */
+template <class T> 
+void NOMAdapter_PixelMap<T>::Project_Mol(TMatrix<T> & mtx, T defval)
+{
+  r_8 xa, yd, teta,phi, facteur;
+  int_4 l,c,k;
+  int_4 nl = mtx.NRows();
+  int_4 nc = mtx.NCols();
+  mtx.Reset(defval);   // On met tout a defval
+//  cout << " NRows= " << nl << "  NCols= " << nc  << endl;
+  for(l=0; l<nl; l++) {
+    yd = (r_8)(l+0.5)/(r_8)nl-0.5;
+    facteur=2.*M_PI/sin(acos((double)yd*2));
+    teta = (yd+0.5)*Pi;
+    //    teta = (0.5-yd)*M_PI;
+    for(c=0; c<nc; c++)  {
+      xa = (r_8)(c+0.5)/(r_8)nc-0.5;
+      phi = xa*facteur+M_PI;
+      if ( (phi <= 2*M_PI) && (phi >= 0.) ) {
+        k = mMap->PixIndexSph(teta, phi);
+        mtx(l,c) = (*mMap)(k);
+      }
+    }
+  }
+}
 
 // -------------------------------------------------------------
Index: trunk/SophyaPI/PIext/nomskymapadapter.h
===================================================================
--- trunk/SophyaPI/PIext/nomskymapadapter.h	(revision 586)
+++ trunk/SophyaPI/PIext/nomskymapadapter.h	(revision 594)
@@ -9,4 +9,5 @@
 
 #include "nomgadapter.h"
+#include "tmatrix.h"
 #include "pixelmap.h"
 
@@ -34,4 +35,7 @@
   virtual NTupleInterface*	GetNTupleInterface(bool& adel);
 
+  virtual void			MeanSig(T& gmoy, T& gsig);
+  virtual void			Project_Mol(TMatrix<T> & mtx, T defval=0.);
+
 protected:
   PixelMap<T>* mMap;
Index: trunk/SophyaPI/PIext/pitvmaad.cc
===================================================================
--- trunk/SophyaPI/PIext/pitvmaad.cc	(revision 594)
+++ trunk/SophyaPI/PIext/pitvmaad.cc	(revision 594)
@@ -0,0 +1,117 @@
+//  Adaptateurs pour TMatrix TVector du package Sophya
+//                             R. Ansari  1/99
+// LAL (Orsay) / IN2P3-CNRS  DAPNIA/SPP (Saclay) / CEA
+
+#include "pitvmaad.h"
+#include <math.h>
+
+/* --Methode-- */
+template <class T> 
+POTVectorAdapter<T>::POTVectorAdapter(TVector<T>* v, bool ad)
+        : P1DArrayAdapter(v->NElts())
+{
+aDel = ad; 
+mVec = v; 
+}
+/* --Methode-- */
+template <class T> 
+POTVectorAdapter<T>::~POTVectorAdapter()
+{
+if (aDel) delete mVec;
+}
+
+/* --Methode-- */
+template <class T> 
+double POTVectorAdapter<T>::Value(int i)
+{
+return((*mVec)(i));
+}
+
+/* --Methode-- */
+double POTVectorAdapter< complex<float> >::Value(int i)
+{
+double re,im;
+re = (*mVec)(i).real();
+im = (*mVec)(i).imag();
+return(sqrt(re*re+im*im));
+}
+
+/* --Methode-- */
+double POTVectorAdapter< complex<double> >::Value(int i)
+{
+double re,im;
+re = (*mVec)(i).real();
+im = (*mVec)(i).imag();
+return(sqrt(re*re+im*im));
+}
+
+/* --Methode-- */
+template <class T> 
+POTMatrixAdapter<T>::POTMatrixAdapter(TMatrix<T>* mtx, bool ad)
+        : P2DArrayAdapter(mtx->NCols(), mtx->NRows())
+{
+aDel = ad; 
+mMtx = mtx;
+}
+/* --Methode-- */
+template <class T> 
+POTMatrixAdapter<T>::~POTMatrixAdapter()
+{
+if (aDel)  delete mMtx;
+}
+/* --Methode-- */
+template <class T> 
+double POTMatrixAdapter<T>::Value(int ix, int iy)
+{
+return((double)(*mMtx)(iy, ix));
+}
+
+/* --Methode-- */
+double POTMatrixAdapter< complex<float> >::Value(int ix, int iy)
+{
+double re,im;
+re = (*mMtx)(iy, ix).real();
+im = (*mMtx)(iy, ix).imag();
+return(sqrt(re*re+im*im));
+}
+
+/* --Methode-- */
+double POTMatrixAdapter< complex<double> >::Value(int ix, int iy)
+{
+double re,im;
+re = (*mMtx)(iy, ix).real();
+im = (*mMtx)(iy, ix).imag();
+return(sqrt(re*re+im*im));
+}
+
+#ifdef __CXX_PRAGMA_TEMPLATES__
+#pragma define_template POTVectorAdapter< int_4 >
+#pragma define_template POTVectorAdapter< int_8 >
+#pragma define_template POTVectorAdapter< float >
+#pragma define_template POTVectorAdapter< double >
+#pragma define_template POTVectorAdapter< complex<float> > 
+#pragma define_template POTVectorAdapter< complex<double> > 
+
+#pragma define_template POTMatrixAdapter< int_4 >
+#pragma define_template POTMatrixAdapter< int_8 >
+#pragma define_template POTMatrixAdapter< float >
+#pragma define_template POTMatrixAdapter< double >
+#pragma define_template POTMatrixAdapter< complex<float> > 
+#pragma define_template POTMatrixAdapter< complex<double> > 
+#endif
+
+#if defined(ANSI_TEMPLATES)
+template class POTVectorAdapter< int_4 >;
+template class POTVectorAdapter< int_8 >;
+template class POTVectorAdapter< float >;
+template class POTVectorAdapter< double >;
+template class POTVectorAdapter< complex<float> >;
+template class POTVectorAdapter< complex<double> >;
+
+template class POTMatrixAdapter< int_4 >;
+template class POTMatrixAdapter< int_8 >;
+template class POTMatrixAdapter< float >;
+template class POTMatrixAdapter< double >;
+template class POTMatrixAdapter< complex<float> >;
+template class POTMatrixAdapter< complex<double> >;
+#endif
Index: trunk/SophyaPI/PIext/pitvmaad.h
===================================================================
--- trunk/SophyaPI/PIext/pitvmaad.h	(revision 586)
+++ trunk/SophyaPI/PIext/pitvmaad.h	(revision 594)
@@ -8,5 +8,4 @@
 
 #include "machdefs.h"
-#include <math.h>
 #include "parradapter.h"
 
@@ -19,11 +18,7 @@
 class POTVectorAdapter : public P1DArrayAdapter {
 public :
-		  POTVectorAdapter(TVector<T>* v, bool ad=false) 
-		        : P1DArrayAdapter(v->NElts())
-	     			{ aDel = ad; mVec = v; }
-  virtual         ~POTVectorAdapter()
-				{ if (aDel) delete mVec; }
-  virtual double  Value(int i)
-				{ return((*mVec)(i)); }
+		  POTVectorAdapter(TVector<T>* v, bool ad=false); 
+  virtual         ~POTVectorAdapter();
+  virtual double  Value(int i);
 
 protected:
@@ -34,19 +29,4 @@
 typedef POTVectorAdapter<r_8> POVectorAdapter;
 
-double POTVectorAdapter< complex<float> >::Value(int i)
-{
-double re,im;
-re = (*mVec)(i).real();
-im = (*mVec)(i).imag();
-return(sqrt(re*re+im*im));
-}
-
-double POTVectorAdapter< complex<double> >::Value(int i)
-{
-double re,im;
-re = (*mVec)(i).real();
-im = (*mVec)(i).imag();
-return(sqrt(re*re+im*im));
-}
 
 // Adaptateur de matrice SOPHYA a P2DArrayAdapter
@@ -55,11 +35,7 @@
 class POTMatrixAdapter :  public P2DArrayAdapter {
 public :
-                  POTMatrixAdapter(TMatrix<T>* mtx, bool ad=false)
-			: P2DArrayAdapter(mtx->NCols(), mtx->NRows())
-			{ aDel = ad; mMtx = mtx; }
-  virtual         ~POTMatrixAdapter()
-			{ if (aDel)  delete mMtx; }
-  virtual double  Value(int ix, int iy)
-			{ return((double)(*mMtx)(iy, ix)); }
+                  POTMatrixAdapter(TMatrix<T>* mtx, bool ad=false);
+  virtual         ~POTMatrixAdapter();
+  virtual double  Value(int ix, int iy);
 
 protected:
@@ -70,18 +46,3 @@
 typedef POTMatrixAdapter<r_8> POMatrixAdapter;
 
-double POTMatrixAdapter< complex<float> >::Value(int ix, int iy)
-{
-double re,im;
-re = (*mMtx)(iy, ix).real();
-im = (*mMtx)(iy, ix).imag();
-return(sqrt(re*re+im*im));
-}
-
-double POTMatrixAdapter< complex<double> >::Value(int ix, int iy)
-{
-double re,im;
-re = (*mMtx)(iy, ix).real();
-im = (*mMtx)(iy, ix).imag();
-return(sqrt(re*re+im*im));
-}
 #endif
