Ignore:
Timestamp:
May 19, 2020, 8:59:28 PM (7 years ago)
Author:
Joachim Langenbach <joachim.langenbach@…>
Branches:
debian/bullseye, master
Children:
24617e1
Parents:
d5199c9
Message:
  • Switched from CamelCase to camel_case naming
    • Added mapservice-webclient to configure script (Closes #33)
    • Switched from unittest to pytest tests
    • Fixed testing errors with post datas by introducing x-fail vendor extension
    • Added x-vendor extension to mark a dependency on mapservice for an operation and the controller_test.mustache adds needed fixtures
    • Copying conftest.py from *_impl/tests into */test (it's a workaround to get the flask app fixtures)
    • Fixed controller_test.mustache, to test the first response with set status code
File:
1 moved

Legend:

Unmodified
Added
Removed
  • src/gnuboat/common/datahandler/log_handler.py

    rd5199c9 r9f0f35e  
    2424from pathlib import Path
    2525
    26 from gnuboat.common.datahandler import logdataset
     26from gnuboat.common.datahandler import log_dataset
    2727
    2828
    … …  
    108108            nmea_log_file = self._nmea_file.name
    109109
    110         latitude = self._degreesDecimalToNmea(dataset.latitude())
    111         longitude = self._degreesDecimalToNmea(dataset.longitude())
     110        latitude = self._degrees_decimal_to_nmea(dataset.latitude())
     111        longitude = self._degrees_decimal_to_nmea(dataset.longitude())
    112112
    113113        logsystemtime = ""
    … …  
    274274                    if last_row is not None:
    275275                        callback(last_row)
    276                     last_row = logdataset.LogDataset()
     276                    last_row = log_dataset.LogDataset()
    277277                    last_row.datetime_set(
    278278                        '{} {}'.format(
    … …  
    282282                    last_row.gps_status_set(nmea_sentence.status)
    283283                    last_row.latitude_set(
    284                         self._nmeaLatitudeToDecimalDegrees(
     284                        self._nmea_latitude_to_decimal_degrees(
    285285                            nmea_sentence.lat, current_row
    286286                        )
    … …  
    288288                    last_row.latitude_direction_set(nmea_sentence.lat_dir)
    289289                    last_row.longitude_set(
    290                         self._nmeaLongitudeToDecimalDegrees(
     290                        self._nmea_longitude_to_decimal_degrees(
    291291                            nmea_sentence.lon, current_row
    292292                        )
    … …  
    344344                return 0
    345345
    346     def _nmeaLatitudeToDecimalDegrees(self, nmea_value, current_row):
     346    def _nmea_latitude_to_decimal_degrees(self, nmea_value, current_row):
    347347        if self._to_float(nmea_value, current_row) == 0:
    348348            return 0
    … …  
    355355            )
    356356            return
    357         decimalDegrees = self._to_float(matches.group(1), current_row)
    358         decimalMinutes = self._to_float(matches.group(2), current_row)
    359         return decimalDegrees + (decimalMinutes / 60.0)
    360 
    361     def _nmeaLongitudeToDecimalDegrees(self, nmea_value, current_row):
     357        decimal_degrees = self._to_float(matches.group(1), current_row)
     358        decimal_minutes = self._to_float(matches.group(2), current_row)
     359        return decimal_degrees + (decimal_minutes / 60.0)
     360
     361    def _nmea_longitude_to_decimal_degrees(self, nmea_value, current_row):
    362362        if self._to_float(nmea_value, current_row) == 0:
    363363            return 0
    … …  
    370370            )
    371371            return
    372         decimalDegrees = self._to_float(matches.group(1), current_row)
    373         decimalMinutes = self._to_float(matches.group(2), current_row)
    374         return decimalDegrees + (decimalMinutes / 60.0)
    375 
    376     def _degreesDecimalToNmea(self, decimalDegrees):
    377         degrees = int(math.floor(decimalDegrees))
    378         minutes = 60.0 * (decimalDegrees - degrees)
     372        decimal_degrees = self._to_float(matches.group(1), current_row)
     373        decimal_minutes = self._to_float(matches.group(2), current_row)
     374        return decimal_degrees + (decimal_minutes / 60.0)
     375
     376    def _degrees_decimal_to_nmea(self, decimal_degrees):
     377        degrees = int(math.floor(decimal_degrees))
     378        minutes = 60.0 * (decimal_degrees - degrees)
    379379        return {'degrees': degrees, 'minutes': minutes}
Note: See TracChangeset for help on using the changeset viewer.