def update_position(self): '''update position text''' state = self.state pos = self.mouse_pos newtext = '' alt = 0 if pos is not None: (lat,lon) = self.coordinates(pos.x, pos.y) newtext += 'Cursor: %f %f (%s)' % (lat, lon, mp_util.latlon_to_grid((lat, lon))) if state.elevation: alt = self.ElevationMap.GetElevation(lat, lon) newtext += ' %.1fm' % alt pending = state.mt.tiles_pending() if pending: newtext += ' Map Downloading %u ' % pending if alt == -1: newtext += ' SRTM Downloading ' newtext += '\n' if self.click_pos is not None: newtext += 'Click: %f %f (%s %s) (%s)' % (self.click_pos[0], self.click_pos[1], mp_util.degrees_to_dms(self.click_pos[0]), mp_util.degrees_to_dms(self.click_pos[1]), mp_util.latlon_to_grid(self.click_pos)) if self.last_click_pos is not None: distance = mp_util.gps_distance(self.last_click_pos[0], self.last_click_pos[1], self.click_pos[0], self.click_pos[1]) bearing = mp_util.gps_bearing(self.last_click_pos[0], self.last_click_pos[1], self.click_pos[0], self.click_pos[1]) newtext += ' Distance: %.1fm Bearing %.1f' % (distance, bearing) if newtext != state.oldtext: self.position.Clear() self.position.WriteText(newtext) state.oldtext = newtext
def update_position(self): """update position text""" state = self.state pos = self.mouse_pos newtext = "" alt = 0 if pos is not None: (lat, lon) = self.coordinates(pos.x, pos.y) newtext += "Cursor: %f %f (%s)" % (lat, lon, mp_util.latlon_to_grid((lat, lon))) if state.elevation: alt = self.ElevationMap.GetElevation(lat, lon) if alt is not None: newtext += " %.1fm" % alt state.mt.set_download(state.download) pending = 0 if state.download: pending = state.mt.tiles_pending() if pending: newtext += " Map Downloading %u " % pending if alt == -1: newtext += " SRTM Downloading " newtext += "\n" if self.click_pos is not None: newtext += "Click: %f %f (%s %s) (%s)" % ( self.click_pos[0], self.click_pos[1], mp_util.degrees_to_dms(self.click_pos[0]), mp_util.degrees_to_dms(self.click_pos[1]), mp_util.latlon_to_grid(self.click_pos), ) if self.last_click_pos is not None: distance = mp_util.gps_distance( self.last_click_pos[0], self.last_click_pos[1], self.click_pos[0], self.click_pos[1] ) bearing = mp_util.gps_bearing( self.last_click_pos[0], self.last_click_pos[1], self.click_pos[0], self.click_pos[1] ) newtext += " Distance: %.1fm Bearing %.1f" % (distance, bearing) if newtext != state.oldtext: self.position.Clear() self.position.WriteText(newtext) state.oldtext = newtext
def show_position(self): """show map position click information""" pos = self.click_position dms = (mp_util.degrees_to_dms(pos[0]), mp_util.degrees_to_dms(pos[1])) msg = "Coordinates in WGS84\n" msg += "Decimal: %.6f %.6f\n" % (pos[0], pos[1]) msg += "DMS: %s %s\n" % (dms[0], dms[1]) msg += "Grid: %s\n" % mp_util.latlon_to_grid(pos) if self.logdir: logf = open(os.path.join(self.logdir, "positions.txt"), "a") logf.write("Position: %.6f %.6f at %s\n" % (pos[0], pos[1], time.ctime())) logf.close() MPMenuChildMessageDialog("Position", msg, font_size=32)
def show_position(self): '''show map position click information''' pos = self.click_position dms = (mp_util.degrees_to_dms(pos[0]), mp_util.degrees_to_dms(pos[1])) msg = "Coordinates in WGS84\n" msg += "Decimal: %.6f %.6f\n" % (pos[0], pos[1]) msg += "DMS: %s %s\n" % (dms[0], dms[1]) msg += "Grid: %s\n" % mp_util.latlon_to_grid(pos) if self.logdir: logf = open(os.path.join(self.logdir, "positions.txt"), "a") logf.write("Position: %.6f %.6f at %s\n" % (pos[0], pos[1], time.ctime())) logf.close() MPMenuChildMessageDialog('Position', msg, font_size=32)