本文整理汇总了Python中auvsi_suas.models.UasTelemetry.kml方法的典型用法代码示例。如果您正苦于以下问题:Python UasTelemetry.kml方法的具体用法?Python UasTelemetry.kml怎么用?Python UasTelemetry.kml使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类auvsi_suas.models.UasTelemetry
的用法示例。
在下文中一共展示了UasTelemetry.kml方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_kml_simple
# 需要导入模块: from auvsi_suas.models import UasTelemetry [as 别名]
# 或者: from auvsi_suas.models.UasTelemetry import kml [as 别名]
def test_kml_simple(self):
coordinates = [
(-76.0, 38.0, 0.0),
(-76.0, 38.0, 10.0),
(-76.0, 38.0, 20.0),
(-76.0, 38.0, 30.0),
(-76.0, 38.0, 100.0),
(-76.0, 38.0, 30.0),
(-76.0, 38.0, 60.0),
]
# Create Coordinates
start = TakeoffOrLandingEvent(user=self.user, uas_in_air=True)
start.save()
for coord in coordinates:
self.create_log_element(*coord)
end = TakeoffOrLandingEvent(user=self.user, uas_in_air=False)
end.save()
kml = Kml()
UasTelemetry.kml(user=self.user,
logs=UasTelemetry.by_user(self.user),
kml=kml,
kml_doc=kml)
for coord in coordinates:
tag = self.coord_format.format(coord[1], coord[0],
units.feet_to_meters(coord[2]))
self.assertTrue(tag in kml.kml())
示例2: test_kml_filter
# 需要导入模块: from auvsi_suas.models import UasTelemetry [as 别名]
# 或者: from auvsi_suas.models.UasTelemetry import kml [as 别名]
def test_kml_filter(self):
coordinates = [
(-76.0, 38.0, 0.0),
(-76.0, 38.0, 10.0),
(-76.0, 38.0, 20.0),
(-76.0, 38.0, 30.0),
(-76.0, 38.0, 100.0),
(-76.0, 38.0, 30.0),
(-76.0, 38.0, 60.0),
]
filtered_out = [(0.1, 0.001, 100), (0.0, 0.0, 0)]
# Create Coordinates
start = TakeoffOrLandingEvent(user=self.user, uas_in_air=True)
start.save()
for coord in coordinates:
self.create_log_element(*coord)
for coord in filtered_out:
self.create_log_element(*coord)
end = TakeoffOrLandingEvent(user=self.user, uas_in_air=False)
end.save()
kml = Kml()
UasTelemetry.kml(user=self.user,
logs=UasTelemetry.by_user(self.user),
kml=kml,
kml_doc=kml)
for filtered in filtered_out:
tag = self.coord_format.format(filtered[1], filtered[0],
filtered[2])
self.assertTrue(tag not in kml.kml())
for coord in coordinates:
tag = self.coord_format.format(coord[1], coord[0], coord[2])
self.assertTrue(tag in kml.kml())
示例3: test_kml_empty
# 需要导入模块: from auvsi_suas.models import UasTelemetry [as 别名]
# 或者: from auvsi_suas.models.UasTelemetry import kml [as 别名]
def test_kml_empty(self):
kml = Kml()
UasTelemetry.kml(
user=self.user,
logs=UasTelemetry.by_user(self.user),
kml=kml,
kml_doc=kml, )
示例4: get
# 需要导入模块: from auvsi_suas.models import UasTelemetry [as 别名]
# 或者: from auvsi_suas.models.UasTelemetry import kml [as 别名]
def get(self, request):
kml = Kml(name='AUVSI SUAS Flight Data')
kml_teams = kml.newfolder(name='Teams')
kml_mission = kml.newfolder(name='Missions')
users = User.objects.all()
for user in users:
# Ignore admins
if user.is_superuser:
continue
UasTelemetry.kml(user=user,
logs=UasTelemetry.by_user(user),
kml=kml_teams,
kml_doc=kml.document)
MissionConfig.kml_all(kml_mission)
kml_flyzone = kml.newfolder(name='Fly Zones')
FlyZone.kml_all(kml_flyzone)
response = HttpResponse(kml.kml())
response['Content-Type'] = 'application/vnd.google-earth.kml+xml'
response['Content-Disposition'] = 'attachment; filename=mission.kml'
response['Content-Length'] = str(len(response.content))
return response