[vtkusers] How to draw multi color lines?

David.Pont at ForestResearch.co.nz David.Pont at ForestResearch.co.nz
Wed Mar 30 17:58:24 EST 2005





Try adding all points and curves to a single dataset and use just one
mapper and actor.

   Dave P

Hua Yuan <hyuan10 at yahoo.com> wrote on 30/03/2005 09:49:36:

> Hello everyone,
>
> I am working on a problem that will show one to hundred thousnad of
> color curves.  There are about thirty points for each curves.  To do
> that I need to new hundred thousand maps and actors and it usually
> crashes after it shows about twenty thousand curves.  So I wonder if
> there is any better way to draw color curves.  The following is part
> of the code I generated.
>
> I really appreciate your help.
>
> Thanks.
> Hookemall
>
> ////////////////////////////////////////////////////////////
> //the following is part of the code
>   for(iLine=0;iLine<nLine;iLine++)
>   {
>    points      = vtkPoints::New();
>    data        = vtkPolyData::New();
>    pMapper     = vtkPolyDataMapper::New();
>    pActor      = vtkActor::New();
>    Lines       = vtkCellArray::New();
>    ids         = vtkIdList::New();
>    points->SetNumberOfPoints((int)nPoints);
>    for(int i=0;i<nPoints;i++)
>    {
>     points->SetPoint(i,x3[i],y3[i],z[i]);
>     ids->SetNumberOfIds(i);
>     ids->InsertId(i,i);
>     }
>    Lines->InsertNextCell(ids);
>    data->SetPoints(points);
>    data->SetLines(Lines);
>    data->Update();
>
>
>     pMapper->SetInput(data);
>    pMapper->Update();
>    pActor->SetMapper(pMapper);
>      getNewColors(iColor11,iColor22,iColor33);
>    pActor->GetProperty()->SetColor(iColor1,iColor2,iColor3);
>
>     this->ren->AddActor(pActor);
>     Lines->Delete();
>    pMapper->Delete();
>    pA ctor->Delete();
>    data->DeleteCells();
>    data->Delete();
>    points->Delete();
>    ids->Delete();
>
>   }
> Do you Yahoo!?
> Make Yahoo! your home page
_______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.
> org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers




More information about the vtkusers mailing list