Exemplo n.º 1
0
 public void Parse(string value, PositionFormat format)
 {
   string val;
   string val1;
   string val2;
   string val3;
   int var1;
   int var2;
   try
   {
     switch (format)
     {
       case PositionFormat.FloatDeg:
         Parse(double.Parse(value));
         break;
       case PositionFormat.FloatMin:
         Parse(float.Parse(value) / 60);
         break;
       case PositionFormat.FloatDegS:
         val = value.Substring(0, value.Length - 2);
         val1 = value.Substring(value.Length - 1, 1);
         setValue(double.Parse(val), val1);
         break;
       case PositionFormat.Decoded:
         var1 = 0;
         var2 = value.IndexOf('°');
         val = value.Substring(0, var2 - var1);
         var1 = var2;
         var2 = value.IndexOf('\'');
         val1 = value.Substring(var1 + 1, var2 - var1-1);
         var1 = var2;
         var2 = value.IndexOf('\"');
         val2 = value.Substring(var1 + 1, var2 - var1 - 1);
         val3 = value.Substring(value.Length - 1, 1);
         setValue(int.Parse(val), int.Parse(val1), double.Parse(val2), val3);
         break;
     }
   }
   catch (Exception)
   {
   }
 }
Exemplo n.º 2
0
 public string ToString(PositionFormat format)
 {
     string reslt;
       switch (format)
       {
     case PositionFormat.DegDecMin:
       reslt = Degrees.ToString("000");
       reslt += ((Minutes + Seconds / 60) * 1000).ToString("00000");
       break;
     case PositionFormat.DegDecMinInmC:
       reslt = string.Format("{0} {1}' {2}", Degrees.ToString(), ((Minutes + Seconds / 60)).ToString("#.##"), Hemisfere);
       break;
     default:
       reslt = ToShortString();
       break;
       }
       return reslt;
 }
Exemplo n.º 3
0
 public static string getFormatString(PositionFormat frmt)
 {
   PositionFormatString FormatStringClass1 = new PositionFormatString();
   return FormatStringClass1.strFormat[frmt];
 }
Exemplo n.º 4
0
 public string ToString(PositionFormat format)
 {
     return(format == PositionFormat.LatLong ? $"{Lat:0.0} , {Lon:0.0}" : $"{X:0.00} , {Y:0.00} , {Z:0.00}");
 }