00001 /******************************************************************************* 00002 * * 00003 * Copyright (C) 2003 Erik Sjolund, (<html>Erik Sjö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 VIEWMODE_H 00016 #define VIEWMODE_H 00017 00018 #include <qstring.h> 00019 #include <qptrlist.h> 00020 #include <string> 00021 class QString; 00022 class QDomElement; 00023 class TrapperDoc; 00024 #include <qdict.h> 00025 #include "generaldata.h" 00026 #include "featuredata.h" 00027 #include "trappertypes.h" 00028 00029 00030 typedef QDict<Database::SecondaryIterator<FeatureData> > SecItDict; 00031 00032 /** \brief To hold the configuration of a single layer in a view mode ( ViewMode ). It knows its height and which features that should 00033 be painted in this layer. */ 00034 00035 00036 class Layer 00037 { 00038 public: 00039 Layer( const QDomElement & elem, SecItDict & ); 00040 ~Layer() 00041 {} 00042 TR_PIX heightInPix( TR_PIX totalheight ); 00043 typedef QPtrList< Database::SecondaryIterator<FeatureData> > FeatureList; 00044 bool allowOverlap; 00045 int height; 00046 FeatureList featureList; 00047 }; 00048 00049 /** \brief To hold the configuration of a single view mode. A view mode specifies which features should be shown and 00050 how each read should be sliced in layers. */ 00051 00052 class ViewMode 00053 { 00054 public: 00055 ViewMode( QDomElement & elem, SecItDict & secItDict ); 00056 ~ViewMode() 00057 {} 00058 QString name(); 00059 typedef QPtrList< Layer > LayerList; 00060 LayerList layerList; 00061 int zoom; 00062 QString m_name; 00063 00064 }; 00065 00066 /** \brief To hold all configured view modes ( of class ViewMode ) */ 00067 00068 class ViewModes 00069 { 00070 public: 00071 ViewModes( const QString & viewMode, TrapperDoc * doc ); 00072 ~ViewModes() 00073 {} 00074 QString mode(); 00075 void setMode(QString); 00076 00077 ViewMode * currentViewMode(); 00078 00079 protected: 00080 void initFeatureIterators(TrapperDoc *); 00081 QString m_name; 00082 QDict<ViewMode> viewModeDict; 00083 SecItDict secItDict; 00084 ViewMode * m_currentViewMode; 00085 }; 00086 #endif