From c49d4bbc66c64ee56a0f7de04ff2e551b3de6a46 Mon Sep 17 00:00:00 2001 From: "eduardo.davila@creatis.insa-lyon.fr" Date: Mon, 12 Feb 2024 14:12:38 +0100 Subject: [PATCH] Clean code --- packages/vtk/src/bbvtkPolyDataReaderPlus.cxx | 41 ++++++-------------- 1 file changed, 12 insertions(+), 29 deletions(-) diff --git a/packages/vtk/src/bbvtkPolyDataReaderPlus.cxx b/packages/vtk/src/bbvtkPolyDataReaderPlus.cxx index 2f7c44f..0d03e54 100644 --- a/packages/vtk/src/bbvtkPolyDataReaderPlus.cxx +++ b/packages/vtk/src/bbvtkPolyDataReaderPlus.cxx @@ -38,9 +38,11 @@ void PolyDataReaderPlus::Process() std::cout << "[" << this << "]" << "PolyDataReaderPlus::Process()..." << std::endl; //Review the observers... - if (!HasObserver(OBS_POST_READER_1) && bbGetInputInPostReadObs1() != NULL) - AddObserver(OBS_POST_READER_1, bbGetInputInPostReadObs1()); - + if (!HasObserver(OBS_POST_READER_1) && bbGetInputInPostReadObs1() != NULL) + { + AddObserver(OBS_POST_READER_1, bbGetInputInPostReadObs1()); + } + if (bbGetInputInPath().size()==0) { std::cout << "Set InPath." << std::endl; @@ -52,9 +54,7 @@ void PolyDataReaderPlus::Process() { std::vector< std::string > partes = StringSplit(bbGetInputInPath(), "."); std::string extension = partes.at(partes.size()-1); - std::cout << "Extension (vtk o vtp?) = " << extension << std::endl; - if (extension.compare("vtk") == 0) { //vtkPolyDataReader* reader = vtkPolyDataReader::New(); @@ -65,8 +65,7 @@ void PolyDataReaderPlus::Process() vtkPolyData* old = bbGetOutputOut(); // old unused ? // JPR bbSetOutputOut(informacion); readed = true; - } - + } // if vtk if (extension.compare("vtp") == 0) { vtkXMLPolyDataReader* reader = vtkXMLPolyDataReader::New(); @@ -76,42 +75,32 @@ void PolyDataReaderPlus::Process() vtkPolyData* old = bbGetOutputOut(); // old unused ? // JPR bbSetOutputOut(informacion); readed = true; - } + } // if vtp } - vtkActor *actor = (vtkActor*)bbGetOutputOutActor(); vtkPolyDataMapper *mapper = vtkPolyDataMapper::New(); - //EED 2017-01-01 Migration VTK7 #if VTK_MAJOR_VERSION <= 5 mapper->SetInput(informacion); #else mapper->SetInputData(informacion); #endif - actor->SetMapper(mapper); bbSetOutputOutActor(actor); - if (bbGetInputInColor().size() >= 3) { actor->GetProperty()->SetColor(bbGetInputInColor()[0],bbGetInputInColor()[1],bbGetInputInColor()[2]); - } - else - { + } else { actor->GetProperty()->SetColor(1,1,1); } actor->GetProperty()->SetOpacity(bbGetInputInOpacity()/100); - //old->Delete(); - InvokeEvent(OBS_POST_READER_1, informacion); - std::cout << "END [" << this << "]" << "PolyDataReaderPlus::Process()..." << std::endl; - } + void PolyDataReaderPlus::bbUserSetDefaultValues() { - // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX // Here we initialize the input 'In' to 0 vtkPolyData* empty = vtkPolyData::New(); @@ -122,32 +111,26 @@ void PolyDataReaderPlus::bbUserSetDefaultValues() bbSetInputInPath(nada); bbSetOutputOutActor(actor); bbSetInputInOpacity(50); - readed = false; - } + void PolyDataReaderPlus::bbUserInitializeProcessing() { - // THE INITIALIZATION METHOD BODY : // Here does nothing // but this is where you should allocate the internal/output pointers // if any - - } + void PolyDataReaderPlus::bbUserFinalizeProcessing() { - // THE FINALIZATION METHOD BODY : // Here does nothing // but this is where you should desallocate the internal/output pointers // if any - } -} -// EO namespace bbvtk +}// EO namespace bbvtk -- 2.45.0