[vtkusers] Clipping planes don't work for vtkLabelPlacementMapper

Donny Zimmerman donny.zimmerman at willowpointsoftware.com
Sun Jan 8 12:45:43 EST 2012


 I was able to get this to work by inserting a vtkClipPolydata filter using
the clipping plane as the ClipFunction.

 

-----Original Message-----
From: Donny Zimmerman [mailto:donny.zimmerman at willowpointsoftware.com] 
Sent: Friday, January 06, 2012 10:06 PM
To: vtkusers at vtk.org
Subject: [vtkusers] Clipping planes don't work for vtkLabelPlacementMapper

 

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/20120108/6943272a/attachment.htm>


More information about the vtkusers mailing list