/*========================================================================= Program: wxMaracas Module: $RCSfile: wxMaracasIRMViewManager.cxx,v $ Language: C++ Date: $Date: 2009/04/01 16:16:59 $ Version: $Revision: 1.1 $ Copyright: (c) 2002, 2003 License: This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ #include "wxMaracasIRMViewManager.h" /** ** Start of the manager class **/ wxMaracasIRMViewManager::wxMaracasIRMViewManager(){ _renderer = NULL; } wxMaracasIRMViewManager::~wxMaracasIRMViewManager(){ } /** ** Sets the renderer to manage the prop3D from the view **/ void wxMaracasIRMViewManager::setRenderer(vtkRenderer* renderer){ _renderer = renderer; } /** ** Adds a prop3D to the manager and returns the identifier **/ int wxMaracasIRMViewManager::addProp3D(vtkProp3D* prop3D){ if(prop3D != NULL){ prop3Dvect.push_back(prop3D); if(_renderer!=NULL){ _renderer->AddActor(prop3D); }else{ throw "Imposible to add actor, check renderer"; } return prop3Dvect.size()-1; }else{ return -1; } } /** ** Changes the opacity in a prop3D **/ void wxMaracasIRMViewManager::changeOpacity(int propid, int value){ if(propid < prop3Dvect.size()){ vtkActor* actor = (vtkActor*)prop3Dvect[propid]; actor->GetProperty()->SetOpacity((double)value/100.0); _renderer->Render(); } } /** ** changes the isovalue in a prop3D **/ void wxMaracasIRMViewManager::changeIsoValue(int propid, int value){ if(propidSetFileName(filename.c_str()); STLReader->Update(); vtkPolyDataMapper* dataMapper = vtkPolyDataMapper::New(); dataMapper->SetInput(STLReader->GetOutput()); vtkActor* dataActor = vtkActor::New(); dataActor->SetMapper(dataMapper); dataActor->GetProperty()->SetOpacity(1); return dataActor; } return NULL; }