/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
| 94 | |
| 95 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 96 | void |
| 97 | pcl::visualization::PCLPlotter::addPlotData ( |
| 98 | double const* array_X, double const* array_Y, |
| 99 | unsigned long size, char const * name /* = "Y Axis" */, |
| 100 | int type, char const* color) |
| 101 | { |
| 102 | //updating the current plot ID |
| 103 | current_plot_++; |
| 104 | |
| 105 | //creating a permanent copy of the arrays |
| 106 | double *permanent_X = new double[size]; |
| 107 | double *permanent_Y = new double[size]; |
| 108 | std::copy(array_X, array_X + size, permanent_X); |
| 109 | std::copy(array_Y, array_Y + size, permanent_Y); |
| 110 | |
| 111 | //transforming data to be fed to the vtkChartXY |
| 112 | VTK_CREATE (vtkTable, table); |
| 113 | |
| 114 | VTK_CREATE (vtkDoubleArray, varray_X); |
| 115 | varray_X->SetName ("X Axis"); |
| 116 | varray_X->SetArray (permanent_X, size, 1, vtkDoubleArray::VTK_DATA_ARRAY_DELETE); |
| 117 | table->AddColumn (varray_X); |
| 118 | |
| 119 | VTK_CREATE (vtkDoubleArray, varray_Y); |
| 120 | varray_Y->SetName (name); |
| 121 | varray_Y->SetArray (permanent_Y, size, 1, vtkDoubleArray::VTK_DATA_ARRAY_DELETE); |
| 122 | table->AddColumn (varray_Y); |
| 123 | |
| 124 | //adding to chart |
| 125 | //vtkPlot *line = chart_->AddPlot(vtkChart::LINE); |
| 126 | vtkPlot *line = chart_->AddPlot (type); |
| 127 | line->SetInputData (table, 0, 1); |
| 128 | line->SetWidth (1); |
| 129 | |
| 130 | if (!color) //color automatically based on the ColorScheme |
| 131 | { |
| 132 | vtkColor3ub vcolor = color_series_->GetColorRepeating (current_plot_); |
| 133 | line->SetColor (vcolor[0], vcolor[1], vcolor[2], 255); |
| 134 | } |
| 135 | else //add the specific color |
| 136 | line->SetColor (color[0], color[1], color[2], color[3]); |
| 137 | } |
| 138 | |
| 139 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 140 | void |
no test coverage detected