Changeset 1099


Ignore:
Timestamp:
12.01.2016 07:24:53 (4 years ago)
Author:
klaus
Message:

corrected trace positioning (unused space at bottom when many traces plottet)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • SHX/trunk/SeismicHandler/modules/wx_.py

    r1098 r1099  
    810810        globalnorm = self._normtype.startswith("A") 
    811811 
     812        # compute trace height (theight) as float, otherwise trace positioning 
     813        # is weird when many traces on screen. 
    812814        if self.traceOrder in [0, 1]: 
    813815            if numTraces: 
    814                 theight = (height - TIMESCALE - MARGINS[0] - MARGINS[2]) // numTraces 
     816                theight = float(height - TIMESCALE - MARGINS[0] \ 
     817                    - MARGINS[2]) / numTraces 
    815818            else: 
    816                 theight = height - TIMESCALE 
     819                theight = float(height - TIMESCALE) 
    817820            pltwidth = width - STATION_INFO - MARGINS[1] - MARGINS[3] 
    818821        elif self.traceOrder in [2, 3]: 
    819822            if numTraces: 
    820                 theight = (width - TIMESCALE - MARGINS[1] - MARGINS[3]) // numTraces 
     823                theight = (width - TIMESCALE - MARGINS[1] - MARGINS[3]) / numTraces 
    821824            theight = width - TIMESCALE 
    822825            pltwidth = height - STATION_INFO - MARGINS[0] - MARGINS[2] 
    823826        else: 
    824827            raise ValueError("unknown trace order %d" % self.traceorder) 
    825  
     828         
    826829        self.width = width 
    827830        self.height = height 
     
    868871                tzoom = 1. 
    869872 
     873            # zheight is the (integer) height of the drawing box, possibly 
     874            # zoomed by a factor if overlapping_traces is selected. 
    870875            if overlapping_traces: 
    871876                # increased zheight produces overlapping of traces on display 
    872                 zheight = theight * tzoom 
     877                zheight = int( theight * tzoom ) 
    873878                try: 
    874879                    prepzoom = 1./tzoom 
     
    876881                    prepzoom = 1. 
    877882            else: 
    878                 zheight = theight 
     883                zheight = int( theight ) 
    879884                prepzoom = 0.9  # why not 1.? 
    880885 
     
    978983                        fac = i 
    979984                    plotpos = Overlays.plotPos( i+1, fac * theight + MARGINS[0]) 
    980                     print "dbg: i, fac, plotpos, zheight", i, fac, plotpos, zheight 
     985                    print "dbg: i, fac, plotpos, zheight", i, fac, plotpos, zheight, theight 
    981986                    canvas.Blit( 
    982987                        plotoffset + STATION_INFO + MARGINS[3],  
Note: See TracChangeset for help on using the changeset viewer.