Ignore:
Timestamp:
Oct 30, 2017, 9:53:22 AM (9 years ago)
Author:
Joachim Langenbach <joachim.langenbach@…>
Branches:
debian/bullseye, debian/jessie
Children:
8fd7454
Parents:
e86d691 (diff), 26f77a6 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch '0.5' into debian/jessie

Conflicts:

setup.py

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/webapp/webservice/inc/GnuBoat/Nmea/Nmea0183/Nmea0183Rmc.php

    re86d691 r8ef59a1  
    5555                        $this->_status = Nmea0183RmcStatus::A;
    5656               
    57                 $this->_latitude = Nmea0183Rmc::nmeaToDecimalDegrees($content[3]);
     57                $this->_latitude = Nmea0183Rmc::nmeaLatitudeToDecimalDegrees($content[3]);
    5858                if(Nmea0183Rmc::directionToEnum($content[4]) == Nmea0183Direction::South)
    5959                        $this->_latitude = $this->_latitude * -1;
    6060               
    61                 $this->_longitude = Nmea0183Rmc::nmeaToDecimalDegrees($content[5]);
     61                $this->_longitude = Nmea0183Rmc::nmeaLongitudeToDecimalDegrees($content[5]);
    6262                if(Nmea0183Rmc::directionToEnum($content[6]) == Nmea0183Direction::West)
    6363                        $this->_longitude = $this->_longitude * -1;
    … …  
    162162        }
    163163       
    164         private static function nmeaToDecimalDegrees($nmeaValue)
     164        private static function nmeaLatitudeToDecimalDegrees($nmeaValue)
    165165        {
    166166                if((float)$nmeaValue == 0)
    … …  
    168168
    169169                $matches = array();
    170                 $result = preg_match('/^([0-9]+)([0-9]{2}\.[0-9]+)$/', $nmeaValue, $matches);
     170                $result = preg_match('/^([0-9]{2})([0-9]{2}\.[0-9]+)$/', $nmeaValue, $matches);
    171171                if($result === false || $result != 1 || count($matches) != 3){
    172                         $message = "Could not convert nmea position into decimal degress ". $nmeaValue;
     172                        $message = "Could not convert nmea latitude position into decimal degress ". $nmeaValue;
    173173                        error_log($message);
    174                         if($debug > 0)
    175                                 print $message ."\n";
    176174                        return 0;
    177175                }
    … …  
    180178                return $decimalDegrees + ($decimalMinutes / 60.0);
    181179        }
    182        
     180
     181        private static function nmeaLongitudeToDecimalDegrees($nmeaValue)
     182        {
     183                if((float)$nmeaValue == 0)
     184                        return 0;
     185
     186                $matches = array();
     187                $result = preg_match('/^([0-9]{3})([0-9]{2}\.[0-9]+)$/', $nmeaValue, $matches);
     188                if($result === false || $result != 1 || count($matches) != 3){
     189                        $message = "Could not convert nmea longitude position into decimal degress ". $nmeaValue;
     190                        error_log($message);
     191                        return 0;
     192                }
     193                $decimalDegrees = (float)$matches[1];
     194                $decimalMinutes = (float)$matches[2];
     195                return $decimalDegrees + ($decimalMinutes / 60.0);
     196        }
     197
    183198        private $_dateTimeUtc;
    184199        private $_status;
Note: See TracChangeset for help on using the changeset viewer.