<div dir="ltr">Can I just remove the actor and add a new one (which will show the updated points)?<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Mar 25, 2014 at 6:34 PM, Matias Montroull <span dir="ltr"><<a href="mailto:matimontg@gmail.com" target="_blank">matimontg@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Hi,<br><br></div>I have a project where I load a set of points and then I show them in screen.<br>
<br></div><div>This works just fine, now, there's also a function where I modify the points position in real time.<br>
<br></div><div>How can I update the viewer with the new points?<br><br></div><div>I have 2 actors, one of them are the points that I modify so I don't want to update the whole scene, just the actor with the modified points.<br>
</div><div><br><br>string filePath = @"C:/tracker/registracion_por_superficie.poi";<br>fs = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);<br> sr = new StreamReader(fs);<br>
vtkPoints points_registracion = vtkPoints.New();<br> while (!sr.EndOfStream)<br> {<br> Buffer_Linea = sr.ReadLine();<br> sXYZ = Buffer_Linea.Split(chDelimiter, StringSplitOptions.RemoveEmptyEntries);<br>
//Reg por Superficie original <br> xyz[0] = double.Parse(sXYZ[3], CultureInfo.InvariantCulture);<br> xyz[1] = double.Parse(sXYZ[4], CultureInfo.InvariantCulture);<br>
xyz[2] = double.Parse(sXYZ[5], CultureInfo.InvariantCulture);<br> points_registracion.InsertNextPoint(xyz[0], xyz[1], xyz[2]);<br> }<br> sr.Close();<br><br> vtkPolyData polydata_registracion = vtkPolyData.New();<br>
polydata_registracion.SetPoints(points_registracion);<br><br> vtkVertexGlyphFilter glyphFilter_registracion = vtkVertexGlyphFilter.New();<br> glyphFilter_registracion.SetInputConnection(polydata_registracion.GetProducerPort());<br>
glyphFilter_registracion.Update();<br><br> vtkPolyDataMapper registracion_mapper = vtkPolyDataMapper.New();<br> registracion_mapper.SetInputConnection(glyphFilter_registracion.GetOutputPort());<br>
vtkActor actor_registracion = vtkActor.New();<br> actor_registracion.SetMapper(registracion_mapper);<br> actor_registracion.GetProperty().SetPointSize(8);<br> actor_registracion.GetProperty().SetColor(255, 0, 0);<br>
<br><br></div>// add render and actor:<br> vtkRenderer render = vtkRenderer.New();//renderWindowControl1.RenderWindow.GetRenderers().GetFirstRenderer(); ;<br> vtkRenderWindow renwin = vtkRenderWindow.New();<br>
renwin.AddRenderer(render);<br> vtkRenderWindowInteractor iren = vtkRenderWindowInteractor.New();<br> iren.SetRenderWindow(renwin);<br> renwin.PointSmoothingOn();<br><br> render.AddActor(actor_registracion);<br>
</div>
</blockquote></div><br></div>