Bug 5953: Plotting: Patterned lines sometimes look solid [1] Bug Number: 5953 Release notes (y/n): Yes For Release Nums: 7.1 See document and screenshots: http://cadswes2.colorado.edu/~philw/pub/5953/DensePattCurveFix.html http://cadswes2.colorado.edu/~philw/pub/5953/DenseCurve2-Prob.png http://cadswes2.colorado.edu/~philw/pub/5953/DenseCurve2-Fix.png http://cadswes2.colorado.edu/~philw/pub/5953/FixDisabledDiag.png Initial analysis: http://cadswes2.colorado.edu/~philw/pub/2017/Qwt/DenseProb.html RiverWare plot curves with a good number of data points (e.g. 500+) and a dotted or dashed line style sometimes appear as solid lines. This can occur with a thin line, but is more prevalent with a line width (thickness) of two or more pixels. The prevalence of this problem is also dependent on the curve style -- less so with 'Linear Interpolation' -- more with Spline, Points, or Step. The fix involves a point filter (the Qwt "Weed Curve Fitter") which has the possibility of negatively impacting plot performance. We haven't actually seen a problem with the application of this point filter with long series (tested with 30,000-timestep series slots), but in case this does turn out to create a problem for particular users, we have provided a way to disable this filter through the use of a special environment variable. The filter is disabled if the following environment variable is defined and has a non-zero value (e.g. "1"): RIVERWARE_PLOT_DISABLE_WEED_FITTER If the filter is disabled (using this environment variable), the following message is written to RiverWare diagnostics when the first non-empty plot is shown: The fix for dense dotted or dashed plot curves looking solid has been disabled with the "RIVERWARE_PLOT_DISABLE_WEED_FITTER" environment variable (non-zero value). =============== Technical Notes =============== The fix is effectively accomplished by removing points from the plotted curve which redundantly fall within a pixel or two of adjacent points -- at the current zoom level of the plot. (This doesn't remove point-symbols, if those are also shown for a curve). This is accomplished with the "QwtWeedingCurveFitter" class (part of the Qwt version 6.1.3 library used to implement RiverWare plots). We have been warned that this filter could cause performance problems with long curves (having many points) if it is used in the canonical way (installed on the curve to be automatically applied to pixel coordinates each time the curve is drawn). The recommended alternative of applying it to application-unit points before handing the point series over to Qwt isn't really mathematically valid AND wouldn't reliably address the problem anyway. In our own testing with long series (e.g. 30,000 timesteps) we haven't seen any additional slowness, beyond what is experienced with such large curves in general. See the discussion in these thread on the QtCentre/Qwt forum: Dense Qwt curves with dotted or dashed line style generally look solid. http://www.qtcentre.org/threads/68094 [4-5-2017]. QwtCurveFitter::fitCurve called only for "Lines" style QwtPlotCurves -- not "Steps". http://www.qtcentre.org/threads/68109 [4-11-2017] Each Qwt plot curve can be assigned a single "curve fitter" instance, of which there are two types: (a) QwtSplineCurveFitter, and (b) QwtWeedingCurveFitter. RiverWare had already been making use of the Spline Fitter -- this is how we provide the "Spline" curve style (as "Spline" is not a native Qwt curve style, as such). We had to sublcass QwtSplineCurveFitter in order to apply both fitters for spline curves. For this fix, we also subclassed QwtWeedingCurveFitter so that we could control the application of the actual fitter computation with RiverWare application-level provisions. See these two classes in the Q3GUI/SlotCurve module, and this Qwt API reference webpage: class SlotCurve::SplineFitter : public QwtSplineCurveFitter; class SlotCurve::WeedFitter : public QwtWeedingCurveFitter; http://qwt.sourceforge.net/class_qwt_curve_fitter.html Unfortunately, Qwt doesn't make use of its Curve Fitters for curves having the "Step" curve style. So, we needed to create our own "stepped" line data from slot data, and present that to Qwt with the "linear" (-interpolation) curve style. See this SlotCurve method: void SlotCurve::precomputeStepPoints (bool applyToo /*=false*/); ---