Mercurial > hg > svgui
comparison layer/RegionLayer.cpp @ 682:1a0dfcbffaf1
Drop std:: from cout, cerr, endl -- pull these in through Debug.h
author | Chris Cannam |
---|---|
date | Tue, 26 Nov 2013 14:06:40 +0000 |
parents | ece1af8cfffa |
children | 084f65094203 |
comparison
equal
deleted
inserted
replaced
681:eaf4446a1bef | 682:1a0dfcbffaf1 |
---|---|
612 if (!v->getValueExtents(queryUnits, min, max, log)) { | 612 if (!v->getValueExtents(queryUnits, min, max, log)) { |
613 | 613 |
614 min = m_model->getValueMinimum(); | 614 min = m_model->getValueMinimum(); |
615 max = m_model->getValueMaximum(); | 615 max = m_model->getValueMaximum(); |
616 | 616 |
617 // std::cerr << "RegionLayer[" << this << "]::getScaleExtents: min = " << min << ", max = " << max << ", log = " << log << std::endl; | 617 // cerr << "RegionLayer[" << this << "]::getScaleExtents: min = " << min << ", max = " << max << ", log = " << log << endl; |
618 | 618 |
619 } else if (log) { | 619 } else if (log) { |
620 | 620 |
621 LogRange::mapRange(min, max); | 621 LogRange::mapRange(min, max); |
622 | 622 |
623 // std::cerr << "RegionLayer[" << this << "]::getScaleExtents: min = " << min << ", max = " << max << ", log = " << log << std::endl; | 623 // cerr << "RegionLayer[" << this << "]::getScaleExtents: min = " << min << ", max = " << max << ", log = " << log << endl; |
624 | 624 |
625 } | 625 } |
626 | 626 |
627 } else if (m_verticalScale == EqualSpaced) { | 627 } else if (m_verticalScale == EqualSpaced) { |
628 | 628 |
630 SpacingMap::const_iterator i = m_spacingMap.begin(); | 630 SpacingMap::const_iterator i = m_spacingMap.begin(); |
631 min = i->second; | 631 min = i->second; |
632 i = m_spacingMap.end(); | 632 i = m_spacingMap.end(); |
633 --i; | 633 --i; |
634 max = i->second; | 634 max = i->second; |
635 // std::cerr << "RegionLayer[" << this << "]::getScaleExtents: equal spaced; min = " << min << ", max = " << max << ", log = " << log << std::endl; | 635 // cerr << "RegionLayer[" << this << "]::getScaleExtents: equal spaced; min = " << min << ", max = " << max << ", log = " << log << endl; |
636 } | 636 } |
637 | 637 |
638 } else { | 638 } else { |
639 | 639 |
640 min = m_model->getValueMinimum(); | 640 min = m_model->getValueMinimum(); |
693 | 693 |
694 } else { | 694 } else { |
695 | 695 |
696 getScaleExtents(v, min, max, logarithmic); | 696 getScaleExtents(v, min, max, logarithmic); |
697 | 697 |
698 // std::cerr << "RegionLayer[" << this << "]::getYForValue(" << val << "): min = " << min << ", max = " << max << ", log = " << logarithmic << std::endl; | 698 // cerr << "RegionLayer[" << this << "]::getYForValue(" << val << "): min = " << min << ", max = " << max << ", log = " << logarithmic << endl; |
699 // std::cerr << "h = " << h << ", margin = " << margin << std::endl; | 699 // cerr << "h = " << h << ", margin = " << margin << endl; |
700 | 700 |
701 if (logarithmic) { | 701 if (logarithmic) { |
702 val = LogRange::map(val); | 702 val = LogRange::map(val); |
703 } | 703 } |
704 | 704 |
738 int iy = spacingIndexToY(v, ivh); | 738 int iy = spacingIndexToY(v, ivh); |
739 | 739 |
740 int dist = iy - y; | 740 int dist = iy - y; |
741 int gap = h / n; // between region lines | 741 int gap = h / n; // between region lines |
742 | 742 |
743 // std::cerr << "getValueForY: y = " << y << ", vh = " << vh << ", ivh = " << ivh << " of " << n << ", iy = " << iy << ", dist = " << dist << ", gap = " << gap << std::endl; | 743 // cerr << "getValueForY: y = " << y << ", vh = " << vh << ", ivh = " << ivh << " of " << n << ", iy = " << iy << ", dist = " << dist << ", gap = " << gap << endl; |
744 | 744 |
745 SpacingMap::const_iterator i = m_spacingMap.begin(); | 745 SpacingMap::const_iterator i = m_spacingMap.begin(); |
746 while (i != m_spacingMap.end()) { | 746 while (i != m_spacingMap.end()) { |
747 if (i->second == ivh) break; | 747 if (i->second == ivh) break; |
748 ++i; | 748 ++i; |
749 } | 749 } |
750 if (i == m_spacingMap.end()) i = m_spacingMap.begin(); | 750 if (i == m_spacingMap.end()) i = m_spacingMap.begin(); |
751 | 751 |
752 // std::cerr << "nearest existing value = " << i->first << " at " << iy << std::endl; | 752 // cerr << "nearest existing value = " << i->first << " at " << iy << endl; |
753 | 753 |
754 float val = 0; | 754 float val = 0; |
755 | 755 |
756 // std::cerr << "note: avoid = " << avoid << ", i->second = " << i->second << std::endl; | 756 // cerr << "note: avoid = " << avoid << ", i->second = " << i->second << endl; |
757 | 757 |
758 if (dist < -gap/3 && | 758 if (dist < -gap/3 && |
759 ((avoid == -1) || | 759 ((avoid == -1) || |
760 (avoid != i->second && avoid != i->second - 1))) { | 760 (avoid != i->second && avoid != i->second - 1))) { |
761 // bisect gap to prior | 761 // bisect gap to prior |
762 if (i == m_spacingMap.begin()) { | 762 if (i == m_spacingMap.begin()) { |
763 val = i->first - 1.f; | 763 val = i->first - 1.f; |
764 // std::cerr << "extended down to " << val << std::endl; | 764 // cerr << "extended down to " << val << endl; |
765 } else { | 765 } else { |
766 SpacingMap::const_iterator j = i; | 766 SpacingMap::const_iterator j = i; |
767 --j; | 767 --j; |
768 val = (i->first + j->first) / 2; | 768 val = (i->first + j->first) / 2; |
769 // std::cerr << "bisected down to " << val << std::endl; | 769 // cerr << "bisected down to " << val << endl; |
770 } | 770 } |
771 } else if (dist > gap/3 && | 771 } else if (dist > gap/3 && |
772 ((avoid == -1) || | 772 ((avoid == -1) || |
773 (avoid != i->second && avoid != i->second + 1))) { | 773 (avoid != i->second && avoid != i->second + 1))) { |
774 // bisect gap to following | 774 // bisect gap to following |
775 SpacingMap::const_iterator j = i; | 775 SpacingMap::const_iterator j = i; |
776 ++j; | 776 ++j; |
777 if (j == m_spacingMap.end()) { | 777 if (j == m_spacingMap.end()) { |
778 val = i->first + 1.f; | 778 val = i->first + 1.f; |
779 // std::cerr << "extended up to " << val << std::endl; | 779 // cerr << "extended up to " << val << endl; |
780 } else { | 780 } else { |
781 val = (i->first + j->first) / 2; | 781 val = (i->first + j->first) / 2; |
782 // std::cerr << "bisected up to " << val << std::endl; | 782 // cerr << "bisected up to " << val << endl; |
783 } | 783 } |
784 } else { | 784 } else { |
785 // snap | 785 // snap |
786 val = i->first; | 786 val = i->first; |
787 // std::cerr << "snapped to " << val << std::endl; | 787 // cerr << "snapped to " << val << endl; |
788 } | 788 } |
789 | 789 |
790 return val; | 790 return val; |
791 | 791 |
792 } else { | 792 } else { |