MapBoard.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:KivyTrek 作者: peterLaurence 项目源码 文件源码
def get_dist_to_center(self):
        """
        :return: The distance in meters between the last known position and the position represented by the middle
        of the screen. If no distance can be calculated, it returns -1.
        """
        if self.map is None:
            return -1
        try:
            merc_x, merc_y = self.map.map_coord_to_map_projection(*self.to_local(Window.size[0]/2, Window.size[1]/2))
        except ZeroDivisionError:
            return -1
        lat, lon = Map.to_geographic(merc_x, merc_y)
        lat_last, lon_last = self.last_pos_wgs84
        dist = Map.distance(lat_last, lon_last, lat, lon)
        return dist
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号