| 1 | // This may look like C code, but it is really -*- C++ -*- | 
|---|
| 2 | #ifndef SPHEREPOS_H_SEEN | 
|---|
| 3 | #define SPHEREPOS_H_SEEN | 
|---|
| 4 |  | 
|---|
| 5 | #include "machdefs.h" | 
|---|
| 6 | #include "ppersist.h" | 
|---|
| 7 | #include <string> | 
|---|
| 8 | #include "unitvector.h" | 
|---|
| 9 | #include "anydataobj.h" | 
|---|
| 10 |  | 
|---|
| 11 | static char *head_spherepos_h_ = "$Header: /Users/garnier/temp/CVSSophya/SophyaLib/SkyMap/spherepos.h,v 1.1.1.1 2000-03-02 17:05:39 ansari Exp $"; | 
|---|
| 12 |  | 
|---|
| 13 | namespace SOPHYA { | 
|---|
| 14 |  | 
|---|
| 15 | enum SphereCoordSysIds { SphereCoordSys_NEUTRAL =0, | 
|---|
| 16 | SphereCoordSys_ROTATION =1, | 
|---|
| 17 | SphereCoordSys_OTHER = 0xFFFF | 
|---|
| 18 | }; | 
|---|
| 19 |  | 
|---|
| 20 |  | 
|---|
| 21 | class SphereCoordSys : public  AnyDataObj { | 
|---|
| 22 | public: | 
|---|
| 23 |  | 
|---|
| 24 | SphereCoordSys(); | 
|---|
| 25 | SphereCoordSys(const SphereCoordSys& a); | 
|---|
| 26 | SphereCoordSys(int id, const string& description); | 
|---|
| 27 | virtual        ~SphereCoordSys(); | 
|---|
| 28 |  | 
|---|
| 29 | virtual int    Id() const {return id_; } | 
|---|
| 30 | virtual string description() const {return description_; } | 
|---|
| 31 | SphereCoordSys& operator = (const SphereCoordSys& a); | 
|---|
| 32 |  | 
|---|
| 33 |  | 
|---|
| 34 | private: | 
|---|
| 35 | int id_; | 
|---|
| 36 | string description_; | 
|---|
| 37 | }; | 
|---|
| 38 |  | 
|---|
| 39 | // Classe pour la gestion de persistance | 
|---|
| 40 |  | 
|---|
| 41 | class FIO_SphereCoordSys : public  PPersist  { | 
|---|
| 42 | public: | 
|---|
| 43 | FIO_SphereCoordSys(); | 
|---|
| 44 | FIO_SphereCoordSys(string const & filename); | 
|---|
| 45 | FIO_SphereCoordSys(const SphereCoordSys & obj); | 
|---|
| 46 | FIO_SphereCoordSys(SphereCoordSys * obj); | 
|---|
| 47 | virtual ~FIO_SphereCoordSys(); | 
|---|
| 48 | virtual AnyDataObj* DataObj(); | 
|---|
| 49 | virtual   void        SetDataObj(AnyDataObj & o); | 
|---|
| 50 | inline operator SphereCoordSys() { return(*dobj); } | 
|---|
| 51 | protected : | 
|---|
| 52 | virtual void       ReadSelf(PInPersist&); | 
|---|
| 53 | virtual void       WriteSelf(POutPersist&) const; | 
|---|
| 54 | SphereCoordSys * dobj; | 
|---|
| 55 | bool ownobj; | 
|---|
| 56 | }; | 
|---|
| 57 |  | 
|---|
| 58 |  | 
|---|
| 59 | class SpherePosition : public UnitVector { | 
|---|
| 60 | public: | 
|---|
| 61 |  | 
|---|
| 62 | SpherePosition(); | 
|---|
| 63 | // cs should be created by new SphereCoordSys... | 
|---|
| 64 | // It will be deleted by the destructor | 
|---|
| 65 | SpherePosition(double theta, double phi, SphereCoordSys* cs = NULL); | 
|---|
| 66 | SpherePosition(double x, double y, double z, SphereCoordSys* cs = NULL); | 
|---|
| 67 | SpherePosition(const UnitVector& v, SphereCoordSys* cs = NULL); | 
|---|
| 68 | virtual        ~SpherePosition(); | 
|---|
| 69 |  | 
|---|
| 70 | inline double  phi() const {return Phi(); } | 
|---|
| 71 | inline double  theta() const { return(Theta()); } | 
|---|
| 72 | inline SphereCoordSys *   GetCoordSys() const { return(cs_); } | 
|---|
| 73 | virtual UnitVector Transform(const SphereCoordSys& cs) const ; | 
|---|
| 74 |  | 
|---|
| 75 | virtual double     Separation(const SpherePosition& gamma) const; | 
|---|
| 76 |  | 
|---|
| 77 | protected: | 
|---|
| 78 | SphereCoordSys* cs_; | 
|---|
| 79 | }; | 
|---|
| 80 |  | 
|---|
| 81 | } // Fin du namespace | 
|---|
| 82 |  | 
|---|
| 83 | #endif | 
|---|