<div style="line-height:1.7;color:#000000;font-size:14px;font-family:arial"> <br>Hi, I have drawed a line in an Image(JPEGReader->ImageActor),I chang the line's Property->SetLineWidth(2).<br>When I ZoomIn or ZoomOut, the Line is missing.<br>how to solve this problem ?Thanks<br><br>The SourceCode:<br><br>#include <vtkSmartPointer.h><br> <br>#include <vtkImageViewer2.h><br>#include <vtkJPEGReader.h><br>#include <vtkRenderWindow.h><br>#include <vtkRenderWindowInteractor.h><br>#include <vtkRenderer.h><br>#include <iostream> <br>#include <vtkInteractorStyleTrackballCamera.h><br>#include <vtkLineSource.h><br>#include <vtkPolyDataMapper.h><br>#include <vtkProperty.h><br>int main(int argc, char* argv[])<br>{<br> // Verify input arguments<br> if ( argc != 2 )<br> {<br> std::cout << "Usage: " << argv[0]<br> << " Filename(.jpeg)" << std::endl;<br> return EXIT_FAILURE;<br> }<br> <br> // Read the image<br> vtkSmartPointer<vtkJPEGReader> jpegReader =<br> vtkSmartPointer<vtkJPEGReader>::New();<br> if(!jpegReader->CanReadFile(argv[1]))<br> {<br> std::cout << argv[0] <br> << ": Error reading file " << argv[1] << std::endl<br> << " Exiting..." << std::endl;<br> return EXIT_FAILURE;<br> }<br> <br> jpegReader->SetFileName ( argv[1] );<br> <br> // Visualize<br> vtkSmartPointer<vtkImageViewer2> imageViewer =<br> vtkSmartPointer<vtkImageViewer2>::New();<br> imageViewer->SetInputConnection( jpegReader->GetOutputPort() );<br> imageViewer->GetRenderWindow()->SetSize( 500, 500 );<br> imageViewer->GetRenderer()->ResetCamera();<br> <br> // Set up an interactor that does not respond to mouse events<br> vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor =<br> vtkSmartPointer<vtkRenderWindowInteractor>::New();<br> imageViewer->GetRenderWindow()->SetInteractor( renderWindowInteractor );<br> vtkInteractorStyleTrackballCamera *style = vtkInteractorStyleTrackballCamera::New();<br> renderWindowInteractor->SetInteractorStyle( style );<br><br> vtkSmartPointer<vtkLineSource> pvtkLine_Move = vtkSmartPointer<vtkLineSource>::New();<br> vtkSmartPointer<vtkActor> m_MoveActor = vtkSmartPointer<vtkActor>::New();<br><br> pvtkLine_Move->SetPoint1(0,0,0);<br> pvtkLine_Move->SetPoint2(50,50,0);<br> pvtkLine_Move->Update();<br> vtkSmartPointer<vtkPolyDataMapper> mapper = <br> vtkSmartPointer<vtkPolyDataMapper>::New();<br> mapper->SetInputConnection(pvtkLine_Move->GetOutputPort());<br> m_MoveActor->SetMapper(mapper);<br> vtkProperty *pProperty = m_MoveActor->GetProperty ();<br> pProperty->SetColor(1,0,0);<br> pProperty->SetLineWidth (2); //The Line Maybe Miss...<br> m_MoveActor->VisibilityOn();<br> <br> imageViewer->GetRenderer()->AddActor(m_MoveActor);<br> imageViewer->Render();<br> // Start the event loop<br> renderWindowInteractor->Initialize();<br> renderWindowInteractor->Start();<br> <br> return EXIT_SUCCESS;<br>}<br><br>Phoniex</div><br><br><span title="neteasefooter"><span id="netease_mail_footer"></span></span>