示例#1
0
def create_kml(item, type, action):
    name = type + "_" + str(item.id) + ".kml"
    path = os.path.dirname(__file__) + "/static/kml/" + name

    if type == 'hangar':
        kml_generator.create_hangar_polygon(item, path)
    else:
        kml_generator.create_droppoint_marker(item, path)

    if action == 'create':
        Kml(name=name, url="static/kml/" + name).save()
    else:
        kml_vis = Kml.objects.get(name=name)
        kml_vis.visibility = item.is_available
        kml_vis.save()

    if type == 'hangar':
        name_influence = kml_generator\
            .hangar_influence(item, os.path.dirname(__file__) +
                              "/static/kml/" + type + "_" +
                              str(item.id) + "_inf.kml")
        if action == 'create':
            Kml(name=name_influence, url="static/kml/" + name_influence,
                visibility=item.is_available).save()
        else:
            kml_vis = Kml.objects.get(name=name_influence)
            kml_vis.visibility = item.is_available
            kml_vis.save()
示例#2
0
def create_kml(item, type, action):
    name = type + "_" + str(item.id) + ".kml"
    path = os.path.dirname(__file__) + "/static/kml/" + name

    if type == 'hangar':
        kml_generator.create_hangar_polygon(item, path)
    else:
        kml_generator.create_droppoint_marker(item, path)

    if action == 'create':
        Kml(name=name, url="static/kml/" + name).save()
    else:
        kml_vis = Kml.objects.get(name=name)
        kml_vis.visibility = item.is_available
        kml_vis.save()

    if type == 'hangar':
        name_influence = kml_generator.hangar_influence(
            item,
            os.path.dirname(__file__) + "/static/kml/" + type + "_" +
            str(item.id) + "_inf.kml")
        if action == 'create':
            Kml(name=name_influence,
                url="static/kml/" + name_influence,
                visibility=item.is_available).save()
        else:
            kml_vis = Kml.objects.get(name=name_influence)
            kml_vis.visibility = item.is_available
            kml_vis.save()
示例#3
0
 def create_hangars(self, path):
     self.stdout.write("Creating Hangars Kml...")
     for item in Hangar.objects.all():
         name = "hangar_" + str(item.id) + ".kml"
         create_hangar_polygon(item, path + name)
         name_inf = hangar_influence(item, path +
                                     "hangar_" + str(item.id) + "_inf.kml")
         Kml(name=name, url=path + name).save()
         Kml(name=name_inf, url=path + name_inf).save()
示例#4
0
 def create_hangars(self, path):
     self.stdout.write("Creating Hangars Kml...")
     for item in Hangar.objects.all():
         name = "hangar_" + str(item.id) + ".kml"
         create_hangar_polygon(item, path + name)
         name_inf = hangar_influence(
             item, path + "hangar_" + str(item.id) + "_inf.kml")
         Kml(name=name, url=path + name).save()
         Kml(name=name_inf, url=path + name_inf).save()