Ignore:
Timestamp:
06/10/12 12:32:09 (12 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

Added support for calculating speeds in km/h for Soviet aircraft

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/flight.py

    r215 r241  
    116116        """Get the touchdown rate if known, None otherwise."""
    117117        return self._tdRate
     118
     119    @property
     120    def speedInKnots(self):
     121        """Determine if the speeds for the flight are to be expressed in
     122        knots."""
     123        return self.aircraft.speedInKnots if self.aircraft is not None \
     124               else True
    118125
    119126    def handleState(self, oldState, currentState):
     
    207214        self._checklistHotkeyPressed = True
    208215
     216    def speedFromKnots(self, knots):
     217        """Convert the given speed value expressed in knots into the flight's
     218        speed unit."""
     219        return knots if self.speedInKnots else knots * const.KNOTSTOKMPH
     220
     221    def speedToKnots(self, speed):
     222        """Convert the given speed expressed in the flight's speed unit into
     223        knots."""       
     224        return speed if self.speedInKnots else speed * const.KMPHTOKNOTS
     225
     226    def getEnglishSpeedUnit(self):
     227        """Get the English name of the speed unit used by the flight."""
     228        return "knots" if self.speedInKnots else "km/h"
     229
     230    def getI18NSpeedUnit(self):
     231        """Get the speed unit suffix for i18n message identifiers."""
     232        return "_knots" if self.speedInKnots else "_kmph"
     233
    209234    def _updateFlownDistance(self, currentState):
    210235        """Update the flown distance."""
Note: See TracChangeset for help on using the changeset viewer.