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