featuregui.h

Go to the documentation of this file.
00001 /*******************************************************************************
00002  *                                                                             *
00003  *   Copyright (C) 2003  Erik Sjolund,  (<html>Erik Sj&ouml;lund</html>)       *
00004  *                       Center for Genomics and Bioinformatics,               *
00005  *                       Karolinska Institutet,                                *
00006  *                       Stockholm,                                            *
00007  *                       Sweden                                                *
00008  *                                                                             *
00009  *  Author: Erik Sjolund                                                       *
00010  *  Email: erik.sjolund@adivo.se                                               *
00011  *                                                                             *
00012  *******************************************************************************
00013  */
00014 
00015 #ifndef FEATUREGUI_H
00016 #define FEATUREGUI_H
00017 
00018 class QPainter;
00019 class Dbt;
00020 
00021 class FeatureData;
00022 class SpatialFeatureData;
00023 class DnpData;
00024 class DnaStrData;
00025 class ChromatData;
00026 class QualityData;
00027 class TagData;
00028 
00029 // just for Q_UINT64 ...
00030 
00031 #include <qpainter.h>
00032 #include <iostream>
00033 #include "trappertypes.h"
00034 
00035 using namespace std;
00036 
00037 /** \brief Abstract class for the visual appereance of a feature. Each FeatureData derived class will have a corresponding FeatureGui derived class with a specialized paintMe() method.
00038 
00039   */
00040 
00041 class FeatureGui
00042 {
00043 public:
00044   FeatureGui( SpatialFeatureData * data ) : m_data( data )
00045   {}
00046   virtual ~FeatureGui()
00047   {}
00048   void paint( QPainter * p, TR_PIX x_pix, TR_PIX y_pix, TR_DNA x1_dna, TR_DNA x2_dna,
00049               /*int*/double width, int height, int center);
00050 protected:
00051   SpatialFeatureData * m_data;
00052   /**
00053    * Paints the visual appearance of a feature.
00054    * @param p the QPainter to paint to
00055    * @param x_pix the pixel coordinate of the upper left corner of the rectangle where the feature should be painted 
00056    * @param y_pix the pixel coordinate of the upper left corner of the rectangle where the feature should be painted 
00057    * @param x1_dna the left most position that should be painted given as a dna coordinate relative the left side of the read.
00058    * @param x2_dna the right most position that should be painted given as a dna coordinate relative the left side of the read.
00059    */
00060   virtual void paintMe( QPainter * p, TR_PIX x_pix, TR_PIX y_pix, TR_DNA x1_dna, TR_DNA x2_dna,
00061                         /*int*/double width, int height, int center) = 0;
00062   
00063 };
00064 
00065 /** \brief The visual appearance of a DnpData  
00066   */
00067 
00068 class DnpGui : public FeatureGui
00069 {
00070 public:
00071     DnpGui( SpatialFeatureData * data ) : FeatureGui( data )
00072     {
00073 //         cerr << "in dnpgui ctor" << endl;
00074     }
00075     void paintMe( QPainter * p, TR_PIX x_pix, TR_PIX y_pix, TR_DNA x1_dna, TR_DNA x2_dna,
00076                   /*int*/double width, int height, int center);
00077     DnpData * dnpData();
00078 };
00079 
00080 /** \brief The visual appearance of a DnaStrData  
00081   */
00082 
00083 class DnaStrGui : public FeatureGui
00084 {
00085 public:
00086     DnaStrGui( SpatialFeatureData * data ) : FeatureGui( data )
00087     {
00088       f.setFamily("Luxi Mono");
00089       f.setFixedPitch( true );
00090       oldRequestedHeight = 0;
00091       oldRequestedWidth = 0;
00092       currentHeight = 0;
00093       currentWidth = 0;
00094       currentDescent = 0;
00095 //       cerr << "in dnastrgui ctor" << endl;
00096     }
00097   void paintMe( QPainter * p, TR_PIX x_pix, TR_PIX y_pix, TR_DNA x1_dna, TR_DNA x2_dna,
00098                 /*int*/double width, int height, int center);
00099 private:
00100   DnaStrData * dnaStrData( );
00101   QFont f;
00102   int currentWidth, currentHeight, oldRequestedHeight, oldRequestedWidth, currentDescent;
00103 };
00104 
00105 /** \brief The visual appearance of a ChromatData  
00106   */
00107 
00108 class ChromatGui : public FeatureGui
00109 {
00110 public:
00111   ChromatGui( SpatialFeatureData * data );
00112   void paintMe( QPainter * p, TR_PIX x_pix, TR_PIX y_pix, TR_DNA x1_dna, TR_DNA x2_dna,
00113                 /*int*/double width, int height, int center);
00114 private:
00115   ChromatData * chromatData( );
00116 };
00117 
00118 /** \brief The visual appearance of a QualityData  
00119   */
00120 class QualityGui : public FeatureGui
00121 {
00122 public:
00123     QualityGui( SpatialFeatureData * data ) : FeatureGui( data )
00124     {
00125 //         cerr << "in qualitygui ctor" << endl;
00126     }
00127     void paintMe( QPainter * p, TR_PIX x_pix, TR_PIX y_pix, TR_DNA x1_dna, TR_DNA x2_dna,
00128                   /*int*/double width, int height, int center);
00129 private:
00130     QualityData * qualityData( );
00131 };
00132 
00133 /** \brief The visual appearance of a TagData
00134   */
00135 
00136 class TagGui : public FeatureGui
00137 {
00138 public:
00139     TagGui( SpatialFeatureData * data ) : FeatureGui( data )
00140     {
00141     }
00142     void paintMe( QPainter * p, TR_PIX x_pix, TR_PIX y_pix, TR_DNA x1_dna, TR_DNA x2_dna,
00143                   /*int*/double width, int height, int center);
00144     TagData* tagData();
00145 };
00146 
00147 #endif

Generated on Fri Jul 17 20:19:29 2009 for ngsview by  doxygen 1.5.1