32 theDoingSeconds(
true),
40 : theDegrees(someDegrees),
44 theDoingSeconds(
true),
56 theDoingSeconds(
true),
85 double degrees, factor, dividend, units;
88 char* cptr =
const_cast<char*
>(copy.
c_str());
174 if (afterdelim ==
true)
178 units = units + (((double)i * factor) / dividend);
182 units = (units * factor) + ((
double)i / dividend);
189 degrees = degrees + ((double)i * factor);
193 degrees = (degrees * factor) + (
double)i;
198 factor = factor * .10;
226 while (*(cptr + 1) ==
' ')
231 degrees = degrees + units;
234 if (afterdelim ==
true)
236 dividend = dividend * dividend;
287 degrees = degrees + units;
297 std::string::const_iterator stringIter;
304 stringIter = tempFormatString.
begin();
311 while(stringIter != tempFormatString.
end())
335 if(*stringIter ==
'c')
337 temp = tolower(temp);
349 while (*stringIter ==
'd' || *stringIter ==
'D')
360 fractionalDegrees = fractionalDegrees * 10.0;
362 fractionalDegrees = fractionalDegrees - (int)fractionalDegrees;
372 d_s -= (int)temp.
length();
378 temp = prefix + temp;
412 result += *stringIter;
414 while (*stringIter ==
' ')
416 result += *stringIter;
425 result += *stringIter++;
434 if((*stringIter ==
's') ||
435 (*stringIter ==
'S'))
450 result += *stringIter++;
465 result += *stringIter++;
481 char *rptr, *fptr, *sptr;
486 if (format[0] ==
'\0')
492 memset(cdegrees,
' ', 64);
504 while (*fptr !=
'\0') {
509 (
theWorking < 0.0) ? (*rptr =
'-') : (*rptr =
' ');
517 (lat_flag ==
true) ? (*rptr =
'S') : (*rptr =
'W');
519 (lat_flag ==
true) ? (*rptr =
'N') : (*rptr =
'E');
528 while (*fptr ==
'd') {
578 fptr += i, rptr += i;
616 std::string::const_iterator& formatIter,
617 std::string& result)
const 620 int ufactor, ires, numunits;
625 ufactor = 1, numunits = 0;
629 while (*formatIter == unit)
632 formatIter++, ufactor *= 10;
639 du = *dd * (double)ufactor;
643 if(*dd < 0.0) *dd = 0.0;
647 du = (*dd * 60.0) * (double)ufactor;
649 ires = (int)(du) / ufactor;
650 *dd = (du - (ires * ufactor)) / (double)ufactor;
651 if(*dd < 0.0) *dd = 0.0;
655 out << std::setw(numunits)
657 << std::setiosflags(std::ios::right)
658 << std::setprecision(numunits)
661 result+=out.str().c_str();
684 int ufactor, ires, numunits;
685 char unit, str_fmt[8];
689 ufactor = 1, numunits = 0;
693 while (*format == unit) {
695 format++, ufactor *= 10;
701 du = *dd * (double)ufactor;
703 ires = (int)(du + 0.5);
707 du = (*dd * 60.0) * (double)ufactor;
709 ires = (int)(du) / ufactor;
710 *dd = (du - (ires * ufactor)) / (double)ufactor;
713 sprintf(res, str_fmt, ires);
732 sprintf(precis,
"%d", ival);
809 if (cdegrees.size() == 0)
return 0.0;
812 char* copy =
new char[cdegrees.size()+1];
820 strcpy(cptr, cdegrees.c_str());
822 double degrees, factor, dividend, units;
852 if(toupper(*cptr) ==
'N')
856 else if(toupper(*cptr) ==
'E')
873 if(toupper(*cptr) ==
'S')
877 else if(toupper(*cptr) ==
'W')
900 if (afterdelim ==
true) {
903 units = units + (((double)i * factor) / dividend);
905 units = (units * factor) + ((
double)i / dividend);
910 degrees = degrees + ((double)i * factor);
912 degrees = (degrees * factor) + (
double)i;
916 factor = factor * .10;
940 while (*(cptr + 1) ==
' ')
943 degrees = degrees + units;
946 if (afterdelim ==
true)
947 dividend = dividend * dividend;
969 if (isspace(*cptr) || ispunct(*cptr))
979 degrees = degrees + units;
988 return(degrees * (
double)
theSign);
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
static ossimString toString(bool aValue)
Numeric to string methods.
void calc_mins_or_secs(double *dd, std::string::const_iterator &formatIter, std::string &result) const
ossimDms()
Default constructor.
void set_default(char *fp, char *rp) const
function set_default * assigns a default format to be used as the template for the conversion of th...
std::string::iterator end()
void init_values(double d) const
function init_values initializes the global values used throughout the function.
static const char * DEFAULT_FORMAT
std::string::size_type length() const
std::string::iterator begin()
bool setDegrees(const std::string &value)
setDegrees(char*).
static const char * SPACES
ossimString degree_to_string(double degrees, char format[], bool lat_flag) const
char * function degree_to_string
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string's contents...
static const ossim_uint8 theDegreeSign
double string_to_degree(const std::string &cdegrees)
double function string_to_degree
void setup_printf(int ival, char *fmt) const
function setup_printf the C library function sprintf takes as its second argument, a format specifier.
unsigned char ossim_uint8
ossimString toString(const ossimString &formatString=ossimString("")) const
You can specify a number of different formats.