/// <summary>
 ///
 /// </summary>
 /// <param name="init_value">Initial value</param>
 /// <param name="format"></param>
 public DelayedFieldFloat(
     float init_value,
     string format,
     CoordFormat coord_fmt = CoordFormat.Decimal)
 {
     val          = init_value;
     time         = 0.0f;
     changed      = false;
     input_str    = val.ToString(format);
     format_str   = format;
     coord_format = coord_fmt;
 }
Exemplo n.º 2
0
            /// <summary>Parse coordinates</summary>
            public Point(CoordFormat format, string coords)
            {
                string[] parts = (coords ?? string.Empty).Split(new[] { ',', ' ', ';' }, StringSplitOptions.RemoveEmptyEntries);
                if (parts.Length != 2)
                {
                    throw new ArgumentException("Coordinates are wrong");
                }
                string strLatitude  = string.Empty;
                string strLongitude = string.Empty;

                switch (format)
                {
                case CoordFormat.latlong:
                    strLatitude  = parts[0];
                    strLongitude = parts[1];
                    break;

                case CoordFormat.longlat:
                    strLongitude = parts[0];
                    strLatitude  = parts[1];
                    break;

                default:
                    throw new ArgumentException("format is wrong");
                }
                if (!decimal.TryParse(strLatitude, NumberStyles.Float, CultureInfo.InvariantCulture, out latitude))
                {
                    throw new ArgumentException("Latitude is wrong");
                }
                latitude = Math.Round(latitude, 7);
                if (!decimal.TryParse(strLongitude, NumberStyles.Float, CultureInfo.InvariantCulture, out longitude))
                {
                    throw new ArgumentException("Longitude is wrong");
                }
                longitude = Math.Round(longitude, 7);
            }
Exemplo n.º 3
0
        private void FillStaticRow( GridViewRowEventArgs e , CoordFormat coordFormat )
        {
            DataRowView drv = e.Row.DataItem as DataRowView;
              Label latLabel = ( Label ) e.Row.FindControl( "latLabel" );
              Label lonLabel = ( Label ) e.Row.FindControl( "lonLabel" );

              if ( drv == null ||
               latLabel == null ||
               lonLabel == null ) return;

              double lat = Convert.ToDouble( drv[ "Lat" ] );
              double lon = Convert.ToDouble( drv[ "Lon" ] );

              if ( coordFormat == CoordFormat.DegMin )
              {
            latLabel.Text = CoordToDegMin( lat , 'S' , 'N' );
            lonLabel.Text = CoordToDegMin( lon , 'W' , 'E' );
              }
              else if ( coordFormat == CoordFormat.DegMinSec )
              {
            latLabel.Text = CoordToDegMinSec( lat , 'S' , 'N' );
            lonLabel.Text = CoordToDegMinSec( lon , 'W' , 'E' );
              }
              else
              {
            latLabel.Text = lat.ToString( "F5" );
            lonLabel.Text = lon.ToString( "F5" );
              }
        }
Exemplo n.º 4
0
 private void FillEditRow( GridViewRowEventArgs e , CoordFormat coordFormat )
 {
     SetCoordsControlValue( e , "latEditMultiView" , "Lat" );
       SetCoordsControlValue( e , "lonEditMultiView" , "Lon" );
 }