OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimDms.h
Go to the documentation of this file.
1 //*******************************************************************
2 //
3 // License: See top LICENSE.txt file.
4 //
5 // Author: Garrett Potts
6 //
7 // Description:
8 //
9 // Contains class definition for Degrees Minutes Seconds (ossimDms)
10 //*******************************************************************
11 // $Id: ossimDms.h 19682 2011-05-31 14:21:20Z dburken $
12 #ifndef ossimDms_HEADER
13 #define ossimDms_HEADER
14 // #include <iostream>
15 
16 #include <ossim/base/ossimConstants.h> /* for OSSIM_DLL macro */
17 #include <ossim/base/ossimString.h>
18 
20 {
21 public:
22  // friend std::ostream& operator << (std::ostream& out, const ossimDms &dms);
23 
27  ossimDms();
28 
40  ossimDms(double someDegrees, bool latFlag = true);
41 
51  ossimDms(const std::string& value);
52 
69  ossimString toString(const ossimString& formatString=ossimString(""))const;
70 
71  double getDegrees() const { return theDegrees; }
72  bool getLatFlag() const { return theLatFlag; }
73 
85  bool setDegrees(const std::string& value);
86 
87  ossimDms& setDegrees(double degrees);
88 
89  ossimDms& setLatFlag(bool latFlag){theLatFlag = latFlag;return *this;}
90  static const ossim_uint8 theDegreeSign;
91 
92 private:
93  static const char* DEFAULT_FORMAT;
94  static const char* SPACES;
95 
96  double theDegrees;
97  bool theLatFlag;
98 
99  // This is a port of the dts written by Christine Hammond
100  // into the OSSIM dms class. We will use this to aid in
101  // formatting DMS data.
102  mutable double theDecDegs;/* decimal part of degrees */
103  mutable bool theAfterDot;/* decimal values flag */
104  mutable bool theDoingSeconds;
105  mutable int theIntDegs;/* integer part of double degrees */
106  mutable int theSign;/* what sign is degrees */
107  mutable double theWorking;/* degrees value to use during calc */
108 
130  ossimString degree_to_string(double degrees,
131  char format[],
132  bool lat_flag)const;
133 
134  void calc_mins_or_secs(double *dd,
135  std::string::const_iterator& formatIter,
136  std::string& result)const;
148  int calc_mins_or_secs(double *dd,
149  const char *format,
150  char *res)const;
151 
160  void setup_printf(int ival, char *fmt)const;
161 
171  void set_default(char *fp, char *rp)const;
172 
178  void init_values(double d)const;
179 
206  double string_to_degree(const std::string& cdegrees);
207 
208 };
209 
210 #endif
int theIntDegs
Definition: ossimDms.h:105
bool getLatFlag() const
Definition: ossimDms.h:72
bool theAfterDot
Definition: ossimDms.h:103
double theDegrees
Definition: ossimDms.h:96
static const char * DEFAULT_FORMAT
Definition: ossimDms.h:93
double theWorking
Definition: ossimDms.h:107
double getDegrees() const
Definition: ossimDms.h:71
static const char * SPACES
Definition: ossimDms.h:94
bool theLatFlag
Definition: ossimDms.h:97
double theDecDegs
Definition: ossimDms.h:102
ossimDms & setLatFlag(bool latFlag)
Definition: ossimDms.h:89
#define OSSIM_DLL
static const ossim_uint8 theDegreeSign
Definition: ossimDms.h:90
int theSign
Definition: ossimDms.h:106
unsigned char ossim_uint8
bool theDoingSeconds
Definition: ossimDms.h:104