]> Creatis software - bbtkGEditor.git/commitdiff
#3084 bbGEditor Bug New Normal - Color refresh for inputs and outputs
authorEduardo DAVILA <davila@localhost.localdomain>
Thu, 30 Mar 2017 12:34:47 +0000 (14:34 +0200)
committerEduardo DAVILA <davila@localhost.localdomain>
Thu, 30 Mar 2017 12:34:47 +0000 (14:34 +0200)
lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBoxView.cxx

index 02d194b772a3c283f2063a22a3513cda4c4d74ec..24db98a14240ae4e82838753eaeee126b2b84d16 100644 (file)
@@ -60,6 +60,8 @@ Version:   $Revision$
 
 
 #include "vtkGBoxView.h"
+#include "vtkUnsignedCharArray.h"
+#include "vtkCellData.h"
 
 namespace bbtk
 {
@@ -100,6 +102,7 @@ namespace bbtk
        void vtkGBoxView::createVtkInputOutputPorts()
        {
                ///************************* Inputs Fill (triangles) *************************
+               float rgb[3];
                GBoxModel* boxModel                     =(GBoxModel*)_model;
                int numberOfTriangles                   = boxModel->getNumInputPorts();
                _TrianglesInputsPts                             = vtkPoints::New();
@@ -124,11 +127,28 @@ namespace bbtk
                                stripTrianglesInputs->InsertCellPoint(i*3+1);
                                stripTrianglesInputs->InsertCellPoint(i*3+2);
                }
+
+               // Create cell data
+               vtkUnsignedCharArray *cellDataInputTriangles = vtkUnsignedCharArray::New();
+               cellDataInputTriangles->SetNumberOfComponents(3);
+               cellDataInputTriangles->SetNumberOfTuples(numberOfTriangles);
+               for (int i = 0; i < numberOfTriangles; i++)
+               {
+                       rgb[0] = 100;
+                       rgb[1] = 100;
+                       rgb[2] = 100;
+                       cellDataInputTriangles->SetTuple(i, rgb);
+               } // for colors  
+               pdTrianglesInputs->GetCellData()->SetScalars(cellDataInputTriangles);
+
                pdTrianglesInputs->SetPoints( _TrianglesInputsPts );
                pdTrianglesInputs->SetStrips( stripTrianglesInputs );
                _TrianglesInputsPolyMapper->SetInput( pdTrianglesInputs );
                _TrianglesInputsActor->SetMapper(_TrianglesInputsPolyMapper);
                _TrianglesInputsPolyMapper->Modified();
+
+
+
                ///************************* Inputs Fill (triangles) *************************
 
                ///************************* Outputs Fill (triangles) *************************
@@ -150,11 +170,23 @@ namespace bbtk
                // RaC In the actual version, zInic=zFin=GPOSITION_Z
                for (int i=0 ; i<numberOfTriangles; i++)
                {
-                               stripTrianglesOutputs->InsertNextCell( 3 );
-                               stripTrianglesOutputs->InsertCellPoint(i*3+0);
-                               stripTrianglesOutputs->InsertCellPoint(i*3+1);
-                               stripTrianglesOutputs->InsertCellPoint(i*3+2);
-               }
+                       stripTrianglesOutputs->InsertNextCell( 3 );
+                       stripTrianglesOutputs->InsertCellPoint(i*3+0);
+                       stripTrianglesOutputs->InsertCellPoint(i*3+1);
+                       stripTrianglesOutputs->InsertCellPoint(i*3+2);
+               } // for
+               // Create cell data
+               vtkUnsignedCharArray *cellDataOutputTriangle = vtkUnsignedCharArray::New();
+               cellDataOutputTriangle->SetNumberOfComponents(3);
+               cellDataOutputTriangle->SetNumberOfTuples(numberOfTriangles);
+               for (int i = 0; i < numberOfTriangles; i++)
+               {
+                       rgb[0] = 000;
+                       rgb[1] = 255;
+                       rgb[2] = 255;
+                       cellDataOutputTriangle->SetTuple(i, rgb);
+               } // for colors  
+               pdTrianglesOutputs->GetCellData()->SetScalars(cellDataOutputTriangle);
                pdTrianglesOutputs->SetPoints( _TrianglesOutputsPts );
                pdTrianglesOutputs->SetStrips( stripTrianglesOutputs );
                _TrianglesOutputsPolyMapper->SetInput( pdTrianglesOutputs );