MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / paintPeptideIDs_

Method paintPeptideIDs_

src/openms_gui/source/VISUAL/Painter2DBase.cpp:66–114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64 }
65
66 void Painter2DBase::paintPeptideIDs_(QPainter* painter, Plot2DCanvas* canvas, const IPeptideIds::PepIds& ids, int layer_index)
67 {
68 painter->setPen(Qt::darkRed);
69 bool show_labels = canvas->getLayerFlag(layer_index, LayerDataBase::I_LABELS);
70
71 for (const auto& id : ids)
72 {
73 if (!id.getHits().empty() || show_labels)
74 {
75 if (!id.hasRT() || !id.hasMZ())
76 {
77 // TODO: show error message here
78 continue;
79 }
80 double rt = id.getRT();
81 if (!canvas->visible_area_.getAreaUnit().containsRT(rt))
82 {
83 continue;
84 }
85 double mz = canvas->getIdentificationMZ_(layer_index, id);
86 if (!canvas->visible_area_.getAreaUnit().containsMZ(mz))
87 {
88 continue;
89 }
90 // draw dot
91 QPoint pos = canvas->dataToWidget_(canvas->unit_mapper_.map(id));
92 painter->drawLine(pos.x(), pos.y() - 1.0, pos.x(), pos.y() + 1.0);
93 painter->drawLine(pos.x() - 1.0, pos.y(), pos.x() + 1.0, pos.y());
94
95 // draw sequence
96 String sequence;
97 if (show_labels)
98 {
99 sequence = id.getMetaValue("label");
100 }
101 else
102 {
103 sequence = id.getHits()[0].getSequence().toString();
104 }
105 if (sequence.empty() && !id.getHits().empty())
106 {
107 sequence = id.getHits()[0].getMetaValue("label");
108 }
109 if (id.getHits().size() > 1)
110 sequence += "...";
111 painter->drawText(pos.x() + 10, pos.y() + 10, sequence.toQString());
112 }
113 }
114 }
115
116 // ###############################
117 // ###### 2D Peak

Callers

nothing calls this directly

Calls 12

hasRTMethod · 0.80
hasMZMethod · 0.80
getIdentificationMZ_Method · 0.80
mapMethod · 0.80
getMetaValueMethod · 0.80
getSequenceMethod · 0.80
drawTextMethod · 0.80
emptyMethod · 0.45
getRTMethod · 0.45
toStringMethod · 0.45
sizeMethod · 0.45
toQStringMethod · 0.45

Tested by

no test coverage detected