def load_gpx_from_file(self, uri): """Parse GPX data, drawing each GPS track segment on the map.""" start_time = clock() open_file = KMLFile if uri[-3:].lower() == 'kml' else GPXFile gpx = open_file(uri, self.progressbar) # Emitting this signal ensures the new tracks get the correct color. get_obj('colorselection').emit('color-changed') self.status_message(_('%d points loaded in %.2fs.') % (len(gpx.tracks), clock() - start_time), True) if len(gpx.tracks) < 2: return points.update(gpx.tracks) metadata.alpha = min(metadata.alpha, gpx.alpha) metadata.omega = max(metadata.omega, gpx.omega) map_view.emit('realize') map_view.set_zoom_level(map_view.get_max_zoom_level()) bounds = Champlain.BoundingBox.new() for poly in polygons: bounds.compose(poly.get_bounding_box()) gpx.latitude, gpx.longitude = bounds.get_center() map_view.ensure_visible(bounds, False) self.prefs.gpx_timezone = gpx.lookup_geoname() self.prefs.set_timezone() gpx_sensitivity()
def load_gpx_from_file(self, uri): """Parse GPX data, drawing each GPS track segment on the map.""" start_time = clock() open_file = KMLFile if uri[-3:].lower() == 'kml' else GPXFile gpx = open_file(uri, self.progressbar) # Emitting this signal ensures the new tracks get the correct color. get_obj('colorselection').emit('color-changed') self.status_message( _('%d points loaded in %.2fs.') % (len(gpx.tracks), clock() - start_time), True) if len(gpx.tracks) < 2: return points.update(gpx.tracks) metadata.alpha = min(metadata.alpha, gpx.alpha) metadata.omega = max(metadata.omega, gpx.omega) map_view.emit('realize') map_view.set_zoom_level(map_view.get_max_zoom_level()) bounds = Champlain.BoundingBox.new() for poly in polygons: bounds.compose(poly.get_bounding_box()) gpx.latitude, gpx.longitude = bounds.get_center() map_view.ensure_visible(bounds, False) self.prefs.gpx_timezone = gpx.lookup_geoname() self.prefs.set_timezone() gpx_sensitivity()
def load_gpx_from_file(self, uri): """Parse GPX data, drawing each GPS track segment on the map.""" start_time = clock() gpx = get_trackfile(uri) self.status_message(_('%d points loaded in %.2fs.') % (len(gpx.tracks), clock() - start_time), True) if len(gpx.tracks) < 2: return metadata.alpha = min(metadata.alpha, gpx.alpha) metadata.omega = max(metadata.omega, gpx.omega) map_view.emit('realize') map_view.set_zoom_level(map_view.get_max_zoom_level()) bounds = Champlain.BoundingBox.new() for trackfile in known_trackfiles.values(): for polygon in trackfile.polygons: bounds.compose(polygon.get_bounding_box()) map_view.ensure_visible(bounds, False) for camera in known_cameras.values(): camera.set_found_timezone(gpx.timezone)