<html>
<head>
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Hi,<br>
<br>
I'm trying to extend the HighlightSelectedPoints (<a
class="moz-txt-link-freetext"
href="http://www.vtk.org/Wiki/VTK/Examples/Cxx/Picking/HighlightSelectedPoints">http://www.vtk.org/Wiki/VTK/Examples/Cxx/Picking/HighlightSelectedPoints</a>)
example to delete the selected points. So far I'm not very
succesful.<br>
I manage to delete the points and update the view, but as soon as I
switch back to the normal (rotate) mouse interaction all my points
disappear after the first mouse click. Also the remaining points are
highlighted once I deleted the points (still in select mode).<br>
The code I use can be found below (added to InteractorStyle class of
the example).<br>
<br>
Does anyone know what I'm doing wrong? Am I taking the right
approach at all? It does not seem a very efficient way of removing
points.<br>
<br>
Thanks in advance.<br>
<br>
Regards,<br>
<br>
Sytse<br>
<br>
<pre class="line-pre" style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; margin-top: 0px; margin-bottom: 0px; width: 770px; color: rgb(51, 51, 51); font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 16.799999237060547px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255);"><div class="line" id="file-delete-highlighted-points-LC1" style="box-sizing: border-box;">virtual void OnKeyPress() {</div><div class="line" id="file-delete-highlighted-points-LC2" style="box-sizing: border-box;"> vtkRenderWindowInteractor *rwi = this->Interactor;</div><div class="line" id="file-delete-highlighted-points-LC3" style="box-sizing: border-box;"> const char* ch = rwi->GetKeySym ();</div><div class="line" id="file-delete-highlighted-points-LC4" style="
box-sizing: border-box;"> if (strcmp (ch, "Delete") == 0) {</div><div class="line" id="file-delete-highlighted-points-LC5" style="box-sizing: border-box;"> vtkPlanes* frustum = static_cast<vtkAreaPicker*>(this->GetInteractor()->GetPicker())->GetFrustum();</div><div class="line" id="file-delete-highlighted-points-LC6" style="box-sizing: border-box;"> </div><div class="line" id="file-delete-highlighted-points-LC7" style="box-sizing: border-box;"> vtkSmartPointer<vtkExtractGeometry> extractGeometry =</div><div class="line" id="file-delete-highlighted-points-LC8" style="box-sizing: border-box;"> vtkSmartPointer<vtkExtractGeometry>::New();</div><div class="line" id="file-delete-highlighted-points-LC9" style="box-sizing: border-box;"> extractGeometry->SetImplicitFunction(frustum);</div><div class="line" id="file-delete-highlighted-points-LC10" style="box-sizing: border-box;"> extractGeometry->SetInputData(thi
s
->Points);</div><div class="line" id="file-delete-highlighted-points-LC11" style="box-sizing: border-box;"> extractGeometry->SetExtractInside(0); //We want all points outside the geometry</div><div class="line" id="file-delete-highlighted-points-LC12" style="box-sizing: border-box;"> extractGeometry->Update();</div><div class="line" id="file-delete-highlighted-points-LC13" style="box-sizing: border-box;"> </div><div class="line" id="file-delete-highlighted-points-LC14" style="box-sizing: border-box;"> vtkSmartPointer<vtkVertexGlyphFilter> glyphFilter =</div><div class="line" id="file-delete-highlighted-points-LC15" style="box-sizing: border-box;"> vtkSmartPointer<vtkVertexGlyphFilter>::New();</div><div class="line" id="file-delete-highlighted-points-LC16" style="box-sizing: border-box;"> glyphFilter->SetInputConnection(extractGeometry->GetOutputPort());</div><div class="line" id="file-delete-highlighted-
p
oints-LC17" style="box-sizing: border-box;"> glyphFilter->Update();</div><div class="line" id="file-delete-highlighted-points-LC18" style="box-sizing: border-box;"> </div><div class="line" id="file-delete-highlighted-points-LC19" style="box-sizing: border-box;"> vtkPolyData* selected = glyphFilter->GetOutput ();</div><div class="line" id="file-delete-highlighted-points-LC20" style="box-sizing: border-box;"> </div><div class="line" id="file-delete-highlighted-points-LC21" style="box-sizing: border-box;"> vtkIdTypeArray* ids = vtkIdTypeArray::SafeDownCast(selected->GetPointData()->GetArray("OriginalIds"));</div><div class="line" id="file-delete-highlighted-points-LC22" style="box-sizing: border-box;"> vtkSmartPointer<vtkPoints> newPoints = vtkSmartPointer<vtkPoints>::New();</div><div class="line" id="file-delete-highlighted-points-LC23" style="box-sizing: border-box;"> for(vtkIdType i = 0; i < ids->GetNumberOfT
u
ples(); i++) {</div><div class="line" id="file-delete-highlighted-points-LC24" style="box-sizing: border-box;"> newPoints->InsertPoint(ids->GetValue(i), this->Points->GetPoint (ids->GetValue(i)));</div><div class="line" id="file-delete-highlighted-points-LC25" style="box-sizing: border-box;"> }</div><div class="line" id="file-delete-highlighted-points-LC26" style="box-sizing: border-box;"> </div><div class="line" id="file-delete-highlighted-points-LC27" style="box-sizing: border-box;"> this->Points->SetPoints (newPoints);</div><div class="line" id="file-delete-highlighted-points-LC28" style="box-sizing: border-box;"> this->GetInteractor()->GetRenderWindow()->Render();</div><div class="line" id="file-delete-highlighted-points-LC29" style="box-sizing: border-box;"> }</div><div class="line" id="file-delete-highlighted-points-LC30" style="box-sizing: border-box;">}</div></pre>
<br>
<br>
<br>
</body>
</html>