#include "vtkSphereSource.h" #include "vtkActor.h" #include "vtkPolyDataMapper.h" #include "vtkRenderer.h" #include "vtkRenderWindow.h" #include "vtkRenderWindowInteractor.h" #include "vtkSmartPointer.h" #include "vtkProperty.h" #include "vtkSetGet.h" int main( int argc, char** argv ) { vtkSmartPointer source; source = vtkSmartPointer::New(); vtkSmartPointer mapper; mapper = vtkSmartPointer::New(); vtkSmartPointer actor; actor = vtkSmartPointer::New(); vtkSmartPointer renderer; renderer = vtkSmartPointer::New(); vtkSmartPointer renderWindow; renderWindow = vtkSmartPointer::New(); double Rayon; Rayon = source->GetRadius(); std::cout << "Rayon = " << Rayon << std::endl; //source->SetRadius(0.4); double Opacite; Opacite = actor.Get()->GetProperty()->GetOpacity(); std:cout << "Opacite = " << Opacite << std::endl; double *Couleur ; Couleur = actor.Get()->GetProperty()->GetColor(); std::cout << "Couleur de la sphere = " << Couleur << std::endl; // std::cout << "couleur de la sphere : " << actor.Get()->GetProperty()->GetColor() << std::endl; double RGB[3] = {1,0,1}; actor.Get()->GetProperty()->SetColor(RGB); actor.Get()->GetProperty()->SetColor(0,0,1); //std::cout << "couleur de la sphere : " << actor.Get()->GetProperty()->GetColor(r, g, b) << std::endl; actor.Get()->GetProperty()->SetOpacity(5.0); //std::cout << "couleur : " << source->GetCouleur() << std::endl; //actor.Get()->GetProperty()->SetColor(0, 0, 1) //actor.Get()->GetProperty()->GetColor() class VTKFILTERSSOURCES_EXPORT vtkSphereSource : public vtkPolyDataAlgorithm { private: double Couleur[3]; double Opacite; public: vtkTypeMacro(vtkSphereSource, vtkPolyDataAlgorithm); void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE; vtkSphereSource* source; vtkGetVectorMacro(Couleur, double, 3); vtkSetVector3Macro(Couleur, double); vtkSetClampMacro(Opacite, double, 0.0, 1.0); vtkGetMacro(Opacite, double); }; vtkSmartPointer rwi; rwi = vtkSmartPointer::New(); mapper->SetInputConnection( source->GetOutputPort()); actor->SetMapper( mapper); renderer->AddViewProp( actor ); renderWindow->AddRenderer( renderer ); renderWindow->SetInteractor( rwi ); rwi->Start( ); return(EXIT_SUCCESS); }