示例#1
0
文件: GLTester.py 项目: essar/pySki
def show_speed_plot(all_data):
    # Create plot window
    win = glplot.create_plot_window()
    plot = win.plot
    
    xData = [stp.ts for stp in all_data.data]
    yData = [stp.spd for stp in all_data.data]
    vData = [stp.alt for stp in all_data.data]
    
    glData = PlotData.build_linear_plot(xData, yData, vData, ySmoothing=50, xMarkers=1)
    glData.compile_vertex_data(renderer.getColourValue, 2)
    
    # Calculate plot size
    plot.cfg.plot_width = max(xData) - min(xData)
    plot.cfg.plot_height = max(yData) - min(yData)
    
    
    # Calculate sensible altitude scaling
    altScale = 1
    plot.cfg.scale_z = altScale
    plot.cfg.drawmode = '2D'
    plot.cfg.animate = False
    plot.cfg.show_status_bar = False
    
    plot.cfg.status_txt = '[ {:%d/%m/%Y %H:%M:%S %Z} ] [ Mode: {:4s} ] [ Altitude: {:4,d}m ] [ Speed: {:>4.1f}km/h ]'
    plot.cfg.status_values_f = lambda idx : (all_data.data[idx].loc_time
                      , all_data.data[idx].mode
                      , all_data.data[idx].alt
                      , all_data.data[idx].spd
    )
    
    print 'Draw {0} points fitting {1}x{2}'.format(len(vData), plot.cfg.plot_width, plot.cfg.plot_height)
    plot.show([glData])
示例#2
0
文件: GLTester.py 项目: essar/pySki
def show_xy_plot(all_data):
    # Create plot window
    plot = glplot.GLPlot()
    
    xyData = [(stp.x, stp.y) for stp in all_data.data]
    vData = [stp.spd for stp in all_data.data]
    
    glData = PlotData.build_xy_plot(xyData, vData)
    glData.compile_vertex_data(renderer.getColourValue, 2)
    
    # Calculate plot size
    plot.cfg.plot_width = (lambda (x1, y1), (x2, y2): abs(x2 - x1))(*all_data.hdr.area)
    plot.cfg.plot_height = (lambda (x1, y1), (x2, y2): abs(y2 - y1))(*all_data.hdr.area)
    
    # Calculate sensible altitude scaling
    altScale = float(abs(all_data.hdr.hiAlt - all_data.hdr.loAlt)) / 1000.0
    plot.cfg.scale_z = altScale
    plot.cfg.drawmode = '2D'
    plot.cfg.animate = True
    plot.cfg.window_fullscreen = True
    plot.cfg.show_marker = True
    plot.cfg.show_status_bar = True
    
    plot.cfg.status_txt = '[ {:%d/%m/%Y %H:%M:%S %Z} ] [ Mode: {:4s} ] [ Altitude: {:4,d}m ] [ Speed: {:>4.1f}km/h ]'
    plot.cfg.status_values_f = lambda idx : (all_data.data[idx].loc_time
                      , all_data.data[idx].mode
                      , all_data.data[idx].alt
                      , all_data.data[idx].spd
    )
    
    print 'Draw {0} points fitting {1}x{2}'.format(len(xyData), plot.cfg.plot_width, plot.cfg.plot_height)
    
    # Create plot window
    glplot.create_plot_window(plot, [glData], data.processor.track_index)
示例#3
0
def readData(*files):
    dList = []
    for filename in files:

        # Read GSD data from file
        gpxData = io.GPXLoader.load_gpx_file(filename)

        # Pre-process
        dList.append(data.preprocessor.preprocess(gpxData))

    # Synchronise two plots
    (dList[0], dList[1]) = data.preprocessor.synchronize(dList[0], dList[1])

    # Set time zone
    data.processor.set_tz("US/Mountain")

    # Process data
    all_data = data.processor.process(*dList)
    hdr = all_data.hdr
    hdr.print_track_header()

    # (minX, minY) = hdr.area[0]

    # xyData1 = [(stp.x, stp.y) for stp in all_data.data if stp.setID == 0]
    # vData1 = [stp.setID for stp in all_data.data if stp.setID == 0]
    # glData1 = PlotData.build_xy_plot(xyData1, vData1, minX, minY)
    # glData1.compile_vertex_data(renderer.absColourValue, 2)

    # xyData2 = [(stp.x, stp.y) for stp in all_data.data if stp.setID == 1]
    # vData2 = [stp.setID for stp in all_data.data if stp.setID == 1]
    # glData2 = PlotData.build_xy_plot(xyData2, vData2, minX, minY)
    # glData2.compile_vertex_data(renderer.absColourValue, 2)

    xyData = [(stp.x, stp.y) for stp in all_data.data]
    vData = [stp.setID for stp in all_data.data]
    # vData = [stp.alt for stp in all_data.data]
    # vData = [stp.spd for stp in all_data.data]
    # vData = [stp.mode for stp in all_data.data]
    glData = PlotData.build_xy_plot(xyData, vData)
    glData.compile_vertex_data(renderer.absColourValue, 2)

    # Create plot
    plot = glplot.GLPlot()

    # Calculate plot size
    plot.cfg.plot_width = (lambda (x1, y1), (x2, y2): abs(x2 - x1))(*hdr.area)
    plot.cfg.plot_height = (lambda (x1, y1), (x2, y2): abs(y2 - y1))(*hdr.area)

    # Calculate sensible altitude scaling
    altScale = float(abs(hdr.hiAlt - hdr.loAlt)) / 1000.0
    plot.cfg.scale_z = altScale
    plot.cfg.drawmode = "2D"
    plot.cfg.animate = False
    plot.cfg.window_fullscreen = True
    plot.cfg.show_marker = False
    plot.cfg.show_status_bar = False

    # plot.cfg.status_txt = '[ {:%d/%m/%Y %H:%M:%S %Z} ] [ Mode: {:4s} ] [ Altitude: {:4,d}m ] [ Speed: {:>4.1f}km/h ]'
    # plot.cfg.status_values_f = lambda idx : (all_data.data[idx].loc_time
    #                  , all_data.data[idx].mode
    #                  , all_data.data[idx].alt
    #                  , all_data.data[idx].spd
    # )

    # win.init_window()
    # plot.show([glData])
    # plot.show()

    # Create plot window
    glplot.create_plot_window(plot, [glData])