From 9620c02fefc725a4e9dc11667be9a555b2502a12 Mon Sep 17 00:00:00 2001 From: apo Date: Tue, 31 Oct 2006 05:56:31 +0000 Subject: [PATCH] Clarify process of creation VISU pipelines --- src/VISUGUI/VisuGUI_ClippingDlg.cxx | 2 +- src/VISUGUI/VisuGUI_CutLinesDlg.cxx | 18 +++--- src/VISUGUI/VisuGUI_CutPlanesDlg.cxx | 10 ++-- src/VISUGUI/VisuGUI_Plot3DDlg.cxx | 8 +-- src/VISUGUI/VisuGUI_Selection.cxx | 2 +- src/VISU_I/VISU_ColoredPrs3d_i.cc | 20 ++++--- src/VISU_I/VISU_ColoredPrs3d_i.hh | 2 +- src/VISU_I/VISU_CutLines_i.cc | 11 ++-- src/VISU_I/VISU_CutLines_i.hh | 2 +- src/VISU_I/VISU_CutPlanes_i.cc | 11 ++-- src/VISU_I/VISU_CutPlanes_i.hh | 2 +- src/VISU_I/VISU_DeformedShape_i.cc | 18 +++--- src/VISU_I/VISU_DeformedShape_i.hh | 2 +- src/VISU_I/VISU_GaussPoints_i.cc | 24 ++++---- src/VISU_I/VISU_GaussPoints_i.hh | 4 +- src/VISU_I/VISU_IsoSurfaces_i.cc | 11 ++-- src/VISU_I/VISU_IsoSurfaces_i.hh | 2 +- src/VISU_I/VISU_Mesh_i.cc | 4 +- src/VISU_I/VISU_Plot3D_i.cc | 11 ++-- src/VISU_I/VISU_Plot3D_i.hh | 2 +- src/VISU_I/VISU_Prs3d_i.cc | 55 ++++++++++++------- src/VISU_I/VISU_Prs3d_i.hh | 15 +++-- src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc | 20 +++---- src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh | 2 +- src/VISU_I/VISU_StreamLines_i.cc | 19 ++++--- src/VISU_I/VISU_StreamLines_i.hh | 2 +- src/VISU_I/VISU_Vectors_i.cc | 19 ++++--- src/VISU_I/VISU_Vectors_i.hh | 4 +- 28 files changed, 167 insertions(+), 135 deletions(-) diff --git a/src/VISUGUI/VisuGUI_ClippingDlg.cxx b/src/VISUGUI/VisuGUI_ClippingDlg.cxx index f0b526a0..d3cd143e 100644 --- a/src/VISUGUI/VisuGUI_ClippingDlg.cxx +++ b/src/VISUGUI/VisuGUI_ClippingDlg.cxx @@ -518,7 +518,7 @@ void VisuGUI_ClippingDlg::ClickOnApply() // Check contents of the resulting (clipped) presentation data if (!isFailed) { - VISU_PipeLine* aPL = myPrs3d->GetPL(); + VISU_PipeLine* aPL = myPrs3d->GetPipeLine(); VISU_PipeLine::TMapper* aM = aPL->GetMapper(); vtkDataSet* aPrsData = aM->GetInput(); aPrsData->Update(); diff --git a/src/VISUGUI/VisuGUI_CutLinesDlg.cxx b/src/VISUGUI/VisuGUI_CutLinesDlg.cxx index 96d8cddf..4ff285f3 100644 --- a/src/VISUGUI/VisuGUI_CutLinesDlg.cxx +++ b/src/VISUGUI/VisuGUI_CutLinesDlg.cxx @@ -354,7 +354,7 @@ void VisuGUI_CutLinesDlg::createPlanes() if (myPreviewActor != 0) return; storeToPrsObject(myCutLines); - myCutLines->GetPL()->Update(); + myCutLines->GetPipeLine()->Update(); vtkAppendPolyData* aPolyData = myCutLines->GetSpecificPL()->GetAppendPolyData(); vtkDataSetMapper* aPlaneMapper = vtkDataSetMapper::New(); aPlaneMapper->SetInput(aPolyData->GetOutput()); @@ -455,7 +455,7 @@ void VisuGUI_CutLinesDlg::onCutSelect (int theId, bool theUpdate) myRotXSpn2->value()*PI/180., myRotYSpn2->value()*PI/180.); myCutLines->SetDisplacement2(myPosSpn2->value());*/ - //myCutLines->GetPL()->Update(); + //myCutLines->GetPipeLine()->Update(); deletePlanes(); createPlanes(); //aView->Repaint(); @@ -481,7 +481,7 @@ void VisuGUI_CutLinesDlg::setBaseDefault (bool theUpdate) if (aView) { if (theUpdate && myPreviewCheck->isChecked() && (myCutLines != NULL)) { //myCutLines->SetBasePlanePosition(aPos); - // myCutLines->GetPL()->Update(); + // myCutLines->GetPipeLine()->Update(); deletePlanes(); createPlanes(); //aView->Repaint(); @@ -552,7 +552,7 @@ void VisuGUI_CutLinesDlg::DrawTable() SVTK_ViewWindow* aView = VISU::GetActiveViewWindow(); if (aView) { if (myPreviewCheck->isChecked()) { - // myCutLines->GetPL()->Update(); + // myCutLines->GetPipeLine()->Update(); deletePlanes(); createPlanes(); //aView->Repaint(); @@ -722,7 +722,7 @@ void VisuGUI_CutLinesDlg::onValueChanged (int theRow, int theCol) if (myPreviewCheck->isChecked()) { //Update Preview //myCutLines->SetLinePosition( theRow, aTxt.toDouble()); - // myCutLines->GetPL()->Update(); + // myCutLines->GetPipeLine()->Update(); deletePlanes(); createPlanes(); //aView->Repaint(); @@ -737,7 +737,7 @@ void VisuGUI_CutLinesDlg::onValueChanged (int theRow, int theCol) if (aView) { if (myPreviewCheck->isChecked()) { //Update Preview - // myCutLines->GetPL()->Update(); + // myCutLines->GetPipeLine()->Update(); deletePlanes(); createPlanes(); //aView->Repaint(); @@ -856,7 +856,7 @@ void VisuGUI_CutLinesDlg::onPreviewCheck (bool thePreview) if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow()) { if (thePreview) { //storeToPrsObject(myCutLines); - // myCutLines->GetPL()->Update(); + // myCutLines->GetPipeLine()->Update(); createPlanes(); //vf->onFitAll(); } else { @@ -894,7 +894,7 @@ void VisuGUI_CutLinesDlg::onRotation (double theValue) myCutLines->SetOrientation2(getOrientaion(false), myRotXSpn2->value()*PI/180., myRotYSpn2->value()*PI/180.);*/ - // myCutLines->GetPL()->Update(); + // myCutLines->GetPipeLine()->Update(); deletePlanes(); createPlanes(); //aView->Repaint(); @@ -909,7 +909,7 @@ void VisuGUI_CutLinesDlg::onPlanePos (const QString& theValue) if (aView) { if (myPreviewCheck->isChecked()) { //myCutLines->SetBasePlanePosition(theValue.toDouble()); - // myCutLines->GetPL()->Update(); + // myCutLines->GetPipeLine()->Update(); deletePlanes(); createPlanes(); //aView->Repaint(); diff --git a/src/VISUGUI/VisuGUI_CutPlanesDlg.cxx b/src/VISUGUI/VisuGUI_CutPlanesDlg.cxx index aadb2de3..c7c9f190 100644 --- a/src/VISUGUI/VisuGUI_CutPlanesDlg.cxx +++ b/src/VISUGUI/VisuGUI_CutPlanesDlg.cxx @@ -353,7 +353,7 @@ void VisuGUI_CutPlanesPane::DrawTable() // Update preview if (myPreviewCheck->isChecked()) { if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow()) { - myCutPlanes->GetPL()->Update(); + myCutPlanes->GetPipeLine()->Update(); deletePlanes(); createPlanes(); vf->Repaint(); @@ -391,7 +391,7 @@ void VisuGUI_CutPlanesPane::onValueChanged (int theRow, int theCol) //Update Preview if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow()) { myCutPlanes->SetPlanePosition( theRow, aTxt.toDouble()); - myCutPlanes->GetPL()->Update(); + myCutPlanes->GetPipeLine()->Update(); deletePlanes(); createPlanes(); vf->Repaint(); @@ -406,7 +406,7 @@ void VisuGUI_CutPlanesPane::onValueChanged (int theRow, int theCol) if (myPreviewCheck->isChecked()) { if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow()) { //Update Preview - myCutPlanes->GetPL()->Update(); + myCutPlanes->GetPipeLine()->Update(); deletePlanes(); createPlanes(); vf->Repaint(); @@ -438,7 +438,7 @@ void VisuGUI_CutPlanesPane::onRotation (double theValue) if (myPreviewCheck->isChecked()) { if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow()) { myCutPlanes->SetOrientation(getOrientaion(),getRotation1()*PI/180.,getRotation2()*PI/180.); - myCutPlanes->GetPL()->Update(); + myCutPlanes->GetPipeLine()->Update(); deletePlanes(); createPlanes(); vf->Repaint(); @@ -451,7 +451,7 @@ void VisuGUI_CutPlanesPane::onPreviewCheck (bool thePreview) if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow()) { if (thePreview) { storeToPrsObject(myCutPlanes); - myCutPlanes->GetPL()->Update(); + myCutPlanes->GetPipeLine()->Update(); createPlanes(); vf->onFitAll(); } else { diff --git a/src/VISUGUI/VisuGUI_Plot3DDlg.cxx b/src/VISUGUI/VisuGUI_Plot3DDlg.cxx index b49e8a54..a46e9730 100644 --- a/src/VISUGUI/VisuGUI_Plot3DDlg.cxx +++ b/src/VISUGUI/VisuGUI_Plot3DDlg.cxx @@ -260,8 +260,8 @@ void VisuGUI_Plot3DPane::storePrsParams() if (!myPipeCopy) myPipeCopy = VISU_Plot3DPL::New(); if (myPrs) { - myPipeCopy->SetIDMapper(myPrs->GetPL()->GetIDMapper()); - myPipeCopy->ShallowCopy(myPrs->GetPL()); + myPipeCopy->SetIDMapper(myPrs->GetPipeLine()->GetIDMapper()); + myPipeCopy->ShallowCopy(myPrs->GetPipeLine()); storeToPrsObject(myPrs); } } @@ -275,7 +275,7 @@ void VisuGUI_Plot3DPane::restorePrsParams() if (!myPipeCopy) myPipeCopy = VISU_Plot3DPL::New(); if (myPrs) - myPrs->GetPL()->ShallowCopy(myPipeCopy); + myPrs->GetPipeLine()->ShallowCopy(myPipeCopy); } //======================================================================= @@ -439,7 +439,7 @@ void VisuGUI_Plot3DPane::initFromPrsObject(VISU::Plot3D_i* thePrs) // disable cutting plane controls if the mesh is planar - if (thePrs->GetPL()->IsPlanarInput()) + if (thePrs->GetPipeLine()->IsPlanarInput()) { GBOrientation->setEnabled(false); Rot1 ->setEnabled(false); diff --git a/src/VISUGUI/VisuGUI_Selection.cxx b/src/VISUGUI/VisuGUI_Selection.cxx index 6ddd429f..140e0edd 100644 --- a/src/VISUGUI/VisuGUI_Selection.cxx +++ b/src/VISUGUI/VisuGUI_Selection.cxx @@ -575,7 +575,7 @@ bool onIdEdit (const QString& theText, if (aPrs3d) { int anId = theText.toInt(); - vtkDataSet* aDataSet = aPrs3d->GetPL()->GetMapper()->GetInput(); + vtkDataSet* aDataSet = aPrs3d->GetPipeLine()->GetMapper()->GetInput(); int aMaxId = (aDataSet->*theMethod)(); if (anId < 0) anId = 0; if (anId >= aMaxId) anId = aMaxId - 1; diff --git a/src/VISU_I/VISU_ColoredPrs3d_i.cc b/src/VISU_I/VISU_ColoredPrs3d_i.cc index f496f886..e233854f 100644 --- a/src/VISU_I/VISU_ColoredPrs3d_i.cc +++ b/src/VISU_I/VISU_ColoredPrs3d_i.cc @@ -119,9 +119,9 @@ bool VISU::ColoredPrs3d_i ::OnSetInput() { - bool anIsNotCreated = GetPL() == NULL; + bool anIsNotCreated = !IsPipeLineExists(); if(anIsNotCreated) - CreatePipeLine(); // to create proper pipeline + CreatePipeLine(NULL); // to create proper pipeline DoSetInput(); @@ -771,14 +771,16 @@ VISU::ColoredPrs3d_i //---------------------------------------------------------------------------- void VISU::ColoredPrs3d_i -::CreatePipeLine() +::CreatePipeLine(VISU_PipeLine* thePipeLine) { - if(MYDEBUG) MESSAGE("ColoredPrs3d_i::CreatePipeLine() - "<GetMapper()->SetScalarVisibility(1); - } - myScalarMapPL = dynamic_cast(myPipeLine); + if(MYDEBUG) MESSAGE("ColoredPrs3d_i::CreatePipeLine() - "<GetMapper()->SetScalarVisibility(1); + }else + myScalarMapPL = dynamic_cast(thePipeLine); + + SetPipeLine(myScalarMapPL); } //---------------------------------------------------------------------------- diff --git a/src/VISU_I/VISU_ColoredPrs3d_i.hh b/src/VISU_I/VISU_ColoredPrs3d_i.hh index de908370..6f03e81e 100644 --- a/src/VISU_I/VISU_ColoredPrs3d_i.hh +++ b/src/VISU_I/VISU_ColoredPrs3d_i.hh @@ -325,7 +325,7 @@ namespace VISU */ virtual void - CreatePipeLine(); + CreatePipeLine(VISU_PipeLine* thePipeLine); /*! First checks whether corresponding VTK pipeline exists and create it if not. diff --git a/src/VISU_I/VISU_CutLines_i.cc b/src/VISU_I/VISU_CutLines_i.cc index 8af03cfb..2b8bbd22 100644 --- a/src/VISU_I/VISU_CutLines_i.cc +++ b/src/VISU_I/VISU_CutLines_i.cc @@ -462,13 +462,14 @@ VISU::CutLines_i //--------------------------------------------------------------- void VISU::CutLines_i -::CreatePipeLine() +::CreatePipeLine(VISU_PipeLine* thePipeLine) { - if(!myPipeLine) - myPipeLine = VISU_CutLinesPL::New(); - myCutLinesPL = dynamic_cast(myPipeLine); + if(!thePipeLine){ + myCutLinesPL = VISU_CutLinesPL::New(); + }else + myCutLinesPL = dynamic_cast(thePipeLine); - TSuperClass::CreatePipeLine(); + TSuperClass::CreatePipeLine(myCutLinesPL); } diff --git a/src/VISU_I/VISU_CutLines_i.hh b/src/VISU_I/VISU_CutLines_i.hh index 9ccf7082..7bf3291a 100644 --- a/src/VISU_I/VISU_CutLines_i.hh +++ b/src/VISU_I/VISU_CutLines_i.hh @@ -191,7 +191,7 @@ namespace VISU //! Extends VISU_ColoredPrs3d_i::CreatePipeLine virtual void - CreatePipeLine(); + CreatePipeLine(VISU_PipeLine* thePipeLine); //! Extends VISU_ColoredPrs3d_i::CheckIsPossible virtual diff --git a/src/VISU_I/VISU_CutPlanes_i.cc b/src/VISU_I/VISU_CutPlanes_i.cc index cfcc4ce4..70d0fc17 100644 --- a/src/VISU_I/VISU_CutPlanes_i.cc +++ b/src/VISU_I/VISU_CutPlanes_i.cc @@ -270,13 +270,14 @@ VISU::CutPlanes_i //---------------------------------------------------------------------------- void VISU::CutPlanes_i -::CreatePipeLine() +::CreatePipeLine(VISU_PipeLine* thePipeLine) { - if(!myPipeLine) - myPipeLine = VISU_CutPlanesPL::New(); - myCutPlanesPL = dynamic_cast(myPipeLine); + if(!thePipeLine){ + myCutPlanesPL = VISU_CutPlanesPL::New(); + }else + myCutPlanesPL = dynamic_cast(thePipeLine); - TSuperClass::CreatePipeLine(); + TSuperClass::CreatePipeLine(myCutPlanesPL); } diff --git a/src/VISU_I/VISU_CutPlanes_i.hh b/src/VISU_I/VISU_CutPlanes_i.hh index 006c8c7e..6ce30b04 100644 --- a/src/VISU_I/VISU_CutPlanes_i.hh +++ b/src/VISU_I/VISU_CutPlanes_i.hh @@ -121,7 +121,7 @@ namespace VISU //! Redefines VISU_ColoredPrs3d_i::CreatePipeLine virtual void - CreatePipeLine(); + CreatePipeLine(VISU_PipeLine* thePipeLine); //! Redefines VISU_ColoredPrs3d_i::CheckIsPossible virtual diff --git a/src/VISU_I/VISU_DeformedShape_i.cc b/src/VISU_I/VISU_DeformedShape_i.cc index 63ccef52..0776e8d7 100644 --- a/src/VISU_I/VISU_DeformedShape_i.cc +++ b/src/VISU_I/VISU_DeformedShape_i.cc @@ -254,14 +254,16 @@ VISU::DeformedShape_i //--------------------------------------------------------------- void VISU::DeformedShape_i -::CreatePipeLine() +::CreatePipeLine(VISU_PipeLine* thePipeLine) { - if(!myPipeLine) - myPipeLine = VISU_DeformedShapePL::New(); - myDeformedShapePL = dynamic_cast(myPipeLine); - myPipeLine->GetMapper()->SetScalarVisibility(IsColored()); + if(!thePipeLine){ + myDeformedShapePL = VISU_DeformedShapePL::New(); + }else + myDeformedShapePL = dynamic_cast(thePipeLine); - TSuperClass::CreatePipeLine(); + myDeformedShapePL->GetMapper()->SetScalarVisibility(IsColored()); + + TSuperClass::CreatePipeLine(myDeformedShapePL); } @@ -318,10 +320,10 @@ VISU::DeformedShape_i if(VISU_ScalarMapAct* anActor = dynamic_cast(theActor)){ if(IsColored()){ anActor->SetBarVisibility(true); - myPipeLine->GetMapper()->SetScalarVisibility(1); + GetPipeLine()->GetMapper()->SetScalarVisibility(1); }else{ anActor->SetBarVisibility(false); - myPipeLine->GetMapper()->SetScalarVisibility(0); + GetPipeLine()->GetMapper()->SetScalarVisibility(0); anActor->GetProperty()->SetColor(myColor.R,myColor.G,myColor.B); } TSuperClass::UpdateActor(theActor); diff --git a/src/VISU_I/VISU_DeformedShape_i.hh b/src/VISU_I/VISU_DeformedShape_i.hh index 902e5cbf..3e768bcd 100644 --- a/src/VISU_I/VISU_DeformedShape_i.hh +++ b/src/VISU_I/VISU_DeformedShape_i.hh @@ -99,7 +99,7 @@ namespace VISU //! Redefines VISU_ColoredPrs3d_i::CreatePipeLine virtual void - CreatePipeLine(); + CreatePipeLine(VISU_PipeLine* thePipeLine); //! Redefines VISU_ColoredPrs3d_i::CheckIsPossible virtual diff --git a/src/VISU_I/VISU_GaussPoints_i.cc b/src/VISU_I/VISU_GaussPoints_i.cc index 5f66133f..8765c43a 100644 --- a/src/VISU_I/VISU_GaussPoints_i.cc +++ b/src/VISU_I/VISU_GaussPoints_i.cc @@ -540,27 +540,27 @@ VISU::GaussPoints_i //---------------------------------------------------------------------------- void VISU::GaussPoints_i -::CreatePipeLine() +::CreatePipeLine(VISU_PipeLine* thePipeLine) { - if(!myPipeLine) - myPipeLine = VISU_GaussPointsPL::New(); + if(!thePipeLine){ + myGaussPointsPL = VISU_GaussPointsPL::New(); + }else + myGaussPointsPL = dynamic_cast(thePipeLine); - myGaussPointsPL = dynamic_cast(myPipeLine); - - TSuperClass::CreatePipeLine(); + TSuperClass::CreatePipeLine(myGaussPointsPL); } //---------------------------------------------------------------------------- VISU_PipeLine* VISU::GaussPoints_i -::GetPipeLine() +::GetPL() { // We create a new PipeLine instance in order to provide // different representations for different actors (basic and segmented) VISU_GaussPointsPL* aPipeLine = VISU_GaussPointsPL::New(); aPipeLine->SetGaussPtsIDMapper(myGaussPointsPL->GetGaussPtsIDMapper()); - aPipeLine->ShallowCopy(myPipeLine); + aPipeLine->ShallowCopy(GetPipeLine()); aPipeLine->Update(); return aPipeLine; } @@ -635,7 +635,7 @@ VISU::GaussPoints_i theScalarBar->SetOrientation(myOrientation); theScalarBar->SetNumberOfLabels(myNumberOfLabels); - vtkLookupTable* aLookupTable = myScalarMapPL->GetBarTable(); + vtkLookupTable* aLookupTable = GetSpecificPL()->GetBarTable(); theLookupTable->SetNumberOfColors(aLookupTable->GetNumberOfColors()); theScalarBar->SetMaximumNumberOfColors(aLookupTable->GetNumberOfColors()); @@ -667,10 +667,10 @@ VISU::GaussPoints_i VISU_ScalarBarCtrl *aScalarBarCtrl = anActor->GetScalarBarCtrl(); if(GetIsColored()){ anActor->SetBarVisibility(true); - myPipeLine->GetMapper()->SetScalarVisibility(1); + GetPipeLine()->GetMapper()->SetScalarVisibility(1); vtkFloatingPointType aRange[2]; - myScalarMapPL->GetSourceRange(aRange); + GetSpecificPL()->GetSourceRange(aRange); aScalarBarCtrl->SetRangeLocal(aRange); TMinMax aTMinMax(-VTK_LARGE_FLOAT,VTK_LARGE_FLOAT); @@ -721,7 +721,7 @@ VISU::GaussPoints_i }else{ anActor->SetBarVisibility(false); - myPipeLine->GetMapper()->SetScalarVisibility(0); + GetPipeLine()->GetMapper()->SetScalarVisibility(0); anActor->GetProperty()->SetColor(myColor.red() / 255.0, myColor.green() / 255.0, diff --git a/src/VISU_I/VISU_GaussPoints_i.hh b/src/VISU_I/VISU_GaussPoints_i.hh index 06da4227..8e8a9bcf 100644 --- a/src/VISU_I/VISU_GaussPoints_i.hh +++ b/src/VISU_I/VISU_GaussPoints_i.hh @@ -257,7 +257,7 @@ namespace VISU //! Redefines VISU_ColoredPrs3d_i::CreatePipeLine virtual void - CreatePipeLine(); + CreatePipeLine(VISU_PipeLine* thePipeLine); //! Redefines VISU_ColoredPrs3d_i::CheckIsPossible virtual @@ -266,7 +266,7 @@ namespace VISU virtual VISU_PipeLine* - GetPipeLine(); + GetPL(); bool OnCreateActor(VISU_GaussPtsAct* theActor, diff --git a/src/VISU_I/VISU_IsoSurfaces_i.cc b/src/VISU_I/VISU_IsoSurfaces_i.cc index b165af57..18994dfc 100644 --- a/src/VISU_I/VISU_IsoSurfaces_i.cc +++ b/src/VISU_I/VISU_IsoSurfaces_i.cc @@ -195,13 +195,14 @@ VISU::IsoSurfaces_i //--------------------------------------------------------------- void VISU::IsoSurfaces_i -::CreatePipeLine() +::CreatePipeLine(VISU_PipeLine* thePipeLine) { - if(MYDEBUG) MESSAGE("IsoSurfaces_i::DoHook()- "<(myPipeLine); + if(!thePipeLine){ + myIsoSurfacesPL = VISU_IsoSurfacesPL::New(); + }else + myIsoSurfacesPL = dynamic_cast(thePipeLine); - TSuperClass::CreatePipeLine(); + TSuperClass::CreatePipeLine(myIsoSurfacesPL); } diff --git a/src/VISU_I/VISU_IsoSurfaces_i.hh b/src/VISU_I/VISU_IsoSurfaces_i.hh index bcbb8662..96195365 100644 --- a/src/VISU_I/VISU_IsoSurfaces_i.hh +++ b/src/VISU_I/VISU_IsoSurfaces_i.hh @@ -91,7 +91,7 @@ namespace VISU //! Redefines VISU_ColoredPrs3d_i::CreatePipeLine virtual void - CreatePipeLine(); + CreatePipeLine(VISU_PipeLine* thePipeLine); //! Redefines VISU_ColoredPrs3d_i::CheckIsPossible virtual diff --git a/src/VISU_I/VISU_Mesh_i.cc b/src/VISU_I/VISU_Mesh_i.cc index a848763f..dfc8499c 100644 --- a/src/VISU_I/VISU_Mesh_i.cc +++ b/src/VISU_I/VISU_Mesh_i.cc @@ -62,7 +62,7 @@ Mesh_i(Result_i* theResult) : Prs3d_i(theResult,false), myMeshPL(VISU_MeshPL::New()) { - myPipeLine = myMeshPL; + SetPipeLine(myMeshPL); } @@ -73,7 +73,7 @@ Mesh_i(Result_i* theResult, Prs3d_i(theResult,theSObject), myMeshPL(VISU_MeshPL::New()) { - myPipeLine = myMeshPL; + SetPipeLine(myMeshPL); } diff --git a/src/VISU_I/VISU_Plot3D_i.cc b/src/VISU_I/VISU_Plot3D_i.cc index 7484a710..238d47d5 100644 --- a/src/VISU_I/VISU_Plot3D_i.cc +++ b/src/VISU_I/VISU_Plot3D_i.cc @@ -279,13 +279,14 @@ VISU::Plot3D_i //--------------------------------------------------------------- void VISU::Plot3D_i -::CreatePipeLine() +::CreatePipeLine(VISU_PipeLine* thePipeLine) { - if (!myPipeLine) - myPipeLine = VISU_Plot3DPL::New(); - myPlot3DPL = dynamic_cast(myPipeLine); + if(!thePipeLine){ + myPlot3DPL = VISU_Plot3DPL::New(); + }else + myPlot3DPL = dynamic_cast(thePipeLine); - TSuperClass::CreatePipeLine(); + TSuperClass::CreatePipeLine(myPlot3DPL); } diff --git a/src/VISU_I/VISU_Plot3D_i.hh b/src/VISU_I/VISU_Plot3D_i.hh index 8a1ce19e..cf64efe8 100644 --- a/src/VISU_I/VISU_Plot3D_i.hh +++ b/src/VISU_I/VISU_Plot3D_i.hh @@ -120,7 +120,7 @@ namespace VISU //! Redefines VISU_ColoredPrs3d_i::CreatePipeLine virtual void - CreatePipeLine(); + CreatePipeLine(VISU_PipeLine* thePipeLine); //! Redefines VISU_ColoredPrs3d_i::CheckIsPossible virtual diff --git a/src/VISU_I/VISU_Prs3d_i.cc b/src/VISU_I/VISU_Prs3d_i.cc index 244f289c..cc4cc6b0 100644 --- a/src/VISU_I/VISU_Prs3d_i.cc +++ b/src/VISU_I/VISU_Prs3d_i.cc @@ -96,7 +96,7 @@ VISU::Prs3d_i ::SameAs(const Prs3d_i* theOrigin) { if(Prs3d_i* anOrigin = const_cast(theOrigin)){ - myPipeLine->SameAs(anOrigin->GetPL()); + GetPipeLine()->SameAs(anOrigin->GetPipeLine()); anOrigin->GetOffset(myOffset); } } @@ -108,7 +108,8 @@ VISU::Prs3d_i { if(MYDEBUG) MESSAGE("Prs3d_i::~Prs3d_i - this = "<Delete(); + if(IsPipeLineExists()) + GetPipeLine()->Delete(); if(myResult) myResult->Destroy(); } @@ -190,8 +191,8 @@ VISU::Prs3d_i ::GetMTime() { unsigned long int aTime = myParamsTime.GetMTime(); - if(myPipeLine) - aTime = std::max(aTime,myPipeLine->GetMTime()); + if(IsPipeLineExists()) + aTime = std::max(aTime,GetPipeLine()->GetMTime()); return aTime; } @@ -250,10 +251,8 @@ VISU::Prs3d_i if(MYDEBUG) MESSAGE("Prs3d_i::Update - this = "<Update(); - myUpdateTime.Modified(); - } + GetPipeLine()->Update(); + myUpdateTime.Modified(); } catch(std::exception&){ throw; }catch(...){ @@ -270,7 +269,7 @@ VISU::Prs3d_i if(GetMTime() < myUpdateTime.GetMTime()) return; - vtkMapper *aMapper = myPipeLine->GetMapper(); + vtkMapper *aMapper = GetPipeLine()->GetMapper(); vtkDataSet *aDataSet = aMapper->GetInput(); if (!aDataSet) throw std::runtime_error("There is no input data !!!"); @@ -317,23 +316,39 @@ VISU::Prs3d_i //---------------------------------------------------------------------------- VISU_PipeLine* VISU::Prs3d_i -::GetPipeLine() +::GetPipeLine() const { - return GetPL(); + if(!myPipeLine) + throw std::runtime_error("VISU::Prs3d_i::myPipeLine == NULL !!!"); + + return myPipeLine; } +void +VISU::Prs3d_i +::SetPipeLine(VISU_PipeLine* thePipeLine) +{ + myPipeLine = thePipeLine; +} + +bool +VISU::Prs3d_i +::IsPipeLineExists() +{ + return myPipeLine != NULL; +} VISU_PipeLine* VISU::Prs3d_i ::GetPL() { - return myPipeLine; + return GetPipeLine(); } vtkUnstructuredGrid* VISU::Prs3d_i:: GetInput() { - return myPipeLine->GetInput(); + return GetPipeLine()->GetInput(); } @@ -399,7 +414,7 @@ VISU::Prs3d_i if(MYDEBUG) MESSAGE("Prs3d_i::UpdateActor - this = "<(myPipeLine); - myPipeLine->GetMapper()->SetScalarVisibility(IsColored()); + if(!thePipeLine){ + myScalarMapOnDeformedShapePL = VISU_ScalarMapOnDeformedShapePL::New(); + }else + myScalarMapOnDeformedShapePL = dynamic_cast(thePipeLine); + + myScalarMapOnDeformedShapePL->GetMapper()->SetScalarVisibility(IsColored()); - TSuperClass::CreatePipeLine(); + TSuperClass::CreatePipeLine(myScalarMapOnDeformedShapePL); } @@ -373,10 +373,10 @@ VISU::ScalarMapOnDeformedShape_i if(VISU_ScalarMapAct* anActor = dynamic_cast(theActor)){ if(IsColored()){ anActor->SetBarVisibility(true); - myPipeLine->GetMapper()->SetScalarVisibility(1); + GetPipeLine()->GetMapper()->SetScalarVisibility(1); }else{ anActor->SetBarVisibility(false); - myPipeLine->GetMapper()->SetScalarVisibility(0); + GetPipeLine()->GetMapper()->SetScalarVisibility(0); anActor->GetProperty()->SetColor(myColor.R,myColor.G,myColor.B); } TSuperClass::UpdateActor(theActor); diff --git a/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh b/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh index 9409a49f..d3fa40c1 100644 --- a/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh +++ b/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh @@ -116,7 +116,7 @@ namespace VISU //! Redefines VISU_ColoredPrs3d_i::CreatePipeLine virtual void - CreatePipeLine(); + CreatePipeLine(VISU_PipeLine* thePipeLine); //! Redefines VISU_ColoredPrs3d_i::CheckIsPossible virtual diff --git a/src/VISU_I/VISU_StreamLines_i.cc b/src/VISU_I/VISU_StreamLines_i.cc index 90a2a527..9ca45daf 100644 --- a/src/VISU_I/VISU_StreamLines_i.cc +++ b/src/VISU_I/VISU_StreamLines_i.cc @@ -212,13 +212,13 @@ VISU::StreamLines_i CORBA::Double thePercents, VISU::StreamLines::Direction theDirection) { - VISU::Prs3d_i* aPrs3di = NULL; + VISU::Prs3d_i* aPrs3d = NULL; vtkPointSet* aSource = NULL; if(!thePrs3d->_is_nil()) - if((aPrs3di = dynamic_cast(VISU::GetServant(thePrs3d).in()))){ + if((aPrs3d = dynamic_cast(VISU::GetServant(thePrs3d).in()))){ for(int i = myAppendFilter->GetNumberOfInputs()-1; i >= 0; i--) myAppendFilter->RemoveInput(myAppendFilter->GetInput(i)); - myAppendFilter->AddInput(aPrs3di->GetPL()->GetMapper()->GetInput()); + myAppendFilter->AddInput(aPrs3d->GetPipeLine()->GetMapper()->GetInput()); aSource = myAppendFilter->GetOutput(); } int anIsAccepted = myStreamLinesPL->SetParams(theIntStep, @@ -229,7 +229,7 @@ VISU::StreamLines_i theDirection, 1); if(anIsAccepted == 1) - SetSource(aPrs3di); + SetSource(aPrs3d); return anIsAccepted == 1; } @@ -338,13 +338,14 @@ VISU::StreamLines_i //--------------------------------------------------------------- void VISU::StreamLines_i -::CreatePipeLine() +::CreatePipeLine(VISU_PipeLine* thePipeLine) { - if(!myPipeLine) - myPipeLine = VISU_StreamLinesPL::New(); - myStreamLinesPL = dynamic_cast(myPipeLine); + if(!thePipeLine){ + myStreamLinesPL = VISU_StreamLinesPL::New(); + }else + myStreamLinesPL = dynamic_cast(thePipeLine); - TSuperClass::CreatePipeLine(); + TSuperClass::CreatePipeLine(myStreamLinesPL); } diff --git a/src/VISU_I/VISU_StreamLines_i.hh b/src/VISU_I/VISU_StreamLines_i.hh index db99dd99..0329f3a4 100644 --- a/src/VISU_I/VISU_StreamLines_i.hh +++ b/src/VISU_I/VISU_StreamLines_i.hh @@ -109,7 +109,7 @@ namespace VISU //! Extends VISU_ColoredPrs3d_i::CreatePipeLine virtual void - CreatePipeLine(); + CreatePipeLine(VISU_PipeLine* thePipeLine); //! Extends VISU_ColoredPrs3d_i::CheckIsPossible virtual diff --git a/src/VISU_I/VISU_Vectors_i.cc b/src/VISU_I/VISU_Vectors_i.cc index 156fac2c..fa7f6c99 100644 --- a/src/VISU_I/VISU_Vectors_i.cc +++ b/src/VISU_I/VISU_Vectors_i.cc @@ -247,24 +247,25 @@ VISU::Vectors_i::GetGlyphPos() //--------------------------------------------------------------- void VISU::Vectors_i -::CreatePipeLine() +::CreatePipeLine(VISU_PipeLine* thePipeLine) { - if(!myPipeLine) - myPipeLine = VISU_VectorsPL::New(); - myVectorsPL = dynamic_cast(myPipeLine); + if(!thePipeLine){ + myVectorsPL = VISU_VectorsPL::New(); + }else + myVectorsPL = dynamic_cast(thePipeLine); - TSuperClass::CreatePipeLine(); + TSuperClass::CreatePipeLine(myVectorsPL); } //--------------------------------------------------------------- VISU_PipeLine* VISU::Vectors_i -::GetPipeLine() +::GetPL() { VISU_PipeLine* aPipeLine = VISU_VectorsPL::New(); - aPipeLine->SetIDMapper(myPipeLine->GetIDMapper()); - aPipeLine->ShallowCopy(myPipeLine); + aPipeLine->SetIDMapper(GetPipeLine()->GetIDMapper()); + aPipeLine->ShallowCopy(GetPipeLine()); aPipeLine->Update(); return aPipeLine; } @@ -313,7 +314,7 @@ VISU::Vectors_i TSuperClass::UpdateActor(anActor); anActor->GetProperty()->SetLineWidth(GetLineWidth()); if(VISU_VectorsPL* aVectorsPL = dynamic_cast(anActor->GetPipeLine())){ - aVectorsPL->ShallowCopy(myPipeLine); + aVectorsPL->ShallowCopy(GetPipeLine()); aVectorsPL->Update(); aVectorsPL->SetMapScale(myVectorsPL->GetMapScale()); } diff --git a/src/VISU_I/VISU_Vectors_i.hh b/src/VISU_I/VISU_Vectors_i.hh index 901e6032..09432446 100644 --- a/src/VISU_I/VISU_Vectors_i.hh +++ b/src/VISU_I/VISU_Vectors_i.hh @@ -100,7 +100,7 @@ namespace VISU //! Redefines VISU_ColoredPrs3d_i::CreatePipeLine virtual void - CreatePipeLine(); + CreatePipeLine(VISU_PipeLine* thePipeLine); //! Redefines VISU_ColoredPrs3d_i::CheckIsPossible virtual @@ -109,7 +109,7 @@ namespace VISU virtual VISU_PipeLine* - GetPipeLine(); + GetPL(); VISU_VectorsPL *myVectorsPL; float myLineWidth; -- 2.39.2