13 #include <vtkRenderer.h>
14 #include <vtkActor2D.h>
15 #include <vtkTextProperty.h>
16 #include <vtkTextMapper.h>
67 for (
unsigned i=0; i<
mMetrics.size(); ++i)
75 for (
unsigned i=0; i<
mMetrics.size(); ++i)
81 this->callSetColoredTextListSlot();
84 QTimer::singleShot(500,
this, &MetricNamesRep::callSetColoredTextListSlot);
87 void MetricNamesRep::callSetColoredTextListSlot()
94 std::vector<DataMetricPtr> metrics;
95 for (
unsigned i=0; i<data.size(); ++i)
97 DataMetricPtr metric = boost::dynamic_pointer_cast<DataMetric>(data[i]);
99 metrics.push_back(metric);
106 if (a.size()!=b.size())
108 for (
unsigned i=0; i<a.size(); ++i)
116 std::vector<std::pair<QColor, QString> > text;
143 double meanHeight = bb.
range()[1]/text.size();
145 for (
unsigned i=0; i<text.size(); ++i)
149 rep->textProperty()->SetJustificationToLeft();
150 rep->getActor()->GetPositionCoordinate()->SetCoordinateSystemToNormalizedViewport();
153 rep->setPosition(currentPos);
162 QStringList fullText;
163 for (
unsigned i=0; i<text.size(); ++i)
164 fullText << text[i].second;
167 double width_p = test.
getMapper()->GetWidth(vp);
168 double height_p = test.
getMapper()->GetHeight(vp);
171 Eigen::Array2i size_vp(vp->GetSize());
172 Eigen::Array2d normsize_box(width_p/size_vp[0], height_p/size_vp[1]);
175 double border = 0.02;
177 DoubleBoundingBox3D bb_box(pos[0], pos[0]+normsize_box[0], pos[1], pos[1]+normsize_box[1], 0, 0);
186 for (
unsigned i=0; i<2; ++i)
188 double shift = another[2*i+1] - box[2*i+1];
197 for (
unsigned i=0; i<3; ++i)
199 double shift = another[2*i] - box[2*i];
219 text << metric->getName();
220 if (metric->showValueInGraphics())
221 text << metric->getValueAsString();
222 return text.join(
" = ");
227 std::vector<std::pair<QColor, QString> > retval;
229 for (
unsigned i = 0; i <
mMetrics.size(); ++i)
232 QString line = metric->getName();
234 if (!metric->showValueInGraphics())
237 QString text = this->
getText(metric,
true);
238 retval.push_back(std::make_pair(metric->getColor(), text));
240 std::reverse(retval.begin(), retval.end());