@@ -415,34 +415,8 @@ internal static void getMouseOverElevation(StringBuilder sb, double Lon, double
415415
416416 /* UI: conversions to and from DMS */
417417 /* FIXME: These do not belong here. And they are only used once! */
418- private static string toDMS ( double thing , char neg , char pos , int prec )
419- {
420- StringBuilder sb = SCANStringBuilderCache . Acquire ( ) ;
421418
422- if ( thing >= 0 )
423- {
424- neg = pos ;
425- }
426-
427- thing = Math . Abs ( thing ) ;
428-
429- sb . Append ( Math . Floor ( thing ) . ToString ( ) ) ;
430- sb . Append ( HOURS ) ;
431- thing = ( thing - Math . Floor ( thing ) ) * 60 ;
432-
433- sb . Append ( Math . Floor ( thing ) . ToString ( ) ) ;
434- sb . Append ( MINUTES ) ;
435- thing = ( thing - Math . Floor ( thing ) ) * 60 ;
436-
437- sb . Append ( thing . ToString ( string . Format ( "F{0}" , prec . ToString ( ) ) ) ) ;
438- sb . Append ( SECONDS ) ;
439-
440- sb . Append ( neg ) ;
441-
442- return sb . SCANToStringAndRelease ( ) ;
443- }
444-
445- private static void toDMS ( StringBuilder sb , double thing , char neg , char pos )
419+ private static void toDMS ( StringBuilder sb , double thing , char neg , char pos , string precFormat = "F2" )
446420 {
447421 if ( thing >= 0 )
448422 {
@@ -459,17 +433,12 @@ private static void toDMS(StringBuilder sb, double thing, char neg, char pos)
459433 sb . Append ( MINUTES ) ;
460434 thing = ( thing - Math . Floor ( thing ) ) * 60 ;
461435
462- sb . Append ( thing . ToString ( "F2" ) ) ;
436+ sb . Append ( thing . ToString ( precFormat ) ) ;
463437 sb . Append ( SECONDS ) ;
464438
465439 sb . Append ( neg ) ;
466440 }
467441
468- internal static string toDMS ( double lat , double lon , int precision = 2 )
469- {
470- return string . Format ( "{0} {1}" , toDMS ( lat , SOUTH , NORTH , precision ) , toDMS ( lon , WEST , EAST , precision ) ) ;
471- }
472-
473442 internal static void toDMS ( StringBuilder sb , double lat , double lon )
474443 {
475444 toDMS ( sb , lat , SOUTH , NORTH ) ;
0 commit comments