[vtkusers] Read data from Callback function

Massinissa Bandou Massinissa.Bandou at USherbrooke.ca
Tue May 21 16:28:25 EDT 2013


Hi all!

Can anyone tell me how to read data from a callback function? For example I
want to read a matrix of vector *row* anytime during the interaction with
points. Is it related to clientdata?

thank you for your advice! 

lass vtkMyLandmark : public vtkCommand
{
public:
	vtkMyLandmark::vtkMyLandmark(){SelectedActor = NULL;}
	static vtkMyLandmark *New(){return new vtkMyLandmark;}

	void SetSelectionActor(vtkActor* pvtkActorSelection) { 
		SelectedActor = pvtkActorSelection;
		};


	virtual void Execute(vtkObject *caller, unsigned long, void*){
		vtkRenderWindowInteractor *iren =
reinterpret_cast<vtkRenderWindowInteractor*>(caller);
		vtkPointPicker *picker = (vtkPointPicker *)iren->GetPicker();
		double picked[3];
		picker->GetPickPosition(picked);
				
		if (picker->GetPointId() != -1) {
			if(SelectedActor){
				SelectedActor->SetPosition(picker->GetPickPosition());

				for(unsigned int i=0;i<3;i++){
					this->row.push_back(picked[i]);
				}
                                this->matrix.push_back(row);

				iren->Render();
			}	
		}
	}
private:
        std::vector<double> row;
	std::vector<std::vector&lt;double>> matrix;
private:
	vtkActor* SelectedActor;

};




--
View this message in context: http://vtk.1045678.n5.nabble.com/Read-data-from-Callback-function-tp5720847.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list