void LinesVisualisation::performStepComputation() { // do not perform painting if not visible if(!isVisible()) return; clearGraphs(); QVector<double> x, y; // Paint the best for (int i = 0; i < swarm()->size(); i++) { const Particle *particle = (*swarm())[i]; x.clear(); y.clear(); y = particle->position; for (int j = 0; j < swarm()->dimension(); j++) { x.append(j + 1); } addGraph(); graph(i)->setData(x, y); graph(i)->setPen(VisualisationHelper::rainbowCoding(i, swarm()->size())); } xAxis->setRange(0, swarm()->dimension()); if (swarm()->dimension() < 20) { xAxis->setAutoTickStep(false); xAxis->setTickStep(1); } rescaleAxes(true); setInteraction(QCP::iRangeDrag, true); setInteraction(QCP::iRangeZoom, true); replot(); }
void SLabeledPointList::updating() { // get PointList in image Field then install distance service if required ::fwData::PointList::sptr landmarks = this->getInOut< ::fwData::PointList >(s_POINTLIST_INOUT); this->unregisterServices(); if ( !landmarks->getPoints().empty() ) { // create the srv configuration for objects auto-connection auto pointListAdaptor = this->registerService< ::visuVTKAdaptor::SPointList>("::visuVTKAdaptor::SPointList"); // register the point list pointListAdaptor->registerInput(landmarks, SPointList::s_POINTLIST_INPUT, true); pointListAdaptor->setColor(m_ptColor); pointListAdaptor->setRadius(m_radius); pointListAdaptor->setInteraction(m_interaction); pointListAdaptor->setPickerId( this->getPickerId() ); pointListAdaptor->setRenderService( this->getRenderService() ); pointListAdaptor->start(); for( ::fwData::Point::sptr point : landmarks->getPoints() ) { auto serviceLabel = this->registerService< ::fwRenderVTK::IAdaptor>("::visuVTKAdaptor::SPointLabel"); // register the point list serviceLabel->registerInput(point, SPointLabel::s_POINT_INPUT, true); serviceLabel->setRenderService( this->getRenderService() ); serviceLabel->start(); } } this->setVtkPipelineModified(); this->requestRender(); }