From d108e756e1f5444e19b63ec457033b7518ba060e Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Thu, 30 Mar 2017 14:34:47 +0200 Subject: [PATCH 1/1] #3084 bbGEditor Bug New Normal - Color refresh for inputs and outputs --- .../bbsVtkGUIEditorGraphic/vtkGBoxView.cxx | 42 ++++++++++++++++--- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBoxView.cxx b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBoxView.cxx index 02d194b..24db98a 100644 --- a/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBoxView.cxx +++ b/lib/EditorGraphicBBS/bbsVtkGUIEditorGraphic/vtkGBoxView.cxx @@ -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 ; iInsertNextCell( 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 ); -- 2.46.2