@@ -1382,25 +1382,41 @@ function loadGeodetic() {
13821382 var val = ge ( "StationCoordinatesGeodetic" ) . value ;
13831383 if ( val > "" ) {
13841384 var parts = recordsGeodetic [ val ] . split ( ' ' ) ;
1385- ge ( "nicknameGeodetic" ) . value = parts [ 0 ] ;
1386- ge ( "fixedLatText" ) . value = parts [ 1 ] ;
1387- ge ( "fixedLongText" ) . value = parts [ 2 ] ;
1388- ge ( "antennaHeight" ) . value = parts [ 4 ] ;
1389- ge ( "antennaReferencePoint" ) . value = parts [ 5 ] ;
1385+ var numParts = parts . length ;
1386+ if ( numParts >= 6 ) {
1387+ var latParts = ( numParts - 4 ) / 2 ;
1388+ ge ( "nicknameGeodetic" ) . value = parts [ 0 ] ;
1389+ ge ( "fixedLatText" ) . value = parts [ 1 ] ;
1390+ if ( latParts > 1 ) {
1391+ for ( let moreParts = 1 ; moreParts < latParts ; moreParts ++ ) {
1392+ ge ( "fixedLatText" ) . value += ' ' + parts [ moreParts + 1 ] ;
1393+ }
1394+ }
1395+ ge ( "fixedLongText" ) . value = parts [ 1 + latParts ] ;
1396+ if ( latParts > 1 ) {
1397+ for ( let moreParts = 1 ; moreParts < latParts ; moreParts ++ ) {
1398+ ge ( "fixedLongText" ) . value += ' ' + parts [ moreParts + 1 + latParts ] ;
1399+ }
1400+ }
1401+ ge ( "fixedAltitude" ) . value = parts [ numParts - 3 ] ;
1402+ ge ( "antennaHeight" ) . value = parts [ numParts - 2 ] ;
1403+ ge ( "antennaReferencePoint" ) . value = parts [ numParts - 1 ] ;
13901404
1391- ge ( "fixedAltitude" ) . value = parts [ 3 ] ;
1405+ $ ( "input[name=markRadio][value=1]" ) . prop ( 'checked' , false ) ;
1406+ $ ( "input[name=markRadio][value=2]" ) . prop ( 'checked' , true ) ;
13921407
1393- $ ( "input[name=markRadio][value=1]" ) . prop ( 'checked' , false ) ;
1394- $ ( "input[name=markRadio][value=2]" ) . prop ( 'checked' , true ) ;
1408+ adjustHAE ( ) ;
13951409
1396- adjustHAE ( ) ;
1397-
1398- clearError ( "nicknameGeodetic" ) ;
1399- clearError ( "fixedLatText" ) ;
1400- clearError ( "fixedLongText" ) ;
1401- clearError ( "fixedAltitude" ) ;
1402- clearError ( "antennaHeight" ) ;
1403- clearError ( "antennaReferencePoint" ) ;
1410+ clearError ( "nicknameGeodetic" ) ;
1411+ clearError ( "fixedLatText" ) ;
1412+ clearError ( "fixedLongText" ) ;
1413+ clearError ( "fixedAltitude" ) ;
1414+ clearError ( "antennaHeight" ) ;
1415+ clearError ( "antennaReferencePoint" ) ;
1416+ }
1417+ else {
1418+ console . log ( "stationGeodetic split error" ) ;
1419+ }
14041420 }
14051421}
14061422
@@ -1780,9 +1796,15 @@ function identifyInputType(userEntry) {
17801796 if ( dashCount > 3 ) return ( CoordinateTypes . COORDINATE_INPUT_TYPE_INVALID_UNKNOWN ) ; //Only 0, 1, 2, or 3 allowed. -105-11-05.1629 is valid.
17811797 if ( lengthOfLeadingNumber > 7 ) return ( CoordinateTypes . COORDINATE_INPUT_TYPE_INVALID_UNKNOWN ) ; //Only 7 or fewer. -1051105.188992 (DDDMMSS or DDMMSS) is valid
17821798
1799+ //console.log("userEntry: " + userEntry);
1800+ //console.log("decimalCount: " + decimalCount);
1801+ //console.log("spaceCount: " + spaceCount);
1802+ //console.log("dashCount: " + dashCount);
1803+ //console.log("lengthOfLeadingNumber: " + lengthOfLeadingNumber);
1804+
17831805 var negativeSign = false ;
17841806 if ( userEntry [ 0 ] == '-' ) {
1785- userEntry = setCharAt ( userEntry , 0 , '' ) ; //Remove leading space
1807+ userEntry = setCharAt ( userEntry , 0 , '' ) ; //Remove leading minus
17861808 negativeSign = true ;
17871809 dashCount -- ; //Use dashCount as the internal dashes only, not the leading negative sign
17881810 }
@@ -1804,7 +1826,7 @@ function identifyInputType(userEntry) {
18041826 seconds -= ( decimal * 10000 ) ; //Remove DDD
18051827 seconds -= ( minutes * 100 ) ; //Remove MM
18061828 convertedCoordinate = decimal + ( minutes / 60.0 ) + ( seconds / 3600.0 ) ;
1807- if ( convertedCoordinate ) convertedCoordinate *= - 1 ;
1829+ if ( negativeSign ) convertedCoordinate *= - 1 ;
18081830 }
18091831 else if ( spaceCount == 0 && dashCount == 0 && ( lengthOfLeadingNumber == 5 || lengthOfLeadingNumber == 4 ) ) //DDMM.mmmmmmm
18101832 {
@@ -1816,7 +1838,7 @@ function identifyInputType(userEntry) {
18161838 var minutes = userEntry ; //Get DDDMM.mmmmmmm
18171839 minutes -= ( decimal * 100 ) ; //Remove DDD
18181840 convertedCoordinate = decimal + ( minutes / 60.0 ) ;
1819- if ( negativeSign ) convertedCoordinate *= - 1 ;
1841+ if ( negativeSign ) convertedCoordinate *= - 1.0 ;
18201842 }
18211843
18221844 else if ( dashCount == 1 ) //DD-MM.mmmmmmm
@@ -1827,7 +1849,7 @@ function identifyInputType(userEntry) {
18271849 var decimal = Number ( data [ 0 ] ) ; //Get DD
18281850 var minutes = Number ( data [ 1 ] ) ; //Get MM.mmmmmmm
18291851 convertedCoordinate = decimal + ( minutes / 60.0 ) ;
1830- if ( negativeSign ) convertedCoordinate *= - 1 ;
1852+ if ( negativeSign ) convertedCoordinate *= - 1.0 ;
18311853 }
18321854 else if ( dashCount == 2 ) //DD-MM-SS.ssss
18331855 {
@@ -1843,13 +1865,13 @@ function identifyInputType(userEntry) {
18431865
18441866 var seconds = Number ( data [ 2 ] ) ; //Get SS.ssssss
18451867 convertedCoordinate = decimal + ( minutes / 60.0 ) + ( seconds / 3600.0 ) ;
1846- if ( negativeSign ) convertedCoordinate *= - 1 ;
1868+ if ( negativeSign ) convertedCoordinate *= - 1.0 ;
18471869 }
18481870 else if ( spaceCount == 0 ) //DD.ddddddddd
18491871 {
18501872 coordinateInputType = CoordinateTypes . COORDINATE_INPUT_TYPE_DD ;
18511873 convertedCoordinate = userEntry ;
1852- if ( negativeSign ) convertedCoordinate *= - 1 ;
1874+ if ( negativeSign ) convertedCoordinate *= - 1.0 ;
18531875 }
18541876 else if ( spaceCount == 1 ) //DD MM.mmmmmmm
18551877 {
@@ -1859,7 +1881,7 @@ function identifyInputType(userEntry) {
18591881 var decimal = Number ( data [ 0 ] ) ; //Get DD
18601882 var minutes = Number ( data [ 1 ] ) ; //Get MM.mmmmmmm
18611883 convertedCoordinate = decimal + ( minutes / 60.0 ) ;
1862- if ( negativeSign ) convertedCoordinate *= - 1 ;
1884+ if ( negativeSign ) convertedCoordinate *= - 1.0 ;
18631885 }
18641886 else if ( spaceCount == 2 ) //DD MM SS.ssssss
18651887 {
@@ -1875,10 +1897,11 @@ function identifyInputType(userEntry) {
18751897
18761898 var seconds = Number ( data [ 2 ] ) ; //Get SS.ssssss
18771899 convertedCoordinate = decimal + ( minutes / 60.0 ) + ( seconds / 3600.0 ) ;
1878- if ( negativeSign ) convertedCoordinate *= - 1 ;
1900+ if ( negativeSign ) convertedCoordinate *= - 1.0 ;
18791901 }
18801902
1881- //console.log("convertedCoordinate: " + convertedCoordinate.toFixed(9));
1903+ //console.log("convertedCoordinate: " + Number(convertedCoordinate).toFixed(9));
1904+ //console.log("Detected type: " + printableInputType(coordinateInputType));
18821905 return ( coordinateInputType ) ;
18831906}
18841907
@@ -1983,6 +2006,9 @@ function printableInputType(coordinateInputType) {
19832006 case ( CoordinateTypes . COORDINATE_INPUT_TYPE_DD_MM_SS ) :
19842007 return ( "DD MM SS.ssssss" ) ;
19852008 break ;
2009+ case ( CoordinateTypes . COORDINATE_INPUT_TYPE_DD_MM_SS_DASH ) :
2010+ return ( "DD-MM-SS.ssssss" ) ;
2011+ break ;
19862012 case ( CoordinateTypes . COORDINATE_INPUT_TYPE_DDMMSS_NO_DECIMAL ) :
19872013 return ( "DDMMSS" ) ;
19882014 break ;
0 commit comments