Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

DnaStrGui Class Reference

The visual appearance of a DnaStrData. More...

#include <featuregui.h>

Inheritance diagram for DnaStrGui:

Inheritance graph
[legend]
Collaboration diagram for DnaStrGui:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 DnaStrGui (FeatureData *data)
void paintMe (QPainter *p, TR_PIX x_pix, TR_PIX y_pix, TR_DNA x1_dna, TR_DNA x2_dna, double width, int height, int center)

Private Member Functions

DnaStrDatadnaStrData ()

Private Attributes

QFont f
int currentWidth
int currentHeight
int oldRequestedHeight
int oldRequestedWidth
int currentDescent

Detailed Description

The visual appearance of a DnaStrData.

Definition at line 81 of file featuregui.h.


Constructor & Destructor Documentation

DnaStrGui::DnaStrGui FeatureData data  )  [inline]
 

Definition at line 84 of file featuregui.h.

References currentDescent, currentHeight, currentWidth, f, oldRequestedHeight, and oldRequestedWidth.

00084                                     : FeatureGui( data )
00085     {
00086       f.setFamily("Luxi Mono");
00087       f.setFixedPitch( true );
00088       oldRequestedHeight = 0;
00089       oldRequestedWidth = 0;
00090       currentHeight = 0;
00091       currentWidth = 0;
00092       currentDescent = 0;
00093 //       cerr << "in dnastrgui ctor" << endl;
00094     }


Member Function Documentation

DnaStrData * DnaStrGui::dnaStrData  )  [private]
 

Definition at line 109 of file featuregui.cpp.

References FeatureGui::m_data.

Referenced by paintMe().

00110 {
00111     return dynamic_cast<DnaStrData *>( m_data );
00112 }

void DnaStrGui::paintMe QPainter *  p,
TR_PIX  x_pix,
TR_PIX  y_pix,
TR_DNA  x1_dna,
TR_DNA  x2_dna,
double  width,
int  height,
int  center
[virtual]
 

Paints the visual appearance of a feature.

Parameters:
p the QPainter to paint to
x_pix the pixel coordinate of the upper left corner of the rectangle where the feature should be painted
y_pix the pixel coordinate of the upper left corner of the rectangle where the feature should be painted
x1_dna the left most position that should be painted given as a dna coordinate relative the left side of the read.
x2_dna the right most position that should be painted given as a dna coordinate relative the left side of the read.

Implements FeatureGui.

Definition at line 114 of file featuregui.cpp.

References currentDescent, currentHeight, currentWidth, dnaStrData(), DnaStrData::dnaVector, f, oldRequestedHeight, oldRequestedWidth, and TrapperVector< T >::stlVector().

00116 {
00117   if ( height != oldRequestedHeight || width != oldRequestedWidth ) {
00118     oldRequestedHeight = height;
00119     oldRequestedWidth = width;
00120     
00121     int sz = height;
00122     
00123     while ( sz > 0 ) {
00124       f.setPointSize( sz );
00125       QFontMetrics fm( f );
00126       
00127       if ( fm.width('m') <= width && fm.height() <= height ) {
00128         currentHeight = fm.height();
00129         currentDescent = fm.descent();
00130         currentWidth = fm.width('m');
00131         break;
00132       }
00133       --sz;
00134     }
00135   }
00136   
00137   QString str;
00138   QBrush brush;
00139   brush.setStyle( Qt::SolidPattern );
00140   
00141   QColor color;
00142   brush.setColor( Qt::black );
00143   
00144   p->setFont(f);
00145   
00146   int pixelsHigh = currentHeight;
00147   
00148   
00149   for ( int i = x1_dna; i <= x2_dna ; ++i ) {
00150     char c = dnaStrData()->dnaVector.stlVector()[i];
00151     QChar c2( c );
00152     QString a( c2 );
00153     p->drawText( x_pix + ( ( i- x1_dna ) + 0.25)* width , y_pix + height - ( ( height - pixelsHigh ) / 2 )- currentDescent, a );
00154   }
00155   return;
00156 }


Member Data Documentation

int DnaStrGui::currentDescent [private]
 

Definition at line 100 of file featuregui.h.

Referenced by DnaStrGui(), and paintMe().

int DnaStrGui::currentHeight [private]
 

Definition at line 100 of file featuregui.h.

Referenced by DnaStrGui(), and paintMe().

int DnaStrGui::currentWidth [private]
 

Definition at line 100 of file featuregui.h.

Referenced by DnaStrGui(), and paintMe().

QFont DnaStrGui::f [private]
 

Definition at line 99 of file featuregui.h.

Referenced by DnaStrGui(), and paintMe().

int DnaStrGui::oldRequestedHeight [private]
 

Definition at line 100 of file featuregui.h.

Referenced by DnaStrGui(), and paintMe().

int DnaStrGui::oldRequestedWidth [private]
 

Definition at line 100 of file featuregui.h.

Referenced by DnaStrGui(), and paintMe().


The documentation for this class was generated from the following files:
Generated on Fri Mar 17 17:44:57 2006 for trapper by  doxygen 1.4.4