core/vcsl/vcsl_spheroid.h
Go to the documentation of this file.
00001 #ifndef vcsl_spheroid_h_
00002 #define vcsl_spheroid_h_
00003 //:
00004 // \file
00005 // \brief Reference sphere or ellipse for a geographic coordinate system
00006 // \author François BERTEL
00007 //
00008 // \verbatim
00009 //  Modifications
00010 //   2000/06/28 François BERTEL Creation. Adapted from IUE
00011 //   2001/04/10 Ian Scott (Manchester) Converted perceps header to doxygen
00012 //   2004/09/17 Peter Vanroose  made a(), b(), e() and f() non-virtual - they just return a member and should not be overloaded
00013 // \endverbatim
00014 
00015 #include <vbl/vbl_ref_count.h>
00016 #include <vcsl/vcsl_spheroid_sptr.h>
00017 
00018 //: Reference sphere or ellipse for a geographic coordinate system
00019 // The default value for a reference ellipsoid is the Clarke 1866 model, but
00020 // this class contains a constructor that allows reference spheroids to be
00021 // constructed with values for several different standard models. See the book
00022 // "Map Projections Used by the U.S. Geological Survey" (Snyder, John P.,
00023 // "Map Projections Used by the U.S. Geological Survey," Geological Survey
00024 // Bulletin 1532, U.S. Government Printing Office, Washington, 1982.) for
00025 // further detail on most of these coordinate systems.
00026 class vcsl_spheroid
00027   : public vbl_ref_count
00028 {
00029  public:
00030   enum vcsl_std_spheroid
00031   {
00032     airy_1830,
00033     australian_national,
00034     bessel_1841,
00035     clarke_1866,
00036     clarke_1880,
00037     everest_1830,
00038     grs_1980,
00039     international,
00040     modified_airy,
00041     modified_everest,
00042     south_american_1969,
00043     wgs_1972,
00044     wgs_1984
00045   };
00046 
00047   //***************************************************************************
00048   // Constructors/Destructor
00049   //***************************************************************************
00050 
00051   //: Default constructor. Clark_1866 spheroid
00052   vcsl_spheroid() { set_from_std(clarke_1866); }
00053 
00054   //: Constructor from a standard spheroid
00055   explicit vcsl_spheroid(const vcsl_std_spheroid s) { set_from_std(s); }
00056 
00057   // Copy constructor
00058   vcsl_spheroid(const vcsl_spheroid &other)
00059     : vbl_ref_count(), a_(other.a_), b_(other.b_), e_(other.e_), f_(other.f_) {}
00060 
00061   // Destructor
00062   ~vcsl_spheroid() {}
00063 
00064   //***************************************************************************
00065   // Status report
00066   //***************************************************************************
00067 
00068   //: Return the major axis of spheroid
00069   double a() const { return a_; }
00070 
00071   //: Return the minor axis of spheroid
00072   double b() const { return b_; }
00073 
00074   //: Return the eccentricity of spheroid
00075   double e() const { return e_; }
00076 
00077   //: Return the flattening of spheroid
00078   double f() const { return f_; }
00079 
00080   //***************************************************************************
00081   // Status setting
00082   //***************************************************************************
00083 
00084   //: Set from a standard spheroid
00085   void set_from_std(const vcsl_std_spheroid new_std_spheroid);
00086 
00087   //: Set the major axis of spheroid
00088   void set_a(double new_a) { a_=new_a; }
00089 
00090   //: Set the minor axis of spheroid
00091   void set_b(double new_b) { b_=new_b; }
00092 
00093   //: Set the eccentricity of spheroid
00094   void set_e(double new_e) { e_=new_e; }
00095 
00096   //: Set the flattening of spheroid
00097   void set_f(double new_f) { f_=new_f; }
00098 
00099   //***************************************************************************
00100   // Comparison
00101   //***************************************************************************
00102 
00103   //: Is `this' equal to `other' ?
00104   bool operator==(const vcsl_spheroid &other) const;
00105 
00106   //***************************************************************************
00107   // Duplication
00108   //***************************************************************************
00109 
00110   // Assignment
00111   vcsl_spheroid &operator=(const vcsl_spheroid &other);
00112 
00113  protected:
00114   //***************************************************************************
00115   // Implementation
00116   //***************************************************************************
00117 
00118   //: Major axis of spheroid
00119   double a_;
00120   //: Minor axis of spheroid
00121   double b_;
00122   //: Eccentricity of spheroid
00123   double e_;
00124   //: Flattening of spheroid
00125   double f_;
00126 };
00127 
00128 #endif // vcsl_spheroid_h_