#include "vtkGBoxView.h"
+#include "vtkUnsignedCharArray.h"
+#include "vtkCellData.h"
namespace bbtk
{
void vtkGBoxView::createVtkInputOutputPorts()
{
///************************* Inputs Fill (triangles) *************************
+ float rgb[3];
GBoxModel* boxModel =(GBoxModel*)_model;
int numberOfTriangles = boxModel->getNumInputPorts();
_TrianglesInputsPts = vtkPoints::New();
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) *************************
// 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 );