From: apo Date: Fri, 24 Nov 2006 12:07:25 +0000 (+0000) Subject: To improve the following functionalities. X-Git-Tag: WP1_2_3_05-12-2006_cache_system~67 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=11a50865c1a478b6be2aa6b9a30f0aa19029c90c;p=modules%2Fvisu.git To improve the following functionalities. 1. Prs3d::CreateActor need not SALOME Interactive Object as its input parameter. 2. Prs3d and its descendants can be created without passing Result_i* as input parameter. 3. RemovableObject_i::SetName will take one addtional argument which says wether to modify the corresponding name in the SALOMEDS.Study or not --- diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index e6bd2860..87143741 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -1528,7 +1528,7 @@ OnRename() VISU::Curve_i* curve = dynamic_cast(VISU::GetServant(aCurve).in()); if (curve) - curve->SetName(Name.latin1()); + curve->SetName(Name.latin1(), true); } break; } @@ -1539,7 +1539,7 @@ OnRename() VISU::Table_i* table = dynamic_cast(VISU::GetServant(aTable).in()); if (table) - table->SetName(Name.latin1()); + table->SetName(Name.latin1(), true); } break; } @@ -1550,7 +1550,7 @@ OnRename() VISU::Container_i* container = dynamic_cast(VISU::GetServant(aContainer).in()); if (container) - container->SetName(Name.latin1()); + container->SetName(Name.latin1(), true); } break; } @@ -1723,6 +1723,18 @@ OnShowAnimation() aAnimationDlg->show(); } +//---------------------------------------------------------------------------- +template +void +DoSameAs(VISU::Prs3d_i* thePrs3d) +{ + typedef typename TL::TColoredEnum2Type::TResult TColoredPrs3d; + TColoredPrs3d* aColoredPrs3d = dynamic_cast(thePrs3d); + TColoredPrs3d* aSameColoredPrs3d = new TColoredPrs3d(VISU::ColoredPrs3d_i::EPublishUnderTimeStamp); + aSameColoredPrs3d->SameAs(aColoredPrs3d); +} + +//---------------------------------------------------------------------------- void VisuGUI:: OnCopyPresentation() @@ -1743,75 +1755,37 @@ OnCopyPresentation() switch (aPrsObject->GetType()) { case VISU::TMESH: { - VISU::Mesh_i* aMeshPrs = dynamic_cast(aPrsObject); - VISU::Mesh_i* aSameMesh = new VISU::Mesh_i(aMeshPrs->GetCResult()); - aSameMesh->SameAs(aMeshPrs); + VISU::Mesh_i* aPrs = dynamic_cast(aPrsObject); + VISU::Mesh_i* aSamePrs = new VISU::Mesh_i(aPrs->GetCResult()); + aSamePrs->SameAs(aPrs); } break; case VISU::TSCALARMAP: - { - VISU::ScalarMap_i* aScalarPrs = dynamic_cast(aPrsObject); - VISU::ScalarMap_i* aSameScalar = new VISU::ScalarMap_i(aScalarPrs->GetCResult()); - aSameScalar->SameAs(aScalarPrs); - } + DoSameAs(aPrsObject); break; case VISU::TDEFORMEDSHAPE: - { - VISU::DeformedShape_i* aDefPrs = dynamic_cast(aPrsObject); - VISU::DeformedShape_i* aSameDeformed = new VISU::DeformedShape_i(aDefPrs->GetCResult()); - aSameDeformed->SameAs(aDefPrs); - } + DoSameAs(aPrsObject); break; case VISU::TSCALARMAPONDEFORMEDSHAPE: - { - VISU::ScalarMapOnDeformedShape_i* aDefPrs = - dynamic_cast(aPrsObject); - VISU::ScalarMapOnDeformedShape_i* aSameScalarMapOnDeformed = - new VISU::ScalarMapOnDeformedShape_i(aDefPrs->GetCResult()); - aSameScalarMapOnDeformed->SameAs(aDefPrs); - } + DoSameAs(aPrsObject); break; case VISU::TCUTPLANES: - { - VISU::CutPlanes_i* aCutPrs = dynamic_cast(aPrsObject); - VISU::CutPlanes_i* aSameCut = new VISU::CutPlanes_i(aCutPrs->GetCResult()); - aSameCut->SameAs(aCutPrs); - } + DoSameAs(aPrsObject); break; case VISU::TCUTLINES: - { - VISU::CutLines_i* aCutPrs = dynamic_cast(aPrsObject); - VISU::CutLines_i* aSameCut = new VISU::CutLines_i(aCutPrs->GetCResult()); - aSameCut->SameAs(aCutPrs); - } + DoSameAs(aPrsObject); break; case VISU::TISOSURFACE: - { - VISU::IsoSurfaces_i* aIsoPrs = dynamic_cast(aPrsObject); - VISU::IsoSurfaces_i* aSameIso = new VISU::IsoSurfaces_i(aIsoPrs->GetCResult()); - aSameIso->SameAs(aIsoPrs); - } + DoSameAs(aPrsObject); break; case VISU::TSTREAMLINES: - { - VISU::StreamLines_i* aLinesPrs = dynamic_cast(aPrsObject); - VISU::StreamLines_i* aSameLines = new VISU::StreamLines_i(aLinesPrs->GetCResult()); - aSameLines->SameAs(aLinesPrs); - } + DoSameAs(aPrsObject); break; case VISU::TVECTORS: - { - VISU::Vectors_i* aVectorsPrs = dynamic_cast(aPrsObject); - VISU::Vectors_i* aSameVectors = new VISU::Vectors_i(aVectorsPrs->GetCResult()); - aSameVectors->SameAs(aVectorsPrs); - } + DoSameAs(aPrsObject); break; case VISU::TPLOT3D: - { - VISU::Plot3D_i* aPlot3DPrs = dynamic_cast(aPrsObject); - VISU::Plot3D_i* aSamePlot3D = new VISU::Plot3D_i(aPlot3DPrs->GetCResult()); - aSamePlot3D->SameAs(aPlot3DPrs); - } + DoSameAs(aPrsObject); break; } UpdateObjBrowser(this); diff --git a/src/VISUGUI/VisuGUI_CutLinesDlg.cxx b/src/VISUGUI/VisuGUI_CutLinesDlg.cxx index 0b79b5ff..172dd49a 100644 --- a/src/VISUGUI/VisuGUI_CutLinesDlg.cxx +++ b/src/VISUGUI/VisuGUI_CutLinesDlg.cxx @@ -313,8 +313,7 @@ void VisuGUI_CutLinesDlg::initFromPrsObject (VISU::CutLines_i* thePrs) setOrientation2(thePrs->GetOrientationType2()); hasInit = true; - myCutLines = new VISU::CutLines_i(thePrs->GetCResult(), - VISU::ColoredPrs3d_i::EDoNotPublish); + myCutLines = new VISU::CutLines_i(VISU::ColoredPrs3d_i::EDoNotPublish); myCutLines->SameAs(thePrs); myCutLines->CopyCurvesInverted(thePrs->GetCurvesInverted()); if (myCutLines->IsAllCurvesInverted()) myAllCurvesInvertedCheck->setChecked(true); diff --git a/src/VISUGUI/VisuGUI_CutPlanesDlg.cxx b/src/VISUGUI/VisuGUI_CutPlanesDlg.cxx index bc0e0ec4..b369535d 100644 --- a/src/VISUGUI/VisuGUI_CutPlanesDlg.cxx +++ b/src/VISUGUI/VisuGUI_CutPlanesDlg.cxx @@ -186,8 +186,7 @@ void VisuGUI_CutPlanesPane::initFromPrsObject (VISU::CutPlanes_i* thePrs) myPosSpn->setValue(thePrs->GetDisplacement()); hasInit = true; // init table - myCutPlanes = new VISU::CutPlanes_i(thePrs->GetCResult(), - VISU::ColoredPrs3d_i::EDoNotPublish); + myCutPlanes = new VISU::CutPlanes_i(VISU::ColoredPrs3d_i::EDoNotPublish); myCutPlanes->SameAs(thePrs); DrawTable(); diff --git a/src/VISU_I/Makefile.in b/src/VISU_I/Makefile.in index 4aab6f41..5e6ae2dd 100644 --- a/src/VISU_I/Makefile.in +++ b/src/VISU_I/Makefile.in @@ -47,18 +47,18 @@ LIB_SRC = \ VISU_CutLines_i.cc \ VISU_Vectors_i.cc \ VISU_StreamLines_i.cc \ + VISU_ScalarMapOnDeformedShape_i.cc \ + VISU_ColoredPrs3dHolder_i.cc \ + VISU_ColoredPrs3dCache_i.cc \ + VISU_ColoredPrs3dFactory.cc \ VISU_Mesh_i.cc \ - VISU_Table_i.cc \ - VISU_Gen_i.cc \ VISU_ViewManager_i.cc \ - VISU_View_i.cc \ VISU_TimeAnimation.cxx \ + VISU_View_i.cc \ + VISU_Table_i.cc \ + VISU_Gen_i.cc \ VISU_CorbaMedConvertor.cxx \ - VISU_DumpPython.cc \ - VISU_ScalarMapOnDeformedShape_i.cc \ - VISU_ColoredPrs3dHolder_i.cc \ - VISU_ColoredPrs3dCache_i.cc \ - VISU_ColoredPrs3dFactory.cc + VISU_DumpPython.cc LIB_MOC = \ VISU_TimeAnimation.h diff --git a/src/VISU_I/VISU_ColoredPrs3dCache_i.cc b/src/VISU_I/VISU_ColoredPrs3dCache_i.cc index b8fc7660..dd16a331 100644 --- a/src/VISU_I/VISU_ColoredPrs3dCache_i.cc +++ b/src/VISU_I/VISU_ColoredPrs3dCache_i.cc @@ -48,7 +48,7 @@ VISU::ColoredPrs3dCache_i if(MYDEBUG) MESSAGE("ColoredPrs3dCache_i::ColoredPrs3dCache_i - this = "<GetID(); @@ -264,7 +264,7 @@ VISU::ColoredPrs3dCache_i VISU::ColoredPrs3dHolder::BasicInput theInput, VISU::ColoredPrs3dHolder_i* theHolder) { - VISU::ColoredPrs3d_i* aPrs3d = VISU::CreatePrs3d_i(theType, GetStudyDocument()); + VISU::ColoredPrs3d_i* aPrs3d = VISU::CreatePrs3d_i(theType, GetStudyDocument(), ColoredPrs3d_i::ERegisterInCache); aPrs3d->SetHolderEntry( theHolder->GetEntry() ); aPrs3d->SetResultObject( theInput.myResult ); aPrs3d->SetMeshName( theInput.myMeshName ); diff --git a/src/VISU_I/VISU_ColoredPrs3dFactory.cc b/src/VISU_I/VISU_ColoredPrs3dFactory.cc index 3fda8c5a..456d5ea5 100644 --- a/src/VISU_I/VISU_ColoredPrs3dFactory.cc +++ b/src/VISU_I/VISU_ColoredPrs3dFactory.cc @@ -51,6 +51,7 @@ namespace VISU //---------------------------------------------------------------------------- bool CreatColoredPrs3d(ColoredPrs3d_i* theColoredPrs3d, + Result_i* theResult, const std::string& theMeshName, VISU::Entity theEntity, const std::string& theFieldName, @@ -65,7 +66,12 @@ namespace VISU try{ #endif #endif - if(theColoredPrs3d->Create(theMeshName, theEntity, theFieldName, theIteration)) + theColoredPrs3d->SetCResult(theResult); + theColoredPrs3d->SetMeshName(theMeshName.c_str()); + theColoredPrs3d->SetEntity(theEntity); + theColoredPrs3d->SetFieldName(theFieldName.c_str()); + theColoredPrs3d->SetTimeStampNumber(theIteration); + if(theColoredPrs3d->Apply()) return true; #ifndef _DEXCEPT_ #ifdef NO_CAS_CATCH @@ -96,29 +102,30 @@ namespace VISU //---------------------------------------------------------------------------- VISU::ColoredPrs3d_i* CreatePrs3d_i(VISUType theType, - SALOMEDS::Study_ptr theStudy) + SALOMEDS::Study_ptr theStudy, + ColoredPrs3d_i::EPublishInStudyMode thePublishInStudyMode) { switch(theType){ case TSCALARMAP: - return VISU::CreatePrs3dByEnum(theStudy); + return VISU::CreatePrs3dByEnum(theStudy, thePublishInStudyMode); case TGAUSSPOINTS: - return VISU::CreatePrs3dByEnum(theStudy); + return VISU::CreatePrs3dByEnum(theStudy, thePublishInStudyMode); case TDEFORMEDSHAPE: - return VISU::CreatePrs3dByEnum(theStudy); + return VISU::CreatePrs3dByEnum(theStudy, thePublishInStudyMode); case TSCALARMAPONDEFORMEDSHAPE: - return VISU::CreatePrs3dByEnum(theStudy); + return VISU::CreatePrs3dByEnum(theStudy, thePublishInStudyMode); case TISOSURFACE: - return VISU::CreatePrs3dByEnum(theStudy); + return VISU::CreatePrs3dByEnum(theStudy, thePublishInStudyMode); case TSTREAMLINES: - return VISU::CreatePrs3dByEnum(theStudy); + return VISU::CreatePrs3dByEnum(theStudy, thePublishInStudyMode); case TPLOT3D: - return VISU::CreatePrs3dByEnum(theStudy); + return VISU::CreatePrs3dByEnum(theStudy, thePublishInStudyMode); case TCUTPLANES: - return VISU::CreatePrs3dByEnum(theStudy); + return VISU::CreatePrs3dByEnum(theStudy, thePublishInStudyMode); case TCUTLINES: - return VISU::CreatePrs3dByEnum(theStudy); + return VISU::CreatePrs3dByEnum(theStudy, thePublishInStudyMode); case TVECTORS: - return VISU::CreatePrs3dByEnum(theStudy); + return VISU::CreatePrs3dByEnum(theStudy, thePublishInStudyMode); } return NULL; } diff --git a/src/VISU_I/VISU_ColoredPrs3dFactory.hh b/src/VISU_I/VISU_ColoredPrs3dFactory.hh index 7dff7758..cd7a6a3e 100644 --- a/src/VISU_I/VISU_ColoredPrs3dFactory.hh +++ b/src/VISU_I/VISU_ColoredPrs3dFactory.hh @@ -154,11 +154,12 @@ namespace VISU //---------------------------------------------------------------------------- template ColoredPrs3d_i* - CreatePrs3dByType(SALOMEDS::Study_ptr theStudy) + CreatePrs3dByType(SALOMEDS::Study_ptr theStudy, + ColoredPrs3d_i::EPublishInStudyMode thePublishInStudyMode) { if(!theStudy->GetProperties()->IsLocked()){ typedef typename TPrs3d_i::TInterface TPrs3d; - if(TPrs3d_i* aPresent = new TPrs3d_i(NULL,ColoredPrs3d_i::EPublishIndependently)){ + if(TPrs3d_i* aPresent = new TPrs3d_i(thePublishInStudyMode)){ return aPresent; } } @@ -169,22 +170,26 @@ namespace VISU //---------------------------------------------------------------------------- template ColoredPrs3d_i* - CreatePrs3dByEnum(SALOMEDS::Study_ptr theStudy) + CreatePrs3dByEnum(SALOMEDS::Study_ptr theStudy, + ColoredPrs3d_i::EPublishInStudyMode thePublishInStudyMode) { typedef typename TL::TColoredEnum2Type::TResult TColoredPrs3d; - return CreatePrs3dByType(theStudy); + return CreatePrs3dByType(theStudy, + thePublishInStudyMode); }; //---------------------------------------------------------------------------- ColoredPrs3d_i* CreatePrs3d_i(VISUType theType, - SALOMEDS::Study_ptr theStudy); + SALOMEDS::Study_ptr theStudy, + ColoredPrs3d_i::EPublishInStudyMode thePublishInStudyMode); //---------------------------------------------------------------------------- bool CreatColoredPrs3d(ColoredPrs3d_i* theColoredPrs3d, + Result_i* theResult, const std::string& theMeshName, VISU::Entity theEntity, const std::string& theFieldName, @@ -209,9 +214,9 @@ namespace VISU return NULL; if(TPrs3d_i::IsPossible(aResult, theMeshName, theEntity, theFieldName, theIteration)){ - TPrs3d_i* aPresent = new TPrs3d_i(aResult); + TPrs3d_i* aPresent = new TPrs3d_i(ColoredPrs3d_i::EPublishUnderTimeStamp); - if(CreatColoredPrs3d(aPresent, theMeshName, theEntity, theFieldName, theIteration)) + if(CreatColoredPrs3d(aPresent, aResult, theMeshName, theEntity, theFieldName, theIteration)) return aPresent; aPresent->_remove_ref(); diff --git a/src/VISU_I/VISU_ColoredPrs3dHolder_i.cc b/src/VISU_I/VISU_ColoredPrs3dHolder_i.cc index e8cd3cfc..e67888aa 100644 --- a/src/VISU_I/VISU_ColoredPrs3dHolder_i.cc +++ b/src/VISU_I/VISU_ColoredPrs3dHolder_i.cc @@ -85,7 +85,7 @@ VISU::ColoredPrs3dHolder_i default: break; } - SetName(GenerateName().latin1()); + SetName(GenerateName().latin1(), false); CORBA::String_var anIOR = GetID(); std::string aFatherEntry = theCache.GetEntry(); QString aComment = QString("myComment=") + aType; diff --git a/src/VISU_I/VISU_ColoredPrs3d_i.cc b/src/VISU_I/VISU_ColoredPrs3d_i.cc index b5248103..3098f582 100644 --- a/src/VISU_I/VISU_ColoredPrs3d_i.cc +++ b/src/VISU_I/VISU_ColoredPrs3d_i.cc @@ -46,10 +46,9 @@ static int MYDEBUG = 0; //============================================================================ VISU::ColoredPrs3d_i:: -ColoredPrs3d_i(Result_i* theResult, - EPublishInStudyMode thePublishInStudyMode) : +ColoredPrs3d_i(EPublishInStudyMode thePublishInStudyMode) : PrsObject_i(SALOMEDS::Study::_nil()), - Prs3d_i(theResult), + Prs3d_i(), myPublishInStudyMode(thePublishInStudyMode), myIsTimeStampFixed(thePublishInStudyMode == EPublishUnderTimeStamp), myScalarMapPL(NULL), @@ -394,6 +393,7 @@ VISU::ColoredPrs3d_i if(const ColoredPrs3d_i* aPrs3d = dynamic_cast(theOrigin)){ ColoredPrs3d_i* anOrigin = const_cast(aPrs3d); + SetCResult(anOrigin->GetCResult()); SetMeshName(anOrigin->GetCMeshName().c_str()); SetEntity(anOrigin->GetEntity()); SetFieldName(anOrigin->GetCFieldName().c_str()); @@ -435,7 +435,7 @@ void VISU::ColoredPrs3d_i ::SameAsParams(const ColoredPrs3d_i* theOrigin) { - int aTimeStampNumber = GetTimeStampNumber(); + CORBA::Long aTimeStampNumber = GetTimeStampNumber(); SameAs(theOrigin); SetTimeStampNumber(aTimeStampNumber); OnSetInput(); @@ -1155,13 +1155,14 @@ VISU::ColoredPrs3d_i if(MYDEBUG) MESSAGE("ColoredPrs3d_i::Build - "<FindObjectIOR(anIOR)); }else if(myPublishInStudyMode == EPublishIndependently){ - SetName(GenerateName().latin1()); + SetName(GenerateName().latin1(), false); CORBA::String_var anIOR = GetID(); std::string aFatherEntry = VISU::FindOrCreate3DPresentationsFolder(GetStudyDocument()); aComment.sprintf("myComment=%s", @@ -1224,7 +1225,7 @@ VISU::ColoredPrs3d_i throw; } #endif - if(myPublishInStudyMode != EDoNotPublish) + if(anIsPublishInStudy) aStudyBuilder->CommitCommand(); return this; } diff --git a/src/VISU_I/VISU_ColoredPrs3d_i.hh b/src/VISU_I/VISU_ColoredPrs3d_i.hh index bed9333e..eb46188e 100644 --- a/src/VISU_I/VISU_ColoredPrs3d_i.hh +++ b/src/VISU_I/VISU_ColoredPrs3d_i.hh @@ -49,11 +49,10 @@ namespace VISU /*! The enumeration allow to define what mode should be used for the presentation building. */ - enum EPublishInStudyMode {EPublishUnderTimeStamp, EPublishIndependently, EDoNotPublish}; + enum EPublishInStudyMode {EPublishUnderTimeStamp, EPublishIndependently, ERegisterInCache, EDoNotPublish}; explicit - ColoredPrs3d_i(Result_i* theResult, - EPublishInStudyMode thePublishInStudyMode = EPublishUnderTimeStamp); + ColoredPrs3d_i(EPublishInStudyMode thePublishInStudyMode); explicit ColoredPrs3d_i(Result_i* theResult, SALOMEDS::SObject_var theSObject); diff --git a/src/VISU_I/VISU_CutLines_i.cc b/src/VISU_I/VISU_CutLines_i.cc index 0957d2bc..e5db69d2 100644 --- a/src/VISU_I/VISU_CutLines_i.cc +++ b/src/VISU_I/VISU_CutLines_i.cc @@ -87,12 +87,11 @@ VISU::CutLines_i //--------------------------------------------------------------- VISU::CutLines_i:: -CutLines_i(Result_i* theResult, - EPublishInStudyMode thePublishInStudyMode) : +CutLines_i(EPublishInStudyMode thePublishInStudyMode) : PrsObject_i(SALOMEDS::Study::_nil()), - Prs3d_i(theResult), - ColoredPrs3d_i(theResult,thePublishInStudyMode), - ScalarMap_i(theResult,thePublishInStudyMode), + Prs3d_i(), + ColoredPrs3d_i(thePublishInStudyMode), + ScalarMap_i(thePublishInStudyMode), myCutLinesPL(NULL) {} @@ -485,9 +484,9 @@ VISU::CutLines_i //--------------------------------------------------------------- VISU_Actor* VISU::CutLines_i -::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) +::CreateActor() { - if(VISU_Actor* anActor = TSuperClass::CreateActor(theIO)){ + if(VISU_Actor* anActor = TSuperClass::CreateActor()){ anActor->SetVTKMapping(true); SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); int aDispMode = aResourceMgr->integerValue("VISU" , "cut_lines_represent", 2); diff --git a/src/VISU_I/VISU_CutLines_i.hh b/src/VISU_I/VISU_CutLines_i.hh index c9c7b726..0a934d5d 100644 --- a/src/VISU_I/VISU_CutLines_i.hh +++ b/src/VISU_I/VISU_CutLines_i.hh @@ -44,8 +44,7 @@ namespace VISU typedef ScalarMap_i TSuperClass; explicit - CutLines_i(Result_i* theResult, - EPublishInStudyMode thePublishInStudyMode = EPublishUnderTimeStamp); + CutLines_i(EPublishInStudyMode thePublishInStudyModep); explicit CutLines_i(Result_i* theResult, SALOMEDS::SObject_var theSObject); @@ -233,7 +232,7 @@ namespace VISU //! Extends VISU_ColoredPrs3d_i::CreateActor virtual VISU_Actor* - CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL); + CreateActor(); void BuildTableOfReal(SALOMEDS::SObject_var theSObject); diff --git a/src/VISU_I/VISU_CutPlanes_i.cc b/src/VISU_I/VISU_CutPlanes_i.cc index c9286737..35774065 100644 --- a/src/VISU_I/VISU_CutPlanes_i.cc +++ b/src/VISU_I/VISU_CutPlanes_i.cc @@ -77,12 +77,11 @@ VISU::CutPlanes_i //---------------------------------------------------------------------------- VISU::CutPlanes_i -::CutPlanes_i(Result_i* theResult, - EPublishInStudyMode thePublishInStudyMode): +::CutPlanes_i(EPublishInStudyMode thePublishInStudyMode): PrsObject_i(SALOMEDS::Study::_nil()), - Prs3d_i(theResult), - ColoredPrs3d_i(theResult,thePublishInStudyMode), - ScalarMap_i(theResult,thePublishInStudyMode), + Prs3d_i(), + ColoredPrs3d_i(thePublishInStudyMode), + ScalarMap_i(thePublishInStudyMode), myCutPlanesPL(NULL) {} @@ -292,9 +291,9 @@ VISU::CutPlanes_i //---------------------------------------------------------------------------- VISU_Actor* VISU::CutPlanes_i -::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) +::CreateActor() { - if(VISU_Actor* anActor = TSuperClass::CreateActor(theIO)){ + if(VISU_Actor* anActor = TSuperClass::CreateActor()){ anActor->SetVTKMapping(true); SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); int aDispMode = aResourceMgr->integerValue("VISU" , "cut_planes_represent", 1); diff --git a/src/VISU_I/VISU_CutPlanes_i.hh b/src/VISU_I/VISU_CutPlanes_i.hh index f011b773..e1547929 100644 --- a/src/VISU_I/VISU_CutPlanes_i.hh +++ b/src/VISU_I/VISU_CutPlanes_i.hh @@ -44,8 +44,7 @@ namespace VISU typedef ScalarMap_i TSuperClass; explicit - CutPlanes_i(Result_i* theResult, - EPublishInStudyMode thePublishInStudyMode = EPublishUnderTimeStamp); + CutPlanes_i(EPublishInStudyMode thePublishInStudyModep); explicit CutPlanes_i(Result_i* theResult, SALOMEDS::SObject_var theSObject); @@ -162,7 +161,7 @@ namespace VISU //! Redefines VISU_ColoredPrs3d_i::CreateActor virtual VISU_Actor* - CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL); + CreateActor(); static const std::string myComment; diff --git a/src/VISU_I/VISU_DeformedShape_i.cc b/src/VISU_I/VISU_DeformedShape_i.cc index 9552cb48..b8d0f05f 100644 --- a/src/VISU_I/VISU_DeformedShape_i.cc +++ b/src/VISU_I/VISU_DeformedShape_i.cc @@ -101,12 +101,11 @@ VISU::DeformedShape_i //--------------------------------------------------------------- VISU::DeformedShape_i -::DeformedShape_i(Result_i* theResult, - EPublishInStudyMode thePublishInStudyMode): +::DeformedShape_i(EPublishInStudyMode thePublishInStudyMode): PrsObject_i(SALOMEDS::Study::_nil()), - Prs3d_i(theResult), - ColoredPrs3d_i(theResult,thePublishInStudyMode), - ScalarMap_i(theResult,thePublishInStudyMode), + Prs3d_i(), + ColoredPrs3d_i(thePublishInStudyMode), + ScalarMap_i(thePublishInStudyMode), myDeformedShapePL(NULL) { if(MYDEBUG) MESSAGE("DeformedShape_i::DeformedShape_i"); @@ -288,10 +287,9 @@ VISU::DeformedShape_i //--------------------------------------------------------------- VISU_Actor* VISU::DeformedShape_i -::CreateActor(const Handle(SALOME_InteractiveObject)& theIO, - bool toSupressShrinking) +::CreateActor(bool toSupressShrinking) { - VISU_Actor* anActor = TSuperClass::CreateActor(theIO, true); + VISU_Actor* anActor = TSuperClass::CreateActor(true); anActor->SetVTKMapping(false); SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); int aDispMode = aResourceMgr->integerValue("VISU", "deformed_shape_represent", 1); @@ -306,9 +304,9 @@ VISU::DeformedShape_i //--------------------------------------------------------------- VISU_Actor* VISU::DeformedShape_i -::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) +::CreateActor() { - return CreateActor(theIO, false); + return CreateActor(false); } diff --git a/src/VISU_I/VISU_DeformedShape_i.hh b/src/VISU_I/VISU_DeformedShape_i.hh index ae6ae789..84d7e846 100644 --- a/src/VISU_I/VISU_DeformedShape_i.hh +++ b/src/VISU_I/VISU_DeformedShape_i.hh @@ -44,8 +44,7 @@ namespace VISU typedef ScalarMap_i TSuperClass; explicit - DeformedShape_i(Result_i* theResult, - EPublishInStudyMode thePublishInStudyMode = EPublishUnderTimeStamp); + DeformedShape_i(EPublishInStudyMode thePublishInStudyModep); explicit DeformedShape_i(Result_i* theResult, SALOMEDS::SObject_var theSObject); @@ -151,12 +150,11 @@ namespace VISU virtual VISU_Actor* - CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL); + CreateActor(); virtual VISU_Actor* - CreateActor(const Handle(SALOME_InteractiveObject)& theIO, - bool toSupressShrinking); + CreateActor(bool toSupressShrinking); virtual void diff --git a/src/VISU_I/VISU_GaussPoints_i.cc b/src/VISU_I/VISU_GaussPoints_i.cc index 5a895bc8..0ced6ab8 100644 --- a/src/VISU_I/VISU_GaussPoints_i.cc +++ b/src/VISU_I/VISU_GaussPoints_i.cc @@ -94,12 +94,11 @@ VISU::GaussPoints_i //---------------------------------------------------------------------------- -VISU::GaussPoints_i:: -GaussPoints_i(Result_i* theResult, - EPublishInStudyMode thePublishInStudyMode) : +VISU::GaussPoints_i +::GaussPoints_i(EPublishInStudyMode thePublishInStudyMode) : PrsObject_i(SALOMEDS::Study::_nil()), - Prs3d_i(theResult), - ColoredPrs3d_i(theResult,thePublishInStudyMode), + Prs3d_i(), + ColoredPrs3d_i(thePublishInStudyMode), myGaussPointsPL(NULL), myColor(Qt::blue), myIsActiveLocalScalarBar(true), @@ -112,9 +111,9 @@ GaussPoints_i(Result_i* theResult, //---------------------------------------------------------------------------- -VISU::GaussPoints_i:: -GaussPoints_i(Result_i* theResult, - SALOMEDS::SObject_var theSObject) : +VISU::GaussPoints_i +::GaussPoints_i(Result_i* theResult, + SALOMEDS::SObject_var theSObject) : PrsObject_i(theSObject->GetStudy()), Prs3d_i(theResult,theSObject), ColoredPrs3d_i(theResult,theSObject), @@ -574,11 +573,10 @@ VISU::GaussPoints_i //---------------------------------------------------------------------------- bool VISU::GaussPoints_i -::OnCreateActor(VISU_GaussPtsAct* theActor, - const Handle(SALOME_InteractiveObject)& theIO) +::OnCreateActor(VISU_GaussPtsAct* theActor) { try{ - TSuperClass::CreateActor(theActor,theIO); + TSuperClass::CreateActor(theActor); theActor->GetPipeLine()->Delete(); UpdateActor(theActor); return true; @@ -591,29 +589,29 @@ VISU::GaussPoints_i VISU_GaussPtsAct1* VISU::GaussPoints_i -::OnCreateActor1(const Handle(SALOME_InteractiveObject)& theIO) +::OnCreateActor1() { VISU_GaussPtsAct1* anActor = VISU_GaussPtsAct1::New(); - if(OnCreateActor(anActor,theIO)) + if(OnCreateActor(anActor)) return anActor; return NULL; } VISU_GaussPtsAct2* VISU::GaussPoints_i -::OnCreateActor2(const Handle(SALOME_InteractiveObject)& theIO) +::OnCreateActor2() { VISU_GaussPtsAct2* anActor = VISU_GaussPtsAct2::New(); - if(OnCreateActor(anActor,theIO)) + if(OnCreateActor(anActor)) return anActor; return NULL; } VISU_Actor* VISU::GaussPoints_i -::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) +::CreateActor() { - return OnCreateActor1(theIO); + return OnCreateActor1(); } //---------------------------------------------------------------------------- diff --git a/src/VISU_I/VISU_GaussPoints_i.hh b/src/VISU_I/VISU_GaussPoints_i.hh index bc44b491..98af17b3 100644 --- a/src/VISU_I/VISU_GaussPoints_i.hh +++ b/src/VISU_I/VISU_GaussPoints_i.hh @@ -53,8 +53,7 @@ namespace VISU typedef ColoredPrs3d_i TSuperClass; explicit - GaussPoints_i(Result_i* theResult, - EPublishInStudyMode thePublishInStudyMode = EPublishUnderTimeStamp); + GaussPoints_i(EPublishInStudyMode thePublishInStudyModep); explicit GaussPoints_i(Result_i* theResult, SALOMEDS::SObject_var theSObject); @@ -281,14 +280,13 @@ namespace VISU GetPL(); bool - OnCreateActor(VISU_GaussPtsAct* theActor, - const Handle(SALOME_InteractiveObject)& theIO = NULL); + OnCreateActor(VISU_GaussPtsAct* theActor); VISU_GaussPtsAct1* - OnCreateActor1(const Handle(SALOME_InteractiveObject)& theIO = NULL); + OnCreateActor1(); VISU_GaussPtsAct2* - OnCreateActor2(const Handle(SALOME_InteractiveObject)& theIO = NULL); + OnCreateActor2(); void UpdateScalarBar(vtkScalarBarActor *theScalarBar, @@ -343,7 +341,7 @@ namespace VISU //---------------------------------------------------------------------------- virtual VISU_Actor* - CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL); + CreateActor(); virtual VISU_GaussPtsAct2* diff --git a/src/VISU_I/VISU_Gen_i.cc b/src/VISU_I/VISU_Gen_i.cc index 36079e80..be084e93 100644 --- a/src/VISU_I/VISU_Gen_i.cc +++ b/src/VISU_I/VISU_Gen_i.cc @@ -244,7 +244,7 @@ namespace VISU ::CreatePrs3d(VISUType theType, SALOMEDS::Study_ptr theStudy) { - if(ColoredPrs3d_i* aPrs3d = VISU::CreatePrs3d_i(theType, theStudy)) + if(ColoredPrs3d_i* aPrs3d = CreatePrs3d_i(theType, theStudy, ColoredPrs3d_i::EPublishIndependently)) return aPrs3d->_this(); return Prs3d::_nil(); } diff --git a/src/VISU_I/VISU_IsoSurfaces_i.cc b/src/VISU_I/VISU_IsoSurfaces_i.cc index c8e4a79e..bf5a8e0d 100644 --- a/src/VISU_I/VISU_IsoSurfaces_i.cc +++ b/src/VISU_I/VISU_IsoSurfaces_i.cc @@ -78,12 +78,11 @@ VISU::IsoSurfaces_i //--------------------------------------------------------------- VISU::IsoSurfaces_i -::IsoSurfaces_i(Result_i* theResult, - EPublishInStudyMode thePublishInStudyMode) : +::IsoSurfaces_i(EPublishInStudyMode thePublishInStudyMode) : PrsObject_i(SALOMEDS::Study::_nil()), - Prs3d_i(theResult), - ColoredPrs3d_i(theResult,thePublishInStudyMode), - ScalarMap_i(theResult,thePublishInStudyMode), + Prs3d_i(), + ColoredPrs3d_i(thePublishInStudyMode), + ScalarMap_i(thePublishInStudyMode), myIsoSurfacesPL(NULL) {} @@ -228,9 +227,9 @@ VISU::IsoSurfaces_i //--------------------------------------------------------------- VISU_Actor* VISU::IsoSurfaces_i -::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) +::CreateActor() { - if(VISU_Actor* anActor = TSuperClass::CreateActor(theIO)){ + if(VISU_Actor* anActor = TSuperClass::CreateActor()){ anActor->SetVTKMapping(true); SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); int aDispMode = aResourceMgr->integerValue("VISU" , "iso_surfaces_represent", 2); diff --git a/src/VISU_I/VISU_IsoSurfaces_i.hh b/src/VISU_I/VISU_IsoSurfaces_i.hh index 5f92ca20..89985fcd 100644 --- a/src/VISU_I/VISU_IsoSurfaces_i.hh +++ b/src/VISU_I/VISU_IsoSurfaces_i.hh @@ -44,8 +44,7 @@ namespace VISU typedef ScalarMap_i TSuperClass; explicit - IsoSurfaces_i(Result_i* theResult, - EPublishInStudyMode thePublishInStudyMode = EPublishUnderTimeStamp); + IsoSurfaces_i(EPublishInStudyMode thePublishInStudyModep); explicit IsoSurfaces_i(Result_i* theResult, SALOMEDS::SObject_var theSObject); @@ -142,7 +141,7 @@ namespace VISU virtual VISU_Actor* - CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL); + CreateActor(); virtual void diff --git a/src/VISU_I/VISU_Mesh_i.cc b/src/VISU_I/VISU_Mesh_i.cc index cb3790c5..c958c2b1 100644 --- a/src/VISU_I/VISU_Mesh_i.cc +++ b/src/VISU_I/VISU_Mesh_i.cc @@ -84,7 +84,7 @@ VISU::Mesh_i //---------------------------------------------------------------------------- VISU::Mesh_i ::Mesh_i(Result_i* theResult, - SALOMEDS::SObject_ptr theSObject) : + SALOMEDS::SObject_ptr theSObject) : PrsObject_i(theResult->GetStudyDocument()), Prs3d_i(theResult,theSObject), myMeshPL(VISU_MeshPL::New()) @@ -272,7 +272,7 @@ VISU::Mesh_i myPresentType = VISU::PresentationType(VISU::GetResourceMgr()->integerValue("VISU" , "mesh_represent", 2)); if(myEntity == VISU::NODE_ENTITY) myPresentType = VISU::POINT; - SetName(GenerateName().latin1()); + SetName(GenerateName().latin1(), false); myCellColor.R = 0.0; myCellColor.G = myCellColor.B = 1.0; myNodeColor.R = myNodeColor.G = 1.0; myNodeColor.B = 1.0; myLinkColor.R = myLinkColor.G = myLinkColor.B = 83/255.; @@ -362,11 +362,11 @@ VISU::Mesh_i VISU_Actor* VISU::Mesh_i -::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) +::CreateActor() { VISU_MeshAct* anActor = VISU_MeshAct::New(); try{ - VISU::Prs3d_i::CreateActor(anActor,theIO); + VISU::Prs3d_i::CreateActor(anActor); SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); bool toShrink = aResourceMgr->booleanValue("VISU", "mesh_shrink", false); if (toShrink) anActor->SetShrink(); diff --git a/src/VISU_I/VISU_Mesh_i.hh b/src/VISU_I/VISU_Mesh_i.hh index 2f87b943..4a16acbf 100644 --- a/src/VISU_I/VISU_Mesh_i.hh +++ b/src/VISU_I/VISU_Mesh_i.hh @@ -102,7 +102,7 @@ namespace VISU virtual Storable* Restore(const Storable::TRestoringMap& theMap); - virtual VISU_Actor* CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL); + virtual VISU_Actor* CreateActor(); virtual void UpdateActor(VISU_Actor* theActor); }; diff --git a/src/VISU_I/VISU_Plot3D_i.cc b/src/VISU_I/VISU_Plot3D_i.cc index 5ef41c89..b76c1a0f 100644 --- a/src/VISU_I/VISU_Plot3D_i.cc +++ b/src/VISU_I/VISU_Plot3D_i.cc @@ -74,12 +74,11 @@ VISU::Plot3D_i //--------------------------------------------------------------- VISU::Plot3D_i -::Plot3D_i(Result_i* theResult, - EPublishInStudyMode thePublishInStudyMode) : +::Plot3D_i(EPublishInStudyMode thePublishInStudyMode) : PrsObject_i(SALOMEDS::Study::_nil()), - Prs3d_i(theResult), - ColoredPrs3d_i(theResult,thePublishInStudyMode), - ScalarMap_i(theResult,thePublishInStudyMode), + Prs3d_i(), + ColoredPrs3d_i(thePublishInStudyMode), + ScalarMap_i(thePublishInStudyMode), myPlot3DPL(NULL) {} @@ -301,9 +300,9 @@ VISU::Plot3D_i //--------------------------------------------------------------- VISU_Actor* VISU::Plot3D_i -::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) +::CreateActor() { - if(VISU_Actor* anActor = TSuperClass::CreateActor(theIO)){ + if(VISU_Actor* anActor = TSuperClass::CreateActor()){ anActor->SetVTKMapping(true); SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); int aDispMode = aResourceMgr->integerValue("VISU", "plot3d_represent", 2); diff --git a/src/VISU_I/VISU_Plot3D_i.hh b/src/VISU_I/VISU_Plot3D_i.hh index d7c6bb29..906aa6a9 100644 --- a/src/VISU_I/VISU_Plot3D_i.hh +++ b/src/VISU_I/VISU_Plot3D_i.hh @@ -38,8 +38,7 @@ namespace VISU typedef ScalarMap_i TSuperClass; explicit - Plot3D_i(Result_i* theResult, - EPublishInStudyMode thePublishInStudyMode = EPublishUnderTimeStamp); + Plot3D_i(EPublishInStudyMode thePublishInStudyModep); explicit Plot3D_i(Result_i* theResult, SALOMEDS::SObject_var theSObject); @@ -156,7 +155,7 @@ namespace VISU virtual VISU_Actor* - CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL); + CreateActor(); static const std::string myComment; diff --git a/src/VISU_I/VISU_Prs3d_i.cc b/src/VISU_I/VISU_Prs3d_i.cc index cea37532..126ad995 100644 --- a/src/VISU_I/VISU_Prs3d_i.cc +++ b/src/VISU_I/VISU_Prs3d_i.cc @@ -50,20 +50,16 @@ static int MYDEBUG = 0; //---------------------------------------------------------------------------- VISU::Prs3d_i -::Prs3d_i(Result_i* theResult) : +::Prs3d_i() : PrsObject_i(SALOMEDS::Study::_nil()), myActorCollection(vtkActorCollection::New()), mySObject(SALOMEDS::SObject::_nil()), - myResult(theResult), - myPipeLine(NULL) + myPipeLine(NULL), + myResult(NULL) { if(MYDEBUG) MESSAGE("Prs3d_i::Prs3d_i - this = "<Delete(); - if(theResult){ - SetStudyDocument(theResult->GetStudyDocument()); - theResult->Register(); - } } @@ -143,36 +139,44 @@ VISU::Prs3d_i //---------------------------------------------------------------------------- void VISU::Prs3d_i -::SetResultObject(VISU::Result_ptr theResult) +::SetCResult(VISU::Result_i* theResult) { - Result_i* aResult = dynamic_cast(GetServant(theResult).in()); - if(myResult != aResult){ + if(myResult != theResult){ if(myResult) myResult->Destroy(); - if(aResult) - aResult->Register(); - SetStudyDocument(aResult->GetStudyDocument()); - myResult = aResult; + if(theResult){ + theResult->Register(); + SetStudyDocument(theResult->GetStudyDocument()); + } + myResult = theResult; myParamsTime.Modified(); } } +//---------------------------------------------------------------------------- +Result_i* +VISU::Prs3d_i +::GetCResult() const +{ + return myResult; +} + //---------------------------------------------------------------------------- -VISU::Result_ptr +void VISU::Prs3d_i -::GetResultObject() +::SetResultObject(VISU::Result_ptr theResult) { - return myResult->_this(); + SetCResult(dynamic_cast(GetServant(theResult).in())); } //---------------------------------------------------------------------------- -Result_i* +VISU::Result_ptr VISU::Prs3d_i -::GetCResult() const -{ - return myResult; +::GetResultObject() +{ + return myResult->_this(); } @@ -222,7 +226,7 @@ VISU::Storable* VISU::Prs3d_i ::Restore(const Storable::TRestoringMap& theMap) { - SetName(VISU::Storable::FindValue(theMap,"myName").latin1()); + SetName(VISU::Storable::FindValue(theMap,"myName").latin1(), false); 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(); @@ -394,13 +398,11 @@ VISU::Prs3d_i //---------------------------------------------------------------------------- void VISU::Prs3d_i -::CreateActor(VISU_Actor* theActor, - const Handle(SALOME_InteractiveObject)& theIO) +::CreateActor(VISU_Actor* theActor) { try{ - Handle(SALOME_InteractiveObject) anIO = theIO; - if(anIO.IsNull() && (!mySObject->_is_nil())){ - anIO = GetIO(); + Handle(SALOME_InteractiveObject) anIO = GetIO(); + if(!anIO.IsNull() && anIO->hasEntry()){ theActor->setIO(anIO); } diff --git a/src/VISU_I/VISU_Prs3d_i.hh b/src/VISU_I/VISU_Prs3d_i.hh index 28fac173..ce9415d7 100644 --- a/src/VISU_I/VISU_Prs3d_i.hh +++ b/src/VISU_I/VISU_Prs3d_i.hh @@ -69,14 +69,12 @@ namespace VISU public virtual PrsObject_i { - Prs3d_i(); Prs3d_i(const Prs3d_i&); public: //---------------------------------------------------------------------------- //! A constructor to create a fresh instance of the class - explicit - Prs3d_i(Result_i* theResult); + Prs3d_i(); //! A constructor to restore an instance of the class explicit @@ -96,6 +94,13 @@ namespace VISU CORBA::Boolean Apply(); + //---------------------------------------------------------------------------- + void + SetCResult(Result_i* theResult); + + Result_i* + GetCResult() const; + virtual void SetResultObject(VISU::Result_ptr theResult); @@ -104,10 +109,7 @@ namespace VISU VISU::Result_ptr GetResultObject(); - //! Get corresponding Result_i - Result_i* - GetCResult() const; - + //---------------------------------------------------------------------------- virtual void SetMeshName(const char* theMeshName); @@ -173,7 +175,7 @@ namespace VISU //! To define a way to create VTK representation of the instance virtual VISU_Actor* - CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL) = 0; + CreateActor() = 0; //! To unregister the pointed actor virtual @@ -257,8 +259,7 @@ namespace VISU SetPipeLine(VISU_PipeLine* thePipeLine); void - CreateActor(VISU_Actor* theActor, - const Handle(SALOME_InteractiveObject)& theIO = NULL); + CreateActor(VISU_Actor* theActor); virtual VISU_PipeLine* diff --git a/src/VISU_I/VISU_PrsObject_i.cc b/src/VISU_I/VISU_PrsObject_i.cc index 497050cc..7fcb4805 100644 --- a/src/VISU_I/VISU_PrsObject_i.cc +++ b/src/VISU_I/VISU_PrsObject_i.cc @@ -51,15 +51,18 @@ VISU::RemovableObject_i //--------------------------------------------------------------- void VISU::RemovableObject_i -::SetName(const std::string& theName) +::SetName(const std::string& theName, + bool theIsUpdateStudyAttr) { myName = theName; - SALOMEDS::SObject_var aSObject = myStudy->FindObjectID(GetEntry().c_str()); - if(!aSObject->_is_nil()){ - SALOMEDS::StudyBuilder_var aBuilder = myStudy->NewBuilder(); - SALOMEDS::GenericAttribute_var anAttr = aBuilder->FindOrCreateAttribute( aSObject, "AttributeName" ); - SALOMEDS::AttributeName_var aNameAttr = SALOMEDS::AttributeName::_narrow( anAttr ); - aNameAttr->SetValue( theName.c_str() ); + if(theIsUpdateStudyAttr){ + SALOMEDS::SObject_var aSObject = myStudy->FindObjectID(GetEntry().c_str()); + if(!aSObject->_is_nil()){ + SALOMEDS::StudyBuilder_var aBuilder = myStudy->NewBuilder(); + SALOMEDS::GenericAttribute_var anAttr = aBuilder->FindOrCreateAttribute( aSObject, "AttributeName" ); + SALOMEDS::AttributeName_var aNameAttr = SALOMEDS::AttributeName::_narrow( anAttr ); + aNameAttr->SetValue( theName.c_str() ); + } } } diff --git a/src/VISU_I/VISU_PrsObject_i.hh b/src/VISU_I/VISU_PrsObject_i.hh index eb4a3b07..c898cc6e 100644 --- a/src/VISU_I/VISU_PrsObject_i.hh +++ b/src/VISU_I/VISU_PrsObject_i.hh @@ -54,7 +54,8 @@ namespace VISU virtual void - SetName(const std::string& theName); + SetName(const std::string& theName, + bool theIsUpdateStudyAttr); protected: RemovableObject_i(); diff --git a/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc b/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc index bd1c1f84..87a41fa6 100644 --- a/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc +++ b/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc @@ -114,12 +114,11 @@ VISU::ScalarMapOnDeformedShape_i //--------------------------------------------------------------- VISU::ScalarMapOnDeformedShape_i -::ScalarMapOnDeformedShape_i(Result_i* theResult, - EPublishInStudyMode thePublishInStudyMode) : +::ScalarMapOnDeformedShape_i(EPublishInStudyMode thePublishInStudyMode) : PrsObject_i(SALOMEDS::Study::_nil()), - Prs3d_i(theResult), - ColoredPrs3d_i(theResult,thePublishInStudyMode), - ScalarMap_i(theResult,thePublishInStudyMode), + Prs3d_i(), + ColoredPrs3d_i(thePublishInStudyMode), + ScalarMap_i(thePublishInStudyMode), myScalarMapOnDeformedShapePL(NULL), myScalarIteration(1) {} @@ -317,9 +316,9 @@ VISU::ScalarMapOnDeformedShape_i //--------------------------------------------------------------- VISU_Actor* VISU::ScalarMapOnDeformedShape_i -::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) +::CreateActor() { - VISU_Actor* anActor = TSuperClass::CreateActor(theIO, true); + VISU_Actor* anActor = TSuperClass::CreateActor(true); SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); int aDispMode = aResourceMgr->integerValue("VISU", "scalar_def_represent", 2); bool toShrink = aResourceMgr->booleanValue("VISU", "scalar_def_shrink", false); diff --git a/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh b/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh index 2d694336..033df7b0 100644 --- a/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh +++ b/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.hh @@ -47,8 +47,7 @@ namespace VISU typedef ScalarMap_i TSuperClass; explicit - ScalarMapOnDeformedShape_i(Result_i* theResult, - EPublishInStudyMode thePublishInStudyMode = EPublishUnderTimeStamp); + ScalarMapOnDeformedShape_i(EPublishInStudyMode thePublishInStudyModep); explicit ScalarMapOnDeformedShape_i(Result_i* theResult, SALOMEDS::SObject_var theSObject); @@ -162,7 +161,7 @@ namespace VISU virtual VISU_Actor* - CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL); + CreateActor(); virtual void diff --git a/src/VISU_I/VISU_ScalarMap_i.cc b/src/VISU_I/VISU_ScalarMap_i.cc index b2e12a83..881aec5f 100644 --- a/src/VISU_I/VISU_ScalarMap_i.cc +++ b/src/VISU_I/VISU_ScalarMap_i.cc @@ -105,11 +105,10 @@ VISU::ScalarMap_i //---------------------------------------------------------------------------- VISU::ScalarMap_i:: -ScalarMap_i(Result_i* theResult, - EPublishInStudyMode thePublishInStudyMode) : +ScalarMap_i(EPublishInStudyMode thePublishInStudyMode) : PrsObject_i(SALOMEDS::Study::_nil()), - Prs3d_i(theResult), - ColoredPrs3d_i(theResult,thePublishInStudyMode) + Prs3d_i(), + ColoredPrs3d_i(thePublishInStudyMode) {} //---------------------------------------------------------------------------- @@ -312,11 +311,11 @@ VISU::ScalarMap_i //---------------------------------------------------------------------------- VISU_Actor* VISU::ScalarMap_i -::CreateActor(const Handle(SALOME_InteractiveObject)& theIO, bool toSupressShrinking) +::CreateActor(bool toSupressShrinking) { VISU_ScalarMapAct* anActor = VISU_ScalarMapAct::New(); try{ - TSuperClass::CreateActor(anActor,theIO); + TSuperClass::CreateActor(anActor); anActor->SetBarVisibility(true); SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); int aDispMode = aResourceMgr->integerValue("VISU", "scalar_map_represent", 2); @@ -336,9 +335,9 @@ VISU::ScalarMap_i //---------------------------------------------------------------------------- VISU_Actor* VISU::ScalarMap_i -::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) +::CreateActor() { - return CreateActor(theIO, false); + return CreateActor(false); } //---------------------------------------------------------------------------- diff --git a/src/VISU_I/VISU_ScalarMap_i.hh b/src/VISU_I/VISU_ScalarMap_i.hh index 9ee01ff2..978e552f 100644 --- a/src/VISU_I/VISU_ScalarMap_i.hh +++ b/src/VISU_I/VISU_ScalarMap_i.hh @@ -45,8 +45,7 @@ namespace VISU typedef ColoredPrs3d_i TSuperClass; explicit - ScalarMap_i(Result_i* theResult, - EPublishInStudyMode thePublishInStudyMode = EPublishUnderTimeStamp); + ScalarMap_i(EPublishInStudyMode thePublishInStudyModep); explicit ScalarMap_i(Result_i* theResult, SALOMEDS::SObject_var theSObject); @@ -155,12 +154,11 @@ namespace VISU virtual VISU_Actor* - CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL); + CreateActor(); virtual VISU_Actor* - CreateActor(const Handle(SALOME_InteractiveObject)& theIO, - bool toSupressShrinking); + CreateActor(bool toSupressShrinking); virtual void diff --git a/src/VISU_I/VISU_StreamLines_i.cc b/src/VISU_I/VISU_StreamLines_i.cc index a8035927..d3d6c261 100644 --- a/src/VISU_I/VISU_StreamLines_i.cc +++ b/src/VISU_I/VISU_StreamLines_i.cc @@ -98,13 +98,12 @@ VISU::StreamLines_i //--------------------------------------------------------------- VISU::StreamLines_i -::StreamLines_i(Result_i* theResult, - EPublishInStudyMode thePublishInStudyMode) : +::StreamLines_i(EPublishInStudyMode thePublishInStudyMode) : PrsObject_i(SALOMEDS::Study::_nil()), - Prs3d_i(theResult), - ColoredPrs3d_i(theResult,thePublishInStudyMode), - ScalarMap_i(theResult,thePublishInStudyMode), - DeformedShape_i(theResult,thePublishInStudyMode), + Prs3d_i(), + ColoredPrs3d_i(thePublishInStudyMode), + ScalarMap_i(thePublishInStudyMode), + DeformedShape_i(thePublishInStudyMode), myStreamLinesPL(NULL), myAppendFilter(vtkAppendFilter::New()) {} @@ -371,9 +370,9 @@ VISU::StreamLines_i //--------------------------------------------------------------- VISU_Actor* VISU::StreamLines_i -::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) +::CreateActor() { - if(VISU_Actor* anActor = TSuperClass::CreateActor(theIO, true)){ + if(VISU_Actor* anActor = TSuperClass::CreateActor(true)){ anActor->SetVTKMapping(true); SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); int aDispMode = aResourceMgr->integerValue("VISU", "stream_lines_represent", 1); diff --git a/src/VISU_I/VISU_StreamLines_i.hh b/src/VISU_I/VISU_StreamLines_i.hh index 41fd93cb..edf55fbe 100644 --- a/src/VISU_I/VISU_StreamLines_i.hh +++ b/src/VISU_I/VISU_StreamLines_i.hh @@ -45,8 +45,7 @@ namespace VISU typedef DeformedShape_i TSuperClass; explicit - StreamLines_i(Result_i* theResult, - EPublishInStudyMode thePublishInStudyMode = EPublishUnderTimeStamp); + StreamLines_i(EPublishInStudyMode thePublishInStudyModep); explicit StreamLines_i(Result_i* theResult, SALOMEDS::SObject_var theSObject); @@ -179,7 +178,7 @@ namespace VISU //! Extends VISU_ColoredPrs3d_i::CreateActor virtual VISU_Actor* - CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL); + CreateActor(); //! Extends VISU_ColoredPrs3d_i::UpdateActor virtual diff --git a/src/VISU_I/VISU_Table_i.cc b/src/VISU_I/VISU_Table_i.cc index 6e2ad6cb..cc62432e 100644 --- a/src/VISU_I/VISU_Table_i.cc +++ b/src/VISU_I/VISU_Table_i.cc @@ -84,6 +84,56 @@ VISU::Table_i::~Table_i() { MESSAGE("Table_i::~Table_i"); } + +//---------------------------------------------------------------------------- +void +VISU::Table_i +::SetTitle( const char* theTitle ) +{ + SetName( theTitle, true ); +} + +//---------------------------------------------------------------------------- +char* +VISU::Table_i +::GetTitle() +{ + return CORBA::string_dup( GetName().c_str() ); +} + +//---------------------------------------------------------------------------- +void +VISU::Table_i +::SetOrientation( VISU::Table::Orientation theOrientation ) +{ + myOrientation = theOrientation; +} + +//---------------------------------------------------------------------------- +VISU::Table::Orientation +VISU::Table_i +::GetOrientation() +{ + return myOrientation; +} + +//---------------------------------------------------------------------------- +SALOMEDS::SObject_var +VISU::Table_i +::GetSObject() const +{ + return mySObj; +} + +//---------------------------------------------------------------------------- +char* +VISU::Table_i +::GetObjectEntry() +{ + return CORBA::string_dup( mySObj->GetID() ); +} + +//---------------------------------------------------------------------------- /*! Gets number of rows in table */ @@ -130,7 +180,7 @@ CORBA::Long VISU::Table_i::GetNbColumns() VISU::Storable* VISU::Table_i::Create() { // generate name ... - SetName(GetTableTitle()); + SetName(GetTableTitle(), false); // mpv (PAL 5357): if name attribute already exist at this label, use it as name of table if ( GetName() == "" ) @@ -143,11 +193,11 @@ VISU::Storable* VISU::Table_i::Create() pCutLines = dynamic_cast(GetServant(aCutLines).in()); } if (!pCutLines) - if (mySObj->GetName()) SetName(mySObj->GetName()); + if (mySObj->GetName()) SetName(mySObj->GetName(), false); } if ( GetName() == "" ) - SetName(GenerateName()); + SetName(GenerateName(), false); // ... and build the object return Build( false ); } @@ -223,7 +273,7 @@ VISU::Storable* VISU::Table_i::Build( int theRestoring ) VISU::Storable* VISU::Table_i::Restore( const Storable::TRestoringMap& theMap, SALOMEDS::SObject_ptr SO) { if(MYDEBUG) MESSAGE(GetComment()); - SetName(VISU::Storable::FindValue(theMap,"myName").latin1()); + SetName(VISU::Storable::FindValue(theMap,"myName").latin1(), false); myTitle = VISU::Storable::FindValue(theMap,"myTitle").latin1(); myOrientation = ( VISU::Table::Orientation )( VISU::Storable::FindValue(theMap,"myOrientation").toInt() ); mySObj = SALOMEDS::SObject::_duplicate(SO); @@ -348,15 +398,93 @@ VISU::Curve_i::~Curve_i() { MESSAGE("Curve_i::~Curve_i"); } + +//---------------------------------------------------------------------------- +void +VISU::Curve_i +::SetTitle( const char* theTitle ) +{ + SetName( theTitle, true ); +} + +//---------------------------------------------------------------------------- +char* +VISU::Curve_i +::GetTitle() +{ + return CORBA::string_dup( GetName().c_str() ); +} + +//---------------------------------------------------------------------------- +void +VISU::Curve_i +::SetColor( const SALOMEDS::Color& theColor ) +{ + myColor = theColor; + myAuto = false; +} + +//---------------------------------------------------------------------------- +SALOMEDS::Color +VISU::Curve_i +::GetColor() +{ + return myColor; +} + +//---------------------------------------------------------------------------- +void +VISU::Curve_i +::SetMarker( VISU::Curve::MarkerType theType ) +{ + myMarker = theType; + myAuto = false; +} + +//---------------------------------------------------------------------------- +VISU::Curve::MarkerType +VISU::Curve_i +::GetMarker() +{ + return myMarker; +} + +//---------------------------------------------------------------------------- +void +VISU::Curve_i +::SetLine( VISU::Curve::LineType theType, CORBA::Long theWidth ) +{ + myLine = theType; + myLineWidth = theWidth; + myAuto = false; +} + +//---------------------------------------------------------------------------- +VISU::Curve::LineType +VISU::Curve_i +::GetLine() +{ + return myLine; +} + +//---------------------------------------------------------------------------- +CORBA::Long +VISU::Curve_i +::GetLineWidth() +{ + return myLineWidth; +} + +//---------------------------------------------------------------------------- /*! Creates curve object */ VISU::Storable* VISU::Curve_i::Create() { // generate name ... - SetName(GetVerTitle()); + SetName(GetVerTitle(), false); if ( GetName() == "" ) - SetName(GenerateName()); + SetName(GenerateName(), false); // ... and build the object return Build( false ); } @@ -672,7 +800,7 @@ VISU::Storable* VISU::Curve_i::Restore( const Storable::TRestoringMap& theMap, S { if(MYDEBUG) MESSAGE(GetComment()); mySObj = SALOMEDS::SObject::_duplicate(theSO); - SetName(VISU::Storable::FindValue(theMap,"myName").latin1()); + SetName(VISU::Storable::FindValue(theMap,"myName").latin1(), false); myHRow = VISU::Storable::FindValue(theMap,"myHRow").toInt(); myVRow = VISU::Storable::FindValue(theMap,"myVRow").toInt(); bool ok = false; @@ -874,7 +1002,7 @@ void VISU::Container_i::Clear() VISU::Storable* VISU::Container_i::Create() { // generate name ... - SetName(GenerateName()); + SetName(GenerateName(), false); // ... and build the object return Build( false ); } @@ -989,7 +1117,7 @@ VISU::Storable* VISU::Container_i::Restore( const Storable::TRestoringMap& theMa { if(MYDEBUG) MESSAGE(GetComment()); mySObj = SALOMEDS::SObject::_duplicate(SO); - SetName(VISU::Storable::FindValue( theMap, "myName" ).latin1()); + SetName(VISU::Storable::FindValue( theMap, "myName" ).latin1(), false); QString val = VISU::Storable::FindValue( theMap, "myCurves" ); myCurves = QStringList::split( QString( "*" ), val, false ); return Build( true ); diff --git a/src/VISU_I/VISU_Table_i.hh b/src/VISU_I/VISU_Table_i.hh index 75f4d0bd..86f8715a 100644 --- a/src/VISU_I/VISU_Table_i.hh +++ b/src/VISU_I/VISU_Table_i.hh @@ -46,11 +46,11 @@ namespace VISU{ virtual ~Table_i(); virtual VISU::VISUType GetType() { return VISU::TTABLE;}; - virtual void SetTitle( const char* theTitle ) { SetName( theTitle ); } - virtual char* GetTitle() { return CORBA::string_dup( GetName().c_str() ); } + virtual void SetTitle( const char* theTitle ); + virtual char* GetTitle(); - virtual void SetOrientation( VISU::Table::Orientation theOrientation ) { myOrientation = theOrientation; } - virtual VISU::Table::Orientation GetOrientation() { return myOrientation; } + virtual void SetOrientation( VISU::Table::Orientation theOrientation ); + virtual VISU::Table::Orientation GetOrientation(); virtual CORBA::Long GetNbRows(); virtual CORBA::Long GetNbColumns(); @@ -67,19 +67,22 @@ namespace VISU{ public: virtual Storable* Create(); - SALOMEDS::SObject_var GetSObject() const { return mySObj;} + SALOMEDS::SObject_var GetSObject() const; + + virtual Storable* Restore( const Storable::TRestoringMap& theMap, + SALOMEDS::SObject_ptr SO); - virtual Storable* Restore( const Storable::TRestoringMap& theMap, SALOMEDS::SObject_ptr SO); static Storable* Restore(SALOMEDS::SObject_ptr theSObject, const std::string& thePrefix, const Storable::TRestoringMap& theMap); + virtual void ToStream( std::ostringstream& theStr ); static const std::string myComment; virtual const char* GetComment() const; virtual const char* GenerateName(); virtual const char* GetTableTitle(); - virtual char* GetObjectEntry() { return CORBA::string_dup( mySObj->GetID() ); } + virtual char* GetObjectEntry(); }; SALOMEDS::SObject_var ImportTables(const char* theFileName, SALOMEDS::Study_ptr theStudy); bool ExportTableToFile(SALOMEDS::SObject_ptr theTable, const char* theFileName); @@ -96,19 +99,18 @@ namespace VISU{ virtual ~Curve_i(); virtual VISU::VISUType GetType() { return VISU::TCURVE;}; - virtual void SetTitle( const char* theTitle ) { SetName( theTitle ); } - virtual char* GetTitle() { return CORBA::string_dup( GetName().c_str() ); } + virtual void SetTitle( const char* theTitle ); + virtual char* GetTitle(); - virtual void SetColor( const SALOMEDS::Color& theColor ) { myColor = theColor; myAuto = false; } - virtual SALOMEDS::Color GetColor() { return myColor; } + virtual void SetColor( const SALOMEDS::Color& theColor ); + virtual SALOMEDS::Color GetColor(); - virtual void SetMarker( VISU::Curve::MarkerType theType ) { myMarker = theType; myAuto = false; } - virtual VISU::Curve::MarkerType GetMarker() { return myMarker; } + virtual void SetMarker( VISU::Curve::MarkerType theType ); + virtual VISU::Curve::MarkerType GetMarker(); - virtual void SetLine( VISU::Curve::LineType theType, CORBA::Long theWidth ) - { myLine = theType; myLineWidth = theWidth; myAuto = false; } - virtual VISU::Curve::LineType GetLine() { return myLine; } - virtual CORBA::Long GetLineWidth() { return myLineWidth; } + virtual void SetLine( VISU::Curve::LineType theType, CORBA::Long theWidth ); + virtual VISU::Curve::LineType GetLine(); + virtual CORBA::Long GetLineWidth(); virtual void RemoveFromStudy(); diff --git a/src/VISU_I/VISU_TimeAnimation.cxx b/src/VISU_I/VISU_TimeAnimation.cxx index 7e61ebf5..0657e528 100644 --- a/src/VISU_I/VISU_TimeAnimation.cxx +++ b/src/VISU_I/VISU_TimeAnimation.cxx @@ -245,7 +245,12 @@ namespace int aTimeStampId = VISU::Storable::FindValue(aTimeMap,"myTimeStampId").toInt(); bool anIsCreated = false; - TPrs3d* aPresent = new TPrs3d(theResult,VISU::ColoredPrs3d_i:: EDoNotPublish); + TPrs3d* aPresent = new TPrs3d(VISU::ColoredPrs3d_i::EDoNotPublish); + aPresent->SetCResult(theResult); + aPresent->SetMeshName(aMeshName.latin1()); + aPresent->SetEntity(anEntity); + aPresent->SetFieldName(aFieldName.latin1()); + aPresent->SetTimeStampNumber(aTimeStampId); #ifdef NO_CAS_CATCH try{ OCC_CATCH_SIGNALS; @@ -253,7 +258,7 @@ namespace CASCatch_TRY{ try{ #endif - if(aPresent->Create(aMeshName.latin1(),anEntity,aFieldName.latin1(),aTimeStampId)){ + if(aPresent->Apply()){ anIsCreated = true; theData.myPrs[aFrameId++] = aPresent; aMin = std::min(aPresent->GetMin(), aMin); diff --git a/src/VISU_I/VISU_Vectors_i.cc b/src/VISU_I/VISU_Vectors_i.cc index cbea1cb7..f7634ac7 100644 --- a/src/VISU_I/VISU_Vectors_i.cc +++ b/src/VISU_I/VISU_Vectors_i.cc @@ -105,13 +105,12 @@ VISU::Vectors_i //--------------------------------------------------------------- VISU::Vectors_i -::Vectors_i(Result_i* theResult, - EPublishInStudyMode thePublishInStudyMode) : +::Vectors_i(EPublishInStudyMode thePublishInStudyMode) : PrsObject_i(SALOMEDS::Study::_nil()), - Prs3d_i(theResult), - ColoredPrs3d_i(theResult,thePublishInStudyMode), - ScalarMap_i(theResult,thePublishInStudyMode), - DeformedShape_i(theResult,thePublishInStudyMode), + Prs3d_i(), + ColoredPrs3d_i(thePublishInStudyMode), + ScalarMap_i(thePublishInStudyMode), + DeformedShape_i(thePublishInStudyMode), myLineWidth(1.0), myVectorsPL(NULL) {} @@ -282,11 +281,11 @@ VISU::Vectors_i //--------------------------------------------------------------- VISU_Actor* VISU::Vectors_i -::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) +::CreateActor() { VISU_VectorsAct* anActor = VISU_VectorsAct::New(); try{ - VISU::Prs3d_i::CreateActor(anActor,theIO); + VISU::Prs3d_i::CreateActor(anActor); anActor->SetVTKMapping(true); anActor->SetBarVisibility(true); anActor->GetProperty()->SetColor(myColor.R,myColor.G,myColor.B); diff --git a/src/VISU_I/VISU_Vectors_i.hh b/src/VISU_I/VISU_Vectors_i.hh index 019110cd..e83613b7 100644 --- a/src/VISU_I/VISU_Vectors_i.hh +++ b/src/VISU_I/VISU_Vectors_i.hh @@ -44,8 +44,7 @@ namespace VISU typedef DeformedShape_i TSuperClass; explicit - Vectors_i(Result_i* theResult, - EPublishInStudyMode thePublishInStudyMode = EPublishUnderTimeStamp); + Vectors_i(EPublishInStudyMode thePublishInStudyModep); explicit Vectors_i(Result_i* theResult, SALOMEDS::SObject_var theSObject); @@ -157,7 +156,7 @@ namespace VISU //! Redefines VISU_ColoredPrs3d_i::CreateActor virtual VISU_Actor* - CreateActor(const Handle(SALOME_InteractiveObject)& theIO = NULL); + CreateActor(); //! Redefines VISU_ColoredPrs3d_i::UpdateActor virtual