comparison layer/RegionLayer.cpp @ 585:f4960f8ce798 debug-output

Convert many cerrs to DEBUGs
author Chris Cannam
date Mon, 16 May 2011 17:19:25 +0100
parents 5bcfc5606528
children 4806715f7a19
comparison
equal deleted inserted replaced
584:1fe7951a61e8 585:f4960f8ce798
59 connectSignals(m_model); 59 connectSignals(m_model);
60 60
61 connect(m_model, SIGNAL(modelChanged()), this, SLOT(recalcSpacing())); 61 connect(m_model, SIGNAL(modelChanged()), this, SLOT(recalcSpacing()));
62 recalcSpacing(); 62 recalcSpacing();
63 63
64 // std::cerr << "RegionLayer::setModel(" << model << ")" << std::endl; 64 // DEBUG << "RegionLayer::setModel(" << model << ")" << endl;
65 65
66 emit modelReplaced(); 66 emit modelReplaced();
67 } 67 }
68 68
69 Layer::PropertyList 69 Layer::PropertyList
237 { 237 {
238 m_spacingMap.clear(); 238 m_spacingMap.clear();
239 m_distributionMap.clear(); 239 m_distributionMap.clear();
240 if (!m_model) return; 240 if (!m_model) return;
241 241
242 // std::cerr << "RegionLayer::recalcSpacing" << std::endl; 242 // DEBUG << "RegionLayer::recalcSpacing" << endl;
243 243
244 for (RegionModel::PointList::const_iterator i = m_model->getPoints().begin(); 244 for (RegionModel::PointList::const_iterator i = m_model->getPoints().begin();
245 i != m_model->getPoints().end(); ++i) { 245 i != m_model->getPoints().end(); ++i) {
246 m_distributionMap[i->value]++; 246 m_distributionMap[i->value]++;
247 // std::cerr << "RegionLayer::recalcSpacing: value found: " << i->value << " (now have " << m_distributionMap[i->value] << " of this value)" << std::endl; 247 // DEBUG << "RegionLayer::recalcSpacing: value found: " << i->value << " (now have " << m_distributionMap[i->value] << " of this value)" << endl;
248 } 248 }
249 249
250 int n = 0; 250 int n = 0;
251 251
252 for (SpacingMap::const_iterator i = m_distributionMap.begin(); 252 for (SpacingMap::const_iterator i = m_distributionMap.begin();
253 i != m_distributionMap.end(); ++i) { 253 i != m_distributionMap.end(); ++i) {
254 m_spacingMap[i->first] = n++; 254 m_spacingMap[i->first] = n++;
255 // std::cerr << "RegionLayer::recalcSpacing: " << i->first << " -> " << m_spacingMap[i->first] << std::endl; 255 // DEBUG << "RegionLayer::recalcSpacing: " << i->first << " -> " << m_spacingMap[i->first] << endl;
256 } 256 }
257 } 257 }
258 258
259 bool 259 bool
260 RegionLayer::getValueExtents(float &min, float &max, 260 RegionLayer::getValueExtents(float &min, float &max,
678 SpacingMap::const_iterator i = m_spacingMap.lower_bound(val); 678 SpacingMap::const_iterator i = m_spacingMap.lower_bound(val);
679 //!!! what now, if i->first != v? 679 //!!! what now, if i->first != v?
680 680
681 int y = spacingIndexToY(v, i->second); 681 int y = spacingIndexToY(v, i->second);
682 682
683 // std::cerr << "RegionLayer::getYForValue: value " << val << " -> i->second " << i->second << " -> y " << y << std::endl; 683 // DEBUG << "RegionLayer::getYForValue: value " << val << " -> i->second " << i->second << " -> y " << y << endl;
684 return y; 684 return y;
685 685
686 686
687 } else { 687 } else {
688 688
809 if (log) { 809 if (log) {
810 LogRange::mapRange(min, max); 810 LogRange::mapRange(min, max);
811 val = LogRange::map(val); 811 val = LogRange::map(val);
812 } 812 }
813 813
814 // std::cerr << "RegionLayer::getColourForValue: min " << min << ", max " 814 // DEBUG << "RegionLayer::getColourForValue: min " << min << ", max "
815 // << max << ", log " << log << ", value " << val << std::endl; 815 // << max << ", log " << log << ", value " << val << endl;
816 816
817 QColor solid = ColourMapper(m_colourMap, min, max).map(val); 817 QColor solid = ColourMapper(m_colourMap, min, max).map(val);
818 return QColor(solid.red(), solid.green(), solid.blue(), 120); 818 return QColor(solid.red(), solid.green(), solid.blue(), 120);
819 } 819 }
820 820
846 paint.setPen(getBaseQColor()); 846 paint.setPen(getBaseQColor());
847 847
848 QColor brushColour(getBaseQColor()); 848 QColor brushColour(getBaseQColor());
849 brushColour.setAlpha(80); 849 brushColour.setAlpha(80);
850 850
851 // std::cerr << "RegionLayer::paint: resolution is " 851 // DEBUG << "RegionLayer::paint: resolution is "
852 // << m_model->getResolution() << " frames" << std::endl; 852 // << m_model->getResolution() << " frames" << endl;
853 853
854 float min = m_model->getValueMinimum(); 854 float min = m_model->getValueMinimum();
855 float max = m_model->getValueMaximum(); 855 float max = m_model->getValueMaximum();
856 if (max == min) max = min + 1.0; 856 if (max == min) max = min + 1.0;
857 857