void QamTachymeter::drawBackground(QPainter& painter ) { float w, h ; // épaisseur et longueur du trait de graduation QColor black1(15,13,11) ; QColor black2(34,32,27) ; QColor white(210,200,190) ; QColor red(221,65,57) ; QColor yellow(205,185,83) ; QColor green(101,149,112) ; QFont fo1("arial.ttf", 60 ) ; QFont fo2("arial.ttf", 50 ) ; // fond qfiBackground(painter, m_radius[ROTOR]+ 50, 10 ) ; // graduations "Turbine" painter.save() ; painter.rotate( m_start[TURBINE] ) ; for ( int i = 0 ; i <= ( m_max[TURBINE] - m_min[TURBINE] ) ; ++i ) { if ( i % 10 == 0 ) { w = 20 ; h = 70 ; } else if ( i % 5 == 0 ) { w = 10 ; h = 60 ; } else { w = 4 ; h = 40 ; } qfiMarker(painter, white, m_radius[TURBINE] - 10, QSize( w, h ) ) ; painter.rotate( m_step[TURBINE] ) ; } painter.restore() ; // sérigraphie "Turbine" for ( int i = 0 ; i <= ( m_max[TURBINE] - m_min[TURBINE] ) ; i += 10 ) { float alpha = qDegreesToRadians( m_start[TURBINE] + i * m_step[TURBINE] ) ; float r = m_radius[TURBINE] - 120 ; qfiText(painter, fo1, white, QPoint( r * qCos(alpha), r * qSin(alpha) ), QString("%1").arg(i) ) ; } qfiText(painter, fo1, white, QPoint( 0, 0.8 * m_radius[TURBINE] ), label(TURBINE) ) ; qfiText(painter, fo2, white, QPoint( 0, 0.9 * m_radius[TURBINE] ), unit(TURBINE) ) ; // seuils "Turbine" w = 20 ; h = 90 ; painter.save() ; painter.rotate(m_start[TURBINE] + m_step[TURBINE] * lowThreshold(TURBINE) / 1000 ) ; qfiMarker(painter, red, m_radius[TURBINE] - 10, QSize(w, h ) ) ; painter.restore() ; painter.save() ; painter.rotate(m_start[TURBINE] + m_step[TURBINE] * highThreshold(TURBINE) / 1000 ) ; qfiMarker(painter, red, m_radius[TURBINE] - 10, QSize(w, h ) ) ; painter.restore() ; // zones colorées "Turbine" float radius = m_radius[TURBINE] - 80 ; float start = m_start[TURBINE] + m_step[TURBINE] * lowThreshold(TURBINE) / 100 + 4 ; float span = m_step[TURBINE] * ( ( ( highThreshold(TURBINE) - lowThreshold(TURBINE) ) / 1000 ) / 3 - 0.75 ) ; qfiArc(painter, yellow, radius, start, span, 24 ) ; start += span + 4 ; span = m_step[TURBINE] * ( ( ( highThreshold(TURBINE) - lowThreshold(TURBINE) ) / 1000 ) / 3 - 0.5 ) ; qfiArc(painter, green, radius, start, span, 24 ) ; start += span + 4 ; span = m_step[TURBINE] * ( ( ( highThreshold(TURBINE) - lowThreshold(TURBINE) ) / 1000 ) / 3 - 0.8 ) ; qfiArc(painter, yellow, radius, start, span, 24 ) ; // graduations "Rotor" painter.save() ; radius = m_radius[ROTOR] ; qfiArc(painter, white, radius, m_start[ROTOR], m_span[ROTOR], 5 ) ; QPen pen( white ) ; pen.setWidth(1) ; painter.setPen( pen ) ; painter.setBrush( white ) ; painter.rotate( m_start[ROTOR] ) ; for ( int i = 0 ; i <= ( m_max[ROTOR] - m_min[ROTOR] ) ; ++i ) { if ( i % 5 == 0 ) { w = 10 ; h = 60 ; } else { w = 6 ; h = 40 ; } qfiMarker(painter, white, m_radius[ROTOR], QSize(w, h ) ) ; painter.rotate( m_step[ROTOR] ) ; } painter.restore() ; // sérigraphie "Rotor" for ( int i = 0 ; i <= ( m_max[ROTOR] - m_min[ROTOR] ) ; i += 10 ) { float alpha = qDegreesToRadians( m_start[ROTOR] + i * m_step[ROTOR] ) ; float r = m_radius[ROTOR] - 90 ; qfiText(painter, fo2, white, QPoint( r * qCos(alpha), r * qSin(alpha) ), QString("%1").arg(i/10) ) ; } qfiText(painter, fo1, white, QPoint( 0, m_radius[ROTOR] / 4 ), label(ROTOR) ) ; qfiText(painter, fo2, white, QPoint( 0, -m_radius[ROTOR] / 4 ), unit(ROTOR) ) ; // seuils "Rotor" w = 20 ; h = 100 ; painter.save() ; painter.rotate(m_start[ROTOR] + m_step[ROTOR] * lowThreshold(ROTOR) / 10 ) ; qfiMarker(painter, red, m_radius[ROTOR] + 40, QSize(w, h ) ) ; painter.restore() ; painter.save() ; painter.rotate(m_start[ROTOR] + m_step[ROTOR] * highThreshold(ROTOR) / 10 ) ; qfiMarker(painter, red, m_radius[ROTOR] + 40, QSize(w, h ) ) ; painter.restore() ; // zones colorées "Rotor" radius = m_radius[ROTOR] + 25 ; start = m_start[ROTOR] + m_step[ROTOR] * lowThreshold(ROTOR) / 10 + 5 ; span = m_step[ROTOR] * 3.5 ; qfiArc(painter, yellow, radius, start, span, 24 ) ; start += span + 5 ; span = m_step[ROTOR] * ( ( highThreshold(ROTOR) - lowThreshold(ROTOR) ) / 10 - 5.5 ) ; qfiArc(painter, green, radius, start, span, 24 ) ; }
void CannyFittingDetector::lowThreshold(int lT) { // 0 < lowThreshold < highThreshold m_lowThreshold = (lT<0) ? 0 : ((lT>highThreshold()) ? highThreshold() : lT); return; }