00001 using System;
00002 using System.Collections.Generic;
00003 using System.Linq;
00004 using System.Text;
00005
00006 namespace UtmConvert {
00007 static class ConvertDegRad {
00008
00009 static string _status = "ok";
00010 public static string Status {
00011 get { return ConvertDegRad._status; }
00012 }
00013
00014
00015 public static double getRadians(string degrees
00016 , string minutes, string seconds, bool plsMns) {
00017 try {
00018 if (plsMns)
00019 return -(Math.PI / 180) * (double.Parse(degrees)
00020 + double.Parse(minutes) / 60 + double.Parse(seconds) / 3600);
00021 return (Math.PI / 180) * (double.Parse(degrees)
00022 + double.Parse(minutes) / 60 + double.Parse(seconds) / 3600);
00023 } catch {
00024 _status = "invalid input";
00025 return -1;
00026 }
00027 }
00028
00029 public static double getRadians(string degrees
00030 , string minutes, bool plsMns) {
00031 try {
00032 if(plsMns)
00033 return -(Math.PI / 180) * (double.Parse(degrees)
00034 + double.Parse(minutes) / 60);
00035 return (Math.PI / 180)*(double.Parse(degrees)
00036 + double.Parse(minutes) / 60);
00037 } catch {
00038 _status = "invalid input";
00039 return -1;
00040 }
00041 }
00042
00043 public static double getRadians(string degrees, bool plsMns) {
00044 try {
00045 if(plsMns)
00046 return -(Math.PI / 180) * (double.Parse(degrees));
00047 return (Math.PI / 180)*(double.Parse(degrees));
00048 } catch {
00049 _status = "invalid input";
00050 return -1;
00051 }
00052 }
00053
00054 public static double getDegrees(double rad) {
00055 return rad / (Math.PI / 180);
00056 }
00057
00058 }
00059 }