11# -*- coding: utf-8 -*-
22from xcsoar .mapgen .waypoints .waypoint import Waypoint
33from xcsoar .mapgen .waypoints .list import WaypointList
4- import cherrypy
54
65
76
@@ -37,7 +36,6 @@ def __next__(self):
3736
3837
3938def __parse_altitude (str ):
40- # cherrypy.log(f'in parse_altitude({str})')
4139 str = str .lower ()
4240 if str .endswith ("ft" ) or str .endswith ("f" ):
4341 str = str .rstrip ("ft" )
@@ -78,57 +76,30 @@ def __parse_length(str):
7876
7977def parse_seeyou_waypoints (lines , bounds = None ):
8078 waypoint_list = WaypointList ()
81- # cherrypy.log('in parse_seeyou_waypoints function:')
82-
83- #gfp 241210: modified to wait for header line before processing
84- #gfp 241210: added 'ISO-8859-2' decoding for correct cherrypy logging display
85-
86- #gfp 241208 added to print out all lines in selected .CUP file
87- # wpnum = 0
88- # for byteline in lines:
89- # wpnum = wpnum + 1
90- # line = byteline.decode('ISO-8859-2')
9179
9280 header = 'name,code,country,lat,lon,elev,style,rwdir,rwlen,freq,desc'
9381
9482 wpnum = 0
9583 for byteline in lines :
9684 wpnum = wpnum + 1
97- line = byteline .decode ('ISO-8859-2' ) #gfp 241210: added 'ISO-8859-2' decoding for correct cherrypy logging display
98- line = line .strip ()
99-
100- # cherrypy.log('in for loop: wpnum = %s line = %s' %(wpnum, line))
101- # cherrypy.log(f'for loop row {wpnum}: {line}')
85+ line = byteline .decode ('UTF-8' )
10286
10387 #check for blank lines or comments
10488 if line == "" or line .startswith ("*" ):
10589 continue
10690
10791 if header in line :
108- # cherrypy.log(f'header line found at row {wpnum}: {line}')
10992 continue #skip to next line (first waypoint line)
11093
11194 if line == "-----Related Tasks-----" :
11295 break
11396
114- # cherrypy.log('in for loop before line = __CSVLine(line): wpnum = %s' %wpnum)
115-
11697 fields = []
11798 CSVline = __CSVLine (line )
118- # cherrypy.log(f'row {wpnum}: line = __CSVLine(line) ->> {line}')
119-
99+
120100 while CSVline .has_next ():
121101 fields .append (next (CSVline ))
122102
123-
124- #display fields for this line
125- # cherrypy.log('extracted fields for line = %s' %wpnum)
126- # idx = 0
127- # for field in fields:
128- # cherrypy.log(f' field[{idx}] = {field}')
129- # idx += 1
130-
131-
132103 if len (fields ) < 6 :
133104 continue
134105
@@ -146,10 +117,7 @@ def parse_seeyou_waypoints(lines, bounds=None):
146117 wp .altitude = __parse_altitude (fields [5 ])
147118 wp .name = fields [0 ].strip ()
148119 wp .country_code = fields [2 ].strip ()
149-
150- # cherrypy.log('waypoint %s: name = %s' %(wpnum, wp.name))
151-
152-
120+
153121 if len (fields ) > 6 and len (fields [6 ]) > 0 :
154122 wp .cup_type = int (fields [6 ])
155123
@@ -165,11 +133,7 @@ def parse_seeyou_waypoints(lines, bounds=None):
165133 if len (fields ) > 10 and len (fields [10 ]) > 0 :
166134 wp .comment = fields [10 ].strip ()
167135
168- # cherrypy.log(f'waypoint {wpnum}: {wp.name}, {wp.lat:.3f}, {wp.lon:.3f}')
169136
170- #gfp print out current 'bounds' params
171- # cherrypy.log(f'bounds = {bounds}')
172-
173137 waypoint_list .append (wp )
174138
175139
0 commit comments