comparison layer/RegionLayer.cpp @ 587:4806715f7a19

Seems to be a bad idea to use plain DEBUG symbol on OS/X (system wants it)
author Chris Cannam
date Tue, 14 Jun 2011 15:27:05 +0100
parents f4960f8ce798
children ece1af8cfffa
comparison
equal deleted inserted replaced
586:1ae54a29e59e 587:4806715f7a19
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 // DEBUG << "RegionLayer::setModel(" << model << ")" << endl; 64 // SVDEBUG << "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 // DEBUG << "RegionLayer::recalcSpacing" << endl; 242 // SVDEBUG << "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 // DEBUG << "RegionLayer::recalcSpacing: value found: " << i->value << " (now have " << m_distributionMap[i->value] << " of this value)" << endl; 247 // SVDEBUG << "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 // DEBUG << "RegionLayer::recalcSpacing: " << i->first << " -> " << m_spacingMap[i->first] << endl; 255 // SVDEBUG << "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 // DEBUG << "RegionLayer::getYForValue: value " << val << " -> i->second " << i->second << " -> y " << y << endl; 683 // SVDEBUG << "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 // DEBUG << "RegionLayer::getColourForValue: min " << min << ", max " 814 // SVDEBUG << "RegionLayer::getColourForValue: min " << min << ", max "
815 // << max << ", log " << log << ", value " << val << 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 }
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 // DEBUG << "RegionLayer::paint: resolution is " 851 // SVDEBUG << "RegionLayer::paint: resolution is "
852 // << m_model->getResolution() << " frames" << 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;