From: apo Date: Thu, 23 Nov 2006 15:14:43 +0000 (+0000) Subject: To refactor creation ColoredPrs3d X-Git-Tag: WP1_2_3_05-12-2006_cache_system~71 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4243705a9b75ab262e51d3c0cc77c5cc1869bd87;p=modules%2Fvisu.git To refactor creation ColoredPrs3d --- diff --git a/idl/VISU_Gen.idl b/idl/VISU_Gen.idl index 51da0b6e..c6f073d1 100644 --- a/idl/VISU_Gen.idl +++ b/idl/VISU_Gen.idl @@ -625,29 +625,27 @@ module VISU { * This interface is responsible for memory management of 3d presentations. * One cache corresponds to one study. */ - interface ColoredPrs3dCache : PrsObject, SALOME::GenericObj + interface ColoredPrs3dCache : RemovableObject, SALOME::GenericObj { - /*! - * This enumeration contains the cache memory modes. - */ + /*! This enumeration contains the cache memory modes. */ enum MemoryMode { MINIMAL, /*!< Minimal memory mode (default behaviour). */ LIMITED /*!< Limited memory mode (fixed memory size for presentations). */ }; - /*! - * Sets a memory mode. - */ + /*! Sets a memory mode.*/ void SetMemoryMode(in MemoryMode theMode); - /*! - * Sets a memory size for limited mode. - */ + /*! Gets a memory mode.*/ + MemoryMode GetMemoryMode(); + + /*! Sets a memory size for limited mode. */ void SetLimitedMemory(in long theMemorySize); - /*! - * Creates %ColoredPrs3dHolder. - */ + /*! Gets a memory size for limited mode. */ + long GetLimitedMemory(); + + /*! Creates %ColoredPrs3dHolder.*/ ColoredPrs3dHolder CreateHolder(in VISUType theType, in ColoredPrs3dHolder::BasicInput theInput); }; @@ -1632,7 +1630,7 @@ module VISU { */ ScalarMap ScalarMapOnField(in Result theResult, in string theMeshName, in Entity theEntity, in string theFieldName, - in double theIteration); + in long theIteration); /*! * Creates a Gauss Points presentation. @@ -1644,7 +1642,7 @@ module VISU { */ GaussPoints GaussPointsOnField(in Result theResult, in string theMeshName, in Entity theEntity, in string theFieldName, - in double theIteration); + in long theIteration); /*! * Creates a deformed shape presentation. @@ -1656,7 +1654,7 @@ module VISU { */ DeformedShape DeformedShapeOnField(in Result theResult, in string theMeshName, in Entity theEntity, in string theFieldName, - in double theIteration); + in long theIteration); /*! * Creates a deformed shape presentation. @@ -1668,7 +1666,7 @@ module VISU { */ ScalarMapOnDeformedShape ScalarMapOnDeformedShapeOnField(in Result theResult, in string theMeshName, in Entity theEntity, in string theFieldName, - in double theIteration); + in long theIteration); /*! * Creates a vector presentation. @@ -1680,7 +1678,7 @@ module VISU { */ Vectors VectorsOnField(in Result theResult, in string theMeshName, in Entity theEntity, in string theFieldName, - in double theIteration); + in long theIteration); /*! * Creates an iso surface presentation. @@ -1692,7 +1690,7 @@ module VISU { */ IsoSurfaces IsoSurfacesOnField(in Result theResult, in string theMeshName, in Entity theEntity, in string theFieldName, - in double theIteration); + in long theIteration); /*! * Creates an stream lines presentation. @@ -1704,7 +1702,7 @@ module VISU { */ StreamLines StreamLinesOnField(in Result theResult, in string theMeshName, in Entity theEntity, in string theFieldName, - in double theIteration); + in long theIteration); /*! * Creates a presentation of cut planes. @@ -1716,7 +1714,7 @@ module VISU { */ CutPlanes CutPlanesOnField(in Result theResult, in string theMeshName, in Entity theEntity, in string theFieldName, - in double theIteration); + in long theIteration); /*! * Creates a presentation of cut lines. @@ -1728,7 +1726,7 @@ module VISU { */ CutLines CutLinesOnField(in Result theResult, in string theMeshName, in Entity theEntity, in string theFieldName, - in double theIteration); + in long theIteration); /*! * Creates a Plot3D presentation. @@ -1740,7 +1738,7 @@ module VISU { */ Plot3D Plot3DOnField(in Result theResult, in string theMeshName, in Entity theEntity, in string theFieldName, - in double theIteration); + in long theIteration); /*! * Creates a table presentation. diff --git a/src/ENGINE/VISU_Engine_i.cc b/src/ENGINE/VISU_Engine_i.cc index f09b5ddc..a44432db 100644 --- a/src/ENGINE/VISU_Engine_i.cc +++ b/src/ENGINE/VISU_Engine_i.cc @@ -231,98 +231,118 @@ namespace VISU{ } - ScalarMap_ptr VISU_Gen_i::ScalarMapOnField(Result_ptr theResult, - const char* theMeshName, - VISU::Entity theEntity, - const char* theFieldName, - CORBA::Double theIteration) + ScalarMap_ptr + VISU_Gen_i + ::ScalarMapOnField(Result_ptr theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + CORBA::Long theIteration) { return myVisuGen->ScalarMapOnField(theResult,theMeshName,theEntity,theFieldName,theIteration); } - GaussPoints_ptr VISU_Gen_i::GaussPointsOnField(Result_ptr theResult, - const char* theMeshName, - VISU::Entity theEntity, - const char* theFieldName, - CORBA::Double theIteration) + GaussPoints_ptr + VISU_Gen_i + ::GaussPointsOnField(Result_ptr theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + CORBA::Long theIteration) { return myVisuGen->GaussPointsOnField(theResult,theMeshName,theEntity,theFieldName,theIteration); } - DeformedShape_ptr VISU_Gen_i::DeformedShapeOnField(Result_ptr theResult, - const char* theMeshName, - VISU::Entity theEntity, - const char* theFieldName, - CORBA::Double theIteration) + DeformedShape_ptr + VISU_Gen_i + ::DeformedShapeOnField(Result_ptr theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + CORBA::Long theIteration) { return myVisuGen->DeformedShapeOnField(theResult,theMeshName,theEntity,theFieldName,theIteration); } - ScalarMapOnDeformedShape_ptr VISU_Gen_i::ScalarMapOnDeformedShapeOnField(Result_ptr theResult, - const char* theMeshName, - VISU::Entity theEntity, - const char* theFieldName, - CORBA::Double theIteration) + ScalarMapOnDeformedShape_ptr + VISU_Gen_i + ::ScalarMapOnDeformedShapeOnField(Result_ptr theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + CORBA::Long theIteration) { return myVisuGen->ScalarMapOnDeformedShapeOnField(theResult,theMeshName,theEntity,theFieldName,theIteration); } - Vectors_ptr VISU_Gen_i::VectorsOnField(Result_ptr theResult, - const char* theMeshName, - VISU::Entity theEntity, - const char* theFieldName, - CORBA::Double theIteration) + Vectors_ptr + VISU_Gen_i + ::VectorsOnField(Result_ptr theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + CORBA::Long theIteration) { return myVisuGen->VectorsOnField(theResult,theMeshName,theEntity,theFieldName,theIteration); } - IsoSurfaces_ptr VISU_Gen_i::IsoSurfacesOnField(Result_ptr theResult, - const char* theMeshName, - VISU::Entity theEntity, - const char* theFieldName, - CORBA::Double theIteration) + IsoSurfaces_ptr + VISU_Gen_i + ::IsoSurfacesOnField(Result_ptr theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + CORBA::Long theIteration) { return myVisuGen->IsoSurfacesOnField(theResult,theMeshName,theEntity,theFieldName,theIteration); } - StreamLines_ptr VISU_Gen_i::StreamLinesOnField(Result_ptr theResult, - const char* theMeshName, - VISU::Entity theEntity, - const char* theFieldName, - CORBA::Double theIteration) + StreamLines_ptr + VISU_Gen_i + ::StreamLinesOnField(Result_ptr theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + CORBA::Long theIteration) { return myVisuGen->StreamLinesOnField(theResult,theMeshName,theEntity,theFieldName,theIteration); } - CutPlanes_ptr VISU_Gen_i::CutPlanesOnField(Result_ptr theResult, - const char* theMeshName, - VISU::Entity theEntity, - const char* theFieldName, - CORBA::Double theIteration) + CutPlanes_ptr + VISU_Gen_i + ::CutPlanesOnField(Result_ptr theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + CORBA::Long theIteration) { return myVisuGen->CutPlanesOnField(theResult,theMeshName,theEntity,theFieldName,theIteration); } - CutLines_ptr VISU_Gen_i::CutLinesOnField(Result_ptr theResult, - const char* theMeshName, - VISU::Entity theEntity, - const char* theFieldName, - CORBA::Double theIteration) + CutLines_ptr + VISU_Gen_i + ::CutLinesOnField(Result_ptr theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + CORBA::Long theIteration) { return myVisuGen->CutLinesOnField(theResult,theMeshName,theEntity,theFieldName,theIteration); } - Plot3D_ptr VISU_Gen_i::Plot3DOnField(Result_ptr theResult, - const char* theMeshName, - VISU::Entity theEntity, - const char* theFieldName, - CORBA::Double theIteration) + Plot3D_ptr + VISU_Gen_i + ::Plot3DOnField(Result_ptr theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + CORBA::Long theIteration) { return myVisuGen->Plot3DOnField(theResult,theMeshName,theEntity,theFieldName,theIteration); } diff --git a/src/ENGINE/VISU_Engine_i.hh b/src/ENGINE/VISU_Engine_i.hh index c10bbc80..d123bd7d 100644 --- a/src/ENGINE/VISU_Engine_i.hh +++ b/src/ENGINE/VISU_Engine_i.hh @@ -82,34 +82,86 @@ namespace VISU const char* theGroupName, const char* theNewName); //Create Presentation Of Results - virtual ScalarMap_ptr ScalarMapOnField - (Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, - const char* theFieldName, CORBA::Double theIteration); - virtual GaussPoints_ptr GaussPointsOnField - (Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, - const char* theFieldName, CORBA::Double theIteration); - virtual DeformedShape_ptr DeformedShapeOnField - (Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, - const char* theFieldName, CORBA::Double theIteration); - virtual Vectors_ptr VectorsOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, - const char* theFieldName, CORBA::Double theIteration); - virtual IsoSurfaces_ptr IsoSurfacesOnField - (Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, - const char* theFieldName, CORBA::Double theIteration); - virtual CutPlanes_ptr CutPlanesOnField - (Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, - const char* theFieldName, CORBA::Double theIteration); - virtual CutLines_ptr CutLinesOnField - (Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, - const char* theFieldName, CORBA::Double theIteration); - virtual StreamLines_ptr StreamLinesOnField - (Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, - const char* theFieldName, CORBA::Double theIteration); - virtual Plot3D_ptr Plot3DOnField (Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, - const char* theFieldName, CORBA::Double theIteration); - virtual ScalarMapOnDeformedShape_ptr ScalarMapOnDeformedShapeOnField - (Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, - const char* theFieldName, CORBA::Double theIteration); + virtual + ScalarMap_ptr + ScalarMapOnField(Result_ptr theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + CORBA::Long theIteration); + + virtual + GaussPoints_ptr + GaussPointsOnField(Result_ptr theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + CORBA::Long theIteration); + + virtual + DeformedShape_ptr + DeformedShapeOnField(Result_ptr theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + CORBA::Long theIteration); + + virtual + Vectors_ptr + VectorsOnField(Result_ptr theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + CORBA::Long theIteration); + + virtual + IsoSurfaces_ptr + IsoSurfacesOnField(Result_ptr theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + CORBA::Long theIteration); + + virtual + CutPlanes_ptr + CutPlanesOnField(Result_ptr theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + CORBA::Long theIteration); + + virtual + CutLines_ptr + CutLinesOnField(Result_ptr theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + CORBA::Long theIteration); + + virtual + StreamLines_ptr + StreamLinesOnField(Result_ptr theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + CORBA::Long theIteration); + + virtual + Plot3D_ptr + Plot3DOnField(Result_ptr theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + CORBA::Long theIteration); + + virtual + ScalarMapOnDeformedShape_ptr + ScalarMapOnDeformedShapeOnField(Result_ptr theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + CORBA::Long theIteration); + //Create Digital Presentation virtual Table_ptr CreateTable(const char* theTableEntry); virtual Curve_ptr CreateCurve(Table_ptr theTable, CORBA::Long theHRow, CORBA::Long theVRow); diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index 17d86621..e6bd2860 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -109,6 +109,8 @@ #include "VisuGUI_TransparencyDlg.h" #include "VisuGUI_CacheDlg.h" +#include "VISU_ColoredPrs3dHolder_i.hh" + #include "VISU_ScalarMap_i.hh" #include "VisuGUI_ScalarBarDlg.h" @@ -431,7 +433,7 @@ CreateCurves( SalomeApp_Module* theModule, return; _PTR(Study) aStudy = GetCStudy( GetAppStudy( theModule ) ); - _PTR(SObject) aSObject = aStudy->FindObjectID( thePrs->GetEntry().latin1() ); + _PTR(SObject) aSObject = aStudy->FindObjectID( thePrs->GetEntry() ); if ( !theCreate && aSObject ) { // Remove old Table @@ -473,7 +475,7 @@ CreateCurves( SalomeApp_Module* theModule, } if ( aCutDlg->isGenerateTable() ) { - GetVisuGen( theModule )->CreateTable( thePrs->GetEntry() ); + GetVisuGen( theModule )->CreateTable( thePrs->GetEntry().c_str() ); if ( aCutDlg->isGenerateCurves() ) { if ( aSObject ) { _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder(); diff --git a/src/VISUGUI/VisuGUI_Displayer.cxx b/src/VISUGUI/VisuGUI_Displayer.cxx index 79a50235..9d1ff6b0 100644 --- a/src/VISUGUI/VisuGUI_Displayer.cxx +++ b/src/VISUGUI/VisuGUI_Displayer.cxx @@ -210,7 +210,7 @@ SPlot2d_Prs* VisuGUI_Displayer::buildTable( Plot2d_ViewWindow* wnd, VISU::Table_ if( !study ) return prs; - _PTR(SObject) TableSO = study->studyDS()->FindObjectID( t->GetEntry().latin1() ); + _PTR(SObject) TableSO = study->studyDS()->FindObjectID( t->GetEntry() ); if( !TableSO ) return prs; diff --git a/src/VISUGUI/VisuGUI_Prs3dTools.h b/src/VISUGUI/VisuGUI_Prs3dTools.h index ebdf2129..acac49e6 100644 --- a/src/VISUGUI/VisuGUI_Prs3dTools.h +++ b/src/VISUGUI/VisuGUI_Prs3dTools.h @@ -28,9 +28,10 @@ #ifndef VisuGUI_Prs3dTools_HeaderFile #define VisuGUI_Prs3dTools_HeaderFile -#include "VISU_Gen_i.hh" #include "VisuGUI_ViewTools.h" #include "VisuGUI_DialogRunner.h" +#include "VISU_ColoredPrs3dFactory.hh" +#include "VISU_ColoredPrs3dCache_i.hh" #include @@ -128,11 +129,22 @@ namespace VISU ColoredPrs3d_i::EPublishInStudyMode thePublishInStudyMode) { VISU::Result_var aResult; - if (CheckResult(theModule,theTimeStamp,aResult)){ + if (CheckResult(theModule, theTimeStamp, aResult)){ QApplication::setOverrideCursor(Qt::waitCursor); - TPrs3d_i* aPrs3d = - GetVisuGen(theModule)->template CreatePrs3d - (aResult,theMeshName,theEntity,theFieldName,theTimeId,thePublishInStudyMode); + TPrs3d_i* aPrs3d = NULL; + if(thePublishInStudyMode == VISU::ColoredPrs3d_i::EPublishUnderTimeStamp) + aPrs3d = VISU::CreatePrs3d(aResult, + theMeshName, + theEntity, + theFieldName, + theTimeId); + else + aPrs3d = VISU::CreateHolder2GetDeviceByType(aResult, + theMeshName, + theEntity, + theFieldName, + theTimeId); + QApplication::restoreOverrideCursor(); if(aPrs3d) return aPrs3d; diff --git a/src/VISUGUI/VisuGUI_Tools.cxx b/src/VISUGUI/VisuGUI_Tools.cxx index 926bf608..4aa51ac2 100644 --- a/src/VISUGUI/VisuGUI_Tools.cxx +++ b/src/VISUGUI/VisuGUI_Tools.cxx @@ -907,7 +907,7 @@ namespace VISU QList clist; aPlot->getCurves( clist ); _PTR(Study) aStudy = GetCStudy( GetAppStudy( theModule ) ); - _PTR(SObject) TableSO = aStudy->FindObjectID( table->GetEntry().latin1() ); + _PTR(SObject) TableSO = aStudy->FindObjectID( table->GetEntry() ); if ( TableSO ) { _PTR(ChildIterator) Iter = aStudy->NewChildIterator( TableSO ); for ( ; Iter->More(); Iter->Next() ) { @@ -921,7 +921,7 @@ namespace VISU for ( int i = 0; i < clist.count(); i++ ) { tmpCurve = dynamic_cast( clist.at( i ) ); if (tmpCurve && tmpCurve->hasIO() && - !strcmp(tmpCurve->getIO()->getEntry(), theCurve->GetEntry())) { + theCurve->GetEntry() != tmpCurve->getIO()->getEntry()) { plotCurve = tmpCurve; break; } @@ -960,7 +960,7 @@ namespace VISU for (int i = 0; i < clist.count(); i++) { tmpCurve = dynamic_cast(clist.at(i)); if (tmpCurve && tmpCurve->hasIO() && - !strcmp(tmpCurve->getIO()->getEntry(), theCurve->GetEntry())) { + theCurve->GetEntry() != tmpCurve->getIO()->getEntry()) { plotCurve = tmpCurve; } else if (theDisplaying == VISU::eDisplayOnly) { aPlot->eraseCurve(clist.at(i)); @@ -1021,7 +1021,7 @@ namespace VISU VISU::Curve_i* theCurve = container->GetCurve( k ); if ( theCurve && theCurve->IsValid() ) { SPlot2d_Curve* plotCurve = dynamic_cast - (aView->getCurveByIO(new SALOME_InteractiveObject (theCurve->GetEntry(), "", ""))); + (aView->getCurveByIO(new SALOME_InteractiveObject(theCurve->GetEntry().c_str(), "", ""))); UpdateCurve( theCurve, aPlot, plotCurve, theDisplaying ); diff --git a/src/VISU_I/Makefile.in b/src/VISU_I/Makefile.in index 4f0074bf..4aab6f41 100644 --- a/src/VISU_I/Makefile.in +++ b/src/VISU_I/Makefile.in @@ -57,7 +57,8 @@ LIB_SRC = \ VISU_DumpPython.cc \ VISU_ScalarMapOnDeformedShape_i.cc \ VISU_ColoredPrs3dHolder_i.cc \ - VISU_ColoredPrs3dCache_i.cc + VISU_ColoredPrs3dCache_i.cc \ + VISU_ColoredPrs3dFactory.cc LIB_MOC = \ VISU_TimeAnimation.h @@ -104,7 +105,8 @@ EXPORT_HEADERS = \ VISU_TimeAnimation.h \ VISU_ScalarMapOnDeformedShape_i.hh \ VISU_ColoredPrs3dHolder_i.hh \ - VISU_ColoredPrs3dCache_i.hh + VISU_ColoredPrs3dCache_i.hh \ + VISU_ColoredPrs3dFactory.hh # additionnal information to compil and link file CPPFLAGS += \ diff --git a/src/VISU_I/VISUConfig.hh b/src/VISU_I/VISUConfig.hh index dcf5d80d..cbfb9157 100644 --- a/src/VISU_I/VISUConfig.hh +++ b/src/VISU_I/VISUConfig.hh @@ -181,14 +181,6 @@ namespace VISU const double theVal); }; - //=========================================================================== - class RemovableObject_i : public virtual POA_VISU::RemovableObject, - public virtual Storable - { - public: - virtual void RemoveFromStudy() = 0; - }; - //=========================================================================== const CORBA::Boolean IsMultifile(); QString GenerateName(const std::string& theFmt, int theId); diff --git a/src/VISU_I/VISU_ColoredPrs3dCache_i.cc b/src/VISU_I/VISU_ColoredPrs3dCache_i.cc index 52670247..b8fc7660 100644 --- a/src/VISU_I/VISU_ColoredPrs3dCache_i.cc +++ b/src/VISU_I/VISU_ColoredPrs3dCache_i.cc @@ -26,30 +26,13 @@ #include "VISU_ColoredPrs3dCache_i.hh" -#include "VISU_ColoredPrs3d_i.hh" #include "VISU_ColoredPrs3dHolder_i.hh" -#include "VISU_Gen_i.hh" -#include "VISU_Result_i.hh" +#include "VISU_ColoredPrs3dFactory.hh" #include "VISU_View_i.hh" #include "VISU_ViewManager_i.hh" -#include "VISU_ScalarMap_i.hh" -#include "VISU_IsoSurfaces_i.hh" -#include "VISU_DeformedShape_i.hh" -#include "VISU_ScalarMapOnDeformedShape_i.hh" -#include "VISU_GaussPoints_i.hh" -#include "VISU_Plot3D_i.hh" -#include "VISU_CutPlanes_i.hh" -#include "VISU_CutLines_i.hh" -#include "VISU_Vectors_i.hh" -#include "VISU_StreamLines_i.hh" - -#include "SUIT_ResourceMgr.h" - #include "VVTK_ViewWindow.h" - -using namespace VISU; -using namespace std; +#include "SUIT_ResourceMgr.h" #ifdef _DEBUG_ static int MYDEBUG = 0; @@ -58,18 +41,18 @@ static int MYDEBUG = 0; #endif //---------------------------------------------------------------------------- -VISU::ColoredPrs3dCache_i:: -ColoredPrs3dCache_i(SALOMEDS::Study_ptr theStudy): - PrsObject_i(theStudy) +VISU::ColoredPrs3dCache_i +::ColoredPrs3dCache_i(SALOMEDS::Study_ptr theStudy): + RemovableObject_i() { if(MYDEBUG) MESSAGE("ColoredPrs3dCache_i::ColoredPrs3dCache_i - this = "<GetID(); - CreateAttributes(GetStudyDocument(), aFatherEntry.in(), "", anIOR.in(), myName, "", "", true); + CreateAttributes(GetStudyDocument(), aFatherEntry.in(), "", anIOR.in(), GetName(), "", "", true); SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); @@ -83,18 +66,29 @@ ColoredPrs3dCache_i(SALOMEDS::Study_ptr theStudy): //---------------------------------------------------------------------------- -VISU::ColoredPrs3dCache_i:: -~ColoredPrs3dCache_i() +VISU::ColoredPrs3dCache_i +::~ColoredPrs3dCache_i() { if(MYDEBUG) MESSAGE("ColoredPrs3dCache_i::~ColoredPrs3dCache_i - this = "<( VISU::GetServant(theInput.myResult).in() ); @@ -134,30 +128,38 @@ IsPossible(VISU::VISUType theType, //---------------------------------------------------------------------------- -void -VISU::ColoredPrs3dCache_i:: -SetMemoryMode(VISU::ColoredPrs3dCache::MemoryMode theMode) +VISU::ColoredPrs3dCache_i* +VISU::ColoredPrs3dCache_i +::GetInstance_i(SALOMEDS::Study_ptr theStudy) { - myMemoryMode = theMode; - cout << theMode << endl; + std::string aFolderName = VISU::ColoredPrs3dCache_i::GetFolderName(); + SALOMEDS::SObject_var aSObject = theStudy->FindObject(aFolderName.c_str()); + if(!CORBA::is_nil(aSObject)){ + CORBA::Object_var anObject = aSObject->GetObject(); + VISU::ColoredPrs3dCache_var aCache = VISU::ColoredPrs3dCache::_narrow(anObject); + if(!CORBA::is_nil(aCache)) + return dynamic_cast(GetServant(aCache).in()); + } + + return new VISU::ColoredPrs3dCache_i(theStudy); } -//---------------------------------------------------------------------------- -void -VISU::ColoredPrs3dCache_i:: -SetLimitedMemory(CORBA::Long theMemorySize) +VISU::ColoredPrs3dCache_ptr +VISU::ColoredPrs3dCache_i +::GetInstance(SALOMEDS::Study_ptr theStudy) { - myLimitedMemory = theMemorySize; - cout << theMemorySize << endl; + VISU::ColoredPrs3dCache_i* aServant = GetInstance_i(theStudy); + VISU::ColoredPrs3dCache_var anObject = aServant->_this(); + return anObject._retn(); } //---------------------------------------------------------------------------- VISU::ColoredPrs3dHolder_ptr -VISU::ColoredPrs3dCache_i:: -CreateHolder(VISU::VISUType theType, - const VISU::ColoredPrs3dHolder::BasicInput& theInput) +VISU::ColoredPrs3dCache_i +::CreateHolder(VISU::VISUType theType, + const VISU::ColoredPrs3dHolder::BasicInput& theInput) { if(IsPossible(theType, theInput)) { @@ -169,14 +171,100 @@ CreateHolder(VISU::VISUType theType, } +//---------------------------------------------------------------------------- +void +VISU::ColoredPrs3dCache_i +::SetMemoryMode(VISU::ColoredPrs3dCache::MemoryMode theMode) +{ + myMemoryMode = theMode; +} + +VISU::ColoredPrs3dCache::MemoryMode +VISU::ColoredPrs3dCache_i +::GetMemoryMode() +{ + return myMemoryMode; +} + + +//---------------------------------------------------------------------------- +void +VISU::ColoredPrs3dCache_i +::SetLimitedMemory(CORBA::Long theMemorySize) +{ + myLimitedMemory = theMemorySize; +} + +CORBA::Long +VISU::ColoredPrs3dCache_i +::GetLimitedMemory() +{ + return myLimitedMemory; +} + + +void +VISU::ColoredPrs3dCache_i +::RemoveFromStudy() +{} + +std::string +VISU::ColoredPrs3dCache_i +::GetFolderName() +{ + return "Cache"; +} + +void +VISU::ColoredPrs3dCache_i +::ToStream(std::ostringstream&) +{} + +VISU::Storable* +VISU::ColoredPrs3dCache_i +::Restore(const Storable::TRestoringMap& theMap) +{ + return this; +} + //---------------------------------------------------------------------------- VISU::ColoredPrs3d_i* -VISU::ColoredPrs3dCache_i:: -CreatePrs(VISU::VISUType theType, - VISU::ColoredPrs3dHolder::BasicInput theInput, - VISU::ColoredPrs3dHolder_i* theHolder) +VISU:: +CreateHolder2GetDeviceByEnum(VISU::VISUType theType, + VISU::Result_ptr theResult, + const std::string& theMeshName, + VISU::Entity theEntity, + const std::string& theFieldName, + CORBA::Long theIteration) { - VISU::ColoredPrs3d_i* aPrs3d = Base_i::GetVisuGenImpl()->CreatePrs3d_i(theType, GetStudyDocument()); + VISU::ColoredPrs3d_i* aColoredPrs3d = NULL; + if(Result_i* aResult = dynamic_cast(GetServant(theResult).in())){ + VISU::ColoredPrs3dHolder::BasicInput anInput; + anInput.myResult = VISU::Result::_duplicate(theResult); + anInput.myMeshName = theMeshName.c_str(); + anInput.myEntity = theEntity; + anInput.myFieldName = theFieldName.c_str(); + anInput.myTimeStampNumber = theIteration; + + SALOMEDS::Study_var aStudy = aResult->GetStudyDocument(); + VISU::ColoredPrs3dCache_var aCache = ColoredPrs3dCache_i::GetInstance(aStudy); + VISU::ColoredPrs3dHolder_var aHolder = aCache->CreateHolder(theType, anInput); + + VISU::ColoredPrs3d_var aPrs3d = aHolder->GetDevice(); + aColoredPrs3d = dynamic_cast(GetServant(aPrs3d).in()); + } + return aColoredPrs3d; +} + + +//---------------------------------------------------------------------------- +VISU::ColoredPrs3d_i* +VISU::ColoredPrs3dCache_i +::CreatePrs(VISU::VISUType theType, + VISU::ColoredPrs3dHolder::BasicInput theInput, + VISU::ColoredPrs3dHolder_i* theHolder) +{ + VISU::ColoredPrs3d_i* aPrs3d = VISU::CreatePrs3d_i(theType, GetStudyDocument()); aPrs3d->SetHolderEntry( theHolder->GetEntry() ); aPrs3d->SetResultObject( theInput.myResult ); aPrs3d->SetMeshName( theInput.myMeshName ); @@ -192,9 +280,9 @@ CreatePrs(VISU::VISUType theType, //---------------------------------------------------------------------------- -TLastVisitedPrsList& -VISU::ColoredPrs3dCache_i:: -GetLastVisitedPrsList(VISU::ColoredPrs3dHolder_i* theHolder) +VISU::TLastVisitedPrsList& +VISU::ColoredPrs3dCache_i +::GetLastVisitedPrsList(VISU::ColoredPrs3dHolder_i* theHolder) { //cout << "VISU::ColoredPrs3dCache_i::GetLastVisitedPrsList("; //cout << theHolder->GetEntry().latin1() << ")" << endl; @@ -204,8 +292,8 @@ GetLastVisitedPrsList(VISU::ColoredPrs3dHolder_i* theHolder) //---------------------------------------------------------------------------- VISU::ColoredPrs3d_i* -VISU::ColoredPrs3dCache_i:: -GetLastVisitedPrs(VISU::ColoredPrs3dHolder_i* theHolder) +VISU::ColoredPrs3dCache_i +::GetLastVisitedPrs(VISU::ColoredPrs3dHolder_i* theHolder) { TLastVisitedPrsList aList = GetLastVisitedPrsList(theHolder); if( !aList.empty() ) @@ -217,9 +305,9 @@ GetLastVisitedPrs(VISU::ColoredPrs3dHolder_i* theHolder) //---------------------------------------------------------------------------- VISU::ColoredPrs3d_i* -VISU::ColoredPrs3dCache_i:: -FindPrsByInput(TLastVisitedPrsList& theLastVisitedPrsList, - const VISU::ColoredPrs3dHolder::BasicInput& theInput) +VISU::ColoredPrs3dCache_i +::FindPrsByInput(TLastVisitedPrsList& theLastVisitedPrsList, + const VISU::ColoredPrs3dHolder::BasicInput& theInput) { //cout << "VISU::ColoredPrs3dCache_i::FindPrsByInput() "; VISU::ColoredPrs3d_i* aPrs3d = NULL; @@ -249,17 +337,16 @@ FindPrsByInput(TLastVisitedPrsList& theLastVisitedPrsList, //---------------------------------------------------------------------------- bool -VISU::ColoredPrs3dCache_i:: -UpdateLastVisitedPrs(VISU::ColoredPrs3dHolder_i* theHolder, - VISU::ColoredPrs3d_i* thePrs, - const VISU::ColoredPrs3dHolder::BasicInput& theInput, - VISU::View3D_ptr theView3D) +VISU::ColoredPrs3dCache_i +::UpdateLastVisitedPrs(VISU::ColoredPrs3dHolder_i* theHolder, + VISU::ColoredPrs3d_i* thePrs, + const VISU::ColoredPrs3dHolder::BasicInput& theInput, + VISU::View3D_ptr theView3D) { //cout << "VISU::ColoredPrs3dCache_i::UpdateLastVisitedPrs" << endl; - VISU::ColoredPrs3d_i* aPrs3d = NULL; TLastVisitedPrsList& aLastVisitedPrsList = GetLastVisitedPrsList(theHolder); - - if(aPrs3d = FindPrsByInput(aLastVisitedPrsList, theInput)) + VISU::ColoredPrs3d_i* aPrs3d = FindPrsByInput(aLastVisitedPrsList, theInput); + if(aPrs3d) { aLastVisitedPrsList.pop_front(); } diff --git a/src/VISU_I/VISU_ColoredPrs3dCache_i.hh b/src/VISU_I/VISU_ColoredPrs3dCache_i.hh index 56a889a8..b4b970c9 100644 --- a/src/VISU_I/VISU_ColoredPrs3dCache_i.hh +++ b/src/VISU_I/VISU_ColoredPrs3dCache_i.hh @@ -20,7 +20,7 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // -// File : VISU_ColoredPrs3dCache_i.hxx +// File : VISU_ColoredPrs3dCache_i.hh // Author : Oleg UVAROV // Module : VISU @@ -31,8 +31,11 @@ #include "SALOME_GenericObj_i.hh" +#include "VISU_ColoredPrs3dFactory.hh" + namespace VISU { + class Result_i; class ColoredPrs3d_i; class ColoredPrs3dHolder_i; @@ -46,7 +49,7 @@ namespace VISU */ class ColoredPrs3dCache_i : public virtual POA_VISU::ColoredPrs3dCache, public virtual SALOME::GenericObj_i, - public virtual PrsObject_i + public virtual RemovableObject_i { ColoredPrs3dCache_i(); ColoredPrs3dCache_i(const ColoredPrs3dCache_i&); @@ -60,51 +63,69 @@ namespace VISU ~ColoredPrs3dCache_i(); //---------------------------------------------------------------------------- - /*! - * Sets a memory mode. - */ - void - SetMemoryMode(VISU::ColoredPrs3dCache::MemoryMode theMode); - - /*! - * Sets a memory size for limited mode. - */ - void - SetLimitedMemory(CORBA::Long theMemorySize); - - /*! - * Creates ColoredPrs3dHolder. - */ + /*! Creates ColoredPrs3dHolder */ + virtual VISU::ColoredPrs3dHolder_ptr CreateHolder(VISU::VISUType theType, const VISU::ColoredPrs3dHolder::BasicInput& theInput); //---------------------------------------------------------------------------- + //! Sets a memory mode. + virtual + void + SetMemoryMode(VISU::ColoredPrs3dCache::MemoryMode theMode); + + virtual VISU::ColoredPrs3dCache::MemoryMode - GetMemoryMode() const { return myMemoryMode; } + GetMemoryMode(); + + //---------------------------------------------------------------------------- + //! Sets a memory size for limited mode. + virtual + void + SetLimitedMemory(CORBA::Long theMemorySize); - long - GetLimitedMemory() const { return myLimitedMemory; } + virtual + CORBA::Long + GetLimitedMemory(); + //---------------------------------------------------------------------------- virtual VISU::VISUType - GetType() { return VISU::TCOLOREDPRS3DCACHE; } + GetType() + { + return VISU::TCOLOREDPRS3DCACHE; + } virtual void - RemoveFromStudy() {} + RemoveFromStudy(); + + static + std::string + GetFolderName(); virtual - void - ToStream(std::ostringstream&) {} + const char* + GetComment() const; virtual - const char* - GetComment() const { return NULL; } + void + ToStream(std::ostringstream&); + + virtual + Storable* + Restore(const Storable::TRestoringMap& theMap); + + //---------------------------------------------------------------------------- + //! Finds or creates instance of the ColoredPrs3dCache in the given SALOMEDS::Study + static + VISU::ColoredPrs3dCache_i* + GetInstance_i(SALOMEDS::Study_ptr theStudy); static - const std::string - GetFolderName() { return "Cache"; } + VISU::ColoredPrs3dCache_ptr + GetInstance(SALOMEDS::Study_ptr theStudy); VISU::ColoredPrs3d_i* CreatePrs(VISU::VISUType theType, @@ -133,11 +154,46 @@ namespace VISU const VISU::ColoredPrs3dHolder::BasicInput& theInput); private: + CORBA::Long myLimitedMemory; VISU::ColoredPrs3dCache::MemoryMode myMemoryMode; - long myLimitedMemory; - TColoredPrs3dHolderMap myHolderMap; + TColoredPrs3dHolderMap myHolderMap; + + static const std::string myComment; }; + + //---------------------------------------------------------------------------- + //! Creates ColoredPrs3dHolder by enumeration value and gets its first device + ColoredPrs3d_i* + CreateHolder2GetDeviceByEnum(VISU::VISUType theType, + VISU::Result_ptr theResult, + const std::string& theMeshName, + VISU::Entity theEntity, + const std::string& theFieldName, + CORBA::Long theIteration); + + + //---------------------------------------------------------------------------- + //! Creates ColoredPrs3dHolder by type and gets its first device + template + TColoredPrs3d_i* + CreateHolder2GetDeviceByType(VISU::Result_ptr theResult, + const std::string& theMeshName, + VISU::Entity theEntity, + const std::string& theFieldName, + CORBA::Long theIteration) + { + typedef typename TL::TColoredType2Enum::TResult TEnum; + VISU::VISUType aColoredPrs3dType = VISU::VISUType(TEnum::value); + ColoredPrs3d_i* aColoredPrs3d = CreateHolder2GetDeviceByEnum(aColoredPrs3dType, + theResult, + theMeshName, + theEntity, + theFieldName, + theIteration); + return dynamic_cast(aColoredPrs3d); + } + } #endif diff --git a/src/VISU_I/VISU_ColoredPrs3dFactory.cc b/src/VISU_I/VISU_ColoredPrs3dFactory.cc new file mode 100644 index 00000000..3fda8c5a --- /dev/null +++ b/src/VISU_I/VISU_ColoredPrs3dFactory.cc @@ -0,0 +1,126 @@ +// VISU OBJECT : interactive object for VISU entities implementation +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// File : VISU_ColoredPrs3dCache_i.cc +// Author : Oleg UVAROV +// Module : VISU + +#include "VISU_ColoredPrs3dFactory.hh" + +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 +#define NO_CAS_CATCH +#endif + +#include + +#ifdef NO_CAS_CATCH +#include +#else +#include "CASCatch.hxx" +#endif + +#ifdef _DEBUG_ +//static int MYDEBUG = 0; +//#define _DEXCEPT_ +#else +//static int MYDEBUG = 0; +#endif + + +namespace VISU +{ + //---------------------------------------------------------------------------- + bool + CreatColoredPrs3d(ColoredPrs3d_i* theColoredPrs3d, + const std::string& theMeshName, + VISU::Entity theEntity, + const std::string& theFieldName, + CORBA::Long theIteration) + { +#ifndef _DEXCEPT_ +#ifdef NO_CAS_CATCH + try{ + OCC_CATCH_SIGNALS; +#else + CASCatch_TRY{ + try{ +#endif +#endif + if(theColoredPrs3d->Create(theMeshName, theEntity, theFieldName, theIteration)) + return true; +#ifndef _DEXCEPT_ +#ifdef NO_CAS_CATCH + }catch(Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + INFOS("Follow signal was occured :\n"<GetMessageString()); + }catch(std::exception& exc){ + INFOS("Follow exception was occured :\n"<GetMessageString()); + } +#endif +#endif + return false; + } + + + //---------------------------------------------------------------------------- + VISU::ColoredPrs3d_i* + CreatePrs3d_i(VISUType theType, + SALOMEDS::Study_ptr theStudy) + { + switch(theType){ + case TSCALARMAP: + return VISU::CreatePrs3dByEnum(theStudy); + case TGAUSSPOINTS: + return VISU::CreatePrs3dByEnum(theStudy); + case TDEFORMEDSHAPE: + return VISU::CreatePrs3dByEnum(theStudy); + case TSCALARMAPONDEFORMEDSHAPE: + return VISU::CreatePrs3dByEnum(theStudy); + case TISOSURFACE: + return VISU::CreatePrs3dByEnum(theStudy); + case TSTREAMLINES: + return VISU::CreatePrs3dByEnum(theStudy); + case TPLOT3D: + return VISU::CreatePrs3dByEnum(theStudy); + case TCUTPLANES: + return VISU::CreatePrs3dByEnum(theStudy); + case TCUTLINES: + return VISU::CreatePrs3dByEnum(theStudy); + case TVECTORS: + return VISU::CreatePrs3dByEnum(theStudy); + } + return NULL; + } + //---------------------------------------------------------------------------- +} diff --git a/src/VISU_I/VISU_ColoredPrs3dFactory.hh b/src/VISU_I/VISU_ColoredPrs3dFactory.hh new file mode 100644 index 00000000..7dff7758 --- /dev/null +++ b/src/VISU_I/VISU_ColoredPrs3dFactory.hh @@ -0,0 +1,245 @@ +// VISU OBJECT : interactive object for VISU entities implementation +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// +// File : VISU_ColoredPrs3dCache_i.hh +// Author : Oleg UVAROV +// Module : VISU + +#ifndef VISU_ColoredPrs3dFactory_HeaderFile +#define VISU_ColoredPrs3dFactory_HeaderFile + +#include "SALOMEconfig.h" +#include CORBA_SERVER_HEADER(VISU_Gen) +#include CORBA_SERVER_HEADER(SALOMEDS) + +#include "VISU_ScalarMapOnDeformedShape_i.hh" +#include "VISU_Plot3D_i.hh" +#include "VISU_GaussPoints_i.hh" +#include "VISU_StreamLines_i.hh" +#include "VISU_Vectors_i.hh" +#include "VISU_CutLines_i.hh" +#include "VISU_CutPlanes_i.hh" +#include "VISU_DeformedShape_i.hh" +#include "VISU_IsoSurfaces_i.hh" +#include "VISU_ScalarMap_i.hh" +#include "VISU_ColoredPrs3d_i.hh" +#include "VISU_Result_i.hh" + +namespace VISU +{ + namespace TL + { + //---------------------------------------------------------------------------- + template + struct TList + { + typedef T THead; + typedef U TTail; + }; + + template + struct TInt2Type + { + enum { value = v }; + }; + + struct TNullType {}; + + //---------------------------------------------------------------------------- + typedef TList > > > > > > > > > + TColoredPrs3dTypeList; + + + typedef TList, + TList, + TList, + TList, + TList, + TList, + TList, + TList, + TList, + TList, + TNullType> > > > > > > > > > + TColoredPrs3dEnumList; + + + //---------------------------------------------------------------------------- + template + struct TTypeAt; + + template + struct TTypeAt, 0> + { + typedef THead TResult; + }; + + + template + struct TTypeAt, index> + { + typedef typename TTypeAt::TResult TResult; + }; + + //---------------------------------------------------------------------------- + template + struct TIndexOf; + + template + struct TIndexOf + { + enum { value = -1 }; + }; + + template + struct TIndexOf, T> + { + enum { value = 0 }; + }; + + template + struct TIndexOf, T> + { + private: + enum { temp = TIndexOf::value }; + public: + enum { value = temp == -1? -1 : 1 + temp }; + }; + + //---------------------------------------------------------------------------- + template + struct TColoredEnum2Type + { + typedef typename TTypeAt >::value >::TResult TResult; + }; + + //---------------------------------------------------------------------------- + template + struct TColoredType2Enum + { + typedef typename TTypeAt::value >::TResult TResult; + }; + + } + + //---------------------------------------------------------------------------- + template + ColoredPrs3d_i* + CreatePrs3dByType(SALOMEDS::Study_ptr theStudy) + { + if(!theStudy->GetProperties()->IsLocked()){ + typedef typename TPrs3d_i::TInterface TPrs3d; + if(TPrs3d_i* aPresent = new TPrs3d_i(NULL,ColoredPrs3d_i::EPublishIndependently)){ + return aPresent; + } + } + return NULL; + } + + + //---------------------------------------------------------------------------- + template + ColoredPrs3d_i* + CreatePrs3dByEnum(SALOMEDS::Study_ptr theStudy) + { + typedef typename TL::TColoredEnum2Type::TResult TColoredPrs3d; + return CreatePrs3dByType(theStudy); + }; + + + //---------------------------------------------------------------------------- + ColoredPrs3d_i* + CreatePrs3d_i(VISUType theType, + SALOMEDS::Study_ptr theStudy); + + + //---------------------------------------------------------------------------- + bool + CreatColoredPrs3d(ColoredPrs3d_i* theColoredPrs3d, + const std::string& theMeshName, + VISU::Entity theEntity, + const std::string& theFieldName, + CORBA::Long theIteration); + + + //---------------------------------------------------------------------------- + //Create 3D collored Presentation Of Different Types + template TPrs3d_i* + CreatePrs3d(Result_ptr theResult, + const std::string& theMeshName, + VISU::Entity theEntity, + const std::string& theFieldName, + CORBA::Long theIteration) + { + typedef typename TPrs3d_i::TInterface TPrs3d; + typename TPrs3d::_var_type aPrs3d; + + if(Result_i* aResult = dynamic_cast(GetServant(theResult).in())){ + SALOMEDS::Study_var aStudy = aResult->GetStudyDocument(); + if(aStudy->GetProperties()->IsLocked()) + return NULL; + + if(TPrs3d_i::IsPossible(aResult, theMeshName, theEntity, theFieldName, theIteration)){ + TPrs3d_i* aPresent = new TPrs3d_i(aResult); + + if(CreatColoredPrs3d(aPresent, theMeshName, theEntity, theFieldName, theIteration)) + return aPresent; + + aPresent->_remove_ref(); + } + } + return NULL; + } + + + //---------------------------------------------------------------------------- + template typename TPrs3d_i::TInterface::_var_type + Prs3dOnField(Result_ptr theResult, + const std::string& theMeshName, + VISU::Entity theEntity, + const std::string& theFieldName, + CORBA::Long theIteration) + { + typedef typename TPrs3d_i::TInterface TPrs3d; + typename TPrs3d::_var_type aPrs3d; + if(TPrs3d_i* aPrs3d = CreatePrs3d(theResult, + theMeshName, + theEntity, + theFieldName, + theIteration)) + return aPrs3d->_this(); + return TPrs3d::_nil(); + } + //---------------------------------------------------------------------------- +} + +#endif diff --git a/src/VISU_I/VISU_ColoredPrs3dHolder_i.cc b/src/VISU_I/VISU_ColoredPrs3dHolder_i.cc index 0e295ddb..1bb4f028 100644 --- a/src/VISU_I/VISU_ColoredPrs3dHolder_i.cc +++ b/src/VISU_I/VISU_ColoredPrs3dHolder_i.cc @@ -43,19 +43,29 @@ int VISU::ColoredPrs3dHolder_i::myNbHolders = 0; //--------------------------------------------------------------- QString -VISU::ColoredPrs3dHolder_i:: -GenerateName() +VISU::ColoredPrs3dHolder_i +::GenerateName() { return VISU::GenerateName("Holder",myNbHolders++); } //---------------------------------------------------------------------------- -VISU::ColoredPrs3dHolder_i:: -ColoredPrs3dHolder_i(VISU::VISUType theType, - VISU::ColoredPrs3dHolder::BasicInput theInput, - VISU::ColoredPrs3dCache_i& theCache) : +const string VISU::ColoredPrs3dHolder_i::myComment = "COLOREDPRS3DHOLDER"; + +const char* +VISU::ColoredPrs3dHolder_i +::GetComment() const +{ + return myComment.c_str(); +} + + +//---------------------------------------------------------------------------- +VISU::ColoredPrs3dHolder_i +::ColoredPrs3dHolder_i(VISU::VISUType theType, + VISU::ColoredPrs3dHolder::BasicInput theInput, + VISU::ColoredPrs3dCache_i& theCache) : PrsObject_i(theCache.GetStudyDocument()), - myPrsType(theType), myCache(theCache) { if(MYDEBUG) MESSAGE("ColoredPrs3dHolder_i::ColoredPrs3dHolder_i - this = "<FindObjectIOR(anIOR)); }else if(myPublishInStudyMode == EPublishIndependently){ - myName = GenerateName().latin1(); + SetName(GenerateName().latin1()); CORBA::String_var anIOR = GetID(); std::string aFatherEntry = VISU::FindOrCreate3DPresentationsFolder(GetStudyDocument()); aComment.sprintf("myComment=%s", @@ -1154,7 +1163,7 @@ VISU::ColoredPrs3d_i aFatherEntry, "", anIOR.in(), - myName, + GetName(), "", aComment.latin1(), true); diff --git a/src/VISU_I/VISU_ColoredPrs3d_i.hh b/src/VISU_I/VISU_ColoredPrs3d_i.hh index 16c3d76f..0204fe4a 100644 --- a/src/VISU_I/VISU_ColoredPrs3d_i.hh +++ b/src/VISU_I/VISU_ColoredPrs3d_i.hh @@ -226,11 +226,12 @@ namespace VISU virtual void - SetHolderEntry( const QString& theEntry ) { myHolderEntry = theEntry; } + SetHolderEntry(const std::string& theEntry); virtual - QString + std::string GetEntry(); + //---------------------------------------------------------------------------- public: /*! @@ -439,7 +440,7 @@ namespace VISU PField myField; EPublishInStudyMode myPublishInStudyMode; - QString myHolderEntry; + std::string myHolderEntry; std::string myTitle; std::string myScalarBarTitle; diff --git a/src/VISU_I/VISU_Gen_i.cc b/src/VISU_I/VISU_Gen_i.cc index bf48e73e..36079e80 100644 --- a/src/VISU_I/VISU_Gen_i.cc +++ b/src/VISU_I/VISU_Gen_i.cc @@ -31,19 +31,10 @@ #include "VISU_Prs3d_i.hh" #include "VISU_Mesh_i.hh" -#include "VISU_ScalarMap_i.hh" -#include "VISU_IsoSurfaces_i.hh" -#include "VISU_DeformedShape_i.hh" -#include "VISU_CutPlanes_i.hh" -#include "VISU_CutLines_i.hh" -#include "VISU_Vectors_i.hh" -#include "VISU_StreamLines_i.hh" -#include "VISU_GaussPoints_i.hh" -#include "VISU_Plot3D_i.hh" #include "VISU_Table_i.hh" #include "VISU_TimeAnimation.h" -#include "VISU_ScalarMapOnDeformedShape_i.hh" +#include "VISU_ColoredPrs3dFactory.hh" #include "VISU_ColoredPrs3dCache_i.hh" #include "VISU_ColoredPrs3dHolder_i.hh" @@ -85,22 +76,11 @@ #include #include -// STL Includes -#include - #include "Utils_ExceptHandlers.hxx" +UNEXPECT_CATCH(SalomeException, SALOME::SALOME_Exception); -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 -#define NO_CAS_CATCH -#endif - -#include - -#ifdef NO_CAS_CATCH -#include -#else -#include "CASCatch.hxx" -#endif +// STL Includes +#include using namespace std; @@ -108,19 +88,18 @@ static QFileInfo aFileInfo; #ifdef _DEBUG_ static int MYDEBUG = 0; -//#define _DEXCEPT_ #else static int MYDEBUG = 0; #endif -UNEXPECT_CATCH(SalomeException, SALOME::SALOME_Exception); - -extern "C" VISU::VISU_Gen_ptr GetImpl(CORBA::ORB_ptr theORB, - PortableServer::POA_ptr thePOA, - SALOME_NamingService* theNamingService, - QMutex* theMutex) +extern "C" +VISU::VISU_Gen_ptr +GetImpl(CORBA::ORB_ptr theORB, + PortableServer::POA_ptr thePOA, + SALOME_NamingService* theNamingService, + QMutex* theMutex) { - if(MYDEBUG) MESSAGE("extern \"C\" GetImpl"); + if(MYDEBUG) MESSAGE("extern 'C' GetImpl"); VISU::VISU_Gen_i *aVISU_Gen = new VISU::VISU_Gen_i(theORB,thePOA,theNamingService,theMutex); //return VISU::VISU_Gen::_duplicate(aVISU_Gen->_this()); return aVISU_Gen->_this(); @@ -128,13 +107,15 @@ extern "C" VISU::VISU_Gen_ptr GetImpl(CORBA::ORB_ptr theORB, namespace VISU { + //---------------------------------------------------------------------------- static string VisuTmpDir; static CORBA::Boolean myIsMultiFile; const CORBA::Boolean IsMultifile() { return myIsMultiFile;} - //=========================================================================== - _PTR(SComponent) ClientFindOrCreateVisuComponent (_PTR(Study) theStudyDocument) + //---------------------------------------------------------------------------- + _PTR(SComponent) + ClientFindOrCreateVisuComponent (_PTR(Study) theStudyDocument) { _PTR(SComponent) aSComponent = theStudyDocument->FindComponent("VISU"); if (!aSComponent) { @@ -169,7 +150,11 @@ namespace VISU return aSComponent; } - SALOMEDS::SComponent_var FindOrCreateVisuComponent(SALOMEDS::Study_ptr theStudyDocument){ + + //---------------------------------------------------------------------------- + SALOMEDS::SComponent_var + FindOrCreateVisuComponent(SALOMEDS::Study_ptr theStudyDocument) + { SALOMEDS::SComponent_var aSComponent = theStudyDocument->FindComponent("VISU"); if (aSComponent->_is_nil()) { SALOMEDS::StudyBuilder_var aStudyBuilder = theStudyDocument->NewBuilder(); @@ -202,7 +187,11 @@ namespace VISU return aSComponent; } - void RegistryStorable() { + + //---------------------------------------------------------------------------- + void + RegistryStorable() + { Storable::Registry(Result_i::myComment.c_str(),&(Result_i::Restore)); Storable::Registry(Mesh_i::myComment.c_str(),&(Restore)); Storable::Registry(ScalarMap_i::myComment.c_str(),&(Restore)); @@ -221,10 +210,10 @@ namespace VISU } - //=========================================================================== - VISU_Gen_i:: - VISU_Gen_i(CORBA::ORB_ptr theORB, PortableServer::POA_ptr thePOA, - SALOME_NamingService* theNamingService, QMutex* theMutex) : + //---------------------------------------------------------------------------- + VISU_Gen_i + ::VISU_Gen_i(CORBA::ORB_ptr theORB, PortableServer::POA_ptr thePOA, + SALOME_NamingService* theNamingService, QMutex* theMutex) : Engines_Component_i() { if(MYDEBUG) MESSAGE("VISU_Gen_i::VISU_Gen_i : "<(theStudy); - case TGAUSSPOINTS: - return VISU::CreatePrs3d_i(theStudy); - case TDEFORMEDSHAPE: - return VISU::CreatePrs3d_i(theStudy); - case TSCALARMAPONDEFORMEDSHAPE: - return VISU::CreatePrs3d_i(theStudy); - case TISOSURFACE: - return VISU::CreatePrs3d_i(theStudy); - case TSTREAMLINES: - return VISU::CreatePrs3d_i(theStudy); - case TPLOT3D: - return VISU::CreatePrs3d_i(theStudy); - case TCUTPLANES: - return VISU::CreatePrs3d_i(theStudy); - case TCUTLINES: - return VISU::CreatePrs3d_i(theStudy); - case TVECTORS: - return VISU::CreatePrs3d_i(theStudy); - } - return NULL; - } - - + //---------------------------------------------------------------------------- Prs3d_ptr - VISU_Gen_i:: - CreatePrs3d(VISUType theType, - SALOMEDS::Study_ptr theStudy) + VISU_Gen_i + ::CreatePrs3d(VISUType theType, + SALOMEDS::Study_ptr theStudy) { - if(ColoredPrs3d_i* aPrs3d = CreatePrs3d_i(theType, theStudy)) + if(ColoredPrs3d_i* aPrs3d = VISU::CreatePrs3d_i(theType, theStudy)) return aPrs3d->_this(); return Prs3d::_nil(); } - bool - CreatColoredPrs3d(ColoredPrs3d_i* theColoredPrs3d, - const std::string& theMeshName, - VISU::Entity theEntity, - const std::string& theFieldName, - CORBA::Double theIteration) + //---------------------------------------------------------------------------- + VISU_Gen_i + ::~VISU_Gen_i() { -#ifndef _DEXCEPT_ -#ifdef NO_CAS_CATCH - try{ - OCC_CATCH_SIGNALS; -#else - CASCatch_TRY{ - try{ -#endif -#endif - if(theColoredPrs3d->Create(theMeshName,theEntity,theFieldName,int(theIteration))) - return true; -#ifndef _DEXCEPT_ -#ifdef NO_CAS_CATCH - }catch(Standard_Failure) { - Handle(Standard_Failure) aFail = Standard_Failure::Caught(); - INFOS("Follow signal was occured :\n"<GetMessageString()); - }catch(std::exception& exc){ - INFOS("Follow exception was occured :\n"<GetMessageString()); - } -#endif -#endif - return false; - } - - VISU_Gen_i::~VISU_Gen_i(){ if(MYDEBUG) MESSAGE("VISU_Gen_i::~VISU_Gen_i"); } - void CorrectSObjectType(SALOMEDS::SObject_ptr theSObject) + + //---------------------------------------------------------------------------- + void + CorrectSObjectType(SALOMEDS::SObject_ptr theSObject) { SALOMEDS::GenericAttribute_var anAttr; if ( theSObject->FindAttribute(anAttr, "AttributeComment") ) { @@ -397,11 +319,14 @@ namespace VISU } } - //=========================================================================== - CORBA::Boolean VISU_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent, - const SALOMEDS::TMPFile & theStream, - const char* theURL, - bool isMultiFile) + + //---------------------------------------------------------------------------- + CORBA::Boolean + VISU_Gen_i + ::Load(SALOMEDS::SComponent_ptr theComponent, + const SALOMEDS::TMPFile & theStream, + const char* theURL, + bool isMultiFile) { Mutex mt(myMutex); SALOMEDS::Study_var aStudy = theComponent->GetStudy(); @@ -422,18 +347,26 @@ namespace VISU return true; } - CORBA::Boolean VISU_Gen_i::LoadASCII(SALOMEDS::SComponent_ptr theComponent, - const SALOMEDS::TMPFile & theStream, - const char* theURL, - bool isMultiFile) + + //---------------------------------------------------------------------------- + CORBA::Boolean + VISU_Gen_i + ::LoadASCII(SALOMEDS::SComponent_ptr theComponent, + const SALOMEDS::TMPFile & theStream, + const char* theURL, + bool isMultiFile) { return Load(theComponent, theStream, theURL, isMultiFile); } - char* VISU_Gen_i::LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject, - const char* aLocalPersistentID, - CORBA::Boolean isMultiFile, - CORBA::Boolean isASCII) + + //---------------------------------------------------------------------------- + char* + VISU_Gen_i + ::LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject, + const char* aLocalPersistentID, + CORBA::Boolean isMultiFile, + CORBA::Boolean isASCII) { CORBA::String_var aString(""); if(strcmp(aLocalPersistentID,"") != 0) { @@ -445,10 +378,13 @@ namespace VISU return aString._retn(); } - //=========================================================================== - SALOMEDS::TMPFile* VISU_Gen_i::Save(SALOMEDS::SComponent_ptr theComponent, - const char* theURL, - bool theIsMultiFile) + + //---------------------------------------------------------------------------- + SALOMEDS::TMPFile* + VISU_Gen_i + ::Save(SALOMEDS::SComponent_ptr theComponent, + const char* theURL, + bool theIsMultiFile) { Mutex mt(myMutex); string aTmpDir = theURL; @@ -514,9 +450,13 @@ namespace VISU return aStreamFile._retn(); } - SALOMEDS::TMPFile* VISU_Gen_i::SaveASCII(SALOMEDS::SComponent_ptr theComponent, - const char* theURL, - bool isMultiFile) + + //---------------------------------------------------------------------------- + SALOMEDS::TMPFile* + VISU_Gen_i + ::SaveASCII(SALOMEDS::SComponent_ptr theComponent, + const char* theURL, + bool isMultiFile) { Mutex mt(myMutex); string aDir = isMultiFile ? theURL : SALOMEDS_Tool::GetTmpDir(); @@ -570,10 +510,14 @@ namespace VISU return aStreamFile._retn(); } - char* VISU_Gen_i::IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject, - const char* IORString, - CORBA::Boolean isMultiFile, - CORBA::Boolean isASCII) + + //---------------------------------------------------------------------------- + char* + VISU_Gen_i + ::IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject, + const char* IORString, + CORBA::Boolean isMultiFile, + CORBA::Boolean isASCII) { CORBA::String_var aString(IORString); if(strcmp(IORString,"") != 0){ @@ -590,11 +534,20 @@ namespace VISU return aString._retn(); } - char* VISU_Gen_i::GetID(){ + + //---------------------------------------------------------------------------- + char* + VISU_Gen_i + ::GetID() + { return Base_i::GetID(); } - void VISU_Gen_i::SetCurrentStudy (SALOMEDS::Study_ptr theStudy) + + //---------------------------------------------------------------------------- + void + VISU_Gen_i + ::SetCurrentStudy(SALOMEDS::Study_ptr theStudy) { class TEvent: public SALOME_Event { std::string myStudyName; @@ -645,17 +598,32 @@ namespace VISU } } - SALOMEDS::Study_ptr VISU_Gen_i::GetCurrentStudy(){ + + //---------------------------------------------------------------------------- + SALOMEDS::Study_ptr + VISU_Gen_i + ::GetCurrentStudy() + { return SALOMEDS::Study::_duplicate(myStudyDocument); } - ViewManager_ptr VISU_Gen_i::GetViewManager(){ + + //---------------------------------------------------------------------------- + ViewManager_ptr + VISU_Gen_i + ::GetViewManager() + { Mutex mt(myMutex); ViewManager_i * aViewManager = new ViewManager_i(myStudyDocument); return ViewManager::_duplicate(aViewManager->_this()); } - SALOMEDS::SObject_ptr VISU_Gen_i::ImportTables(const char* theFileName){ + + //---------------------------------------------------------------------------- + SALOMEDS::SObject_ptr + VISU_Gen_i + ::ImportTables(const char* theFileName) + { if(myStudyDocument->GetProperties()->IsLocked()) return SALOMEDS::SObject::_nil(); Mutex mt(myMutex); @@ -663,13 +631,22 @@ namespace VISU return aRes._retn(); } - CORBA::Boolean VISU_Gen_i::ExportTableToFile(SALOMEDS::SObject_ptr theTable, - const char* theFileName) + + //---------------------------------------------------------------------------- + CORBA::Boolean + VISU_Gen_i + ::ExportTableToFile(SALOMEDS::SObject_ptr theTable, + const char* theFileName) { return VISU::ExportTableToFile(theTable, theFileName); } - Result_ptr VISU_Gen_i::ImportFile(const char* theFileName){ + + //---------------------------------------------------------------------------- + Result_ptr + VISU_Gen_i + ::ImportFile(const char* theFileName) + { if(myStudyDocument->GetProperties()->IsLocked()) return Result::_nil(); Mutex mt(myMutex); @@ -685,7 +662,12 @@ namespace VISU } } - Result_ptr VISU_Gen_i::CreateResult(const char* theFileName){ + + //---------------------------------------------------------------------------- + Result_ptr + VISU_Gen_i + ::CreateResult(const char* theFileName) + { if(myStudyDocument->GetProperties()->IsLocked()) return Result::_nil(); Mutex mt(myMutex); @@ -702,7 +684,12 @@ namespace VISU } } - Result_ptr VISU_Gen_i::CopyAndImportFile(const char* theFileName){ + + //---------------------------------------------------------------------------- + Result_ptr + VISU_Gen_i + ::CopyAndImportFile(const char* theFileName) + { if(myStudyDocument->GetProperties()->IsLocked()) return Result::_nil(); Mutex mt(myMutex); @@ -716,7 +703,11 @@ namespace VISU return aResult._retn(); } - Result_ptr VISU_Gen_i::ImportMed (SALOMEDS::SObject_ptr theMedSObject) + + //---------------------------------------------------------------------------- + Result_ptr + VISU_Gen_i + ::ImportMed(SALOMEDS::SObject_ptr theMedSObject) { if (myStudyDocument->GetProperties()->IsLocked()) return Result::_nil(); @@ -732,7 +723,11 @@ namespace VISU } } - Result_ptr VISU_Gen_i::ImportMedField (SALOME_MED::FIELD_ptr theField) + + //---------------------------------------------------------------------------- + Result_ptr + VISU_Gen_i + ::ImportMedField (SALOME_MED::FIELD_ptr theField) { if (myStudyDocument->GetProperties()->IsLocked()) return Result::_nil(); @@ -748,11 +743,13 @@ namespace VISU } } - void VISU_Gen_i::RenameMeshInStudy(Result_ptr theResult, - string theMeshName, - int theEntity, // -1 for group indication - string theSubMeshName, // Family or Group name - string theNewName) + void + VISU_Gen_i + ::RenameMeshInStudy(Result_ptr theResult, + const std::string& theMeshName, + int theEntity, // -1 for group indication + const std::string& theSubMeshName, // Family or Group name + const std::string& theNewName) { if (myStudyDocument->GetProperties()->IsLocked()) return; Mutex mt(myMutex); @@ -802,34 +799,50 @@ namespace VISU aStudyBuilder->CommitCommand(); } - void VISU_Gen_i::RenameEntityInStudy(Result_ptr theResult, - const char* theMeshName, - VISU::Entity theEntity, - const char* theNewName) + + //---------------------------------------------------------------------------- + void + VISU_Gen_i + ::RenameEntityInStudy(Result_ptr theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theNewName) { RenameMeshInStudy(theResult, theMeshName, (int)theEntity, "", theNewName); } - void VISU_Gen_i::RenameFamilyInStudy(Result_ptr theResult, - const char* theMeshName, - VISU::Entity theEntity, - const char* theFamilyName, - const char* theNewName) + + //---------------------------------------------------------------------------- + void + VISU_Gen_i + ::RenameFamilyInStudy(Result_ptr theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theFamilyName, + const char* theNewName) { RenameMeshInStudy(theResult, theMeshName, (int)theEntity, theFamilyName, theNewName); } - void VISU_Gen_i::RenameGroupInStudy(Result_ptr theResult, - const char* theMeshName, - const char* theGroupName, - const char* theNewName) + + //---------------------------------------------------------------------------- + void + VISU_Gen_i + ::RenameGroupInStudy(Result_ptr theResult, + const char* theMeshName, + const char* theGroupName, + const char* theNewName) { RenameMeshInStudy(theResult, theMeshName, -1, theGroupName, theNewName); } - Mesh_ptr VISU_Gen_i::MeshOnEntity(Result_ptr theResult, - const char* theMeshName, - VISU::Entity theEntity) + + //---------------------------------------------------------------------------- + Mesh_ptr + VISU_Gen_i + ::MeshOnEntity(Result_ptr theResult, + const char* theMeshName, + VISU::Entity theEntity) { if(myStudyDocument->GetProperties()->IsLocked()) return Mesh::_nil(); @@ -845,10 +858,14 @@ namespace VISU return VISU::Mesh::_nil(); } - Mesh_ptr VISU_Gen_i::FamilyMeshOnEntity(Result_ptr theResult, - const char* theMeshName, - VISU::Entity theEntity, - const char* theFamilyName) + + //---------------------------------------------------------------------------- + Mesh_ptr + VISU_Gen_i + ::FamilyMeshOnEntity(Result_ptr theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theFamilyName) { if(myStudyDocument->GetProperties()->IsLocked()) return Mesh::_nil(); @@ -864,9 +881,13 @@ namespace VISU return VISU::Mesh::_nil(); } - Mesh_ptr VISU_Gen_i::GroupMesh(Result_ptr theResult, - const char* theMeshName, - const char* theGroupName) + + //---------------------------------------------------------------------------- + Mesh_ptr + VISU_Gen_i + ::GroupMesh(Result_ptr theResult, + const char* theMeshName, + const char* theGroupName) { if(myStudyDocument->GetProperties()->IsLocked()) return Mesh::_nil(); @@ -882,20 +903,32 @@ namespace VISU return VISU::Mesh::_nil(); } - ScalarMap_ptr VISU_Gen_i::ScalarMapOnField(Result_ptr theResult, - const char* theMeshName, - VISU::Entity theEntity, - const char* theFieldName, - CORBA::Double theIteration) + + //---------------------------------------------------------------------------- + ScalarMap_ptr + VISU_Gen_i + ::ScalarMapOnField(Result_ptr theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + CORBA::Long theIteration) { - return Prs3dOnField(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn(); + return Prs3dOnField(theResult, + theMeshName, + theEntity, + theFieldName, + theIteration)._retn(); } - GaussPoints_ptr VISU_Gen_i::GaussPointsOnField(Result_ptr theResult, - const char* theMeshName, - VISU::Entity theEntity, - const char* theFieldName, - CORBA::Double theIteration) + + //---------------------------------------------------------------------------- + GaussPoints_ptr + VISU_Gen_i + ::GaussPointsOnField(Result_ptr theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theFieldName, + CORBA::Long theIteration) { return Prs3dOnField(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn(); } @@ -904,7 +937,7 @@ namespace VISU const char* theMeshName, VISU::Entity theEntity, const char* theFieldName, - CORBA::Double theIteration) + CORBA::Long theIteration) { return Prs3dOnField(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn(); } @@ -913,7 +946,7 @@ namespace VISU const char* theMeshName, VISU::Entity theEntity, const char* theFieldName, - CORBA::Double theIteration) + CORBA::Long theIteration) { return Prs3dOnField(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn(); } @@ -922,7 +955,7 @@ namespace VISU const char* theMeshName, VISU::Entity theEntity, const char* theFieldName, - CORBA::Double theIteration) + CORBA::Long theIteration) { return Prs3dOnField(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn(); } @@ -931,7 +964,7 @@ namespace VISU const char* theMeshName, VISU::Entity theEntity, const char* theFieldName, - CORBA::Double theIteration) + CORBA::Long theIteration) { return Prs3dOnField(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn(); } @@ -940,7 +973,7 @@ namespace VISU const char* theMeshName, VISU::Entity theEntity, const char* theFieldName, - CORBA::Double theIteration) + CORBA::Long theIteration) { return Prs3dOnField(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn(); } @@ -949,7 +982,7 @@ namespace VISU const char* theMeshName, VISU::Entity theEntity, const char* theFieldName, - CORBA::Double theIteration) + CORBA::Long theIteration) { return Prs3dOnField(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn(); } @@ -958,7 +991,7 @@ namespace VISU const char* theMeshName, VISU::Entity theEntity, const char* theFieldName, - CORBA::Double theIteration) + CORBA::Long theIteration) { return Prs3dOnField(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn(); } @@ -967,7 +1000,7 @@ namespace VISU const char* theMeshName, VISU::Entity theEntity, const char* theFieldName, - CORBA::Double theIteration) + CORBA::Long theIteration) { return Prs3dOnField(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn(); } @@ -1168,7 +1201,6 @@ namespace VISU // Assign an ID = 1 the the type VISU::Result theObjectID = 1; - SALOMEDS::SComponent_var aSComponent = theObject->GetStudy()->FindComponent("VISU"); return aStreamFile._retn(); } @@ -1237,45 +1269,10 @@ namespace VISU return aResultSO._retn(); } - VISU::ColoredPrs3d_i* - VISU_Gen_i:: - CreateHolder(VISU::VISUType theType, - Result_i* theResult, - const std::string& theMeshName, - VISU::Entity theEntity, - const std::string& theFieldName, - CORBA::Double theIteration) - { - VISU::ColoredPrs3dHolder::BasicInput anInput; - anInput.myResult = theResult->_this(); - anInput.myMeshName = theMeshName.c_str(); - anInput.myEntity = theEntity; - anInput.myFieldName = theFieldName.c_str(); - anInput.myTimeStampNumber = theIteration; - - SALOMEDS::Study_var aStudy = GetCurrentStudy(); - VISU::ColoredPrs3dCache_ptr aCache = GetColoredPrs3dCache(aStudy); - VISU::ColoredPrs3dHolder_ptr aHolder = aCache->CreateHolder(theType,anInput); - - VISU::ColoredPrs3d_ptr aPrs3d = aHolder->GetDevice(); - VISU::ColoredPrs3d_i* aPrs3d_i = dynamic_cast(GetServant(aPrs3d).in()); - - return aPrs3d_i; - } - VISU::ColoredPrs3dCache_ptr VISU_Gen_i:: GetColoredPrs3dCache(SALOMEDS::Study_ptr theStudy) { - SALOMEDS::SObject_var aSObject = theStudy->FindObject(VISU::ColoredPrs3dCache_i::GetFolderName().c_str()); - if(!CORBA::is_nil(aSObject)) - { - CORBA::Object_var anObject = aSObject->GetObject(); - VISU::ColoredPrs3dCache_var aCache = VISU::ColoredPrs3dCache::_narrow(anObject); - if(!CORBA::is_nil(aCache)) - return aCache._retn(); - } - - return (new VISU::ColoredPrs3dCache_i(theStudy))->_this(); + return ColoredPrs3dCache_i::GetInstance(theStudy); } } diff --git a/src/VISU_I/VISU_Gen_i.hh b/src/VISU_I/VISU_Gen_i.hh index a1f97108..3b8280b1 100644 --- a/src/VISU_I/VISU_Gen_i.hh +++ b/src/VISU_I/VISU_Gen_i.hh @@ -34,31 +34,7 @@ namespace VISU { - class Result_i; - class ColoredPrs3d_i; - class ColoredPrs3dCache_i; - class ColoredPrs3dHolder_i; - - bool - CreatColoredPrs3d(ColoredPrs3d_i* theColoredPrs3d, - const std::string& theMeshName, - VISU::Entity theEntity, - const std::string& theFieldName, - CORBA::Double theIteration); - - template - ColoredPrs3d_i* - CreatePrs3d_i(SALOMEDS::Study_ptr theStudy) - { - if(!theStudy->GetProperties()->IsLocked()){ - typedef typename TPrs3d_i::TInterface TPrs3d; - if(TPrs3d_i* aPresent = new TPrs3d_i(NULL,ColoredPrs3d_i::EPublishIndependently)){ - return aPresent; - } - } - return NULL; - } - + //---------------------------------------------------------------------------- class VISU_Gen_i : public virtual POA_VISU::VISU_Gen, public virtual ::Engines_Component_i, public virtual Base_i @@ -71,7 +47,9 @@ namespace VISU PortableServer::POA_ptr thePOA, SALOME_NamingService* theNamingService, QMutex* theMutex); - virtual ~VISU_Gen_i(); + + virtual + ~VISU_Gen_i(); virtual char* @@ -103,7 +81,7 @@ namespace VISU const char* theFileName ); //Create Result - virtual + virtual Result_ptr ImportFile(const char* theFileName); @@ -126,11 +104,11 @@ namespace VISU //Rename Presentation Of Submeshes void - RenameMeshInStudy(Result_ptr theResult, - std::string theMeshName, - int theEntity, // -1 for group indication - std::string theSubMeshName, // Family or Group name - std::string theNewName); + RenameMeshInStudy(Result_ptr theResult, + const std::string& theMeshName, + int theEntity, // -1 for group indication + const std::string& theSubMeshName, // Family or Group name + const std::string& theNewName); virtual void RenameEntityInStudy(Result_ptr theResult, @@ -171,78 +149,17 @@ namespace VISU const char* theMeshName, const char* theGroupName); - ColoredPrs3d_i* - CreatePrs3d_i(VISUType theType, - SALOMEDS::Study_ptr theStudy); - Prs3d_ptr CreatePrs3d(VISUType theType, SALOMEDS::Study_ptr theStudy); - ColoredPrs3d_i* - CreateHolder(VISU::VISUType theType, - Result_i* theResult, - const std::string& theMeshName, - VISU::Entity theEntity, - const std::string& theFieldName, - CORBA::Double theIteration); - - //Create 3D collored Presentation Of Different Types - template TPrs3d_i* - CreatePrs3d(Result_ptr theResult, - const std::string& theMeshName, - VISU::Entity theEntity, - const std::string& theFieldName, - CORBA::Double theIteration, - ColoredPrs3d_i::EPublishInStudyMode thePublishInStudyMode = ColoredPrs3d_i::EPublishUnderTimeStamp) - { - if(myStudyDocument->GetProperties()->IsLocked()) - return NULL; - - typedef typename TPrs3d_i::TInterface TPrs3d; - typename TPrs3d::_var_type aPrs3d; - Mutex mt(myMutex); - if(Result_i* aResult = dynamic_cast(GetServant(theResult).in())){ - if(TPrs3d_i::IsPossible(aResult,theMeshName,theEntity,theFieldName,int(theIteration))){ - TPrs3d_i* aPresent = new TPrs3d_i(aResult,thePublishInStudyMode); - - if( thePublishInStudyMode != ColoredPrs3d_i::EPublishUnderTimeStamp ) - { - ColoredPrs3d_i* aPrs3d = - CreateHolder(aPresent->GetType(),aResult,theMeshName,theEntity,theFieldName,theIteration); - - return dynamic_cast(aPrs3d); - } - - if(CreatColoredPrs3d(aPresent,theMeshName,theEntity,theFieldName,theIteration)) - return aPresent; - aPresent->_remove_ref(); - } - } - return NULL; - } - - template typename TPrs3d_i::TInterface::_var_type - Prs3dOnField(Result_ptr theResult, - const std::string& theMeshName, - VISU::Entity theEntity, - const std::string& theFieldName, - CORBA::Double theIteration) - { - typedef typename TPrs3d_i::TInterface TPrs3d; - typename TPrs3d::_var_type aPrs3d; - if(TPrs3d_i* aPrs3d = CreatePrs3d(theResult,theMeshName,theEntity,theFieldName,theIteration)) - return aPrs3d->_this(); - return TPrs3d::_nil(); - } - virtual ScalarMap_ptr ScalarMapOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, const char* theFieldName, - CORBA::Double theIteration); + CORBA::Long theIteration); virtual GaussPoints_ptr @@ -250,7 +167,7 @@ namespace VISU const char* theMeshName, VISU::Entity theEntity, const char* theFieldName, - CORBA::Double theIteration); + CORBA::Long theIteration); virtual DeformedShape_ptr @@ -258,7 +175,7 @@ namespace VISU const char* theMeshName, VISU::Entity theEntity, const char* theFieldName, - CORBA::Double theIteration); + CORBA::Long theIteration); virtual ScalarMapOnDeformedShape_ptr @@ -266,14 +183,14 @@ namespace VISU const char* theMeshName, VISU::Entity theEntity, const char* theFieldName, - CORBA::Double theIteration); + CORBA::Long theIteration); virtual Vectors_ptr VectorsOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, const char* theFieldName, - CORBA::Double theIteration); + CORBA::Long theIteration); virtual IsoSurfaces_ptr @@ -281,7 +198,7 @@ namespace VISU const char* theMeshName, VISU::Entity theEntity, const char* theFieldName, - CORBA::Double theIteration); + CORBA::Long theIteration); virtual CutPlanes_ptr @@ -289,7 +206,7 @@ namespace VISU const char* theMeshName, VISU::Entity theEntity, const char* theFieldName, - CORBA::Double theIteration); + CORBA::Long theIteration); virtual CutLines_ptr @@ -297,7 +214,7 @@ namespace VISU const char* theMeshName, VISU::Entity theEntity, const char* theFieldName, - CORBA::Double theIteration); + CORBA::Long theIteration); virtual StreamLines_ptr @@ -305,7 +222,7 @@ namespace VISU const char* theMeshName, VISU::Entity theEntity, const char* theFieldName, - CORBA::Double theIteration); + CORBA::Long theIteration); virtual Plot3D_ptr @@ -313,7 +230,7 @@ namespace VISU const char* theMeshName, VISU::Entity theEntity, const char* theFieldName, - CORBA::Double theIteration); + CORBA::Long theIteration); //Create Digital Presentation virtual diff --git a/src/VISU_I/VISU_Mesh_i.cc b/src/VISU_I/VISU_Mesh_i.cc index 7d924cff..cb3790c5 100644 --- a/src/VISU_I/VISU_Mesh_i.cc +++ b/src/VISU_I/VISU_Mesh_i.cc @@ -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; - myName = GenerateName().latin1(); + SetName(GenerateName().latin1()); 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.; diff --git a/src/VISU_I/VISU_Prs3d_i.cc b/src/VISU_I/VISU_Prs3d_i.cc index 1f13d04f..8eef43a2 100644 --- a/src/VISU_I/VISU_Prs3d_i.cc +++ b/src/VISU_I/VISU_Prs3d_i.cc @@ -222,7 +222,7 @@ VISU::Storable* VISU::Prs3d_i ::Restore(const Storable::TRestoringMap& theMap) { - myName = VISU::Storable::FindValue(theMap,"myName").latin1(); + SetName(VISU::Storable::FindValue(theMap,"myName").latin1()); 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(); @@ -234,7 +234,7 @@ void VISU::Prs3d_i ::ToStream(std::ostringstream& theStr) { - Storable::DataToStream( theStr, "myName", myName.c_str() ); + Storable::DataToStream( theStr, "myName", GetName().c_str() ); Storable::DataToStream( theStr, "myOffset[0]", myOffset[0] ); Storable::DataToStream( theStr, "myOffset[1]", myOffset[1] ); Storable::DataToStream( theStr, "myOffset[2]", myOffset[2] ); @@ -377,7 +377,7 @@ VISU::Prs3d_i:: GetIO() { if( myIO.IsNull() ) - myIO = new SALOME_InteractiveObject(GetEntry(),"VISU",GetName()); + myIO = new SALOME_InteractiveObject(GetEntry().c_str(), "VISU", GetName().c_str()); return myIO; } diff --git a/src/VISU_I/VISU_PrsObject_i.cc b/src/VISU_I/VISU_PrsObject_i.cc index 8ce68939..497050cc 100644 --- a/src/VISU_I/VISU_PrsObject_i.cc +++ b/src/VISU_I/VISU_PrsObject_i.cc @@ -33,29 +33,28 @@ static int MYDEBUG = 0; #endif //--------------------------------------------------------------- -VISU::PrsObject_i -::PrsObject_i(SALOMEDS::Study_ptr theStudy): - myStudy(SALOMEDS::Study::_duplicate(theStudy)) +VISU::RemovableObject_i +::RemovableObject_i() { - if(MYDEBUG) MESSAGE("PrsObject_i::PrsObject_i - this = "<FindObjectIOR(anIOR.in()); - CORBA::String_var anEntry; + CORBA::String_var anEntry(""); if(!CORBA::is_nil(aSObject.in())) anEntry = aSObject->GetID(); else MESSAGE("PrsObject_i::GetEntry - Cannot find SObject in the Study with StudyId = "<StudyId()<<" !!!"); return anEntry.in(); } + + +//--------------------------------------------------------------- +VISU::PrsObject_i +::PrsObject_i(SALOMEDS::Study_ptr theStudy) +{ + SetStudyDocument(theStudy); +} + + diff --git a/src/VISU_I/VISU_PrsObject_i.hh b/src/VISU_I/VISU_PrsObject_i.hh index 781c6eb1..eb4a3b07 100644 --- a/src/VISU_I/VISU_PrsObject_i.hh +++ b/src/VISU_I/VISU_PrsObject_i.hh @@ -31,39 +31,56 @@ namespace VISU { - class PrsObject_i : public virtual POA_VISU::PrsObject, - public virtual RemovableObject_i + //---------------------------------------------------------------------------- + class RemovableObject_i : public virtual POA_VISU::RemovableObject, + public virtual Storable { - PrsObject_i(const PrsObject_i&); - SALOMEDS::Study_var myStudy; - public: - PrsObject_i(SALOMEDS::Study_ptr theStudy = SALOMEDS::Study::_nil()); + typedef Storable TSuperClass; virtual - ~PrsObject_i(); + ~RemovableObject_i(); - protected: - void - SetStudyDocument(SALOMEDS::Study_ptr theStudy); + const SALOMEDS::Study_var& + GetStudyDocument() const; - std::string myName; + virtual + std::string + GetEntry(); - public: virtual - const char* + const std::string& GetName() const; virtual void SetName(const std::string& theName); - const SALOMEDS::Study_var& - GetStudyDocument() const; + protected: + RemovableObject_i(); - virtual - QString - GetEntry(); + void + SetStudyDocument(SALOMEDS::Study_ptr theStudy); + + private: + std::string myName; + SALOMEDS::Study_var myStudy; + + RemovableObject_i(const RemovableObject_i&); + }; + + + //---------------------------------------------------------------------------- + class PrsObject_i : public virtual POA_VISU::PrsObject, + public virtual RemovableObject_i + { + PrsObject_i(const PrsObject_i&); + SALOMEDS::Study_var myStudy; + + public: + typedef RemovableObject_i TSuperClass; + + PrsObject_i(SALOMEDS::Study_ptr theStudy); }; } diff --git a/src/VISU_I/VISU_Result_i.hh b/src/VISU_I/VISU_Result_i.hh index b04fc0d5..e60c748d 100644 --- a/src/VISU_I/VISU_Result_i.hh +++ b/src/VISU_I/VISU_Result_i.hh @@ -27,7 +27,7 @@ #ifndef __VISU_RESULT_I_H__ #define __VISU_RESULT_I_H__ -#include "VISUConfig.hh" +#include "VISU_PrsObject_i.hh" #include "VISU_BoostSignals.h" #include "SALOME_GenericObj_i.hh" diff --git a/src/VISU_I/VISU_Table_i.cc b/src/VISU_I/VISU_Table_i.cc index 77bd7333..6e2ad6cb 100644 --- a/src/VISU_I/VISU_Table_i.cc +++ b/src/VISU_I/VISU_Table_i.cc @@ -130,10 +130,10 @@ CORBA::Long VISU::Table_i::GetNbColumns() VISU::Storable* VISU::Table_i::Create() { // generate name ... - myName = GetTableTitle(); + SetName(GetTableTitle()); // mpv (PAL 5357): if name attribute already exist at this label, use it as name of table - if ( myName == "" ) + if ( GetName() == "" ) if ( !mySObj->_is_nil() ) { CutLines_i* pCutLines = NULL; CORBA::Object_var anObj = SObjectToObject(mySObj); @@ -143,11 +143,11 @@ VISU::Storable* VISU::Table_i::Create() pCutLines = dynamic_cast(GetServant(aCutLines).in()); } if (!pCutLines) - if (mySObj->GetName()) myName = mySObj->GetName(); + if (mySObj->GetName()) SetName(mySObj->GetName()); } - if ( myName == "" ) - myName = GenerateName(); + if ( GetName() == "" ) + SetName(GenerateName()); // ... and build the object return Build( false ); } @@ -223,7 +223,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()); - myName = VISU::Storable::FindValue(theMap,"myName").latin1(); + SetName(VISU::Storable::FindValue(theMap,"myName").latin1()); myTitle = VISU::Storable::FindValue(theMap,"myTitle").latin1(); myOrientation = ( VISU::Table::Orientation )( VISU::Storable::FindValue(theMap,"myOrientation").toInt() ); mySObj = SALOMEDS::SObject::_duplicate(SO); @@ -234,7 +234,7 @@ VISU::Storable* VISU::Table_i::Restore( const Storable::TRestoringMap& theMap, S */ void VISU::Table_i::ToStream( std::ostringstream& theStr ) { - Storable::DataToStream( theStr, "myName", myName.c_str() ); + Storable::DataToStream( theStr, "myName", GetName().c_str() ); Storable::DataToStream( theStr, "myTitle", myTitle.c_str() ); Storable::DataToStream( theStr, "myOrientation", myOrientation ); } @@ -354,9 +354,9 @@ VISU::Curve_i::~Curve_i() VISU::Storable* VISU::Curve_i::Create() { // generate name ... - myName = GetVerTitle(); - if ( myName == "" ) - myName = GenerateName(); + SetName(GetVerTitle()); + if ( GetName() == "" ) + SetName(GenerateName()); // ... and build the object return Build( false ); } @@ -659,9 +659,10 @@ SPlot2d_Curve* VISU::Curve_i::CreatePresentation() SALOMEDS::Color color = GetColor(); crv->setColor( QColor( (int)(color.R*255.), (int)(color.G*255.), (int)(color.B*255.) ) ); crv->setAutoAssign( IsAuto() ); - crv->setIO(new SALOME_InteractiveObject(mySObj->GetID(),"VISU",GetName())); + CORBA::String_var aString = mySObj->GetID(); + crv->setIO(new SALOME_InteractiveObject(aString.in(), "VISU", GetName().c_str())); if ( myTable ) - crv->setTableIO(new SALOME_InteractiveObject(myTable->GetObjectEntry(),"VISU",myTable->GetName())); + crv->setTableIO(new SALOME_InteractiveObject(myTable->GetObjectEntry(), "VISU", myTable->GetName().c_str())); return crv; } /*! @@ -671,7 +672,7 @@ VISU::Storable* VISU::Curve_i::Restore( const Storable::TRestoringMap& theMap, S { if(MYDEBUG) MESSAGE(GetComment()); mySObj = SALOMEDS::SObject::_duplicate(theSO); - myName = VISU::Storable::FindValue(theMap,"myName").latin1(); + SetName(VISU::Storable::FindValue(theMap,"myName").latin1()); myHRow = VISU::Storable::FindValue(theMap,"myHRow").toInt(); myVRow = VISU::Storable::FindValue(theMap,"myVRow").toInt(); bool ok = false; @@ -692,7 +693,7 @@ VISU::Storable* VISU::Curve_i::Restore( const Storable::TRestoringMap& theMap, S */ void VISU::Curve_i::ToStream( std::ostringstream& theStr ) { - Storable::DataToStream( theStr, "myName", myName.c_str() ); + Storable::DataToStream( theStr, "myName", GetName().c_str() ); Storable::DataToStream( theStr, "myHRow", myHRow ); Storable::DataToStream( theStr, "myVRow", myVRow ); Storable::DataToStream( theStr, "myZRow", myZRow ); @@ -792,7 +793,7 @@ void VISU::Container_i::AddCurve( Curve_ptr theCurve ) { if ( GetStudyDocument()->_is_nil() ) return; - SALOMEDS::SObject_var mySO = GetStudyDocument()->FindObjectID( GetEntry() ); + SALOMEDS::SObject_var mySO = GetStudyDocument()->FindObjectID( GetEntry().c_str() ); if ( mySO->_is_nil() ) return; PortableServer::POA_ptr aPOA = GetPOA(); @@ -815,7 +816,7 @@ void VISU::Container_i::RemoveCurve( Curve_ptr theCurve ) { if ( GetStudyDocument()->_is_nil() ) return; - SALOMEDS::SObject_var mySO = GetStudyDocument()->FindObjectID( GetEntry() ); + SALOMEDS::SObject_var mySO = GetStudyDocument()->FindObjectID( GetEntry().c_str() ); if ( mySO->_is_nil() ) return; PortableServer::POA_ptr aPOA = GetPOA(); @@ -852,7 +853,7 @@ void VISU::Container_i::Clear() { if ( GetStudyDocument()->_is_nil() ) return; - SALOMEDS::SObject_var mySO = GetStudyDocument()->FindObjectID( GetEntry() ); + SALOMEDS::SObject_var mySO = GetStudyDocument()->FindObjectID( GetEntry().c_str() ); if ( mySO->_is_nil() ) return; QStringList toDelete; @@ -873,7 +874,7 @@ void VISU::Container_i::Clear() VISU::Storable* VISU::Container_i::Create() { // generate name ... - myName = GenerateName(); + SetName(GenerateName()); // ... and build the object return Build( false ); } @@ -908,7 +909,7 @@ void VISU::Container_i::Update() if ( GetStudyDocument()->_is_nil() ) return; SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder(); - SALOMEDS::SObject_var mySO = GetStudyDocument()->FindObjectID( GetEntry() ); + SALOMEDS::SObject_var mySO = GetStudyDocument()->FindObjectID( GetEntry().c_str() ); SALOMEDS::GenericAttribute_var anAttr; if ( !mySO->_is_nil() ) { QStringList toDelete; @@ -988,7 +989,7 @@ VISU::Storable* VISU::Container_i::Restore( const Storable::TRestoringMap& theMa { if(MYDEBUG) MESSAGE(GetComment()); mySObj = SALOMEDS::SObject::_duplicate(SO); - myName = VISU::Storable::FindValue( theMap, "myName" ).latin1(); + SetName(VISU::Storable::FindValue( theMap, "myName" ).latin1()); QString val = VISU::Storable::FindValue( theMap, "myCurves" ); myCurves = QStringList::split( QString( "*" ), val, false ); return Build( true ); @@ -998,7 +999,7 @@ VISU::Storable* VISU::Container_i::Restore( const Storable::TRestoringMap& theMa */ void VISU::Container_i::ToStream( std::ostringstream& theStr ) { - Storable::DataToStream( theStr, "myName", myName.c_str() ); + Storable::DataToStream( theStr, "myName", GetName().c_str() ); Storable::DataToStream( theStr, "myCurves", myCurves.join( QString( "*" ) ) ); // theStr<<" myName "<(clist.at(i)); if (aSPlot2dC->hasIO() && - !strcmp(aSPlot2dC->getIO()->getEntry(), theCurve->GetEntry())) { + theCurve->GetEntry() != aSPlot2dC->getIO()->getEntry()) { if(MYDEBUG) MESSAGE("UpdatePlot2d - erasing : curve - " << aSPlot2dC); theView->eraseCurve(aSPlot2dC); } @@ -352,7 +352,7 @@ namespace VISU { for (int i = 0; i < clist.count(); i++) { SPlot2d_Curve* aSPlot2dC = dynamic_cast(clist.at(i)); if (aSPlot2dC->hasIO() && - !strcmp(aSPlot2dC->getIO()->getEntry(), theCurve->GetEntry())) { + theCurve->GetEntry() != aSPlot2dC->getIO()->getEntry()) { if(MYDEBUG) MESSAGE("UpdatePlot2d - displaying : curve - " << aSPlot2dC); aSPlot2dC->setHorTitle( theCurve->GetHorTitle().c_str() ); aSPlot2dC->setVerTitle( theCurve->GetVerTitle().c_str() ); @@ -401,7 +401,7 @@ namespace VISU { for (int i = 0; i < clist.count(); i++) { SPlot2d_Curve* aSPlot2dC = dynamic_cast(clist.at(i)); if (aSPlot2dC->hasIO() && - !strcmp(aSPlot2dC->getIO()->getEntry(), theCurve->GetEntry())) { + theCurve->GetEntry() != aSPlot2dC->getIO()->getEntry()) { if(MYDEBUG) MESSAGE("UpdatePlot2d - displaying only : curve - " << aSPlot2dC); aSPlot2dC->setHorTitle( theCurve->GetHorTitle().c_str() ); aSPlot2dC->setVerTitle( theCurve->GetVerTitle().c_str() ); @@ -530,7 +530,7 @@ namespace VISU { for (int i = 0; i < clist.count(); i++) { if (SPlot2d_Curve* cu = dynamic_cast(clist.at(i))) { if (cu->hasIO() && - strcmp(cu->getIO()->getEntry(), myPrs->GetEntry()) == 0) { + myPrs->GetEntry() == cu->getIO()->getEntry()) { vf->eraseCurve(cu); } } diff --git a/src/VISU_I/VISU_View_i.cc b/src/VISU_I/VISU_View_i.cc index 1553fe8d..ef63c4c9 100644 --- a/src/VISU_I/VISU_View_i.cc +++ b/src/VISU_I/VISU_View_i.cc @@ -1286,7 +1286,7 @@ namespace VISU { } } if (!aCStudy) return; - _PTR(SObject) TableSO = aCStudy->FindObjectID(aTable->GetEntry().latin1()); + _PTR(SObject) TableSO = aCStudy->FindObjectID(aTable->GetEntry()); if (TableSO) { _PTR(ChildIterator) Iter = aCStudy->NewChildIterator(TableSO); for (; Iter->More(); Iter->Next()) { diff --git a/src/VISU_SWIG/visu_cache.py b/src/VISU_SWIG/visu_cache.py index cc90e55d..9f8268bd 100644 --- a/src/VISU_SWIG/visu_cache.py +++ b/src/VISU_SWIG/visu_cache.py @@ -60,7 +60,7 @@ PRS3D_TYPE_LIST.append(VISU.TSCALARMAPONDEFORMEDSHAPE) #--------------------------------------------------------------- aMedFile = "TimeStamps.med" -aMedFile = "ResOK_0000.med" +#aMedFile = "ResOK_0000.med" aMedFile = os.getenv('DATA_DIR') + '/MedFiles/' + aMedFile aResult = myVisu.ImportFile(aMedFile) @@ -75,10 +75,12 @@ aViewManager = myVisu.GetViewManager(); WalkTroughTimeStamps(VISU.TSCALARMAP, anInput, aViewManager) -for aVISUType in PRS3D_TYPE_LIST: - WalkTroughTimeStamps(aVISUType, anInput, aViewManager) - pass +#for aVISUType in PRS3D_TYPE_LIST: +# WalkTroughTimeStamps(aVISUType, anInput, aViewManager) +# pass +# +#anInput.myEntity = VISU.CELL; +#anInput.myFieldName = "pression"; +#WalkTroughTimeStamps(VISU.TGAUSSPOINTS, anInput, aViewManager) -anInput.myEntity = VISU.CELL; -anInput.myFieldName = "pression"; -WalkTroughTimeStamps(VISU.TGAUSSPOINTS, anInput, aViewManager) +#execfile('/data/apo/a.py') \ No newline at end of file