def report_altitude(self, altitude):
        '''possibly report a new altitude'''
        master = self.master
        if getattr(self.console, 'ElevationMap', None) is not None and self.mpstate.settings.basealt != 0:
            lat = master.field('GLOBAL_POSITION_INT', 'lat', 0)*1.0e-7
            lon = master.field('GLOBAL_POSITION_INT', 'lon', 0)*1.0e-7
            alt1 = self.console.ElevationMap.GetElevation(lat, lon)
            if alt1 is not None:
                alt2 = self.mpstate.settings.basealt
                altitude += alt2 - alt1
        self.status.altitude = altitude
        altitude_converted = self.height_convert_units(altitude)
        if (int(self.mpstate.settings.altreadout) > 0 and
            math.fabs(altitude_converted - self.last_altitude_announce) >=
            int(self.settings.altreadout)):
            self.last_altitude_announce = altitude_converted
            rounded_alt = int(self.settings.altreadout) * ((self.settings.altreadout/2 + int(altitude_converted)) / int(self.settings.altreadout))
            self.say("height %u" % rounded_alt, priority='notification')
def report_altitude ( self , altitude ) : master = self . master if getattr ( self . console , 'ElevationMap' , None ) is not None and self . mpstate . settings . basealt != 0 : lat = master . field ( 'GLOBAL_POSITION_INT' , 'lat' , 0 ) * 1.0e-7 lon = master . field ( 'GLOBAL_POSITION_INT' , 'lon' , 0 ) * 1.0e-7 alt1 = self . console . ElevationMap . GetElevation ( lat , lon ) if alt1 is not None : alt2 = self . mpstate . settings . basealt altitude += alt2 - alt1 self . status . altitude = altitude altitude_converted = self . height_convert_units ( altitude ) if ( int ( self . mpstate . settings . altreadout ) > 0 and math . fabs ( altitude_converted - self . last_altitude_announce ) >= int ( self . settings . altreadout ) ) : self . last_altitude_announce = altitude_converted rounded_alt = int ( self . settings . altreadout ) * ( ( self . settings . altreadout / 2 + int ( altitude_converted ) ) / int ( self . settings . altreadout ) ) self . say ( "height %u" % rounded_alt , priority = 'notification' )
possibly report a new altitude