Index: trunk/SophyaLib/SkyMap/fiolocalmap.cc
===================================================================
--- trunk/SophyaLib/SkyMap/fiolocalmap.cc	(revision 2195)
+++ trunk/SophyaLib/SkyMap/fiolocalmap.cc	(revision 2198)
@@ -120,10 +120,10 @@
   //  dobj->setNbPixels(nPix);
   dobj->ReSize(nSzX, nSzY); 
-  //  string ss("local mapping is done");
-  // string sso;
-  // is.GetStr(sso);
-  // if(sso == ss)
-  //  {
-  //   cout<<" ReadSelf:: local mapping"<<endl;
+  string ss("local mapping is done");
+  string sso;
+  is.GetStr(sso);
+  if(sso == ss)
+    {
+      //   cout<<" ReadSelf:: local mapping"<<endl;
 
       double angleX, angleY;
@@ -142,6 +142,6 @@
       dobj->SetOrigin(theta, phi, x0, y0, angle);
 
-      //  }
-
+    }
+  
 // On lit le DataBlock;
       //  FIO_NDataBlock<T> fio_nd(&dobj->DataBlock());
@@ -184,8 +184,8 @@
   //  os.PutI4(nPix);
 
-  // if(dobj->LocalMap_isDone())
-  // {
-  //   string ss("local mapping is done");
-  //    os.PutStr(ss);
+  if(dobj->LocalMap_isDone())
+    {
+      string ss("local mapping is done");
+      os.PutStr(ss);
 
       double angleX, angleY;
@@ -204,10 +204,10 @@
       os.PutR8(angle);
 
-      // }
-// else
-//  {
-//   string ss("no local mapping");
-//   os.PutStr(ss);
-//  }
+    }
+  else
+    {
+      string ss("no local mapping");
+      os.PutStr(ss);
+    }
 
 // On ecrit le dataBlock 
Index: trunk/SophyaLib/SkyMap/localmap.cc
===================================================================
--- trunk/SophyaLib/SkyMap/localmap.cc	(revision 2195)
+++ trunk/SophyaLib/SkyMap/localmap.cc	(revision 2198)
@@ -65,4 +65,24 @@
 }
 
+//! partial constructor of the local map
+/*!
+  \param nx : number of pixels in x direction
+  \param ny : number of pixels in y direction
+
+must be followed by calling the methodsa setSize() and setOrigin() in order the object become usable
+
+ */
+
+template<class T>
+LocalMap<T>::LocalMap(int_4 nx, int_4 ny)  
+{
+  InitNul();
+  ReSize(nx, ny);
+  //  nSzX_ = nx;
+  //  nSzY_ = ny;
+  //  nPix_= nx*ny;
+  //  pixels_.ReSize(ny,nx);
+}
+
 //! full constructor of the local map
 /*!
@@ -82,8 +102,9 @@
 {
   InitNul();
-  nSzX_ = nx;
-  nSzY_ = ny;
-  nPix_= nx*ny;
-  pixels_.ReSize(ny,nx);
+  //  nSzX_ = nx;
+  // nSzY_ = ny;
+  // nPix_= nx*ny;
+  // pixels_.ReSize(ny,nx);
+  ReSize(nx, ny);
   SetSize(angleX, angleY);
   SetOrigin(theta0, phi0, x0, y0, angle);
@@ -107,63 +128,62 @@
 {
   InitNul();
+  //  nSzX_ = nx;
+  //  nSzY_ = ny;
+  // nPix_= nx*ny;
+  //  pixels_.ReSize(ny,nx);
+  ReSize(nx, ny);
+  SetSize(angleX, angleY);
+  SetOrigin(theta0, phi0, angle);
+}
+
+//! copy constructor 
+/*!
+  \param share : if true, share data. If false copy data
+ */
+template<class T>
+LocalMap<T>::LocalMap(const LocalMap<T>& lm, bool share)
+  : pixels_(lm.pixels_, share)
+{
+
+  if(lm.mInfo_) mInfo_= new DVList(*lm.mInfo_);
+  recopierVariablesSimples(lm);
+}
+
+//! copy constructor 
+/*!
+  \warning datas are \b SHARED with \b lm.
+  \sa TMatrix::TMatrix(const TMatrix<T>&)
+*/
+template<class T>
+LocalMap<T>::LocalMap(const LocalMap<T>& lm)
+  : pixels_(lm.pixels_)
+
+{
+
+  if(lm.mInfo_) mInfo_= new DVList(*lm.mInfo_);
+  recopierVariablesSimples(lm);
+}
+
+template<class T>
+LocalMap<T>::~LocalMap() {;}
+
+
+
+/*!  \fn void SOPHYA::LocalMap::ReSize(int_4 nx, int_4 ny) 
+
+  Resize storage area for pixels 
+*/
+template<class T>
+void LocalMap<T>::ReSize(int_4 nx, int_4 ny) 
+{
+    // angles par pixel,  en radians 
+  deltaPhi_   *=  nSzX_/nx;   
+  deltaTheta_ *=  nSzY_/ny;
+
   nSzX_ = nx;
   nSzY_ = ny;
   nPix_= nx*ny;
   pixels_.ReSize(ny,nx);
-  cout << " tableau pixels initialise " << endl;
-  SetSize(angleX, angleY);
-  cout << " fin du setsize " << endl;
-  SetOrigin(theta0, phi0, angle);
-  cout << " fin du set oorigine " << endl;
-}
-
-//! copy constructor 
-/*!
-  \param share : if true, share data. If false copy data
- */
-template<class T>
-LocalMap<T>::LocalMap(const LocalMap<T>& lm, bool share)
-  : pixels_(lm.pixels_, share)
-{
-
-  if(lm.mInfo_) mInfo_= new DVList(*lm.mInfo_);
-  recopierVariablesSimples(lm);
-}
-
-//! copy constructor 
-/*!
-  \warning datas are \b SHARED with \b lm.
-  \sa TMatrix::TMatrix(const TMatrix<T>&)
-*/
-template<class T>
-LocalMap<T>::LocalMap(const LocalMap<T>& lm)
-  : pixels_(lm.pixels_)
-
-{
-
-  if(lm.mInfo_) mInfo_= new DVList(*lm.mInfo_);
-  recopierVariablesSimples(lm);
-}
-
-template<class T>
-LocalMap<T>::~LocalMap() {;}
-
-
-
-/*!  \fn void SOPHYA::LocalMap::ReSize(int_4 nx, int_4 ny) 
-
-  Resize storage area for pixels 
-*/
-template<class T>
-void LocalMap<T>::ReSize(int_4 nx, int_4 ny) 
-{
-    // angles par pixel,  en radians 
-  deltaPhi_   *=  nSzX_/nx;   
-  deltaTheta_ *=  nSzY_/ny;
-
-  nSzX_ = nx;
-  nSzY_ = ny;
-  nPix_= nx*ny;
-  pixels_.ReSize(ny,nx);
+  pixelSized_ = true;
 }
 
@@ -285,4 +305,5 @@
   int_4 i,j;
 
+  if (! LocalMap_isDone()) initializationError();
   double csTheta = cos(theta);
   double snTheta = sin(theta);
@@ -296,5 +317,4 @@
   if ( denom == 0.) 
     {
-      throw PException("LocalMap::PixIndexSph : vector radius parallel to map plane ");
     }
   double lambda = 1./denom;
@@ -428,4 +448,5 @@
 void LocalMap<T>::PixToSphereC(int_4 ip, int_4 it, double& XP, double& YP, double& ZP) const
 {
+  if (! LocalMap_isDone()) initializationError();
   double X= double(ip-x0_)* deltaPhi_;
   double Y= double(it-y0_)*deltaTheta_; 
@@ -466,8 +487,4 @@
 void LocalMap<T>::SetOrigin(double theta0,double phi0,int_4 x0,int_4 y0,double angle)
 {
-  // if (originFlag_)
-  //   {
-  //     throw PException("LocalMap::SetOrigin : redefining origin is not allowed at the moment ");
-  //  }
 
   if ( theta0 < 0. || theta0 > 180. || phi0 < 0. || phi0 > 360. || angle < -90. || angle > 90.)
@@ -483,4 +500,10 @@
   cosAngle_= cos(angle_);
   sinAngle_= sin(angle_);
+
+   if (originSet_)
+     {
+       cout << " WARNING:  LocalMap<T>::SetOrigin() : reset origine of a local map which had already an origin " << endl;
+     }
+   originSet_ = true;
 } 
 
@@ -510,4 +533,5 @@
 {
   cout << " calcul matrice de passage " << endl;
+  if (! LocalMap_isDone()) initializationError();
   TMatrix<double> passage(3,3);
   double cos_th_axeZ;
@@ -578,4 +602,6 @@
 void LocalMap<T>::SetSize(double angleX,double angleY)
 {
+  if (!pixelSized_) initializationError();
+
   if ( angleX <= 0. || angleX > 180. || angleY <= 0. || angleY > 180.)
     {
@@ -589,5 +615,10 @@
   deltaPhi_   = angleX*Pi/(180.*nSzX_);
   deltaTheta_ = angleY*Pi/(180.*nSzY_);
-
+ 
+  if (angleSized_)
+     {
+       cout << " WARNING LocalMap::SetSize  ; angle resizing of an already sized local map " << endl;
+     }
+  angleSized_  = true;
 
 }
@@ -624,4 +655,9 @@
 //--
 { 
+
+  pixelSized_  = false;
+  angleSized_  = false;
+  originSet_ = false;
+
   nSzX_ = 0;
   nSzY_ = 0;
@@ -635,4 +671,5 @@
 
 
+
   nPix_ = 0;
 
@@ -699,4 +736,9 @@
 {
 
+  pixelSized_ = lm.pixelSized_;
+  angleSized_ = lm.angleSized_;
+  originSet_  = lm.originSet_ ;
+
+
   nSzX_ = lm.nSzX_;
   nSzY_ = lm.nSzY_;
@@ -721,4 +763,17 @@
   deltaTheta_ = lm.deltaTheta_;
 }
+
+template<class T>
+void LocalMap<T>::initializationError() const
+{
+  cout << endl;
+  if (!pixelSized_) cout << " LocalMap::initializationError() ; pixel sizing is missing " << endl;
+  if (!angleSized_ ) cout << " LocalMap::initializationError() ; angle sizing is missing " << endl;
+  if (!originSet_ ) cout << " LocalMap::initializationError() ; origin of map is not set " << endl;
+      throw PException("LocalMap::initializationError() : bad initialization of the local map ");
+
+
+}
+
 
 //   ...... Operations de calcul  ......
Index: trunk/SophyaLib/SkyMap/localmap.h
===================================================================
--- trunk/SophyaLib/SkyMap/localmap.h	(revision 2195)
+++ trunk/SophyaLib/SkyMap/localmap.h	(revision 2198)
@@ -39,4 +39,5 @@
 
 LocalMap();
+LocalMap(int_4 nx, int_4 ny);
 LocalMap(int_4 nx, int_4 ny, double angleX,double angleY, double theta0,double phi0,int_4 x0,int_4 y0,double angle=0.);
 LocalMap(int_4 nx, int_4 ny, double angleX,double angleY, double theta0,double phi0, double angle=0.);
@@ -86,9 +87,14 @@
 void ReSize(int_4 nx, int_4 ny);
 
+void SetOrigin(double theta=90.,double phi=0.,double angle=0.);
+void SetOrigin(double theta,double phi,int_4 x0,int_4 y0,double angle=0.);
+void SetSize(double angleX,double angleY);
+
+
 inline virtual char* TypeOfMap() const {return "LOCAL";};
  
 
 /*! Check to see if the local mapping is done */
-  //inline bool LocalMap_isDone() const {return(originFlag_ && extensFlag_);};
+inline bool LocalMap_isDone() const {return( originSet_ && angleSized_ && pixelSized_);};
 
 void PixThetaPhi(int_4 ip,int_4 it, double& theta,double& phi) const;
@@ -186,7 +192,4 @@
 
 void InitNul();
-void SetOrigin(double theta=90.,double phi=0.,double angle=0.);
-void SetOrigin(double theta,double phi,int_4 x0,int_4 y0,double angle=0.);
-void SetSize(double angleX,double angleY);
 void SetCoorC(double theta0, double phi0);
 TMatrix<double> CalculMatricePassage();
@@ -196,4 +199,5 @@
 void recopierVariablesSimples(const LocalMap<T>& lm);
 
+void initializationError() const;
 
 // ---------- Variables internes ----------------------------
@@ -201,4 +205,8 @@
 
   // variables suffisantes pour reconstruire l'objet
+
+  bool pixelSized_;
+  bool angleSized_;
+  bool originSet_;
 
   int_4 nSzX_;
@@ -212,4 +220,5 @@
   double angleDegres_;
 
+
   //  NDataBlock<T> pixels_;
   TMatrix<T> pixels_;
Index: trunk/SophyaLib/SkyMap/spherethetaphi.h
===================================================================
--- trunk/SophyaLib/SkyMap/spherethetaphi.h	(revision 2195)
+++ trunk/SophyaLib/SkyMap/spherethetaphi.h	(revision 2198)
@@ -258,5 +258,6 @@
  NDataBlock<int_4>  NPhi_;  // tableau donnant, pour chaque bande en theta, 
                          //le nombre de pixels selon phi
- NDataBlock<int_4> TNphi_;
+ NDataBlock<int_4> TNphi_; // tableau donnant ke nombre de pixels cumule,
+                           // jusqu'au debut de chaque tranche
  NDataBlock<r_8> Theta_;
  NDataBlock<T> pixels_;
