From: apo Date: Mon, 27 Nov 2006 07:01:23 +0000 (+0000) Subject: To move Holder dependant factory methods to Factory header file X-Git-Tag: WP1_2_3_05-12-2006_cache_system~60 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4ede48019bc7f3f35521789f150c8e3ee87e9e40;p=modules%2Fvisu.git To move Holder dependant factory methods to Factory header file --- diff --git a/src/VISUGUI/VisuGUI_CacheDlg.h b/src/VISUGUI/VisuGUI_CacheDlg.h index aea2afe6..77e51ad9 100644 --- a/src/VISUGUI/VisuGUI_CacheDlg.h +++ b/src/VISUGUI/VisuGUI_CacheDlg.h @@ -35,11 +35,6 @@ class QSpinBox; class SalomeApp_Module; -namespace VISU -{ - class ColoredPrs3dCache_i; -} - class VisuGUI_CacheDlg : public QDialog { Q_OBJECT diff --git a/src/VISUGUI/VisuGUI_Prs3dTools.h b/src/VISUGUI/VisuGUI_Prs3dTools.h index f6029722..20306499 100644 --- a/src/VISUGUI/VisuGUI_Prs3dTools.h +++ b/src/VISUGUI/VisuGUI_Prs3dTools.h @@ -32,7 +32,6 @@ #include "VisuGUI_Tools.h" #include "VisuGUI_ViewTools.h" #include "VISU_ColoredPrs3dFactory.hh" -#include "VISU_ColoredPrs3dCache_i.hh" #include diff --git a/src/VISU_I/VISU_ColoredPrs3dCache_i.cc b/src/VISU_I/VISU_ColoredPrs3dCache_i.cc index 5a18f0be..61c8c4a3 100644 --- a/src/VISU_I/VISU_ColoredPrs3dCache_i.cc +++ b/src/VISU_I/VISU_ColoredPrs3dCache_i.cc @@ -277,39 +277,6 @@ VISU::ColoredPrs3dCache_i return this; } -//---------------------------------------------------------------------------- -VISU::ColoredPrs3d_i* -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* 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); - - if( CORBA::is_nil(aHolder) ) - return NULL; - - VISU::ColoredPrs3d_var aPrs3d = aHolder->GetDevice(); - aColoredPrs3d = dynamic_cast(GetServant(aPrs3d).in()); - } - return aColoredPrs3d; -} - - //---------------------------------------------------------------------------- VISU::ColoredPrs3d_i* VISU::ColoredPrs3dCache_i diff --git a/src/VISU_I/VISU_ColoredPrs3dCache_i.hh b/src/VISU_I/VISU_ColoredPrs3dCache_i.hh index 4eb1f3cb..2c3d32d5 100644 --- a/src/VISU_I/VISU_ColoredPrs3dCache_i.hh +++ b/src/VISU_I/VISU_ColoredPrs3dCache_i.hh @@ -173,38 +173,8 @@ namespace VISU 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 index 456d5ea5..4c5afcc5 100644 --- a/src/VISU_I/VISU_ColoredPrs3dFactory.cc +++ b/src/VISU_I/VISU_ColoredPrs3dFactory.cc @@ -25,6 +25,7 @@ // Module : VISU #include "VISU_ColoredPrs3dFactory.hh" +#include "VISU_ColoredPrs3dCache_i.hh" #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 #define NO_CAS_CATCH @@ -129,5 +130,39 @@ namespace VISU } return NULL; } + + + //---------------------------------------------------------------------------- + VISU::ColoredPrs3d_i* + 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* 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); + + if( CORBA::is_nil(aHolder) ) + return NULL; + + VISU::ColoredPrs3d_var aPrs3d = aHolder->GetDevice(); + aColoredPrs3d = dynamic_cast(GetServant(aPrs3d).in()); + } + return aColoredPrs3d; + } + + //---------------------------------------------------------------------------- } diff --git a/src/VISU_I/VISU_ColoredPrs3dFactory.hh b/src/VISU_I/VISU_ColoredPrs3dFactory.hh index 3dac4d94..b631d479 100644 --- a/src/VISU_I/VISU_ColoredPrs3dFactory.hh +++ b/src/VISU_I/VISU_ColoredPrs3dFactory.hh @@ -244,6 +244,41 @@ namespace VISU typedef typename TPrs3d_i::TInterface TPrs3d; return TPrs3d::_nil(); } + + + //---------------------------------------------------------------------------- + //! 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 theTimeStampNumber); + + + //---------------------------------------------------------------------------- + //! 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 theTimeStampNumber) + { + typedef typename TL::TColoredType2Enum::TResult TEnum; + VISU::VISUType aColoredPrs3dType = VISU::VISUType(TEnum::value); + ColoredPrs3d_i* aColoredPrs3d = CreateHolder2GetDeviceByEnum(aColoredPrs3dType, + theResult, + theMeshName, + theEntity, + theFieldName, + theTimeStampNumber); + return dynamic_cast(aColoredPrs3d); + } + + //---------------------------------------------------------------------------- }