From: apo Date: Mon, 30 Oct 2006 08:36:21 +0000 (+0000) Subject: To introduce more intelligent way to update presentations based on comparision of... X-Git-Tag: WP1_2_3_06-10-2006~31 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=274a7f588d5b62794e684952dc55475d2e65e903;p=modules%2Fvisu.git To introduce more intelligent way to update presentations based on comparision of modification time --- diff --git a/src/PIPELINE/VISU_CutLinesPL.cxx b/src/PIPELINE/VISU_CutLinesPL.cxx index a7561e48..789e1ebb 100644 --- a/src/PIPELINE/VISU_CutLinesPL.cxx +++ b/src/PIPELINE/VISU_CutLinesPL.cxx @@ -142,9 +142,10 @@ VISU_CutLinesPL anAppendPolyData->Delete(); //Calculate values for building of table vtkMath::Cross(aDir[0],aDir[1],myDirLn); - for (int i=0; i<3 ; i++) { + for (int i = 0; i<3 ; i++) { myRealDirLn[i] = myDirLn[i]; - if(myDirLn[i]<0) myDirLn[i] = (-1)*myDirLn[i];//enk:: correction of bug Bug PAL10401 + if(myDirLn[i] < 0.0) + myDirLn[i] = -1.0*myDirLn[i];//enk:: correction of bug Bug PAL10401 } GetBoundProject(myBoundPrjLn, aBaseBounds, myDirLn); VISU::Mul(myDirLn,myBoundPrjLn[0],myBasePnt); diff --git a/src/PIPELINE/VISU_CutLinesPL.hxx b/src/PIPELINE/VISU_CutLinesPL.hxx index ec7c8def..7406610e 100644 --- a/src/PIPELINE/VISU_CutLinesPL.hxx +++ b/src/PIPELINE/VISU_CutLinesPL.hxx @@ -82,30 +82,47 @@ public: int thePlaneCondition, vtkFloatingPointType theDisplacement); - const vtkFloatingPointType* - GetDirLn() - { - return myDirLn; - } - + //! Returns direction that is defined by position & orientation of the basic and tool planes const vtkFloatingPointType* GetRealDirLn() { return myRealDirLn; } + /*! + Returns direction that corresponds to the myRealDirLn, + but has the same direction as main axis. + */ const vtkFloatingPointType* - GetBoundPrjLn() + GetDirLn() { - return myBoundPrjLn; + return myDirLn; } + /*! + Returns coordinates of 3D point that shows + where is the first intersection of the given mesh. + with the defined direction. + */ const vtkFloatingPointType* GetBasePnt() { return myBasePnt; } + /*! + Returns three floating point numbers that defines the following values: + 1. Distance between the initial point of intersection and origin of coordinates; + 2. Distance between the last point of intersection and origin of coordinates; + 3. Distance between the last point and initial points of intersection. + with the defined direction. + */ + const vtkFloatingPointType* + GetBoundPrjLn() + { + return myBoundPrjLn; + } + protected: vtkFloatingPointType myDirLn[3]; vtkFloatingPointType myRealDirLn[3]; diff --git a/src/PIPELINE/VISU_CutPlanesPL.cxx b/src/PIPELINE/VISU_CutPlanesPL.cxx index c1780194..a5af21f5 100644 --- a/src/PIPELINE/VISU_CutPlanesPL.cxx +++ b/src/PIPELINE/VISU_CutPlanesPL.cxx @@ -257,6 +257,24 @@ VISU_CutPlanesPL } +vtkFloatingPointType +VISU_CutPlanesPL +::GetDisplacement(int theNum) +{ + return myDisplacement[theNum]; +} + + +void +VISU_CutPlanesPL +::SetDisplacement(vtkFloatingPointType theDisp, + int theNum) +{ + myDisplacement[theNum] = theDisp; + Modified(); +} + + void VISU_CutPlanesPL ::SetNbParts(int theNb) @@ -273,7 +291,8 @@ VISU_CutPlanesPL ::SetPartPosition(int thePartNumber, vtkFloatingPointType thePartPosition) { - if(thePartNumber >= myNbParts) return; + if(thePartNumber >= myNbParts) + return; myPartPosition[thePartNumber] = thePartPosition; myPartCondition[thePartNumber] = 0; Modified(); @@ -284,7 +303,8 @@ VISU_CutPlanesPL ::GetPartPosition(int thePartNumber, int theNum) { - if(thePartNumber >= myNbParts) return 0; + if(thePartNumber >= myNbParts) + return 0; vtkFloatingPointType aPosition = myPartPosition[thePartNumber]; if(myPartCondition[thePartNumber]){ vtkFloatingPointType aDir[3], aBounds[6], aBoundPrj[3]; diff --git a/src/PIPELINE/VISU_CutPlanesPL.hxx b/src/PIPELINE/VISU_CutPlanesPL.hxx index cea06cb2..5dc01d39 100644 --- a/src/PIPELINE/VISU_CutPlanesPL.hxx +++ b/src/PIPELINE/VISU_CutPlanesPL.hxx @@ -71,18 +71,12 @@ public: virtual vtkFloatingPointType - GetDisplacement(int theNum = 0) - { - return myDisplacement[theNum]; - } + GetDisplacement(int theNum = 0); virtual void SetDisplacement(vtkFloatingPointType theDisp, - int theNum = 0) - { - myDisplacement[theNum] = theDisp; - } + int theNum = 0); virtual void diff --git a/src/PIPELINE/VISU_GaussPointsPL.cxx b/src/PIPELINE/VISU_GaussPointsPL.cxx index 3ffc7564..51b7547d 100644 --- a/src/PIPELINE/VISU_GaussPointsPL.cxx +++ b/src/PIPELINE/VISU_GaussPointsPL.cxx @@ -113,6 +113,15 @@ VISU_GaussPointsPL } +//---------------------------------------------------------------------------- +unsigned long int +VISU_GaussPointsPL +::GetMTime() +{ + unsigned long int aTime = std::max(Superclass::GetMTime(),myPSMapper->GetMTime()); + return aTime; +} + //---------------------------------------------------------------------------- void CopyGlyph( vtkGlyph3D* source, vtkGlyph3D* dest ) @@ -220,8 +229,7 @@ VISU_GaussPointsPL void VISU_GaussPointsPL ::Build() -{ -} +{} //---------------------------------------------------------------------------- void @@ -392,7 +400,14 @@ VISU_GaussPointsPL ::SetIsColored(bool theIsColored) { myPSMapper->SetPointSpriteMode( theIsColored ? 0 : 1 ); // Results / Geometry - Modified(); +} + +//---------------------------------------------------------------------------- +bool +VISU_GaussPointsPL +::GetIsColored() +{ + return myPSMapper->GetPointSpriteMode() == 0; } //---------------------------------------------------------------------------- diff --git a/src/PIPELINE/VISU_GaussPointsPL.hxx b/src/PIPELINE/VISU_GaussPointsPL.hxx index 4acd793f..5a53c7fb 100644 --- a/src/PIPELINE/VISU_GaussPointsPL.hxx +++ b/src/PIPELINE/VISU_GaussPointsPL.hxx @@ -66,6 +66,10 @@ public: static VISU_GaussPointsPL* New(); + virtual + unsigned long int + GetMTime(); + virtual void ShallowCopy(VISU_PipeLine *thePipeLine); @@ -141,6 +145,9 @@ public: void SetIsColored(bool theIsColored); + bool + GetIsColored(); + //! Set type of the primitives. void SetPrimitiveType(int thePrimitiveType); diff --git a/src/PIPELINE/VISU_PipeLine.cxx b/src/PIPELINE/VISU_PipeLine.cxx index 91e05edb..0e7f6fc5 100644 --- a/src/PIPELINE/VISU_PipeLine.cxx +++ b/src/PIPELINE/VISU_PipeLine.cxx @@ -32,6 +32,7 @@ #include "SALOME_ExtractGeometry.h" #include +#include #include #include @@ -72,7 +73,6 @@ VISU_PipeLine anImplicitBoolean->Delete(); myIsShrinkable = false; - } VISU_PipeLine @@ -81,6 +81,14 @@ VISU_PipeLine if(MYDEBUG) MESSAGE("VISU_PipeLine::~VISU_PipeLine - "<GetMTime()); + return aTime; +} + // Turn debugging output on. void VISU_PipeLine @@ -149,13 +157,14 @@ void VISU_PipeLine ::SetInput(TInput* theInput) { + if(GetInput() == theInput) + return; + if(theInput) theInput->Update(); myExtractGeometry->SetInput(theInput); myInput = theInput; - - Modified(); } VISU_PipeLine::TMapper* diff --git a/src/PIPELINE/VISU_PipeLine.hxx b/src/PIPELINE/VISU_PipeLine.hxx index c90080ce..0d1ea057 100644 --- a/src/PIPELINE/VISU_PipeLine.hxx +++ b/src/PIPELINE/VISU_PipeLine.hxx @@ -30,6 +30,7 @@ #include #include #include +#include #include "VISU_IDMapper.hxx" @@ -37,6 +38,8 @@ class vtkCell; class vtkDataSet; class vtkImplicitFunction; + +//---------------------------------------------------------------------------- template class TVTKSmartPtr: public vtkSmartPointer { @@ -70,6 +73,8 @@ public: } }; + +//---------------------------------------------------------------------------- class vtkMapper; class vtkDataSetMapper; class vtkUnstructuredGrid; @@ -81,11 +86,14 @@ class SALOME_ExtractGeometry; typedef VISU::TVTKOutput TInput; -class VISU_PipeLine : public vtkObject{ +class VISU_PipeLine : public vtkObject +{ public: vtkTypeMacro(VISU_PipeLine,vtkObject); + virtual - ~VISU_PipeLine(); + unsigned long int + GetMTime(); virtual void @@ -211,6 +219,9 @@ protected: VISU_PipeLine(); VISU_PipeLine(const VISU_PipeLine&); + virtual + ~VISU_PipeLine(); + virtual TInput* GetInput2() const; diff --git a/src/PIPELINE/VISU_Plot3DPL.cxx b/src/PIPELINE/VISU_Plot3DPL.cxx index 2b87e56f..8875badb 100644 --- a/src/PIPELINE/VISU_Plot3DPL.cxx +++ b/src/PIPELINE/VISU_Plot3DPL.cxx @@ -245,6 +245,21 @@ GetScaleFactor() const return myScaleFactor; } +void +VISU_Plot3DPL:: +SetContourPrs(bool theIsContourPrs ) +{ + myIsContour = theIsContourPrs; + Modified(); +} + +bool +VISU_Plot3DPL:: +GetIsContourPrs() const +{ + return myIsContour; +} + void VISU_Plot3DPL:: SetPlanePosition(vtkFloatingPointType thePosition, @@ -252,6 +267,7 @@ SetPlanePosition(vtkFloatingPointType thePosition, { myIsRelative = theIsRelative; myPosition = thePosition; + Modified(); } bool @@ -309,6 +325,7 @@ SetOrientation(VISU_CutPlanesPL::PlaneOrientation theOrientation, case VISU_CutPlanesPL::ZX: myAngle[0] = theYAngle; break; } myOrientation = theOrientation; + Modified(); } vtkFloatingPointType @@ -322,10 +339,11 @@ GetPlanePosition() const //function : GetBasePlane //purpose : //======================================================================= - -void VISU_Plot3DPL::GetBasePlane(vtkFloatingPointType theOrigin[3], - vtkFloatingPointType theNormal[3], - bool theCenterOrigine ) const +void +VISU_Plot3DPL +::GetBasePlane(vtkFloatingPointType theOrigin[3], + vtkFloatingPointType theNormal[3], + bool theCenterOrigine ) const { VISU_CutPlanesPL::GetDir(theNormal,myAngle,myOrientation); @@ -369,9 +387,10 @@ void VISU_Plot3DPL::GetBasePlane(vtkFloatingPointType theOrigin[3], //function : GetMinMaxPosition //purpose : return absolute position range //======================================================================= - -void VISU_Plot3DPL::GetMinMaxPosition( vtkFloatingPointType& minPos, - vtkFloatingPointType& maxPos ) const +void +VISU_Plot3DPL +::GetMinMaxPosition( vtkFloatingPointType& minPos, + vtkFloatingPointType& maxPos ) const { vtkFloatingPointType aBounds[6], aBoundPrj[3], aNormal[3]; VISU_CutPlanesPL::GetDir(aNormal,myAngle,myOrientation); @@ -386,7 +405,9 @@ void VISU_Plot3DPL::GetMinMaxPosition( vtkFloatingPointType& minPos, //purpose : //======================================================================= -void VISU_Plot3DPL::SetMapScale(vtkFloatingPointType theMapScale) +void +VISU_Plot3DPL +::SetMapScale(vtkFloatingPointType theMapScale) { VISU_ScalarMapPL::SetMapScale(theMapScale); diff --git a/src/PIPELINE/VISU_Plot3DPL.hxx b/src/PIPELINE/VISU_Plot3DPL.hxx index cb237fa7..93044d79 100644 --- a/src/PIPELINE/VISU_Plot3DPL.hxx +++ b/src/PIPELINE/VISU_Plot3DPL.hxx @@ -80,10 +80,10 @@ public: GetScaleFactor() const; void - SetContourPrs (bool theIsContourPrs ) { myIsContour = theIsContourPrs; } + SetContourPrs(bool theIsContourPrs ); bool - GetIsContourPrs() { return myIsContour; } + GetIsContourPrs() const; void SetNumberOfContours(int theNumber); diff --git a/src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.hxx b/src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.hxx index 66553b30..6abcf103 100644 --- a/src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.hxx +++ b/src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.hxx @@ -46,20 +46,41 @@ protected: public: vtkTypeMacro(VISU_ScalarMapOnDeformedShapePL,VISU_ScalarMapPL); - static VISU_ScalarMapOnDeformedShapePL* New(); + static + VISU_ScalarMapOnDeformedShapePL* + New(); - virtual void ShallowCopy(VISU_PipeLine *thePipeLine); + virtual + void + ShallowCopy(VISU_PipeLine *thePipeLine); - virtual void SetScale(vtkFloatingPointType theScale); - virtual vtkFloatingPointType GetScale(); + virtual + void + SetScale(vtkFloatingPointType theScale); - virtual int GetScalarMode(); - virtual void SetScalarMode(int theScalarMode = 0); + virtual + vtkFloatingPointType + GetScale(); - virtual void GetSourceRange(vtkFloatingPointType theRange[2]); + virtual + int + GetScalarMode(); - virtual void SetScalars(vtkDataSet *theScalars); - virtual vtkUnstructuredGrid* GetScalars(); + virtual + void + SetScalarMode(int theScalarMode = 0); + + virtual + void + GetSourceRange(vtkFloatingPointType theRange[2]); + + virtual + void + SetScalars(vtkDataSet *theScalars); + + virtual + vtkUnstructuredGrid* + GetScalars(); public: //! Redefined method for initialization of the pipeline. @@ -81,7 +102,9 @@ public: void UpdateScalars(); - virtual void SetMapScale(vtkFloatingPointType theMapScale = 1.0); + virtual + void + SetMapScale(vtkFloatingPointType theMapScale = 1.0); protected: vtkFloatingPointType myScaleFactor; diff --git a/src/PIPELINE/VISU_VectorsPL.cxx b/src/PIPELINE/VISU_VectorsPL.cxx index 3fa4bd66..2cc28805 100644 --- a/src/PIPELINE/VISU_VectorsPL.cxx +++ b/src/PIPELINE/VISU_VectorsPL.cxx @@ -122,6 +122,38 @@ VISU_VectorsPL } +void +VISU_VectorsPL +::SetGlyphType(VISU_VectorsPL::GlyphType theType) +{ + myTypeGlyph = theType; + Modified(); +} + +VISU_VectorsPL::GlyphType +VISU_VectorsPL +::GetGlyphType() const +{ + return myTypeGlyph; +} + + +void +VISU_VectorsPL +::SetGlyphPos(VISU_VectorsPL::GlyphPos thePos) +{ + myPosGlyph = thePos; + Modified(); +} + +VISU_VectorsPL::GlyphPos +VISU_VectorsPL +::GetGlyphPos() const +{ + return myPosGlyph; +} + + void VISU_VectorsPL ::Init() diff --git a/src/PIPELINE/VISU_VectorsPL.hxx b/src/PIPELINE/VISU_VectorsPL.hxx index fd83f022..8c3f4d78 100644 --- a/src/PIPELINE/VISU_VectorsPL.hxx +++ b/src/PIPELINE/VISU_VectorsPL.hxx @@ -71,33 +71,21 @@ public: virtual void - SetGlyphType(GlyphType theType) - { - myTypeGlyph = theType; - } + SetGlyphType(GlyphType theType); virtual GlyphType - GetGlyphType() - { - return myTypeGlyph; - } + GetGlyphType() const; enum GlyphPos{ CENTER, TAIL,HEAD}; virtual void - SetGlyphPos(GlyphPos thePos) - { - myPosGlyph = thePos; - } + SetGlyphPos(GlyphPos thePos); virtual GlyphPos - GetGlyphPos() - { - return myPosGlyph; - } + GetGlyphPos() const; public: virtual diff --git a/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx b/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx index 2c0e864d..0459eef8 100644 --- a/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx +++ b/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx @@ -295,7 +295,7 @@ void VisuGUI_GaussScalarBarPane::initFromPrsObject(VISU::GaussPoints_i* thePrs) myCBDisplayed->setEnabled( activeLocal ); myCBDisplayed->setChecked( thePrs->GetIsDispGlobalScalarBar() ); - bool bicolor = thePrs->GetGaussPointsPL()->GetBicolor(); + bool bicolor = thePrs->GetSpecificPL()->GetBicolor(); BicolorButton->setChecked( bicolor ); RainbowButton->setChecked( !bicolor ); ColorLabel->setEnabled( !bicolor ); @@ -373,7 +373,7 @@ int VisuGUI_GaussScalarBarPane::storeToPrsObject(VISU::GaussPoints_i* thePrs) { thePrs->SetNbColors(ColorSpin->value()); thePrs->SetLabels(LabelSpin->value()); - thePrs->GetGaussPointsPL()->SetBicolor(BicolorButton->isChecked()); + thePrs->GetSpecificPL()->SetBicolor(BicolorButton->isChecked()); //if (isToSave()) storeToResources(); @@ -699,7 +699,7 @@ void VisuGUI_GaussPointsDlg::accept() if( myPrs && myPrimitiveBox->getPrimitiveType() == VISU_OpenGLPointSpriteMapper::GeomSphere ) { int aNumberOfFaces = myPrimitiveBox->getFaceNumber(); - int aNumberOfPoints = ( (vtkPolyData*)myPrs->GetGaussPointsPL()->GetInput() )->GetNumberOfCells(); + int aNumberOfPoints = ( (vtkPolyData*)myPrs->GetSpecificPL()->GetInput() )->GetNumberOfCells(); if( aNumberOfFaces * aNumberOfPoints > myPrimitiveBox->getFaceLimit() ) { diff --git a/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx b/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx index 45e47f88..d0960c6b 100644 --- a/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx +++ b/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx @@ -563,7 +563,7 @@ void VisuGUI_ScalarBarPane::initFromPrsObject(VISU::ScalarMap_i* thePrs) { setLogarithmic(false); } vtkFloatingPointType aRange[2]; - thePrs->GetScalarMapPL()->GetSourceRange(aRange); + thePrs->GetSpecificPL()->GetSourceRange(aRange); Rmin = aRange[0]; Rmax = aRange[1]; setRange( thePrs->GetMin(), thePrs->GetMax(), /*0.0, 0.0,*/ thePrs->IsRangeFixed() ); @@ -652,8 +652,8 @@ void VisuGUI_ScalarBarPane::createScalarBar() if (!check()) return; myScalarMapPL = VISU_ScalarMapPL::New(); - if(myScalarMap->GetScalarMapPL()) - myScalarMapPL->ShallowCopy(myScalarMap->GetScalarMapPL()); + if(myScalarMap->GetSpecificPL()) + myScalarMapPL->ShallowCopy(myScalarMap->GetSpecificPL()); if ( myBusy ) return; @@ -916,7 +916,7 @@ void VisuGUI_ScalarBarPane::changeScalarMode( int theMode ) vtkFloatingPointType aRange[2]; int aMode = myScalarMap->GetScalarMode(); myScalarMap->SetScalarMode(theMode); - myScalarMap->GetScalarMapPL()->GetSourceRange(aRange); + myScalarMap->GetSpecificPL()->GetSourceRange(aRange); MinEdit->setText( QString::number( aRange[0] ) ); MaxEdit->setText( QString::number( aRange[1] ) ); myScalarMap->SetScalarMode(aMode); diff --git a/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx b/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx index 1160cc6e..e93bedef 100644 --- a/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx +++ b/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx @@ -449,9 +449,9 @@ void VisuGUI_ScalarMapOnDeformedShapeDlg::onTimeStampChanged(int){ void VisuGUI_ScalarMapOnDeformedShapeDlg::UpdateScalarField(){ myPrs->SetScale(getFactor()); vtkFloatingPointType aRange[2]; - myPrs->GetScalarMapOnDeformedShapePL()->Build(); - myPrs->GetScalarMapOnDeformedShapePL()->Update(); - myPrs->GetScalarMapOnDeformedShapePL()->GetSourceRange(aRange); + myPrs->GetSpecificPL()->Build(); + myPrs->GetSpecificPL()->Update(); + myPrs->GetSpecificPL()->GetSourceRange(aRange); double aDoubleRange[2]; aDoubleRange[0] = double(aRange[0]); aDoubleRange[1] = double(aRange[1]); diff --git a/src/VISU_I/VISU_ColoredPrs3d_i.cc b/src/VISU_I/VISU_ColoredPrs3d_i.cc index 89f06a2e..f496f886 100644 --- a/src/VISU_I/VISU_ColoredPrs3d_i.cc +++ b/src/VISU_I/VISU_ColoredPrs3d_i.cc @@ -103,7 +103,7 @@ VISU::ColoredPrs3d_i { if(TSuperClass::SetInput()){ if(CheckIsPossible()){ - if(ApplyInput()){ + if(OnSetInput()){ if(Create(GetMeshName(),GetEntity(),GetFieldName(),GetTimeStampNumber())) return true; }else @@ -117,7 +117,7 @@ VISU::ColoredPrs3d_i //--------------------------------------------------------------- bool VISU::ColoredPrs3d_i -::ApplyInput() +::OnSetInput() { bool anIsNotCreated = GetPL() == NULL; if(anIsNotCreated) @@ -134,7 +134,10 @@ void VISU::ColoredPrs3d_i ::SetEntity(VISU::Entity theEntity) { - myEntity = theEntity; + if(myEntity != theEntity){ + myEntity = theEntity; + myParamsTime.Modified(); + } } @@ -150,7 +153,10 @@ void VISU::ColoredPrs3d_i ::SetFieldName(const char* theFieldName) { - myFieldName = theFieldName; + if(myFieldName != theFieldName){ + myFieldName = theFieldName; + myParamsTime.Modified(); + } } char* @@ -164,7 +170,10 @@ void VISU::ColoredPrs3d_i ::SetTimeStampNumber(CORBA::Long theTimeStampNumber) { - myTimeStampNumber = theTimeStampNumber; + if(myTimeStampNumber != theTimeStampNumber){ + myTimeStampNumber = theTimeStampNumber; + myParamsTime.Modified(); + } } CORBA::Long @@ -187,7 +196,7 @@ VISU::ColoredPrs3d_i SetEntity(anOrigin->GetEntity()); SetFieldName(anOrigin->GetFieldName()); SetTimeStampNumber(anOrigin->GetTimeStampNumber()); - ApplyInput(); + OnSetInput(); Build(ESameAs); @@ -226,7 +235,7 @@ VISU::ColoredPrs3d_i int aTimeStampNumber = GetTimeStampNumber(); SameAs(theOrigin); SetTimeStampNumber(aTimeStampNumber); - ApplyInput(); + OnSetInput(); Build(ESameAs); Update(); @@ -280,7 +289,10 @@ void VISU::ColoredPrs3d_i ::SetBarOrientation(VISU::ScalarMap::Orientation theOrientation) { - myOrientation = theOrientation; + if(myOrientation != theOrientation){ + myOrientation = theOrientation; + myParamsTime.Modified(); + } } VISU::ScalarMap::Orientation @@ -296,6 +308,7 @@ VISU::ColoredPrs3d_i { myPosition[0] = X; myPosition[1] = Y; + myParamsTime.Modified(); } CORBA::Double @@ -318,6 +331,7 @@ VISU::ColoredPrs3d_i { myWidth = theWidth; myHeight = theHeight; + myParamsTime.Modified(); } CORBA::Double @@ -338,7 +352,10 @@ void VISU::ColoredPrs3d_i ::SetLabels(CORBA::Long theNbLabels) { - myNumberOfLabels = theNbLabels; + if(myNumberOfLabels != theNbLabels){ + myNumberOfLabels = theNbLabels; + myParamsTime.Modified(); + } } CORBA::Long @@ -352,7 +369,10 @@ void VISU::ColoredPrs3d_i ::SetTitle(const char* theName) { - myTitle = theName; + if(myTitle != theName){ + myTitle = theName; + myParamsTime.Modified(); + } } char* @@ -371,9 +391,12 @@ VISU::ColoredPrs3d_i void VISU::ColoredPrs3d_i -::SetBoldTitle(bool isBold) +::SetBoldTitle(bool theIsBoldTitle) { - myIsBoldTitle = isBold; + if(myIsBoldTitle != theIsBoldTitle){ + myIsBoldTitle = theIsBoldTitle; + myParamsTime.Modified(); + } } bool @@ -385,9 +408,12 @@ VISU::ColoredPrs3d_i void VISU::ColoredPrs3d_i -::SetItalicTitle(bool isItalic) +::SetItalicTitle(bool theIsItalicTitle) { - myIsItalicTitle = isItalic; + if(myIsItalicTitle != theIsItalicTitle){ + myIsItalicTitle = theIsItalicTitle; + myParamsTime.Modified(); + } } bool @@ -399,9 +425,12 @@ VISU::ColoredPrs3d_i void VISU::ColoredPrs3d_i -::SetShadowTitle(bool isShadow) +::SetShadowTitle(bool theIsShadowTitle) { - myIsShadowTitle = isShadow; + if(myIsShadowTitle != theIsShadowTitle){ + myIsShadowTitle = theIsShadowTitle; + myParamsTime.Modified(); + } } int @@ -413,9 +442,12 @@ VISU::ColoredPrs3d_i void VISU::ColoredPrs3d_i -::SetTitFontType(int theType) +::SetTitFontType(int theTitFontType) { - myTitFontType = theType; + if(myTitFontType != theTitFontType){ + myTitFontType = theTitFontType; + myParamsTime.Modified(); + } } void @@ -438,6 +470,7 @@ VISU::ColoredPrs3d_i myTitleColor[0] = theR; myTitleColor[1] = theG; myTitleColor[2] = theB; + myParamsTime.Modified(); } bool @@ -449,9 +482,12 @@ VISU::ColoredPrs3d_i void VISU::ColoredPrs3d_i -::SetBoldLabel(bool isBold) +::SetBoldLabel(bool theIsBoldLabel) { - myIsBoldLabel = isBold; + if(myIsBoldLabel != theIsBoldLabel){ + myIsBoldLabel = theIsBoldLabel; + myParamsTime.Modified(); + } } bool @@ -463,9 +499,12 @@ VISU::ColoredPrs3d_i void VISU::ColoredPrs3d_i -::SetItalicLabel(bool isItalic) +::SetItalicLabel(bool theIsItalicLabel) { - myIsItalicLabel = isItalic; + if(myIsItalicLabel != theIsItalicLabel){ + myIsItalicLabel = theIsItalicLabel; + myParamsTime.Modified(); + } } bool @@ -477,9 +516,12 @@ VISU::ColoredPrs3d_i void VISU::ColoredPrs3d_i -::SetShadowLabel(bool isShadow) +::SetShadowLabel(bool theIsShadowLabel) { - myIsShadowLabel = isShadow; + if(myIsShadowLabel != theIsShadowLabel){ + myIsShadowLabel = theIsShadowLabel; + myParamsTime.Modified(); + } } int @@ -491,9 +533,12 @@ VISU::ColoredPrs3d_i void VISU::ColoredPrs3d_i -::SetLblFontType(int theType) +::SetLblFontType(int theLblFontType) { - myLblFontType = theType; + if(myIsShadowLabel != theLblFontType){ + myLblFontType = theLblFontType; + myParamsTime.Modified(); + } } void @@ -516,6 +561,7 @@ VISU::ColoredPrs3d_i myLabelColor[0] = theR; myLabelColor[1] = theG; myLabelColor[2] = theB; + myParamsTime.Modified(); } @@ -534,7 +580,7 @@ VISU::ColoredPrs3d_i SetEntity(theEntity); SetFieldName(theFieldName); SetTimeStampNumber(theTimeStampNumber); - ApplyInput(); + OnSetInput(); Build(ECreateNew); // to get corresponding input from result and initilize the pipeline @@ -644,7 +690,7 @@ VISU::ColoredPrs3d_i SetEntity((VISU::Entity)VISU::Storable::FindValue(theMap,"myEntity").toInt()); SetFieldName(VISU::Storable::FindValue(theMap,"myFieldName").latin1()); SetTimeStampNumber(VISU::Storable::FindValue(theMap,"myIteration").toInt()); - ApplyInput(); + OnSetInput(); myAddToStudy = false; //SRN Added 21/06/2003 SAL2983: to avoid addition of the new ScalarMap to study. @@ -803,10 +849,3 @@ VISU::ColoredPrs3d_i { return VISU::TEntity(int(myEntity)); } - -VISU_ScalarMapPL* -VISU::ColoredPrs3d_i -::GetScalarMapPL() -{ - return myScalarMapPL; -} diff --git a/src/VISU_I/VISU_ColoredPrs3d_i.hh b/src/VISU_I/VISU_ColoredPrs3d_i.hh index b131e325..de908370 100644 --- a/src/VISU_I/VISU_ColoredPrs3d_i.hh +++ b/src/VISU_I/VISU_ColoredPrs3d_i.hh @@ -208,9 +208,6 @@ namespace VISU virtual const VISU::PField& GetField() const; - VISU_ScalarMapPL* - GetScalarMapPL(); - virtual bool IsBoldTitle(); @@ -338,7 +335,7 @@ namespace VISU */ virtual bool - ApplyInput(); + OnSetInput(); /*! Sets input data set according to basic input parameters - diff --git a/src/VISU_I/VISU_DeformedShape_i.cc b/src/VISU_I/VISU_DeformedShape_i.cc index 0dbfdbe3..63ccef52 100644 --- a/src/VISU_I/VISU_DeformedShape_i.cc +++ b/src/VISU_I/VISU_DeformedShape_i.cc @@ -214,6 +214,43 @@ VISU::DeformedShape_i } +//--------------------------------------------------------------- +CORBA::Boolean +VISU::DeformedShape_i +::IsColored() +{ + return myIsColored; +} + + +//--------------------------------------------------------------- +void +VISU::DeformedShape_i +::ShowColored(CORBA::Boolean theColored) +{ + myIsColored = theColored; + myParamsTime.Modified(); +} + +//--------------------------------------------------------------- +SALOMEDS::Color +VISU::DeformedShape_i +::GetColor() +{ + return myColor; +} + + +//--------------------------------------------------------------- +void +VISU::DeformedShape_i +::SetColor(const SALOMEDS::Color& theColor) +{ + myColor = theColor; + myParamsTime.Modified(); +} + + //--------------------------------------------------------------- void VISU::DeformedShape_i diff --git a/src/VISU_I/VISU_DeformedShape_i.hh b/src/VISU_I/VISU_DeformedShape_i.hh index be727c74..902e5cbf 100644 --- a/src/VISU_I/VISU_DeformedShape_i.hh +++ b/src/VISU_I/VISU_DeformedShape_i.hh @@ -73,30 +73,19 @@ namespace VISU virtual CORBA::Boolean - IsColored() - { - return myIsColored; - } + IsColored(); virtual void - ShowColored(CORBA::Boolean theColored) - { - myIsColored = theColored; - } + ShowColored(CORBA::Boolean theColored); virtual - SALOMEDS::Color GetColor() - { - return myColor; - } + SALOMEDS::Color + GetColor(); virtual void - SetColor(const SALOMEDS::Color& theColor) - { - myColor = theColor; - } + SetColor(const SALOMEDS::Color& theColor); typedef VISU::DeformedShape TInterface; diff --git a/src/VISU_I/VISU_GaussPoints_i.cc b/src/VISU_I/VISU_GaussPoints_i.cc index c42f9bbf..5f66133f 100644 --- a/src/VISU_I/VISU_GaussPoints_i.cc +++ b/src/VISU_I/VISU_GaussPoints_i.cc @@ -97,11 +97,10 @@ VISU::GaussPoints_i VISU::GaussPoints_i:: GaussPoints_i(Result_i* theResult, bool theAddToStudy) : - PrsObject_i(theResult->GetStudyDocument()), + PrsObject_i(SALOMEDS::Study::_nil()), Prs3d_i(theResult,theAddToStudy), ColoredPrs3d_i(theResult,theAddToStudy), myGaussPointsPL(NULL), - myIsColored(true), myColor(Qt::blue), myIsActiveLocalScalarBar(true), myIsDispGlobalScalarBar(true), @@ -116,11 +115,10 @@ GaussPoints_i(Result_i* theResult, VISU::GaussPoints_i:: GaussPoints_i(Result_i* theResult, SALOMEDS::SObject_ptr theSObject) : - PrsObject_i(theResult->GetStudyDocument()), + PrsObject_i(theSObject->GetStudy()), Prs3d_i(theResult,theSObject), ColoredPrs3d_i(theResult,theSObject), myGaussPointsPL(NULL), - myIsColored(true), myColor(Qt::blue), myIsActiveLocalScalarBar(true), myIsDispGlobalScalarBar(true), @@ -296,13 +294,6 @@ VISU::GaussPoints_i //---------------------------------------------------------------------------- -VISU_GaussPointsPL* -VISU::GaussPoints_i -::GetGaussPointsPL() -{ - return myGaussPointsPL; -} - void VISU::GaussPoints_i ::SetIsDeformed( bool theIsDeformed ) @@ -335,10 +326,16 @@ void VISU::GaussPoints_i ::SetIsColored( bool theIsColored ) { - myIsColored = theIsColored; myGaussPointsPL->SetIsColored( theIsColored ); } +bool +VISU::GaussPoints_i +::GetIsColored() +{ + return myGaussPointsPL->GetIsColored(); +} + bool VISU::GaussPoints_i ::SetMainTexture( const QString& theMainTexture ) @@ -698,7 +695,7 @@ VISU::GaussPoints_i aRangeGlobal[0] = aTMinMax.first; aRangeGlobal[1] = aTMinMax.second; - GetGaussPointsPL()->GetMapper()->SetScalarRange(aRangeGlobal); + GetSpecificPL()->GetMapper()->SetScalarRange(aRangeGlobal); } aScalarBarCtrl->SetMode(aScalarBarMode); @@ -711,7 +708,7 @@ VISU::GaussPoints_i aScalarBarCtrl->SetSpacing(mySpacing); // Bicolor - bool anIsBicolor = GetGaussPointsPL()->GetBicolor(); + bool anIsBicolor = GetSpecificPL()->GetBicolor(); aScalarBarCtrl->SetBicolor(anIsBicolor); UpdateScalarBar(aScalarBarCtrl->GetLocalBar(), @@ -731,7 +728,7 @@ VISU::GaussPoints_i myColor.blue() / 255.0); } - if( GetGaussPointsPL()->GetPrimitiveType() != VISU_OpenGLPointSpriteMapper::GeomSphere ) + if( GetSpecificPL()->GetPrimitiveType() != VISU_OpenGLPointSpriteMapper::GeomSphere ) theActor->SetRepresentation( VTK_POINTS ); else theActor->SetRepresentation( VTK_SURFACE ); @@ -770,9 +767,12 @@ VISU::GaussPoints_i //---------------------------------------------------------------------------- void VISU::GaussPoints_i -::SetIsActiveLocalScalarBar(const bool theFlag) +::SetIsActiveLocalScalarBar(const bool theIsActiveLocalScalarBar) { - myIsActiveLocalScalarBar = theFlag; + if(myIsActiveLocalScalarBar != theIsActiveLocalScalarBar){ + myIsActiveLocalScalarBar = theIsActiveLocalScalarBar; + myParamsTime.Modified(); + } } bool @@ -784,9 +784,12 @@ VISU::GaussPoints_i void VISU::GaussPoints_i -::SetIsDispGlobalScalarBar(const bool theFlag) +::SetIsDispGlobalScalarBar(const bool theIsDispGlobalScalarBar) { - myIsDispGlobalScalarBar=theFlag; + if(myIsDispGlobalScalarBar != theIsDispGlobalScalarBar){ + myIsDispGlobalScalarBar = theIsDispGlobalScalarBar; + myParamsTime.Modified(); + } } bool @@ -807,14 +810,14 @@ void VISU::GaussPoints_i ::SetBiColor(bool theIsBiColor) { - GetGaussPointsPL()->SetBicolor(theIsBiColor); + GetSpecificPL()->SetBicolor(theIsBiColor); } bool VISU::GaussPoints_i ::GetBiColor() { - return GetGaussPointsPL()->GetBicolor(); + return GetSpecificPL()->GetBicolor(); } void @@ -822,6 +825,7 @@ VISU::GaussPoints_i ::SetSpacing(const vtkFloatingPointType theSpacing) { mySpacing = theSpacing; + myParamsTime.Modified(); } vtkFloatingPointType diff --git a/src/VISU_I/VISU_GaussPoints_i.hh b/src/VISU_I/VISU_GaussPoints_i.hh index 3a907582..06da4227 100644 --- a/src/VISU_I/VISU_GaussPoints_i.hh +++ b/src/VISU_I/VISU_GaussPoints_i.hh @@ -71,10 +71,6 @@ namespace VISU typedef VISU::GaussPoints TInterface; - //! Get the Gauss Points Pipeline. - VISU_GaussPointsPL* - GetGaussPointsPL(); - int GetFaceLimit() { return myFaceLimit; } @@ -104,7 +100,7 @@ namespace VISU //! Get flag indicating which mode of the presentation is active. /*! When Results mode is active, returns true. Geometry - false. */ bool - GetIsColored() { return myIsColored; } + GetIsColored(); //! Get flag indicating which mode of the presentation is active. void @@ -289,7 +285,6 @@ namespace VISU protected: VISU_GaussPointsPL *myGaussPointsPL; - bool myIsColored; bool myIsDispGlobalScalarBar; bool myIsActiveLocalScalarBar; QColor myColor; diff --git a/src/VISU_I/VISU_Gen_i.cc b/src/VISU_I/VISU_Gen_i.cc index 5d599352..b6c2c82a 100644 --- a/src/VISU_I/VISU_Gen_i.cc +++ b/src/VISU_I/VISU_Gen_i.cc @@ -285,6 +285,8 @@ namespace VISU return VISU::CreatePrs3d(theStudy); case TCUTLINES: return VISU::CreatePrs3d(theStudy); + case TVECTORS: + return VISU::CreatePrs3d(theStudy); } return Prs3d::_nil(); } diff --git a/src/VISU_I/VISU_Prs3d_i.cc b/src/VISU_I/VISU_Prs3d_i.cc index 87ab1241..244f289c 100644 --- a/src/VISU_I/VISU_Prs3d_i.cc +++ b/src/VISU_I/VISU_Prs3d_i.cc @@ -149,7 +149,7 @@ VISU::Prs3d_i aResult->Register(); SetStudyDocument(aResult->GetStudyDocument()); myResult = aResult; - myInputTimeStamp.Modified(); + myParamsTime.Modified(); } } @@ -169,8 +169,8 @@ VISU::Prs3d_i ::SetMeshName(const char* theMeshName) { if(myMeshName != theMeshName){ - myMeshName == theMeshName; - myInputTimeStamp.Modified(); + myMeshName = theMeshName; + myParamsTime.Modified(); } } @@ -189,23 +189,10 @@ unsigned long int VISU::Prs3d_i ::GetMTime() { - return max(GetInputMTime(),GetParamsMTime()); -} - -//---------------------------------------------------------------------------- -unsigned long int -VISU::Prs3d_i -::GetInputMTime() -{ - return myInputTimeStamp.GetMTime(); -} - -//---------------------------------------------------------------------------- -unsigned long int -VISU::Prs3d_i -::GetParamsMTime() -{ - return myParamsTimeStamp.GetMTime(); + unsigned long int aTime = myParamsTime.GetMTime(); + if(myPipeLine) + aTime = std::max(aTime,myPipeLine->GetMTime()); + return aTime; } //---------------------------------------------------------------------------- @@ -217,7 +204,7 @@ VISU::Prs3d_i myOffset[0] = VISU::Storable::FindValue(theMap,"myOffset[0]").toFloat(); myOffset[1] = VISU::Storable::FindValue(theMap,"myOffset[1]").toFloat(); myOffset[2] = VISU::Storable::FindValue(theMap,"myOffset[2]").toFloat(); - myParamsTimeStamp.Modified(); + myParamsTime.Modified(); return this; } @@ -257,10 +244,18 @@ void VISU::Prs3d_i ::Update() { + if(GetMTime() < myUpdateTime.GetMTime()) + return; + if(MYDEBUG) MESSAGE("Prs3d_i::Update - this = "<Update(); + myUpdateTime.Modified(); + } + } catch(std::exception&){ + throw; }catch(...){ throw std::runtime_error("Prs3d_i::Update >> unexpected exception was caught!!!"); } @@ -272,14 +267,19 @@ void VISU::Prs3d_i ::CheckDataSet() { + if(GetMTime() < myUpdateTime.GetMTime()) + return; + vtkMapper *aMapper = myPipeLine->GetMapper(); vtkDataSet *aDataSet = aMapper->GetInput(); if (!aDataSet) throw std::runtime_error("There is no input data !!!"); + aDataSet->Update(); static float eps = VTK_LARGE_FLOAT * 0.1 ; if (!aDataSet->GetNumberOfCells()) throw std::runtime_error("There are no visible elements"); + if (aDataSet->GetLength() > eps) throw std::runtime_error("Diagonal of the actor is too large !!!"); } @@ -363,7 +363,6 @@ VISU::Prs3d_i myActorCollection->AddItem(theActor); theActor->Delete(); - }catch(std::bad_alloc& ex){ throw std::runtime_error("CreateActor >> No enough memory"); throw ex; @@ -395,7 +394,11 @@ void VISU::Prs3d_i ::UpdateActor(VISU_Actor* theActor) { + if(theActor->GetMTime() < myUpdateTime.GetMTime()) + return; + if(MYDEBUG) MESSAGE("Prs3d_i::UpdateActor - this = "<GetSource() == myAppendFilter->GetOutput()) return; + if(!myStreamLinesPL->GetSource() && mySourceEntry == "") + return; + if(myStreamLinesPL->GetSource() == myAppendFilter->GetOutput()) + return; VISU::Prs3d_var aPrs3d = GetSource(); SetParams(GetIntegrationStep(), GetPropagationTime(), diff --git a/src/VISU_I/VISU_Vectors_i.cc b/src/VISU_I/VISU_Vectors_i.cc index d7e6fedd..156fac2c 100644 --- a/src/VISU_I/VISU_Vectors_i.cc +++ b/src/VISU_I/VISU_Vectors_i.cc @@ -112,6 +112,7 @@ VISU::Vectors_i ColoredPrs3d_i(theResult,theAddToStudy), ScalarMap_i(theResult,theAddToStudy), DeformedShape_i(theResult,theAddToStudy), + myLineWidth(1.0), myVectorsPL(NULL) {} @@ -125,6 +126,7 @@ VISU::Vectors_i ColoredPrs3d_i(theResult,theSObject), ScalarMap_i(theResult,theSObject), DeformedShape_i(theResult,theSObject), + myLineWidth(1.0), myVectorsPL(NULL) {} @@ -151,7 +153,6 @@ VISU::Vectors_i const char* theFieldName, int theTimeStampNumber) { - myLineWidth = 1.0; return TSuperClass::Create(theMeshName,theEntity,theFieldName,theTimeStampNumber); } @@ -198,6 +199,7 @@ VISU::Vectors_i ::SetLineWidth(CORBA::Double theWidth) { myLineWidth = theWidth; + myParamsTime.Modified(); } //--------------------------------------------------------------- diff --git a/src/VISU_SWIG/Makefile.in b/src/VISU_SWIG/Makefile.in index 98950247..c7718a4e 100644 --- a/src/VISU_SWIG/Makefile.in +++ b/src/VISU_SWIG/Makefile.in @@ -42,7 +42,7 @@ SWIG_DEF = libVISU_Swig.i EXPORT_PYSCRIPTS = libVISU_Swig.py batchmode_visu.py batchmode_visu_table.py batchmode_visu_view3d.py \ visu_med.py visu_view3d.py visu.py visu_gui.py visu_prs_example.py \ visu_table.py visu_big_table.py visu_view.py visu_delete.py \ - visu_swig_test.py visu_split_views.py \ + visu_swig_test.py visu_split_views.py visu_change_input.py \ VISU_Example_01.py VISU_Example_02.py VISU_Example_03.py VISU_Example_04.py \ VISU_Example_05.py VISU_Example_06.py VISU_Example_07.py EXPORT_SHAREDPYSCRIPTS = VISU_shared_modules.py