[764] | 1 | // This may look like C code, but it is really -*- C++ -*-
|
---|
| 2 | #ifndef LOCALMAP_SEEN
|
---|
| 3 | #define LOCALMAP_SEEN
|
---|
| 4 |
|
---|
| 5 | #include "pixelmap.h"
|
---|
| 6 | #include "sphericalmap.h"
|
---|
| 7 | #include "ndatablock.h"
|
---|
| 8 |
|
---|
| 9 | #include "anydataobj.h"
|
---|
| 10 | #include "ppersist.h"
|
---|
| 11 |
|
---|
| 12 |
|
---|
| 13 |
|
---|
| 14 | // ***************** Class LocalMap *****************************
|
---|
| 15 |
|
---|
[841] | 16 |
|
---|
| 17 |
|
---|
| 18 | namespace SOPHYA {
|
---|
| 19 |
|
---|
| 20 |
|
---|
[1217] | 21 | /* Class LocalMap */
|
---|
| 22 |
|
---|
| 23 |
|
---|
[764] | 24 | template<class T>
|
---|
| 25 | class LocalMap : public PixelMap<T>
|
---|
| 26 | {
|
---|
| 27 |
|
---|
| 28 | public:
|
---|
| 29 |
|
---|
| 30 | LocalMap();
|
---|
| 31 | LocalMap(int_4 nx, int_4 ny);
|
---|
[917] | 32 | LocalMap(const LocalMap<T>& lm, bool share);
|
---|
[908] | 33 | LocalMap(const LocalMap<T>& lm);
|
---|
[764] | 34 | virtual ~LocalMap();
|
---|
| 35 |
|
---|
[908] | 36 | inline virtual bool IsTemp(void) const { return pixels_.IsTemp();}
|
---|
[1217] | 37 |
|
---|
[764] | 38 | /*! Setting blockdata to temporary (see ndatablock documentation) */
|
---|
| 39 | inline virtual void SetTemp(bool temp=false) const {pixels_.SetTemp(temp);};
|
---|
| 40 |
|
---|
| 41 |
|
---|
| 42 | // ---------- Overloading of () to access pixel number k ----
|
---|
| 43 |
|
---|
| 44 | inline T& operator()(int_4 k) {return(PixVal(k));}
|
---|
| 45 | inline T const& operator()(int_4 k) const {return(PixVal(k));}
|
---|
| 46 | inline T& operator()(int_4 ix, int_4 iy) {return PixVal(iy*nSzX_+ix);};
|
---|
| 47 | inline T const& operator()(int_4 ix, int_4 iy) const {return PixVal(iy*nSzX_+ix);};
|
---|
| 48 |
|
---|
| 49 | // ---------- Definition of PixelMap abstract methods -------
|
---|
| 50 |
|
---|
| 51 | virtual int_4 NbPixels() const; // D.Y. int change en int_4 rationalisation Mac
|
---|
| 52 |
|
---|
| 53 | virtual T& PixVal(int_4 k);
|
---|
| 54 | virtual T const& PixVal(int_4 k) const;
|
---|
| 55 |
|
---|
| 56 | virtual bool ContainsSph(double theta, double phi) const;
|
---|
| 57 | virtual int_4 PixIndexSph(double theta,double phi) const;
|
---|
| 58 |
|
---|
| 59 | virtual void PixThetaPhi(int_4 k,double& theta,double& phi) const;
|
---|
| 60 |
|
---|
| 61 | virtual T SetPixels(T v);
|
---|
| 62 |
|
---|
| 63 | virtual double PixSolAngle(int_4 k) const;
|
---|
| 64 |
|
---|
| 65 | // ---------- Specific methods ------------------------------
|
---|
| 66 |
|
---|
| 67 | void ReSize(int_4 nx, int_4 ny);
|
---|
| 68 |
|
---|
| 69 | inline virtual char* TypeOfMap() const {return "LOCAL";};
|
---|
| 70 |
|
---|
| 71 | virtual void SetOrigin(double theta=90.,double phi=0.,double angle=0.);
|
---|
| 72 | virtual void SetOrigin(double theta,double phi,int_4 x0,int_4 y0,double angle=0.);
|
---|
| 73 |
|
---|
| 74 | virtual void SetSize(double angleX,double angleY);
|
---|
| 75 |
|
---|
[1217] | 76 | /*! Check to see if the local mapping is done */
|
---|
[764] | 77 | inline bool LocalMap_isDone() const {return(originFlag_ && extensFlag_);};
|
---|
| 78 |
|
---|
| 79 | virtual void Project(SphericalMap<T>& sphere) const;
|
---|
| 80 |
|
---|
| 81 | /* There should be a more complex algorithm somewhere to combine *several* local maps to a full sphere.
|
---|
| 82 | -> static method, or separate class */
|
---|
| 83 |
|
---|
[1217] | 84 | /*! provides a integer characterizing the pixelization refinement (here : number of pixels) */
|
---|
[764] | 85 | inline virtual int_4 SizeIndex() const {return(nPix_);}
|
---|
| 86 | inline int_4 Size_x() const {return nSzX_;}
|
---|
| 87 | inline int_4 Size_y() const {return nSzY_;}
|
---|
| 88 |
|
---|
[1163] | 89 | /* Je rajoute ces 2 fonctions inlines pour compatibilite d'interface
|
---|
| 90 | avec TArray - Reza 30/8/2000 */
|
---|
| 91 | inline int_4 SizeX() const {return nSzX_;}
|
---|
| 92 | inline int_4 SizeY() const {return nSzY_;}
|
---|
| 93 |
|
---|
[764] | 94 | inline void Origin(double& theta,double& phi,int_4& x0,int_4& y0,double& angle) const {theta= theta0_; phi= phi0_; x0= x0_; y0= y0_;angle= angle_;}
|
---|
| 95 |
|
---|
| 96 | inline void Aperture(double& anglex,double& angley) const {anglex= angleX_; angley= angleY_;}
|
---|
| 97 |
|
---|
| 98 |
|
---|
| 99 | /* Acces to the DataBlock */
|
---|
| 100 | inline NDataBlock<T>& DataBlock() {return pixels_;}
|
---|
| 101 | inline const NDataBlock<T>& DataBlock() const {return pixels_;}
|
---|
| 102 |
|
---|
| 103 | /* impression */
|
---|
| 104 | void print(ostream& os) const;
|
---|
| 105 |
|
---|
[908] | 106 | inline LocalMap<T>& operator = (const LocalMap<T>& a) {return Set(a);}
|
---|
| 107 |
|
---|
| 108 |
|
---|
| 109 |
|
---|
[764] | 110 | // ---------- Méthodes internes -----------------------------
|
---|
| 111 |
|
---|
| 112 | private :
|
---|
| 113 |
|
---|
| 114 | void InitNul();
|
---|
| 115 | void Getij(int_4 k,int_4& i,int_4& j) const;
|
---|
| 116 | void ReferenceToUser(double& theta,double& phi) const;
|
---|
| 117 | void UserToReference(double& theta,double& phi) const;
|
---|
| 118 | void PixProjToAngle(double x,double y,double& theta,double& phi) const;
|
---|
| 119 | void AngleProjToPix(double theta,double phi,double& x,double& y) const;
|
---|
| 120 |
|
---|
[908] | 121 | void recopierVariablesSimples(const LocalMap<T>& lm);
|
---|
| 122 | LocalMap<T>& Set(const LocalMap<T>& a);
|
---|
[979] | 123 | void CloneOrShare(const LocalMap<T>& a);
|
---|
| 124 | LocalMap<T>& CopyElt(const LocalMap<T>& a);
|
---|
[908] | 125 |
|
---|
| 126 |
|
---|
[764] | 127 | // ---------- Variables internes ----------------------------
|
---|
| 128 |
|
---|
| 129 | int_4 nSzX_;
|
---|
| 130 | int_4 nSzY_;
|
---|
| 131 | int_4 nPix_;
|
---|
| 132 | bool originFlag_;
|
---|
| 133 | bool extensFlag_;
|
---|
| 134 | int_4 x0_;
|
---|
| 135 | int_4 y0_;
|
---|
| 136 | double theta0_;
|
---|
| 137 | double phi0_;
|
---|
| 138 | double angle_;
|
---|
| 139 | double cos_angle_;
|
---|
| 140 | double sin_angle_;
|
---|
| 141 | double angleX_;
|
---|
| 142 | double angleY_;
|
---|
| 143 | double tgAngleX_;
|
---|
| 144 | double tgAngleY_;
|
---|
| 145 | NDataBlock<T> pixels_;
|
---|
| 146 | };
|
---|
| 147 |
|
---|
| 148 |
|
---|
| 149 |
|
---|
[841] | 150 | } // Fin du namespace
|
---|
[764] | 151 |
|
---|
| 152 | #endif
|
---|