//===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) //===== #include "bbcreaVtkVoiMPR.h" #include "bbcreaVtkPackage.h" namespace bbcreaVtk { BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,VoiMPR) BBTK_BLACK_BOX_IMPLEMENTATION(VoiMPR,bbtk::AtomicBlackBox); //===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) //===== void VoiMPR::Process() { // THE MAIN PROCESSING METHOD BODY // Here we simply set the input 'In' value to the output 'Out' // And print out the output value // INPUT/OUTPUT ACCESSORS ARE OF THE FORM : // void bbSet{Input|Output}NAME(const TYPE&) // const TYPE& bbGet{Input|Output}NAME() const // Where : // * NAME is the name of the input/output // (the one provided in the attribute 'name' of the tag 'input') // * TYPE is the C++ type of the input/output // (the one provided in the attribute 'type' of the tag 'input') // bbSetOutputOut( bbGetInputIn() ); // std::cout << "Output value = " < vecP = bbGetInputIn(); int dep; std::vector vecPoint = bbGetInputActualPoint(); if (vecPoint.size()==3) { if ((vecPoint[0]>=vecP[0]) && (vecPoint[0]<=vecP[1]) ) { showActorYZ=bbGetInputActive() && true; } else { showActorYZ=bbGetInputActive() && false; } if ((vecPoint[1]>=vecP[2]) && (vecPoint[1]<=vecP[3]) ) { showActorXZ=bbGetInputActive() && true; } else { showActorXZ=bbGetInputActive() && false; } if ((vecPoint[2]>=vecP[4]) && (vecPoint[2]<=vecP[5]) ) { showActorXY=bbGetInputActive() && true; } else { showActorXY=bbGetInputActive() && false; } } else { showActorXY=bbGetInputActive(); showActorYZ=bbGetInputActive(); showActorXZ=bbGetInputActive(); } if (bbGetInputXYrender()!=NULL) { dep=-900; pointsXY->SetPoint(0, vecP[0], vecP[2], dep); pointsXY->SetPoint(1, vecP[0], vecP[3], dep); pointsXY->SetPoint(2, vecP[1], vecP[3], dep); pointsXY->SetPoint(3, vecP[1], vecP[2], dep); pointsXY-> Modified(); if ( showActorXY==true ) { if (actorAddedXY==false) { bbGetInputXYrender()->AddActor(polygonActorXY); actorAddedXY=true; } // } else { if (actorAddedXY==true) { bbGetInputXYrender()->RemoveActor(polygonActorXY); actorAddedXY=false; } // }// Active } // if XYrender if (bbGetInputYZrender()!=NULL) { dep=900; pointsYZ->SetPoint(0, dep,vecP[2], vecP[4] ); pointsYZ->SetPoint(1, dep,vecP[2], vecP[5] ); pointsYZ->SetPoint(2, dep,vecP[3], vecP[5] ); pointsYZ->SetPoint(3, dep,vecP[3], vecP[4] ); pointsYZ-> Modified(); if ( showActorYZ==true ) { if (actorAddedYZ==false) { bbGetInputYZrender()->AddActor(polygonActorYZ); actorAddedYZ=true; } // } else { if (actorAddedYZ==true) { bbGetInputYZrender()->RemoveActor(polygonActorYZ); actorAddedYZ=false; } // }// Active } // if XYrender if (bbGetInputXZrender()!=NULL) { dep=-900; pointsXZ->SetPoint(0, vecP[0],dep, vecP[4] ); pointsXZ->SetPoint(1, vecP[0],dep, vecP[5] ); pointsXZ->SetPoint(2, vecP[1],dep, vecP[5] ); pointsXZ->SetPoint(3, vecP[1],dep, vecP[4] ); pointsXZ-> Modified(); if ( showActorXZ==true ) { if (actorAddedXZ==false) { bbGetInputXZrender()->AddActor(polygonActorXZ); actorAddedXZ=true; } // } else { if (actorAddedXZ==true) { bbGetInputXZrender()->RemoveActor(polygonActorXZ); actorAddedXZ=false; } // }// Active } // if XYrender } // In size } //===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) //===== void VoiMPR::bbUserSetDefaultValues() { // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX // Here we initialize the input 'In' to 0 actorAddedXY=false; actorAddedXZ=false; actorAddedYZ=false; bbSetInputActive(true); bbSetInputXYrender(NULL); bbSetInputYZrender(NULL); bbSetInputXZrender(NULL); } //===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) //===== void VoiMPR::bbUserInitializeProcessing() { // THE INITIALIZATION METHOD BODY : // Here does nothing // but this is where you should allocate the internal/output pointers // if any pointsXY = vtkPoints ::New(); linesXY = vtkCellArray ::New(); polygonXY = vtkPolyData ::New(); polygonMapperXY = vtkPolyDataMapper ::New(); polygonActorXY = vtkActor ::New(); pointsXY -> SetNumberOfPoints(4); pointsXY -> SetPoint(0, 0, 0, 0); pointsXY -> SetPoint(1, 0, 0, 0); pointsXY -> SetPoint(2, 0, 0, 0); pointsXY -> SetPoint(3, 0, 0, 0); linesXY -> InsertNextCell(5); linesXY -> InsertCellPoint(0); linesXY -> InsertCellPoint(1); linesXY -> InsertCellPoint(2); linesXY -> InsertCellPoint(3); linesXY -> InsertCellPoint(0); polygonXY -> SetPoints(pointsXY); polygonXY -> SetLines(linesXY); polygonMapperXY -> SetInputData(polygonXY); polygonMapperXY -> Update(); polygonActorXY -> SetMapper(polygonMapperXY); pointsXZ = vtkPoints ::New(); linesXZ = vtkCellArray ::New(); polygonXZ = vtkPolyData ::New(); polygonMapperXZ = vtkPolyDataMapper ::New(); polygonActorXZ = vtkActor ::New(); pointsXZ -> SetNumberOfPoints(4); pointsXZ -> SetPoint(0, 0, 0, 0); pointsXZ -> SetPoint(1, 0, 0, 0); pointsXZ -> SetPoint(2, 0, 0, 0); pointsXZ -> SetPoint(3, 0, 0, 0); linesXZ -> InsertNextCell(5); linesXZ -> InsertCellPoint(0); linesXZ -> InsertCellPoint(1); linesXZ -> InsertCellPoint(2); linesXZ -> InsertCellPoint(3); linesXZ -> InsertCellPoint(0); polygonXZ -> SetPoints(pointsXZ); polygonXZ -> SetLines(linesXZ); polygonMapperXZ -> SetInputData(polygonXZ); polygonMapperXZ -> Update(); polygonActorXZ -> SetMapper(polygonMapperXZ); pointsYZ = vtkPoints ::New(); linesYZ = vtkCellArray ::New(); polygonYZ = vtkPolyData ::New(); polygonMapperYZ = vtkPolyDataMapper ::New(); polygonActorYZ = vtkActor ::New(); pointsYZ ->SetNumberOfPoints(4); pointsYZ ->SetPoint(0, 0, 0, 0); pointsYZ ->SetPoint(1, 0, 0, 0); pointsYZ ->SetPoint(2, 0, 0, 0); pointsYZ ->SetPoint(3, 0, 0, 0); linesYZ ->InsertNextCell(5); linesYZ ->InsertCellPoint(0); linesYZ ->InsertCellPoint(1); linesYZ ->InsertCellPoint(2); linesYZ ->InsertCellPoint(3); linesYZ ->InsertCellPoint(0); polygonYZ -> SetPoints(pointsYZ); polygonYZ -> SetLines(linesYZ); polygonMapperYZ -> SetInputData(polygonYZ); polygonMapperYZ -> Update(); polygonActorYZ -> SetMapper(polygonMapperYZ); } //===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) //===== void VoiMPR::bbUserFinalizeProcessing() { // THE FINALIZATION METHOD BODY : // Here does nothing // but this is where you should desallocate the internal/output pointers // if any } } // EO namespace bbcreaVtk