Skip to content
Snippets Groups Projects
Commit 9a659bca authored by stefan's avatar stefan
Browse files

New SequenceViewer, colors for Aligments

git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@2302 5a81b35b-ba03-0410-adc8-b2c5c5119f08
parent 21356238
Branches
Tags
No related merge requests found
......@@ -21,6 +21,7 @@ sequence_search_bar.hh
)
set(OST_GUI_SEQUENCE_VIEW_HEADERS
align_properties_painter.hh
base_row.hh
background_painter.hh
painter.hh
......@@ -214,6 +215,7 @@ sequence_viewer/sequence_viewer_base.cc
sequence_viewer/sequence_viewer.cc
sequence_viewer/sequence_scene.cc
sequence_viewer/sequence_search_bar.cc
sequence/align_properties_painter.cc
sequence/base_row.cc
sequence/background_painter.cc
sequence/secstr_row.cc
......@@ -347,6 +349,7 @@ sequence_viewer/sequence_viewer_base.hh
sequence_viewer/sequence_viewer.hh
sequence_viewer/sequence_scene.hh
sequence_viewer/sequence_search_bar.hh
sequence/align_properties_painter.hh
sequence/background_painter.hh
sequence/base_row.hh
sequence/painter.hh
......
//------------------------------------------------------------------------------
// This file is part of the OpenStructure project <www.openstructure.org>
//
// Copyright (C) 2008-2010 by the OpenStructure authors
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License as published by the Free
// Software Foundation; either version 3.0 of the License, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
// details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this library; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
//------------------------------------------------------------------------------
/*
Author: Stefan Scheuber
*/
#include <QtGui>
#include "align_properties_painter.hh"
namespace ost { namespace gui {
namespace {
QMap<QString,QColor> GetColorMap(){
QMap<QString,QColor> map;
map["G"]=QColor(Qt::gray);
map["A"]=QColor(Qt::gray);
map["V"]=QColor(Qt::gray);
map["L"]=QColor(Qt::gray);
map["I"]=QColor(Qt::gray);
map["F"]=QColor(255,165,0);
map["Y"]=QColor(255,165,0);
map["W"]=QColor(255,165,0);
map["C"]=QColor(Qt::yellow);
map["M"]=QColor(Qt::yellow);
map["S"]=QColor(Qt::green);
map["T"]=QColor(Qt::green);
map["K"]=QColor(Qt::red);
map["R"]=QColor(Qt::red);
map["H"]=QColor(Qt::red);
map["D"]=QColor(Qt::blue);
map["E"]=QColor(Qt::blue);
map["N"]=QColor(Qt::blue);
map["Q"]=QColor(Qt::blue);
map["P"]=QColor(Qt::magenta);
return map;
}
}
QMap<QString,QColor> AlignPropertiesPainter::color_map_ = GetColorMap();
AlignPropertiesPainter::AlignPropertiesPainter(QObject* parent)
: Painter(parent)
{}
void AlignPropertiesPainter::Paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index){
painter->save();
if (index.column()>0){
QString text = index.data(Qt::DisplayRole).toString();
if(color_map_.contains(text)){
painter->fillRect(option.rect, color_map_[text]);
}
}
painter->restore();
}
}}
//------------------------------------------------------------------------------
// This file is part of the OpenStructure project <www.openstructure.org>
//
// Copyright (C) 2008-2010 by the OpenStructure authors
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License as published by the Free
// Software Foundation; either version 3.0 of the License, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
// details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this library; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
//------------------------------------------------------------------------------
#ifndef OST_SEQUENCE_VIEWER_ALIGN_PROPERTIES_PAINTER
#define OST_SEQUENCE_VIEWER_ALIGN_PROPERTIES_PAINTER
/*
Author: Stefan Scheuber
*/
#include <QObject>
#include "painter.hh"
namespace ost { namespace gui {
class AlignPropertiesPainter : public Painter
{
Q_OBJECT
public:
AlignPropertiesPainter(QObject* parent = 0);
void Paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index);
private:
static QMap<QString,QColor> color_map_;
};
}}
#endif
......@@ -30,6 +30,7 @@
#include "sequence_row.hh"
#include "secstr_row.hh"
#include "align_properties_painter.hh"
#include "painter.hh"
#include "background_painter.hh"
#include "seq_secstr_painter.hh"
......@@ -82,6 +83,8 @@ void SequenceViewObject::AddSequence(seq::SequenceHandle& sequence, const QStrin
SequenceRow* new_row = new SequenceRow(name, sequence, this);
Painter* p = new BackgroundPainter(this);
new_row->InsertPainter(p);
p = new AlignPropertiesPainter(this);
new_row->InsertPainter(p);
p = new SeqSelectionPainter(this);
new_row->InsertPainter(p);
p = new SeqTextPainter(this);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment