00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef OST_SEQUENCE_VIEWER_SEQUENCE_MODEL
00020 #define OST_SEQUENCE_VIEWER_SEQUENCE_MODEL
00021
00022
00023
00024
00025
00026 #include <QAbstractTableModel>
00027 #include <QItemSelection>
00028
00029 #include <ost/mol/chain_view.hh>
00030
00031 #include <ost/seq/sequence_list.hh>
00032 #include <ost/seq/alignment_handle.hh>
00033
00034 #include <ost/gfx/entity.hh>
00035
00036 #include "base_view_object.hh"
00037 #include "alignment_view_object.hh"
00038 #include "sequence_view_object.hh"
00039
00040 namespace ost { namespace gui {
00041
00042 class SequenceModel : public QAbstractTableModel
00043 {
00044 Q_OBJECT
00045
00046 public:
00047 SequenceModel(QObject *parent = 0);
00048
00049 void InsertAlignment(const seq::AlignmentHandle& alignment);
00050 void InsertGfxEntity(const gfx::EntityP& entity);
00051 void InsertChain(QString& name, mol::ChainView& view);
00052 void InsertSequence(QString& name, seq::SequenceHandle& seq);
00053 void InsertSequences(const QList<QString>& names, seq::SequenceList& list);
00054
00055 void RemoveAlignment(const seq::AlignmentHandle& alignment);
00056 void RemoveGfxEntity(const gfx::EntityP& entity);
00057
00058 QModelIndexList GetModelIndexes(gfx::EntityP& entity, const mol::EntityView& view);
00059 QModelIndexList GetModelIndexes(const QString& subject, const QString& sequence_name=QString());
00060
00061 int GetGlobalRow(BaseViewObject* obj, int row) const;
00062
00063
00064 const QStringList& GetDisplayModes();
00065 const QStringList& GetDisplayModes(const gfx::EntityP& entity);
00066 const QStringList& GetDisplayModes(const seq::AlignmentHandle& alignment);
00067 const QString& GetCurrentDisplayMode();
00068 const QString& GetCurrentDisplayMode(const gfx::EntityP& entity);
00069 const QString& GetCurrentDisplayMode(const seq::AlignmentHandle& alignment);
00070 void SetDisplayMode(const QString& mode);
00071 void SetDisplayMode(const gfx::EntityP& entity, const QString& mode);
00072 void SetDisplayMode(const seq::AlignmentHandle& alignment, const QString& mode);
00073
00074 const PainterList& GetPainters(const QModelIndex& index) const;
00075
00076
00077 int rowCount(const QModelIndex& parent=QModelIndex()) const;
00078
00079 int columnCount(const QModelIndex& parent=QModelIndex()) const;
00080
00081 QVariant data(const QModelIndex& index, int role=Qt::DisplayRole) const;
00082
00083 QVariant headerData(int section, Qt::Orientation orientation,
00084 int role=Qt::DisplayRole) const;
00085
00086 virtual Qt::ItemFlags flags(const QModelIndex& index=QModelIndex()) const;
00087
00088 public slots:
00089 void ZoomIn();
00090 void ZoomOut();
00091 void DoubleClicked(const QModelIndex& index);
00092 void SelectionChanged(const QItemSelection& sel, const QItemSelection& desel);
00093 private:
00094 int GetColumnCount() const;
00095 SequenceViewObject* GetItem(const gfx::EntityP& entity);
00096 AlignmentViewObject* GetItem(const seq::AlignmentHandle& alignment);
00097 BaseViewObject* GetItem(const QModelIndex& index) const;
00098 QPair<int, BaseViewObject*> GetRowWithItem(int row) const;
00099 QPair<int, BaseViewObject*> GetRowWithItem(const QModelIndex& index) const;
00100
00101 QList<BaseViewObject*> objects_;
00102 int max_columns;
00103 PainterList empty_painter_list_;
00104 QString empty_string_;
00105 QStringList empty_string_list_;
00106 QStringList display_modes_;
00107 QString current_display_mode_;
00108 };
00109
00110
00111 }}
00112
00113 #endif