公用函数¶
-
tafor.utils.convert.parseTime(time, basetime=None)¶
-
tafor.utils.convert.parsePeriod(period, basetime=None)¶
-
tafor.utils.convert.parseTimez(timez)¶ 解析报文的日期组,推算报文的发送时间,当月没有的日期视为上一个月
参数: timez – 报文日期组,如 150113Z 返回: 返回 Datetime 对象
-
tafor.utils.convert.ceilTime(time, amount=10)¶ 时间添加一个增量,并使分钟为 5 的倍数
参数: - time – Datetime 对象
- amount – 需要增加的量,单位分钟
返回: 返回 Datetime 对象
-
tafor.utils.convert.degreeToDecimal(text)¶ 转换度分为十进制角度
参数: text – 字符,如 E11021 返回: 字符,如 110.30
-
tafor.utils.convert.decimalToDegree(degree, fmt='latitude')¶ 转换十进制角度为度分
参数: - degree – 字符,如 -20.5
- fmt – 格式化方式,可选参数 ‘longitude’、’latitude’,代表经度或是纬度
返回: 字符,如 S2030
-
tafor.utils.convert.calcPosition(latitude, longitude, speed, time, degree)¶ 根据当前的经纬度,已知点的移动方向和速度,计算一定时间之后的经纬度坐标
参数: - latitude – 字符,如 N1930
- longitude – 字符,如 E11236
- speed – 移动速度,单位千米每小时,如 25
- time – 移动时间,单位秒,如 7200
- degree – 移动方向,如 90
返回: 元组,如 (‘N2021’, ‘E11042’)
-
tafor.utils.convert.listToPoint(points)¶ 列表格式的坐标点转换为 QPoint
参数: points – 列表,如 [[20, 30], [10, 15]] 返回: 列表,如 [QPoint(20, 30), QPoint(10, 15)]
-
tafor.utils.convert.pointToList(points)¶ QPoint 格式的坐标点转换为列表
参数: points – 列表,如 [QPoint(20, 30), QPoint(10, 15)] 返回: 列表,如 [[20, 30], [10, 15]]