本文整理汇总了C#中Azimuth.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Azimuth.ToString方法的具体用法?C# Azimuth.ToString怎么用?C# Azimuth.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Azimuth
的用法示例。
在下文中一共展示了Azimuth.ToString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GprmcSentence
/// <summary>
/// Creates a GprmcSentence from the specified parameters
/// </summary>
/// <param name="utcDateTime"></param>
/// <param name="isFixAcquired"></param>
/// <param name="position"></param>
/// <param name="speed"></param>
/// <param name="bearing"></param>
/// <param name="magneticVariation"></param>
public GprmcSentence(DateTime utcDateTime, bool isFixAcquired, Position position, Speed speed, Azimuth bearing, Longitude magneticVariation)
{
// Use a string builder to create the sentence text
StringBuilder builder = new StringBuilder(128);
/* GPRMC sentences have the following format:
*
* $GPRMC,040302.663,A,3939.7,N,10506.6,W,0.27,358.86,200804,,*1A
*/
// Append the command word, $GPRMC
builder.Append("$GPRMC");
// Append a comma
builder.Append(',');
#region Append the UTC time
builder.Append(utcDateTime.Hour.ToString("0#", NmeaCultureInfo));
builder.Append(utcDateTime.Minute.ToString("0#", NmeaCultureInfo));
builder.Append(utcDateTime.Second.ToString("0#", NmeaCultureInfo));
builder.Append(".");
builder.Append(utcDateTime.Millisecond.ToString("00#", NmeaCultureInfo));
#endregion
// Append a comma
builder.Append(',');
#region Append the fix status
// Write fix information
if (isFixAcquired)
builder.Append("A");
else
builder.Append("V");
#endregion
// Append a comma
builder.Append(',');
#region Append the position
// Append latitude in the format HHMM.MMMM.
builder.Append(position.Latitude.ToString("HHMM.MMMM,I,", NmeaCultureInfo));
// Append Longitude in the format HHHMM.MMMM.
builder.Append(position.Longitude.ToString("HHHMM.MMMM,I,", NmeaCultureInfo));
#endregion
// Append the speed (in knots)
builder.Append(speed.ToKnots().ToString("v.v", NmeaCultureInfo));
// Append a comma
builder.Append(',');
// Append the bearing
builder.Append(bearing.ToString("d.d", NmeaCultureInfo));
// Append a comma
builder.Append(',');
#region Append the UTC date
// Append UTC date
builder.Append(utcDateTime.Day.ToString("0#", NmeaCultureInfo));
builder.Append(utcDateTime.Month.ToString("0#", NmeaCultureInfo));
// Append the year (year minus 2000)
int year = utcDateTime.Year - 2000;
builder.Append(year.ToString("0#", NmeaCultureInfo));
#endregion
// Append a comma
builder.Append(',');
// Append magnetic variation
builder.Append(magneticVariation.ToString("d.d", NmeaCultureInfo));
// Set this object's sentence
SetSentence(builder.ToString());
// Finally, append the checksum
AppendChecksum();
}