MCPcopy Create free account
hub / github.com/PointCloudLibrary/pcl / createActor

Method createActor

visualization/src/histogram_visualizer.cpp:196–274  ·  view source on GitHub ↗

///////////////////////////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

194
195////////////////////////////////////////////////////////////////////////////////////////////
196void
197pcl::visualization::PCLHistogramVisualizer::createActor (
198 const vtkSmartPointer<vtkDoubleArray> &xy_array,
199 pcl::visualization::RenWinInteract &renwinint,
200 const std::string &id, const int win_width, const int win_height)
201{
202 // Create the actor
203 renwinint.xy_plot_->SetDataObjectPlotModeToColumns ();
204 renwinint.xy_plot_->SetXValuesToValue ();
205
206 // Create the data structures
207 vtkSmartPointer<vtkFieldData> field_values = vtkSmartPointer<vtkFieldData>::New ();
208 field_values->AddArray (xy_array);
209
210 vtkSmartPointer<vtkDataObject> field_data = vtkSmartPointer<vtkDataObject>::New ();
211 field_data->SetFieldData (field_values);
212
213 renwinint.xy_plot_->AddDataObjectInput (field_data);
214 // Set the plot color
215 renwinint.xy_plot_->SetPlotColor (0, 1.0, 0.0, 0.0);
216
217 renwinint.xy_plot_->SetDataObjectXComponent (0, 0); renwinint.xy_plot_->SetDataObjectYComponent (0, 1);
218 renwinint.xy_plot_->PlotPointsOn ();
219 //renwinint.xy_plot_->PlotCurvePointsOn ();
220 //renwinint.xy_plot_->PlotLinesOn ();
221 renwinint.xy_plot_->PlotCurveLinesOn ();
222
223 // Get min-max range
224 double min_max[2];
225 xy_array->GetRange (min_max, 1);
226
227 renwinint.xy_plot_->SetYTitle (""); renwinint.xy_plot_->SetXTitle ("");
228 renwinint.xy_plot_->SetYRange (min_max[0], min_max[1]);
229 renwinint.xy_plot_->SetXRange (0, static_cast<double> (xy_array->GetNumberOfTuples () - 1));
230
231 //renwinint.xy_plot_->SetTitle (id.c_str ());
232 renwinint.xy_plot_->GetProperty ()->SetColor (0, 0, 0);
233
234 // Adjust text properties
235 vtkSmartPointer<vtkTextProperty> tprop = renwinint.xy_plot_->GetTitleTextProperty ();
236 renwinint.xy_plot_->AdjustTitlePositionOn ();
237 tprop->SetFontSize (8);
238 tprop->ShadowOff (); tprop->ItalicOff ();
239 tprop->SetColor (renwinint.xy_plot_->GetProperty ()->GetColor ());
240
241 renwinint.xy_plot_->SetAxisLabelTextProperty (tprop);
242 renwinint.xy_plot_->SetAxisTitleTextProperty (tprop);
243 renwinint.xy_plot_->SetNumberOfXLabels (8);
244 renwinint.xy_plot_->GetProperty ()->SetPointSize (3);
245 renwinint.xy_plot_->GetProperty ()->SetLineWidth (2);
246
247 renwinint.xy_plot_->SetPosition (0, 0);
248 renwinint.xy_plot_->SetWidth (1); renwinint.xy_plot_->SetHeight (1);
249
250 // Create the new window with its interactor and renderer
251 renwinint.ren_->AddViewProp (renwinint.xy_plot_);
252 renwinint.ren_->SetBackground (1, 1, 1);
253 renwinint.win_->SetWindowName (id.c_str ());

Callers

nothing calls this directly

Calls 6

NewFunction · 0.85
SetPlotColorMethod · 0.80
SetWidthMethod · 0.80
SetHeightMethod · 0.80
SetColorMethod · 0.45
InitializeMethod · 0.45

Tested by

no test coverage detected