[vtkusers] Clipping planes don't work for vtkLabelPlacementMapper
Donny Zimmerman
donny.zimmerman at willowpointsoftware.com
Fri Jan 6 23:06:17 EST 2012
I am rendering points using vtkPolyDataMapper and I am associating a
clipping plane with that mapper. I am also using vtkLabelPlacementMapper to
display data associated with each point and I also added the same clipping
plane to this mapper. The clipping plane for the polydata mapper works as
intended, but does not work with the label placement mapper. I assume this
is because this is a 2D mapper. Is there any way I can make the point labels
clip along with it's associated point?
polydata = vtkSmartPointer<vtkPolyData>::New();
polydata->SetPoints(points);
polydata->GetPointData()->AddArray(labels);
polydata->GetPointData()->AddArray(sizes);
// Create a mapper and actor for the points.
pointmapper = vtkSmartPointer<vtkPolyDataMapper>::New();
pointmapper->SetClippingPlanes(this->m_planecollection);
pointmapper->SetInput(polydata);
pointactor = vtkSmartPointer<vtkActor>::New();
pointactor->SetMapper(pointmapper);
// Generate the label hierarchy.
sizefilter =
vtkSmartPointer<vtkPointSetToLabelHierarchy>::New();
sizefilter->SetInput(polydata);
sizefilter->SetLabelArrayName("labels");
sizefilter->SetPriorityArrayName("sizes");
sizefilter->Update();
// Create a mapper and actor for the labels.
labelmapper =
vtkSmartPointer<vtkLabelPlacementMapper>::New();
labelmapper->SetClippingPlanes(this->m_planecollection);
labelmapper->SetInputConnection(sizefilter->GetOutputPort());
labelactor = vtkSmartPointer<vtkActor2D>::New();
labelactor->SetMapper(labelmapper);
m_actors->AddItem(pointactor);
m_actors->AddItem(labelactor);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120106/a7990dd5/attachment.htm>
More information about the vtkusers
mailing list