]> Creatis software - bbtk.git/blobdiff - packages/vtk/src/bbvtkPolyDataReaderPlus.cxx
Clean code
[bbtk.git] / packages / vtk / src / bbvtkPolyDataReaderPlus.cxx
index ab887e2e8b1dd4b783af508dd2b862d8b3525420..0d03e540ca69a8d4cba1ce0f5b5f78886c332fcf 100644 (file)
@@ -1,3 +1,30 @@
+/*
+ # ---------------------------------------------------------------------
+ #
+ # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+ #                        pour la SantÈ)
+ # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+ # Previous Authors : Laurent Guigues, Jean-Pierre Roux
+ # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+ #
+ #  This software is governed by the CeCILL-B license under French law and
+ #  abiding by the rules of distribution of free software. You can  use,
+ #  modify and/ or redistribute the software under the terms of the CeCILL-B
+ #  license as circulated by CEA, CNRS and INRIA at the following URL
+ #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+ #  or in the file LICENSE.txt.
+ #
+ #  As a counterpart to the access to the source code and  rights to copy,
+ #  modify and redistribute granted by the license, users are provided only
+ #  with a limited warranty  and the software's author,  the holder of the
+ #  economic rights,  and the successive licensors  have only  limited
+ #  liability.
+ #
+ #  The fact that you are presently reading this means that you have had
+ #  knowledge of the CeCILL-B license and that you accept its terms.
+ # ------------------------------------------------------------------------ */
+
+
 #include "bbvtkPolyDataReaderPlus.h"
 #include "bbvtkPackage.h"
 namespace bbvtk
@@ -11,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;
@@ -25,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();
@@ -35,51 +62,45 @@ void PolyDataReaderPlus::Process()
                        reader->SetFileName(bbGetInputInPath().data());
                        informacion = (vtkPolyData*)reader->GetOutput();
                        reader->CloseVTKFile();
-                       vtkPolyData* old = bbGetOutputOut();
+                       vtkPolyData* old = bbGetOutputOut();  // old unused ? // JPR
                        bbSetOutputOut(informacion);
                        readed = true;
-               }
-
+               } // if vtk
                if (extension.compare("vtp") == 0)
                {
                        vtkXMLPolyDataReader* reader = vtkXMLPolyDataReader::New();
                        reader->SetFileName(bbGetInputInPath().data());
                        informacion = reader->GetOutput();
 
-                       vtkPolyData* old = bbGetOutputOut();
+                       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();
@@ -90,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