Added newline char at end of file to remove gcc warning
[mussa.git] / qui / motif_editor / MotifElement.cpp
1 #include "qui/motif_editor/MotifEditor.hpp"
2 #include "alg/alphabet.hpp"
3
4 #include <iostream>
5
6 MotifElement::MotifElement() :
7   enabled(true),
8   color(Color(1.0,0.0,0.0,1.0)),
9   motif(Sequence::nucleic_alphabet)
10 {
11 }
12
13 MotifElement::MotifElement(const Sequence& seq, Color c) :
14   enabled(true),
15   color(c),
16   motif(seq)
17 {
18 }
19
20 bool MotifElement::isEmpty() const
21 {
22   if (motif.get_name().size() == 0 and motif.size() == 0) {
23     return true;
24   }
25   return false;
26 }
27 //! should we search the analysis for this element?
28 bool MotifElement::isEnabled() const
29 {
30   return enabled;
31 }
32
33 //! set the state for searching the analysis for this element?
34 void MotifElement::setEnabled(bool enabled_)
35 {
36   enabled = enabled_;
37 }
38   
39 //! return color should this motif be drawn as
40 Color MotifElement::getColor() const
41 {
42   return color;
43 }
44
45 //! set what color this motif should be drawn as
46 void MotifElement::setColor(const Color& c)
47 {
48   color = c;
49 }
50   
51 //! return color should this motif be drawn as
52 QColor MotifElement::getQColor() const
53 {
54   QColor qcolor;
55   qcolor.setRgbF(color.r(), color.g(), color.b(), color.a());
56   return qcolor;
57 }
58
59 //! set what color this motif should be drawn as
60 void MotifElement::setQColor(const QColor& c)
61 {
62   color = Color(c.redF(), c.greenF(), c.blueF(), c.alphaF());
63 }
64   
65 //! return sequence
66 const Sequence& MotifElement::getSequence() const
67 {
68   return motif;
69 }
70
71 //! set sequence
72 void MotifElement::setSequence(const Sequence& seq)
73 {
74   motif = seq;
75 }
76
77 //! set sequence text
78 void MotifElement::setSequence(const std::string& seq_text)
79 {
80   motif.set_sequence(seq_text, Sequence::nucleic_alphabet);
81 }
82
83 QString MotifElement::getSequenceText() const
84 {
85   return QString(motif.get_sequence().c_str());
86 }
87   
88 //! get sequence name
89 std::string MotifElement::getName() const
90 {
91   return motif.get_name();
92 }
93
94 //! set sequence name
95 void MotifElement::setName(const std::string& seq_name)
96 {
97   motif.set_fasta_header(seq_name);
98 }