Esempio n. 1
0
 def test_ogimet_to_VOBL(self):  # BLR
     filepath = DATADIR + '/AF192_LFPG-VOBL_28Dec2016_10:25z_OFP_12_0_1.txt'
     with open(filepath, 'r') as f:
         ofp = OFP(f.read())
     route = ogimet_route(ofp.route)
     points = [p.name for p in route if p.name]
     self.assertEqual(points[0], 'LFPG')
     self.assertEqual(points[-1], '43296')
     self.assertLess(len(points), 23)
Esempio n. 2
0
 def test_ogimet_from_VOBL(self):  # BLR
     filepath = DATADIR + '/AF191_VOBL-LFPG_30Dec2016_21:50z_OFP_20_0_1.txt'
     with open(filepath, 'r') as f:
         ofp = OFP(f.read())
     route = ogimet_route(ofp.route)
     points = [p.name for p in route if p.name]
     self.assertEqual(points[0], '43296')
     self.assertEqual(points[-1], 'LFPG')
     self.assertLess(len(points), 23)
Esempio n. 3
0
 def test_ogimet_to_FAOR(self):  # JNB
     filepath = DATADIR + '/AF990_LFPG-FAOR_05Jun2016_21:25z_OFP_12_0_1.txt'
     with open(filepath, 'r') as f:
         ofp = OFP(f.read())
     route = ogimet_route(ofp.route)
     points = [p.name for p in route if p.name]
     self.assertEqual(points[0], 'LFPG')
     self.assertEqual(points[-1], 'FAJS')  # FAOR => FAJS
     self.assertLess(len(points), 23)
Esempio n. 4
0
 def test_ogimet_from_FAOR(self):  # JNB
     filepath = DATADIR + '/AF995_FAOR-LFPG_09Jun2016_16:50z_OFP_9_0_1.txt'
     with open(filepath, 'r') as f:
         ofp = OFP(f.read())
     route = ogimet_route(ofp.route)
     points = [p.name for p in route if p.name]
     self.assertEqual(points[0], 'FAJS')  # FAOR => FAJS
     self.assertEqual(points[-1], 'LFPG')
     self.assertLess(len(points), 23)
Esempio n. 5
0
 def test_ogimet_to_VOBL(self):  # BLR
     filepath = DATADIR + '/AF192_LFPG-VOBL_28Dec2016_10:25z_OFP_12_0_1.txt'
     with open(filepath, 'r') as f:
         ofp = OFP(f.read())
     route = ogimet_route(ofp.route)
     points = [p.name for p in route if p.name]
     self.assertEqual(points[0], 'LFPG')
     self.assertEqual(points[-1], '43296')
     self.assertLessEqual(len(points), 21)
Esempio n. 6
0
 def test_ogimet_from_VOBL(self):  # BLR
     filepath = DATADIR + '/AF191_VOBL-LFPG_30Dec2016_21:50z_OFP_20_0_1.txt'
     with open(filepath, 'r') as f:
         ofp = OFP(f.read())
     route = ogimet_route(ofp.route)
     points = [p.name for p in route if p.name]
     self.assertEqual(points[0], '43296')
     self.assertEqual(points[-1], 'LFPG')
     self.assertLessEqual(len(points), 21)
Esempio n. 7
0
 def test_ogimet_from_FAOR(self):  # JNB
     filepath = DATADIR + '/AF995_FAOR-LFPG_09Jun2016_16:50z_OFP_9_0_1.txt'
     with open(filepath, 'r') as f:
         ofp = OFP(f.read())
     route = ogimet_route(ofp.route)
     points = [p.name for p in route if p.name]
     self.assertEqual(points[0], 'FAJS')  # FAOR => FAJS
     self.assertEqual(points[-1], 'LFPG')
     self.assertLess(len(points), 21)
Esempio n. 8
0
 def test_ogimet_to_FAOR(self):  # JNB
     filepath = DATADIR + '/AF990_LFPG-FAOR_05Jun2016_21:25z_OFP_12_0_1.txt'
     with open(filepath, 'r') as f:
         ofp = OFP(f.read())
     route = ogimet_route(ofp.route)
     points = [p.name for p in route if p.name]
     self.assertEqual(points[0], 'LFPG')
     self.assertEqual(points[-1], 'FAJS')  # FAOR => FAJS
     self.assertLessEqual(len(points), 21)
Esempio n. 9
0
 def test_ogimet_AF191(self):  # BLR
     filepath = DATADIR + '/AF191_VOBL-LFPG_30Dec2016_21:50z_OFP_20_0_1.txt'
     with io.open(filepath, 'r', encoding="utf-8") as f:
         ofp = OFP(f.read())
     route = ogimet_route(ofp.route)
     points = [p.name for p in route if p.name]
     self.assertEqual(
         ' '.join(points),
         '43296 43264 43160 43109 OIKB 40851 40821 OIIK OITZ OITT 17024 15561 15499 15460 15182 LKTB 11406 10605 06484 LFPC LFPG'
     )
Esempio n. 10
0
 def test_ogimet_AF010_NVP(self):  # BLR
     filepath = DATADIR + '/AF 010_LFPG-KJFK_27Sep2019_1450z_OFP_6_nvp_pdfminer.txt'
     with io.open(filepath, 'r', encoding="utf-8") as f:
         ofp = OFP(f.read())
     route = ogimet_route(ofp.route)
     points = [p.name for p in route if p.name]
     self.assertEqual(
         ' '.join(points),
         'LFPG LFPB 07002 03559 03354 EGNH 03916 CWCA 71513 71634 KPWM KBOS KPVD 72501 72505 KJFK'
     )
Esempio n. 11
0
 def test_ogimet_existing_airports(self):
     filepath = DATADIR + '/KJFK-LFPG 27Mar2015 05:45z OFP.txt'
     with open(filepath, 'r') as f:
         ofp = OFP(f.read())
     route = ogimet_route(ofp.route)
     points = [p.name for p in route if p.name]
     self.assertEqual(points[0], 'KJFK')
     self.assertEqual(points[-1], 'LFPG')
     self.assertLess(len(points), 23)
     self.assertEqual(
         points,
         [u'KJFK', u'74483', u'KCON', u'KNHZ', u'KEPO', u'71787', u'CYSU', u'CWGR', u'71159', u'CWDO', u'03964',
          u'03961', u'EGOP', u'EGDL', u'03882', u'07040', u'LFPG']
     )
Esempio n. 12
0
 def test_ogimet_existing_airports(self):
     filepath = DATADIR + '/KJFK-LFPG 27Mar2015 05:45z OFP.txt'
     with open(filepath, 'r') as f:
         ofp = OFP(f.read())
     route = ogimet_route(ofp.route)
     points = [p.name for p in route if p.name]
     self.assertEqual(points[0], 'KJFK')
     self.assertEqual(points[-1], 'LFPG')
     self.assertLess(len(points), 21)
     self.assertEqual([
         u'KJFK', u'74483', u'KNHZ', u'KEPO', u'CYSU', u'CWDO', u'03976',
         u'03966', u'03716', u'EGDL', u'EGVO', u'07040', u'LFOB', u'LFPC',
         u'LFPG'
     ], points)
Esempio n. 13
0
def lido2mapsme(action_in, params, debug=False):
    """
    Lido2Mapsme KML rendering action
    :param action_in: unicode action input
    :param params: dict action's parameters
    :param debug: bool determines wether or not to print ogimet debug messages
    :return:
    """
    from editolido.constants import NAT_POSITION_ENTRY, PIN_NONE
    from editolido.geopoint import GeoPoint
    from editolido.kml import KMLGenerator
    from editolido.ofp import OFP
    from editolido.route import Route
    from editolido.ogimet import ogimet_route
    ofp = OFP(action_in)
    kml = KMLGenerator()
    pin_rnat = params.get('Repère NAT', PIN_NONE)
    pin_rmain = params.get('Point Route', PIN_NONE)
    pin_ralt = params.get('Point Dégagement', PIN_NONE)
    kml.add_folders(
        'greatcircle', 'ogimet',
        ('rnat', pin_rnat),
        ('ralt', pin_ralt),
        ('rmain', pin_rmain))
    route_name = "{departure}-{destination}".format(**ofp.infos)
    route = ofp.route
    route.name = route_name
    route.description = ofp.description

    natmarks = []
    if params.get('Afficher NAT', False):
        pin_pos = 0 if params['Position repère'] == NAT_POSITION_ENTRY else -1
        for track in ofp.tracks:
            if track:
                kml.add_line('rnat', track)
                if pin_rnat != PIN_NONE:
                    if track.is_mine:
                        p = GeoPoint(track[0], name=track.name,
                                     description=track.description)
                        natmarks.append(p)
                        kml.add_point('rnat', p, style=pin_rnat)
                        p = GeoPoint(track[-1], name=track.name,
                                     description=track.description)
                        natmarks.append(p)
                        kml.add_point('rnat', p, style=pin_rnat)
                    else:
                        p = GeoPoint(track[pin_pos], name=track.name,
                                     description=track.description)
                        natmarks.append(p)
                        kml.add_point('rnat', p, style=pin_rnat)
            else:
                print("empty track found %s" % track.name)

    if params.get('Afficher Ortho', False):
        greatcircle = Route((route[0], route[-1])).split(
            300, name="Ortho %s" % route_name)
        kml.add_line('greatcircle', greatcircle)

    kml.add_line('rmain', route)
    if pin_rmain != PIN_NONE:
        kml.add_points('rmain', route,
                       excluded=natmarks, style=pin_rmain)

    if params.get('Afficher Dégagement', False):
        alt_route = Route(ofp.wpt_coordinates_alternate,
                          name="Route Dégagement")
        kml.add_line('ralt', alt_route)
        if pin_ralt != PIN_NONE:
            kml.add_points(
                'ralt', alt_route[1:],
                style=pin_ralt)

    if params.get('Afficher Ogimet', False):  # 1.0.x compatible
        kml.add_line('ogimet',
                     ogimet_route(route, debug=debug, name="Ogimet Route"))

    return kml.render(
        name=ofp.description,
        rnat_color=params.get('Couleur NAT', '') or '60DA25A8',
        ogimet_color=params.get('Couleur Ogimet', '')  or '40FF0000',
        greatcircle_color=params.get('Couleur Ortho', '')  or '5F1478FF',
        rmain_color=params.get('Couleur Route', '')  or 'FFDA25A8',
        ralt_color=params.get('Couleur Dégagement', '') or 'FFFF00FF'
    )