本文整理匯總了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