From 37713defaa0ec0bb32753a2b779782667dd9bf6d Mon Sep 17 00:00:00 2001 From: apo Date: Tue, 22 May 2007 10:46:37 +0000 Subject: [PATCH] Completion implementation of PAL13246 --- src/PIPELINE/VISU_ColoredPL.cxx | 5 +- src/PIPELINE/VISU_CutLinesPL.cxx | 8 ++ src/PIPELINE/VISU_CutPlanesPL.cxx | 23 ++++- src/PIPELINE/VISU_IsoSurfacesPL.cxx | 4 +- src/PIPELINE/VISU_Plot3DPL.cxx | 16 ++++ src/PIPELINE/VISU_VectorsPL.cxx | 10 +- .../VisuGUI_ScalarMapOnDeformedShapeDlg.cxx | 2 - src/VISU_I/VISU_ColoredPrs3d_i.cc | 60 +++++++++--- src/VISU_I/VISU_CutLines_i.cc | 33 +++++-- src/VISU_I/VISU_CutPlanes_i.cc | 46 ++++++++-- src/VISU_I/VISU_DeformedShape_i.cc | 21 ++++- src/VISU_I/VISU_IsoSurfaces_i.cc | 26 +----- src/VISU_I/VISU_Plot3D_i.cc | 49 ++++++++-- src/VISU_I/VISU_Prs3d_i.cc | 3 +- src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc | 80 +++------------- src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh | 19 ---- src/VISU_I/VISU_ScalarMap_i.cc | 3 +- src/VISU_I/VISU_StreamLines_i.cc | 92 ++++++++++++++++--- src/VISU_I/VISU_Vectors_i.cc | 11 ++- 19 files changed, 336 insertions(+), 175 deletions(-) diff --git a/src/PIPELINE/VISU_ColoredPL.cxx b/src/PIPELINE/VISU_ColoredPL.cxx index 2020ef06..d067adde 100644 --- a/src/PIPELINE/VISU_ColoredPL.cxx +++ b/src/PIPELINE/VISU_ColoredPL.cxx @@ -108,7 +108,7 @@ VISU_ColoredPL } else { vtkCellData *aCellData = theInput->GetCellData(); if(!aCellData->GetAttribute(vtkDataSetAttributes::VECTORS)){ - if(theScalarMode==0){ + if(theScalarMode == 0){ return; } } @@ -133,6 +133,9 @@ void VISU_ColoredPL ::SetScalarRange(vtkFloatingPointType theRange[2]) { + if(theRange[0] > theRange[1]) + return; + myFieldTransform->SetScalarRange(theRange); myBarTable->SetRange(theRange); } diff --git a/src/PIPELINE/VISU_CutLinesPL.cxx b/src/PIPELINE/VISU_CutLinesPL.cxx index 7727e4c5..3bad32d1 100644 --- a/src/PIPELINE/VISU_CutLinesPL.cxx +++ b/src/PIPELINE/VISU_CutLinesPL.cxx @@ -90,6 +90,11 @@ void VISU_CutLinesPL ::SetPosition(vtkFloatingPointType thePosition) { + bool anIsSameValue = VISU::CheckIsSameValue(myPosition, thePosition); + anIsSameValue &= (myCondition == 0); + if(anIsSameValue) + return; + myPosition = thePosition; myCondition = 0; Modified(); @@ -127,6 +132,9 @@ void VISU_CutLinesPL ::SetDefault() { + if(myCondition == 1) + return; + myCondition = 1; Modified(); } diff --git a/src/PIPELINE/VISU_CutPlanesPL.cxx b/src/PIPELINE/VISU_CutPlanesPL.cxx index 431080ee..caad525c 100644 --- a/src/PIPELINE/VISU_CutPlanesPL.cxx +++ b/src/PIPELINE/VISU_CutPlanesPL.cxx @@ -336,6 +336,9 @@ VISU_CutPlanesPL ::SetDisplacement(vtkFloatingPointType theDisp, int theNum) { + if(VISU::CheckIsSameValue(myDisplacement[theNum], theDisp)) + return; + myDisplacement[theNum] = theDisp; Modified(); } @@ -344,12 +347,12 @@ VISU_CutPlanesPL //---------------------------------------------------------------------------- void VISU_CutPlanesPL -::SetNbParts(int theNb) +::SetNbParts(int theNbParts) { - if(theNb > 0){ - myNbParts = theNb; - myPartPosition.resize(myNbParts); - myPartCondition.resize(myNbParts, 1); + if(theNbParts > 0 && myNbParts != theNbParts){ + myPartPosition.resize(theNbParts); + myPartCondition.resize(theNbParts, 1); + myNbParts = theNbParts; Modified(); } } @@ -364,6 +367,11 @@ VISU_CutPlanesPL if(thePartNumber >= myNbParts) return; + bool anIsSameValue = VISU::CheckIsSameValue(myPartPosition[thePartNumber], thePartPosition); + anIsSameValue &= VISU::CheckIsSameValue(myPartCondition[thePartNumber], 0); + if(anIsSameValue) + return; + myPartPosition[thePartNumber] = thePartPosition; myPartCondition[thePartNumber] = 0; Modified(); @@ -413,6 +421,11 @@ VISU_CutPlanesPL if(thePartNumber >= myNbParts) return; + bool anIsSameValue = VISU::CheckIsSameValue(myPartPosition[thePartNumber], GetPartPosition(thePartNumber)); + anIsSameValue &= VISU::CheckIsSameValue(myPartCondition[thePartNumber], 1); + if(anIsSameValue) + return; + myPartPosition[thePartNumber] = GetPartPosition(thePartNumber); myPartCondition[thePartNumber] = 1; Modified(); diff --git a/src/PIPELINE/VISU_IsoSurfacesPL.cxx b/src/PIPELINE/VISU_IsoSurfacesPL.cxx index aaf427b7..8f92a1cb 100644 --- a/src/PIPELINE/VISU_IsoSurfacesPL.cxx +++ b/src/PIPELINE/VISU_IsoSurfacesPL.cxx @@ -93,7 +93,6 @@ VISU_IsoSurfacesPL ::SetNbParts(int theNb) { myContourFilter->SetNumberOfContours(theNb); - Modified(); } @@ -112,6 +111,9 @@ void VISU_IsoSurfacesPL ::SetRange(vtkFloatingPointType theRange[2]) { + if(VISU::CheckIsSameRange(myRange, theRange)) + return; + if(theRange[0] <= theRange[1]){ myRange[0] = theRange[0]; myRange[1] = theRange[1]; diff --git a/src/PIPELINE/VISU_Plot3DPL.cxx b/src/PIPELINE/VISU_Plot3DPL.cxx index 5b26e979..60244568 100644 --- a/src/PIPELINE/VISU_Plot3DPL.cxx +++ b/src/PIPELINE/VISU_Plot3DPL.cxx @@ -316,6 +316,9 @@ void VISU_Plot3DPL:: SetContourPrs(bool theIsContourPrs ) { + if(myIsContour == theIsContourPrs) + return; + myIsContour = theIsContourPrs; Modified(); } @@ -336,6 +339,11 @@ VISU_Plot3DPL ::SetPlanePosition(vtkFloatingPointType thePosition, bool theIsRelative) { + bool anIsSameValue = VISU::CheckIsSameValue(myIsRelative, theIsRelative); + anIsSameValue &= (myPosition == thePosition); + if(anIsSameValue) + return; + myIsRelative = theIsRelative; myPosition = thePosition; Modified(); @@ -394,16 +402,24 @@ SetOrientation(VISU_CutPlanesPL::PlaneOrientation theOrientation, vtkFloatingPointType theXAngle, vtkFloatingPointType theYAngle) { + bool anIsSameValue = VISU::CheckIsSameValue(GetRotateX(), theXAngle); + anIsSameValue &= VISU::CheckIsSameValue(GetRotateY(), theYAngle); + anIsSameValue &= (myOrientation == theOrientation); + if(anIsSameValue) + return; + switch(theOrientation){ case VISU_CutPlanesPL::XY: myAngle[0] = theXAngle; break; case VISU_CutPlanesPL::YZ: myAngle[1] = theXAngle; break; case VISU_CutPlanesPL::ZX: myAngle[2] = theXAngle; break; } + switch(theOrientation){ case VISU_CutPlanesPL::XY: myAngle[1] = theYAngle; break; case VISU_CutPlanesPL::YZ: myAngle[2] = theYAngle; break; case VISU_CutPlanesPL::ZX: myAngle[0] = theYAngle; break; } + myOrientation = theOrientation; Modified(); } diff --git a/src/PIPELINE/VISU_VectorsPL.cxx b/src/PIPELINE/VISU_VectorsPL.cxx index f06301f6..36a3014f 100644 --- a/src/PIPELINE/VISU_VectorsPL.cxx +++ b/src/PIPELINE/VISU_VectorsPL.cxx @@ -145,6 +145,9 @@ void VISU_VectorsPL ::SetGlyphType(VISU_VectorsPL::GlyphType theType) { + if(myTypeGlyph == theType) + return; + myTypeGlyph = theType; Modified(); } @@ -164,6 +167,9 @@ void VISU_VectorsPL ::SetGlyphPos(VISU_VectorsPL::GlyphPos thePos) { + if(myPosGlyph == thePos) + return; + myPosGlyph = thePos; Modified(); } @@ -185,8 +191,8 @@ VISU_VectorsPL { Superclass::Init(); - myTypeGlyph = ARROW; - myPosGlyph = TAIL; + SetGlyphType(ARROW); + SetGlyphPos(TAIL); } diff --git a/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx b/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx index 62f99dec..9d8d0fe7 100644 --- a/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx +++ b/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx @@ -333,8 +333,6 @@ VisuGUI_ScalarMapOnDeformedShapeDlg if(myUpdateScalars) SetScalarField( false ); - myPrsCopy->ShowColored(true); - VISU::TSameAsFactory().Copy(thePrs, myPrsCopy); return anIsOk; diff --git a/src/VISU_I/VISU_ColoredPrs3d_i.cc b/src/VISU_I/VISU_ColoredPrs3d_i.cc index 3a94dd9d..0fa7c820 100644 --- a/src/VISU_I/VISU_ColoredPrs3d_i.cc +++ b/src/VISU_I/VISU_ColoredPrs3d_i.cc @@ -26,8 +26,9 @@ #include "VISU_ColoredPrs3d_i.hh" -#include "VISU_ColoredPL.hxx" #include "VISU_Result_i.hh" +#include "VISU_ColoredPL.hxx" +#include "VISU_PipeLineUtils.hxx" #include "VISU_Convertor.hxx" #include "SUIT_ResourceMgr.h" @@ -528,7 +529,8 @@ VISU::ColoredPrs3d_i else if(theScalarMode > aNbComp) theScalarMode = 0; - myColoredPL->SetScalarMode(theScalarMode); + ProcessVoidEvent(new TVoidMemFun1ArgEvent + (GetSpecificPL(), &VISU_ColoredPL::SetScalarMode, theScalarMode)); } //---------------------------------------------------------------------------- @@ -552,10 +554,10 @@ void VISU::ColoredPrs3d_i ::SetRange(CORBA::Double theMin, CORBA::Double theMax) { - if(theMin > theMax) - return; vtkFloatingPointType aScalarRange[2] = {theMin, theMax}; - GetSpecificPL()->SetScalarRange(aScalarRange); + ProcessVoidEvent(new TVoidMemFun1ArgEvent + (GetSpecificPL(), &VISU_ColoredPL::SetScalarRange, aScalarRange)); + UseFixedRange(true); } @@ -565,12 +567,15 @@ void VISU::ColoredPrs3d_i ::SetSourceRange() { - if(IsTimeStampFixed()) + if(IsTimeStampFixed()){ GetSpecificPL()->SetSourceRange(); - else{ + ProcessVoidEvent(new TVoidMemFunEvent + (GetSpecificPL(), &VISU_ColoredPL::SetSourceRange)); + }else{ TMinMax aTMinMax = GetField()->GetMinMax(GetScalarMode()); vtkFloatingPointType aScalarRange[2] = {aTMinMax.first, aTMinMax.second}; - GetSpecificPL()->SetScalarRange(aScalarRange); + ProcessVoidEvent(new TVoidMemFun1ArgEvent + (GetSpecificPL(), &VISU_ColoredPL::SetScalarRange, aScalarRange)); } UseFixedRange(false); } @@ -610,7 +615,8 @@ void VISU::ColoredPrs3d_i ::SetNbColors(CORBA::Long theNbColors) { - GetSpecificPL()->SetNbColors(theNbColors); + ProcessVoidEvent(new TVoidMemFun1ArgEvent + (GetSpecificPL(), &VISU_ColoredPL::SetNbColors, theNbColors)); } //---------------------------------------------------------------------------- @@ -643,10 +649,15 @@ VISU::ColoredPrs3d_i //---------------------------------------------------------------------------- void VISU::ColoredPrs3d_i -::SetPosition(CORBA::Double X, CORBA::Double Y) +::SetPosition(CORBA::Double theX, CORBA::Double theY) { - myPosition[0] = X; - myPosition[1] = Y; + bool anIsSameValue = VISU::CheckIsSameValue(myPosition[0], theX); + anIsSameValue &= VISU::CheckIsSameValue(myPosition[1], theY); + if(anIsSameValue) + return; + + myPosition[0] = theX; + myPosition[1] = theY; myParamsTime.Modified(); } @@ -671,6 +682,11 @@ void VISU::ColoredPrs3d_i ::SetSize(CORBA::Double theWidth, CORBA::Double theHeight) { + bool anIsSameValue = VISU::CheckIsSameValue(myWidth, theWidth); + anIsSameValue &= VISU::CheckIsSameValue(myHeight, theHeight); + if(anIsSameValue) + return; + myWidth = theWidth; myHeight = theHeight; myParamsTime.Modified(); @@ -846,6 +862,12 @@ VISU::ColoredPrs3d_i vtkFloatingPointType theG, vtkFloatingPointType theB) { + bool anIsSameValue = VISU::CheckIsSameValue(myTitleColor[0], theR); + anIsSameValue &= VISU::CheckIsSameValue(myTitleColor[1], theG); + anIsSameValue &= VISU::CheckIsSameValue(myTitleColor[2], theB); + if(anIsSameValue) + return; + myTitleColor[0] = theR; myTitleColor[1] = theG; myTitleColor[2] = theB; @@ -947,6 +969,12 @@ VISU::ColoredPrs3d_i vtkFloatingPointType theG, vtkFloatingPointType theB) { + bool anIsSameValue = VISU::CheckIsSameValue(myLabelColor[0], theR); + anIsSameValue &= VISU::CheckIsSameValue(myLabelColor[1], theG); + anIsSameValue &= VISU::CheckIsSameValue(myLabelColor[2], theB); + if(anIsSameValue) + return; + myLabelColor[0] = theR; myLabelColor[1] = theG; myLabelColor[2] = theB; @@ -967,7 +995,11 @@ void VISU::ColoredPrs3d_i ::UseFixedRange(bool theUseFixedRange) { + if(myIsFixedRange == theUseFixedRange) + return; + myIsFixedRange = theUseFixedRange; + myParamsTime.Modified(); } //---------------------------------------------------------------------------- @@ -1008,9 +1040,9 @@ VISU::ColoredPrs3d_i // Orientation int anOrientation = aResourceMgr->integerValue("VISU", "scalar_bar_orientation", 0); if(anOrientation == 1) - myOrientation = VISU::ScalarMap::HORIZONTAL; + SetBarOrientation(VISU::ScalarMap::HORIZONTAL); else - myOrientation = VISU::ScalarMap::VERTICAL; + SetBarOrientation(VISU::ScalarMap::VERTICAL); // Scalar Bar origin QString propertyName = QString( "scalar_bar_%1_" ).arg( anOrientation == 0 ? "vertical" : "horizontal" ); diff --git a/src/VISU_I/VISU_CutLines_i.cc b/src/VISU_I/VISU_CutLines_i.cc index dc066034..e634111b 100644 --- a/src/VISU_I/VISU_CutLines_i.cc +++ b/src/VISU_I/VISU_CutLines_i.cc @@ -367,7 +367,8 @@ void VISU::CutLines_i ::SetDisplacement(CORBA::Double theDisp) { - myCutLinesPL->SetDisplacement(theDisp); + ProcessVoidEvent(new TVoidMemFun2ArgEvent + (GetSpecificPL(), &VISU_CutLinesPL::SetDisplacement, theDisp, 0)); } //--------------------------------------------------------------- @@ -375,7 +376,8 @@ void VISU::CutLines_i ::SetDisplacement2(CORBA::Double theDisp) { - myCutLinesPL->SetDisplacement(theDisp,1); + ProcessVoidEvent(new TVoidMemFun2ArgEvent + (GetSpecificPL(), &VISU_CutLinesPL::SetDisplacement, theDisp, 1)); } @@ -401,7 +403,8 @@ void VISU::CutLines_i ::SetBasePlanePosition(CORBA::Double thePlanePosition) { - myCutLinesPL->SetPosition(thePlanePosition); + ProcessVoidEvent(new TVoidMemFun1ArgEvent + (GetSpecificPL(), &VISU_CutLinesPL::SetPosition, thePlanePosition)); } //--------------------------------------------------------------- @@ -418,7 +421,8 @@ VISU::CutLines_i ::SetLinePosition(CORBA::Long thePlaneNumber, CORBA::Double thePlanePosition) { - myCutLinesPL->SetPartPosition(thePlaneNumber,thePlanePosition); + ProcessVoidEvent(new TVoidMemFun2ArgEvent + (GetSpecificPL(), &VISU_CutLinesPL::SetPartPosition, thePlaneNumber, thePlanePosition)); } //--------------------------------------------------------------- @@ -435,7 +439,8 @@ void VISU::CutLines_i ::SetDefault() { - myCutLinesPL->SetDefault(); + ProcessVoidEvent(new TVoidMemFunEvent + (GetSpecificPL(), &VISU_CutLinesPL::SetDefault)); } //--------------------------------------------------------------- @@ -451,7 +456,8 @@ void VISU::CutLines_i ::SetDefaultPosition(CORBA::Long thePlaneNumber) { - myCutLinesPL->SetPartDefault(thePlaneNumber); + ProcessVoidEvent(new TVoidMemFun1ArgEvent + (GetSpecificPL(), &VISU_CutLinesPL::SetPartDefault, thePlaneNumber)); } //--------------------------------------------------------------- @@ -471,7 +477,7 @@ void VISU::CutLines_i ::SetAllCurvesInverted(CORBA::Boolean theInvert) { - for(int i=0; iSetNbParts(theNb); + ProcessVoidEvent(new TVoidMemFun1ArgEvent + (GetSpecificPL(), &VISU_CutLinesPL::SetNbParts, theNb)); } //--------------------------------------------------------------- diff --git a/src/VISU_I/VISU_CutPlanes_i.cc b/src/VISU_I/VISU_CutPlanes_i.cc index f6c28f99..4d9583d2 100644 --- a/src/VISU_I/VISU_CutPlanes_i.cc +++ b/src/VISU_I/VISU_CutPlanes_i.cc @@ -168,9 +168,37 @@ VISU::CutPlanes_i CORBA::Double theXAngle, CORBA::Double theYAngle) { - myCutPlanesPL->SetOrientation(VISU_CutPlanesPL::PlaneOrientation(theOrient), - theXAngle, - theYAngle); + struct TEvent: public SALOME_Event + { + VISU_CutPlanesPL* myPipeLine; + VISU_CutPlanesPL::PlaneOrientation myOrient; + CORBA::Double myXAngle; + CORBA::Double myYAngle; + + TEvent(VISU_CutPlanesPL* thePipeLine, + VISU_CutPlanesPL::PlaneOrientation theOrient, + CORBA::Double theXAngle, + CORBA::Double theYAngle): + myPipeLine(thePipeLine), + myOrient(theOrient), + myXAngle(theXAngle), + myYAngle(theYAngle) + {} + + virtual + void + Execute() + { + myPipeLine->SetOrientation(myOrient, + myXAngle, + myYAngle); + } + }; + + ProcessVoidEvent(new TEvent(GetSpecificPL(), + VISU_CutPlanesPL::PlaneOrientation(theOrient), + theXAngle, + theYAngle)); } //---------------------------------------------------------------------------- @@ -203,7 +231,8 @@ void VISU::CutPlanes_i ::SetDisplacement(CORBA::Double theDisp) { - myCutPlanesPL->SetDisplacement(theDisp); + ProcessVoidEvent(new TVoidMemFun2ArgEvent + (GetSpecificPL(), &VISU_CutPlanesPL::SetDisplacement, theDisp, 0)); } //---------------------------------------------------------------------------- @@ -221,7 +250,8 @@ VISU::CutPlanes_i ::SetPlanePosition(CORBA::Long thePlaneNumber, CORBA::Double thePlanePosition) { - myCutPlanesPL->SetPartPosition(thePlaneNumber, thePlanePosition); + ProcessVoidEvent(new TVoidMemFun2ArgEvent + (GetSpecificPL(), &VISU_CutPlanesPL::SetPartPosition, thePlaneNumber, thePlanePosition)); } //---------------------------------------------------------------------------- @@ -238,7 +268,8 @@ void VISU::CutPlanes_i ::SetDefault(CORBA::Long thePlaneNumber) { - myCutPlanesPL->SetPartDefault(thePlaneNumber); + ProcessVoidEvent(new TVoidMemFun1ArgEvent + (GetSpecificPL(), &VISU_CutPlanesPL::SetPartDefault, thePlaneNumber)); } //---------------------------------------------------------------------------- @@ -255,7 +286,8 @@ void VISU::CutPlanes_i ::SetNbPlanes(CORBA::Long theNb) { - myCutPlanesPL->SetNbParts(theNb); + ProcessVoidEvent(new TVoidMemFun1ArgEvent + (GetSpecificPL(), &VISU_CutPlanesPL::SetNbParts, theNb)); } //---------------------------------------------------------------------------- diff --git a/src/VISU_I/VISU_DeformedShape_i.cc b/src/VISU_I/VISU_DeformedShape_i.cc index 38afca52..b942c81a 100644 --- a/src/VISU_I/VISU_DeformedShape_i.cc +++ b/src/VISU_I/VISU_DeformedShape_i.cc @@ -29,9 +29,11 @@ #include "VISU_ScalarMapAct.h" #include "VISU_DeformedShapePL.hxx" +#include "VISU_PipeLineUtils.hxx" #include "VISU_Convertor.hxx" #include "SUIT_ResourceMgr.h" +#include "SALOME_Event.hxx" #include #include @@ -199,7 +201,8 @@ void VISU::DeformedShape_i ::SetScale(CORBA::Double theScale) { - myDeformedShapePL->SetScale(theScale); + ProcessVoidEvent(new TVoidMemFun1ArgEvent + (GetSpecificPL(), &VISU_DeformedShapePL::SetScale, theScale)); } //--------------------------------------------------------------- @@ -225,6 +228,9 @@ void VISU::DeformedShape_i ::ShowColored(CORBA::Boolean theColored) { + if(myIsColored == theColored) + return; + myIsColored = theColored; myParamsTime.Modified(); } @@ -243,6 +249,12 @@ void VISU::DeformedShape_i ::SetColor(const SALOMEDS::Color& theColor) { + bool anIsSameValue = VISU::CheckIsSameValue(myColor.R, theColor.R); + anIsSameValue &= VISU::CheckIsSameValue(myColor.G, theColor.G); + anIsSameValue &= VISU::CheckIsSameValue(myColor.B, theColor.B); + if(anIsSameValue) + return; + myColor = theColor; myParamsTime.Modified(); } @@ -269,7 +281,12 @@ bool VISU::DeformedShape_i ::CheckIsPossible() { - return IsPossible(GetCResult(),GetCMeshName(),GetEntity(),GetCFieldName(),GetTimeStampNumber(),true); + return IsPossible(GetCResult(), + GetCMeshName(), + GetEntity(), + GetCFieldName(), + GetTimeStampNumber(), + true); } diff --git a/src/VISU_I/VISU_IsoSurfaces_i.cc b/src/VISU_I/VISU_IsoSurfaces_i.cc index c93c179f..c152e8da 100644 --- a/src/VISU_I/VISU_IsoSurfaces_i.cc +++ b/src/VISU_I/VISU_IsoSurfaces_i.cc @@ -152,27 +152,8 @@ void VISU::IsoSurfaces_i ::SetNbSurfaces(CORBA::Long theNb) { - - struct TEvent: public SALOME_Event - { - VISU_IsoSurfacesPL* myIsoSurfacesPL; - CORBA::Long myNb; - - TEvent(VISU_IsoSurfacesPL* theIsoSurfacesPL, - CORBA::Long theNb): - myIsoSurfacesPL(theIsoSurfacesPL), - myNb(theNb) - {} - - virtual - void - Execute() - { - myIsoSurfacesPL->SetNbParts(myNb); - } - }; - - ProcessVoidEvent(new TEvent(myIsoSurfacesPL, theNb)); + ProcessVoidEvent(new TVoidMemFun1ArgEvent + (GetSpecificPL(), &VISU_IsoSurfacesPL::SetNbParts, theNb)); } //--------------------------------------------------------------- @@ -190,7 +171,8 @@ VISU::IsoSurfaces_i ::SetSubRange(CORBA::Double theMin, CORBA::Double theMax) { vtkFloatingPointType aRange[2] = {theMin, theMax}; - myIsoSurfacesPL->SetRange(aRange); + ProcessVoidEvent(new TVoidMemFun1ArgEvent + (GetSpecificPL(), &VISU_IsoSurfacesPL::SetRange, aRange)); } //--------------------------------------------------------------- diff --git a/src/VISU_I/VISU_Plot3D_i.cc b/src/VISU_I/VISU_Plot3D_i.cc index 0ec0e291..34ac5d2a 100644 --- a/src/VISU_I/VISU_Plot3D_i.cc +++ b/src/VISU_I/VISU_Plot3D_i.cc @@ -19,10 +19,13 @@ // #include "VISU_Plot3D_i.hh" + #include "VISU_Result_i.hh" #include "VISU_Plot3DPL.hxx" #include "VISU_Actor.h" + #include "SUIT_ResourceMgr.h" +#include "SALOME_Event.hxx" #ifdef _DEBUG_ static int MYDEBUG = 0; @@ -158,9 +161,37 @@ VISU::Plot3D_i CORBA::Double theXAngle, CORBA::Double theYAngle) { - myPlot3DPL->SetOrientation(VISU_CutPlanesPL::PlaneOrientation(theOrient), - theXAngle, - theYAngle); + struct TEvent: public SALOME_Event + { + VISU_Plot3DPL* myPipeLine; + VISU_CutPlanesPL::PlaneOrientation myOrient; + CORBA::Double myXAngle; + CORBA::Double myYAngle; + + TEvent(VISU_Plot3DPL* thePipeLine, + VISU_CutPlanesPL::PlaneOrientation theOrient, + CORBA::Double theXAngle, + CORBA::Double theYAngle): + myPipeLine(thePipeLine), + myOrient(theOrient), + myXAngle(theXAngle), + myYAngle(theYAngle) + {} + + virtual + void + Execute() + { + myPipeLine->SetOrientation(myOrient, + myXAngle, + myYAngle); + } + }; + + ProcessVoidEvent(new TEvent(GetSpecificPL(), + VISU_CutPlanesPL::PlaneOrientation(theOrient), + theXAngle, + theYAngle)); } @@ -197,7 +228,8 @@ VISU::Plot3D_i ::SetPlanePosition(CORBA::Double thePlanePosition, CORBA::Boolean theIsRelative) { - myPlot3DPL->SetPlanePosition(thePlanePosition, theIsRelative); + ProcessVoidEvent(new TVoidMemFun2ArgEvent + (GetSpecificPL(), &VISU_Plot3DPL::SetPlanePosition, thePlanePosition, theIsRelative)); } @@ -224,7 +256,8 @@ void VISU::Plot3D_i ::SetScaleFactor(CORBA::Double theScaleFactor) { - myPlot3DPL->SetScaleFactor(theScaleFactor); + ProcessVoidEvent(new TVoidMemFun1ArgEvent + (GetSpecificPL(), &VISU_Plot3DPL::SetScaleFactor, theScaleFactor)); } @@ -242,7 +275,8 @@ void VISU::Plot3D_i ::SetNbOfContours(CORBA::Long theNb) { - myPlot3DPL->SetNumberOfContours(theNb); + ProcessVoidEvent(new TVoidMemFun1ArgEvent + (GetSpecificPL(), &VISU_Plot3DPL::SetNumberOfContours, theNb)); } @@ -260,7 +294,8 @@ void VISU::Plot3D_i ::SetContourPrs(CORBA::Boolean theIsContourPrs) { - myPlot3DPL->SetContourPrs( theIsContourPrs ); + ProcessVoidEvent(new TVoidMemFun1ArgEvent + (GetSpecificPL(), &VISU_Plot3DPL::SetContourPrs, theIsContourPrs)); } diff --git a/src/VISU_I/VISU_Prs3d_i.cc b/src/VISU_I/VISU_Prs3d_i.cc index edf46594..afb7eee5 100644 --- a/src/VISU_I/VISU_Prs3d_i.cc +++ b/src/VISU_I/VISU_Prs3d_i.cc @@ -350,7 +350,8 @@ VISU::Prs3d_i if(MYDEBUG) MESSAGE("Prs3d_i::Update - this = "<Update(); + ProcessVoidEvent(new TVoidMemFunEvent + (GetPipeLine(), &VISU_PipeLine::Update)); myUpdateTime.Modified(); }catch(std::exception&){ throw; diff --git a/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc b/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc index f2501868..bab79a4b 100644 --- a/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc +++ b/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc @@ -31,6 +31,7 @@ #include "VISU_Result_i.hh" #include "SUIT_ResourceMgr.h" +#include "SALOME_Event.hxx" #include #include @@ -141,9 +142,6 @@ VISU::ScalarMapOnDeformedShape_i const std::string& theFieldName, CORBA::Long theTimeStampNumber) { - myIsColored = true; - myColor.R = myColor.G = myColor.B = 0.5; - SetScalarField(theMeshName.c_str(), theFieldName.c_str(), theTimeStampNumber, @@ -177,11 +175,7 @@ VISU::ScalarMapOnDeformedShape_i anEntity); SetScale(VISU::Storable::FindValue(theMap,"myFactor").toDouble()); - myIsColored = VISU::Storable::FindValue(theMap,"myIsColored").toInt(); - myColor.R = VISU::Storable::FindValue(theMap,"myColor.R").toDouble(); - myColor.G = VISU::Storable::FindValue(theMap,"myColor.G").toDouble(); - myColor.B = VISU::Storable::FindValue(theMap,"myColor.B").toDouble(); - + return this; } @@ -199,10 +193,6 @@ VISU::ScalarMapOnDeformedShape_i Storable::DataToStream( theStr, "myScalarEntity", int(myScalarEntity)); Storable::DataToStream( theStr, "myFactor", GetScale() ); - Storable::DataToStream( theStr, "myIsColored", myIsColored ); - Storable::DataToStream( theStr, "myColor.R", myColor.R ); - Storable::DataToStream( theStr, "myColor.G", myColor.G ); - Storable::DataToStream( theStr, "myColor.B", myColor.B ); } @@ -240,7 +230,8 @@ void VISU::ScalarMapOnDeformedShape_i ::SetScale(CORBA::Double theScale) { - myScalarMapOnDeformedShapePL->SetScale(theScale); + ProcessVoidEvent(new TVoidMemFun1ArgEvent + (GetSpecificPL(), &VISU_ScalarMapOnDeformedShapePL::SetScale, theScale)); } @@ -253,43 +244,6 @@ VISU::ScalarMapOnDeformedShape_i } -//--------------------------------------------------------------- -CORBA::Boolean -VISU::ScalarMapOnDeformedShape_i -::IsColored() -{ - return myIsColored; -} - - -//--------------------------------------------------------------- -void -VISU::ScalarMapOnDeformedShape_i -::ShowColored(CORBA::Boolean theColored) -{ - myIsColored = theColored; - myParamsTime.Modified(); -} - -//--------------------------------------------------------------- -SALOMEDS::Color -VISU::ScalarMapOnDeformedShape_i -::GetColor() -{ - return myColor; -} - - -//--------------------------------------------------------------- -void -VISU::ScalarMapOnDeformedShape_i -::SetColor(const SALOMEDS::Color& theColor) -{ - myColor = theColor; - myParamsTime.Modified(); -} - - //--------------------------------------------------------------- void VISU::ScalarMapOnDeformedShape_i @@ -300,7 +254,7 @@ VISU::ScalarMapOnDeformedShape_i }else myScalarMapOnDeformedShapePL = dynamic_cast(thePipeLine); - myScalarMapOnDeformedShapePL->GetMapper()->SetScalarVisibility(IsColored()); + myScalarMapOnDeformedShapePL->GetMapper()->SetScalarVisibility(1); TSuperClass::CreatePipeLine(myScalarMapOnDeformedShapePL); } @@ -325,8 +279,8 @@ VISU::ScalarMapOnDeformedShape_i int aDispMode = aResourceMgr->integerValue("VISU", "scalar_def_represent", 2); bool toShrink = aResourceMgr->booleanValue("VISU", "scalar_def_shrink", false); anActor->SetRepresentation(aDispMode); - if (toShrink) anActor->SetShrink(); - anActor->GetProperty()->SetColor(myColor.R,myColor.G,myColor.B); + if (toShrink) + anActor->SetShrink(); anActor->SetVTKMapping(false); return anActor; } @@ -338,16 +292,10 @@ VISU::ScalarMapOnDeformedShape_i ::UpdateActor(VISU_Actor* theActor) { if(VISU_ScalarMapAct* anActor = dynamic_cast(theActor)){ - if(IsColored()){ - anActor->SetBarVisibility(true); - GetPipeLine()->GetMapper()->SetScalarVisibility(1); - }else{ - anActor->SetBarVisibility(false); - GetPipeLine()->GetMapper()->SetScalarVisibility(0); - anActor->GetProperty()->SetColor(myColor.R,myColor.G,myColor.B); - } - TSuperClass::UpdateActor(theActor); + anActor->SetBarVisibility(true); + GetPipeLine()->GetMapper()->SetScalarVisibility(1); } + TSuperClass::UpdateActor(theActor); } @@ -400,8 +348,9 @@ VISU::ScalarMapOnDeformedShape_i vtkUnstructuredGrid* anOutput = anIDMapper->GetUnstructuredGridOutput(); if(myScalarMapOnDeformedShapePL && anOutput) - myScalarMapOnDeformedShapePL->SetScalars(anOutput); - + ProcessVoidEvent(new TVoidMemFun1ArgEvent + (GetSpecificPL(), &VISU_ScalarMapOnDeformedShapePL::SetScalars, anOutput)); + myScalarMeshName = theMeshName; myScalarEntity = theEntity; myScalarFieldName = theFieldName; @@ -409,7 +358,8 @@ VISU::ScalarMapOnDeformedShape_i SetTitle(theFieldName); if(!IsRangeFixed() && IsPipeLineExists()) - GetSpecificPL()->SetSourceRange(); + ProcessVoidEvent(new TVoidMemFunEvent + (GetSpecificPL(), &VISU_ColoredPL::SetSourceRange)); myParamsTime.Modified(); } diff --git a/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh b/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh index 2738ccdc..4c36ea89 100644 --- a/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh +++ b/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh @@ -67,22 +67,6 @@ namespace VISU CORBA::Double GetScale(); - virtual - CORBA::Boolean - IsColored(); - - virtual - void - ShowColored(CORBA::Boolean theColored); - - virtual - SALOMEDS::Color - GetColor(); - - virtual - void - SetColor(const SALOMEDS::Color& theColor); - virtual void SameAs(const Prs3d_i* theOrigin); @@ -195,9 +179,6 @@ namespace VISU private: VISU_ScalarMapOnDeformedShapePL *myScalarMapOnDeformedShapePL; - bool myIsColored; - SALOMEDS::Color myColor; - PField myScalarField; std::string myScalarMeshName; std::string myScalarFieldName; diff --git a/src/VISU_I/VISU_ScalarMap_i.cc b/src/VISU_I/VISU_ScalarMap_i.cc index 8d7f8216..9ce78f1c 100644 --- a/src/VISU_I/VISU_ScalarMap_i.cc +++ b/src/VISU_I/VISU_ScalarMap_i.cc @@ -323,7 +323,8 @@ void VISU::ScalarMap_i ::SetScaling(VISU::Scaling theScaling) { - GetSpecificPL()->SetScaling(theScaling); + ProcessVoidEvent(new TVoidMemFun1ArgEvent + (GetSpecificPL(), &VISU_ColoredPL::SetScaling, theScaling)); } //---------------------------------------------------------------------------- diff --git a/src/VISU_I/VISU_StreamLines_i.cc b/src/VISU_I/VISU_StreamLines_i.cc index 4e13c66e..40102686 100644 --- a/src/VISU_I/VISU_StreamLines_i.cc +++ b/src/VISU_I/VISU_StreamLines_i.cc @@ -32,6 +32,7 @@ #include "VISU_Convertor.hxx" #include "SUIT_ResourceMgr.h" +#include "SALOME_Event.hxx" #include #include @@ -210,22 +211,80 @@ VISU::StreamLines_i CORBA::Double thePercents, VISU::StreamLines::Direction theDirection) { - VISU::Prs3d_i* aPrs3d = NULL; - vtkPointSet* aSource = NULL; - if (!thePrs3d->_is_nil()) - if ((aPrs3d = dynamic_cast(VISU::GetServant(thePrs3d).in()))) { - myAppendFilter->RemoveAllInputs(); - myAppendFilter->AddInput(aPrs3d->GetPipeLine()->GetMapper()->GetInput()); - aSource = myAppendFilter->GetOutput(); + struct TEvent: public SALOME_Event + { + CORBA::Double myIntStep; + CORBA::Double myPropogationTime; + CORBA::Double myStepLength; + VISU::Prs3d_ptr myPrs3d; + CORBA::Double myPercents; + VISU::StreamLines::Direction myDirection; + + VISU_StreamLinesPL* myPipeLine; + VISU::Prs3d_i*& myPrs3dServant; + vtkAppendFilter* myAppendFilter; + size_t& myIsAccepted; + + TEvent(CORBA::Double theIntStep, + CORBA::Double thePropogationTime, + CORBA::Double theStepLength, + VISU::Prs3d_ptr thePrs3d, + CORBA::Double thePercents, + VISU::StreamLines::Direction theDirection, + VISU_StreamLinesPL* thePipeLine, + VISU::Prs3d_i*& thePrs3dServant, + vtkAppendFilter* theAppendFilter, + size_t& theIsAccepted): + myIntStep(myIntStep), + myPropogationTime(thePropogationTime), + myStepLength(theStepLength), + myPrs3d(thePrs3d), + myPercents(thePercents), + myDirection(theDirection), + myPipeLine(thePipeLine), + myPrs3dServant(thePrs3dServant), + myAppendFilter(theAppendFilter), + myIsAccepted(theIsAccepted) + {} + + virtual + void + Execute() + { + myPrs3dServant = NULL; + vtkDataSet* aSource = NULL; + if (!CORBA::is_nil(myPrs3d)){ + myPrs3dServant = dynamic_cast(VISU::GetServant(myPrs3d).in()); + if(myPrs3dServant){ + myAppendFilter->RemoveAllInputs(); + myAppendFilter->AddInput(myPrs3dServant->GetPipeLine()->GetMapper()->GetInput()); + aSource = myAppendFilter->GetOutput(); + } + } + myIsAccepted = myPipeLine->SetParams(myIntStep, + myPropogationTime, + myStepLength, + aSource, + myPercents, + myDirection); } - size_t anIsAccepted = myStreamLinesPL->SetParams(theIntStep, - thePropogationTime, - theStepLength, - aSource, - thePercents, - theDirection); - if (anIsAccepted) - SetSource(aPrs3d); + }; + + size_t anIsAccepted = false; + VISU::Prs3d_i* aPrs3dServant = NULL; + ProcessVoidEvent(new TEvent(theIntStep, + thePropogationTime, + theStepLength, + thePrs3d, + thePercents, + theDirection, + GetSpecificPL(), + aPrs3dServant, + myAppendFilter, + anIsAccepted)); + if(anIsAccepted) + SetSource(aPrs3dServant); + return anIsAccepted; } @@ -250,6 +309,9 @@ VISU::StreamLines_i if(thePrs3d){ SALOMEDS::SObject_var aSObject = thePrs3d->GetSObject(); CORBA::String_var aString = aSObject->GetID(); + if(mySourceEntry == aString.in()) + return; + mySourceEntry = aString.in(); myParamsTime.Modified(); } diff --git a/src/VISU_I/VISU_Vectors_i.cc b/src/VISU_I/VISU_Vectors_i.cc index cf04e4fe..caee0703 100644 --- a/src/VISU_I/VISU_Vectors_i.cc +++ b/src/VISU_I/VISU_Vectors_i.cc @@ -29,9 +29,11 @@ #include "VISU_VectorsAct.h" #include "VISU_VectorsPL.hxx" +#include "VISU_PipeLineUtils.hxx" #include "VISU_Convertor.hxx" #include "SUIT_ResourceMgr.h" +#include "SALOME_Event.hxx" #include @@ -198,6 +200,9 @@ void VISU::Vectors_i ::SetLineWidth(CORBA::Double theWidth) { + if(VISU::CheckIsSameValue(myLineWidth, theWidth)) + return; + myLineWidth = theWidth; myParamsTime.Modified(); } @@ -216,7 +221,8 @@ void VISU::Vectors_i ::SetGlyphType(VISU::Vectors::GlyphType theType) { - myVectorsPL->SetGlyphType(VISU_VectorsPL::GlyphType(theType)); + ProcessVoidEvent(new TVoidMemFun1ArgEvent + (GetSpecificPL(), &VISU_VectorsPL::SetGlyphType, VISU_VectorsPL::GlyphType(theType))); } //--------------------------------------------------------------- @@ -233,7 +239,8 @@ void VISU::Vectors_i ::SetGlyphPos(VISU::Vectors::GlyphPos thePos) { - myVectorsPL->SetGlyphPos(VISU_VectorsPL::GlyphPos(thePos)); + ProcessVoidEvent(new TVoidMemFun1ArgEvent + (GetSpecificPL(), &VISU_VectorsPL::SetGlyphPos, VISU_VectorsPL::GlyphPos(thePos))); } //--------------------------------------------------------------- -- 2.39.2