comparison layer/SliceLayer.cpp @ 1233:1a7c2ca31579

Scale pen, place line ends in centres of bins, default to line mode
author Chris Cannam
date Thu, 26 Jan 2017 21:19:49 +0000
parents ee01a4062747
children 4d0ca1ab4cd0
comparison
equal deleted inserted replaced
1232:de1792daae07 1233:1a7c2ca31579
32 SliceLayer::SliceLayer() : 32 SliceLayer::SliceLayer() :
33 m_sliceableModel(0), 33 m_sliceableModel(0),
34 m_colourMap(0), 34 m_colourMap(0),
35 m_energyScale(dBScale), 35 m_energyScale(dBScale),
36 m_samplingMode(SampleMean), 36 m_samplingMode(SampleMean),
37 m_plotStyle(PlotSteps), 37 m_plotStyle(PlotLines),
38 m_binScale(LinearBins), 38 m_binScale(LinearBins),
39 m_normalize(false), 39 m_normalize(false),
40 m_threshold(0.0), 40 m_threshold(0.0),
41 m_initialThreshold(0.0), 41 m_initialThreshold(0.0),
42 m_gain(1.0), 42 m_gain(1.0),
329 paint.drawLine(0, m_scalePoints[i], rect.width(), m_scalePoints[i]); 329 paint.drawLine(0, m_scalePoints[i], rect.width(), m_scalePoints[i]);
330 } 330 }
331 } 331 }
332 } 332 }
333 333
334 paint.setPen(getBaseQColor()); 334 if (m_plotStyle == PlotBlocks) {
335 // Must use actual zero-width pen, too slow otherwise
336 paint.setPen(QPen(getBaseQColor(), 0));
337 } else {
338 paint.setPen(PaintAssistant::scalePen(getBaseQColor()));
339 }
335 340
336 int xorigin = getVerticalScaleWidth(v, true, paint) + 1; 341 int xorigin = getVerticalScaleWidth(v, true, paint) + 1;
337 int w = v->getPaintWidth() - xorigin - 1; 342 int w = v->getPaintWidth() - xorigin - 1;
338 343
339 m_xorigins[v] = xorigin; // for use in getFeatureDescription 344 m_xorigins[v] = xorigin; // for use in getFeatureDescription
421 double y = getYForValue(value, v, norm); 426 double y = getYForValue(value, v, norm);
422 427
423 if (m_plotStyle == PlotLines) { 428 if (m_plotStyle == PlotLines) {
424 429
425 if (bin == 0) { 430 if (bin == 0) {
426 path.moveTo(x, y); 431 path.moveTo((x + nx) / 2, y);
427 } else { 432 } else {
428 path.lineTo(x, y); 433 path.lineTo((x + nx) / 2, y);
429 } 434 }
430 435
431 } else if (m_plotStyle == PlotSteps) { 436 } else if (m_plotStyle == PlotSteps) {
432 437
433 if (bin == 0) { 438 if (bin == 0) {