From: apo Date: Fri, 24 Nov 2006 13:48:15 +0000 (+0000) Subject: Tune holder presentations creation X-Git-Tag: WP1_2_3_05-12-2006_cache_system~66 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=569dddb77cc6997d2b95487ee39529d80ffa0386;p=modules%2Fvisu.git Tune holder presentations creation --- diff --git a/src/VISU_I/VISU_ColoredPrs3dCache_i.cc b/src/VISU_I/VISU_ColoredPrs3dCache_i.cc index dd16a331..a6ef3c79 100644 --- a/src/VISU_I/VISU_ColoredPrs3dCache_i.cc +++ b/src/VISU_I/VISU_ColoredPrs3dCache_i.cc @@ -85,45 +85,51 @@ VISU::ColoredPrs3dCache_i //---------------------------------------------------------------------------- +template int -VISU::ColoredPrs3dCache_i -::IsPossible(VISU::VISUType theType, - const VISU::ColoredPrs3dHolder::BasicInput& theInput) +CheckIsPossible(const VISU::ColoredPrs3dHolder::BasicInput& theInput) { - //cout << "VISU::ColoredPrs3dCache_i::IsPossible " << endl; VISU::Result_i* aResult = dynamic_cast( VISU::GetServant(theInput.myResult).in() ); std::string aMeshName = theInput.myMeshName.in(); VISU::Entity anEntity = theInput.myEntity; std::string aFieldName = theInput.myFieldName.in(); - long aTimeStampNumber = theInput.myTimeStampNumber; - - bool ok = 0; - switch( theType ){ - case TSCALARMAP: ok = VISU::ScalarMap_i::IsPossible(aResult,aMeshName,anEntity,aFieldName,aTimeStampNumber); - break; - case TISOSURFACE: ok = VISU::IsoSurfaces_i::IsPossible(aResult,aMeshName,anEntity,aFieldName,aTimeStampNumber); - break; - case TDEFORMEDSHAPE: ok = VISU::DeformedShape_i::IsPossible(aResult,aMeshName,anEntity,aFieldName,aTimeStampNumber); - break; - case TSCALARMAPONDEFORMEDSHAPE: ok = VISU::ScalarMapOnDeformedShape_i::IsPossible(aResult,aMeshName,anEntity,aFieldName,aTimeStampNumber); - break; - case TGAUSSPOINTS: ok = VISU::GaussPoints_i::IsPossible(aResult,aMeshName,anEntity,aFieldName,aTimeStampNumber); - break; - case TPLOT3D: ok = VISU::Plot3D_i::IsPossible(aResult,aMeshName,anEntity,aFieldName,aTimeStampNumber); - break; - case TCUTPLANES: ok = VISU::CutPlanes_i::IsPossible(aResult,aMeshName,anEntity,aFieldName,aTimeStampNumber); - break; - case TCUTLINES: ok = VISU::CutLines_i::IsPossible(aResult,aMeshName,anEntity,aFieldName,aTimeStampNumber); - break; - case TVECTORS: ok = VISU::Vectors_i::IsPossible(aResult,aMeshName,anEntity,aFieldName,aTimeStampNumber); - break; - case TSTREAMLINES: ok = VISU::StreamLines_i::IsPossible(aResult,aMeshName,anEntity,aFieldName,aTimeStampNumber); - break; - default: break; + CORBA::Long aTimeStampNumber = theInput.myTimeStampNumber; + + typedef typename VISU::TL::TColoredEnum2Type::TResult TColoredPrs3d; + return TColoredPrs3d::IsPossible(aResult,aMeshName,anEntity,aFieldName,aTimeStampNumber); +} + +//---------------------------------------------------------------------------- +int +VISU::ColoredPrs3dCache_i +::IsPossible(VISU::VISUType theType, + const VISU::ColoredPrs3dHolder::BasicInput& theInput) +{ + //cout << "VISU::ColoredPrs3dCache_i::IsPossible " << endl; + switch(theType){ + case TSCALARMAP: + return CheckIsPossible(theInput); + case TGAUSSPOINTS: + return CheckIsPossible(theInput); + case TDEFORMEDSHAPE: + return CheckIsPossible(theInput); + case TSCALARMAPONDEFORMEDSHAPE: + return CheckIsPossible(theInput); + case TISOSURFACE: + return CheckIsPossible(theInput); + case TSTREAMLINES: + return CheckIsPossible(theInput); + case TPLOT3D: + return CheckIsPossible(theInput); + case TCUTPLANES: + return CheckIsPossible(theInput); + case TCUTLINES: + return CheckIsPossible(theInput); + case TVECTORS: + return CheckIsPossible(theInput); } - //cout << "returned " << ok << endl; - return ok; + return 0; } @@ -164,7 +170,11 @@ VISU::ColoredPrs3dCache_i if(IsPossible(theType, theInput)) { VISU::ColoredPrs3dHolder_i* aHolder = new VISU::ColoredPrs3dHolder_i(theType, theInput, *this); - CreatePrs(theType, theInput, aHolder); + VISU::ColoredPrs3d_i* aColoredPrs3d = CreateColoredPrs3d(theType, theInput); + std::string aComment = std::string("myComment=") + aColoredPrs3d->GetComment(); + std::string aName = aColoredPrs3d->GenerateName().latin1(); + aHolder->PublishInStudy(aName, aComment); + RegisterInHolder(aColoredPrs3d, aHolder); return aHolder->_this(); } return VISU::ColoredPrs3dHolder::_nil(); @@ -212,7 +222,7 @@ std::string VISU::ColoredPrs3dCache_i ::GetFolderName() { - return "Cache"; + return "3D Cache System"; } void @@ -260,25 +270,43 @@ CreateHolder2GetDeviceByEnum(VISU::VISUType theType, //---------------------------------------------------------------------------- VISU::ColoredPrs3d_i* VISU::ColoredPrs3dCache_i -::CreatePrs(VISU::VISUType theType, - VISU::ColoredPrs3dHolder::BasicInput theInput, - VISU::ColoredPrs3dHolder_i* theHolder) +::CreateColoredPrs3d(VISU::VISUType theType, + VISU::ColoredPrs3dHolder::BasicInput theInput) { VISU::ColoredPrs3d_i* aPrs3d = VISU::CreatePrs3d_i(theType, GetStudyDocument(), ColoredPrs3d_i::ERegisterInCache); - aPrs3d->SetHolderEntry( theHolder->GetEntry() ); aPrs3d->SetResultObject( theInput.myResult ); aPrs3d->SetMeshName( theInput.myMeshName ); aPrs3d->SetEntity( theInput.myEntity ); aPrs3d->SetFieldName( theInput.myFieldName ); aPrs3d->SetTimeStampNumber( theInput.myTimeStampNumber ); aPrs3d->Apply(); - - GetLastVisitedPrsList(theHolder).push_back(aPrs3d); - return aPrs3d; } +//---------------------------------------------------------------------------- +VISU::ColoredPrs3d_i* +VISU::ColoredPrs3dCache_i +::RegisterInHolder(VISU::ColoredPrs3d_i* thePrs3d, + VISU::ColoredPrs3dHolder_i* theHolder) +{ + thePrs3d->SetHolderEntry( theHolder->GetEntry() ); + GetLastVisitedPrsList(theHolder).push_back(thePrs3d); + return thePrs3d; +} + + +//---------------------------------------------------------------------------- +VISU::ColoredPrs3d_i* +VISU::ColoredPrs3dCache_i +::CreatePrs(VISU::VISUType theType, + VISU::ColoredPrs3dHolder::BasicInput theInput, + VISU::ColoredPrs3dHolder_i* theHolder) +{ + return RegisterInHolder(CreateColoredPrs3d(theType, theInput), theHolder); +} + + //---------------------------------------------------------------------------- VISU::TLastVisitedPrsList& VISU::ColoredPrs3dCache_i diff --git a/src/VISU_I/VISU_ColoredPrs3dCache_i.hh b/src/VISU_I/VISU_ColoredPrs3dCache_i.hh index b4b970c9..4eb1f3cb 100644 --- a/src/VISU_I/VISU_ColoredPrs3dCache_i.hh +++ b/src/VISU_I/VISU_ColoredPrs3dCache_i.hh @@ -127,6 +127,17 @@ namespace VISU VISU::ColoredPrs3dCache_ptr GetInstance(SALOMEDS::Study_ptr theStudy); + //! Creates corresponding ColoredPrs3d instance and apply the BasicInput + VISU::ColoredPrs3d_i* + CreateColoredPrs3d(VISU::VISUType theType, + VISU::ColoredPrs3dHolder::BasicInput theInput); + + //! Registers the given ColoredPrs3d instance for the ColoredPrs3dHolder + VISU::ColoredPrs3d_i* + RegisterInHolder(VISU::ColoredPrs3d_i* thePrs3d, + VISU::ColoredPrs3dHolder_i* theHolder); + + //! Creates and registers corresponding ColoredPrs3d instance for the ColoredPrs3dHolder VISU::ColoredPrs3d_i* CreatePrs(VISU::VISUType theType, VISU::ColoredPrs3dHolder::BasicInput theInput, diff --git a/src/VISU_I/VISU_ColoredPrs3dHolder_i.cc b/src/VISU_I/VISU_ColoredPrs3dHolder_i.cc index e67888aa..5825e08b 100644 --- a/src/VISU_I/VISU_ColoredPrs3dHolder_i.cc +++ b/src/VISU_I/VISU_ColoredPrs3dHolder_i.cc @@ -69,27 +69,6 @@ VISU::ColoredPrs3dHolder_i myCache(theCache) { if(MYDEBUG) MESSAGE("ColoredPrs3dHolder_i::ColoredPrs3dHolder_i - this = "<setEntry(myHolderEntry.c_str()); - return anIO; -} - //---------------------------------------------------------------------------- CORBA::Boolean VISU::ColoredPrs3d_i diff --git a/src/VISU_I/VISU_ColoredPrs3d_i.hh b/src/VISU_I/VISU_ColoredPrs3d_i.hh index eb46188e..19ad5515 100644 --- a/src/VISU_I/VISU_ColoredPrs3d_i.hh +++ b/src/VISU_I/VISU_ColoredPrs3d_i.hh @@ -227,12 +227,6 @@ namespace VISU void SetHolderEntry(const std::string& theEntry); - //---------------------------------------------------------------------------- - //! Create and return the interactive object - virtual - Handle(SALOME_InteractiveObject) - GetIO(); - //---------------------------------------------------------------------------- public: /*! diff --git a/src/VISU_I/VISU_Prs3d_i.cc b/src/VISU_I/VISU_Prs3d_i.cc index 126ad995..1ac89d41 100644 --- a/src/VISU_I/VISU_Prs3d_i.cc +++ b/src/VISU_I/VISU_Prs3d_i.cc @@ -395,6 +395,14 @@ VISU::Prs3d_i return myIO; } +//---------------------------------------------------------------------------- +void +VISU::Prs3d_i +::SetIO(const Handle(SALOME_InteractiveObject)& theIO) +{ + myIO = theIO; +} + //---------------------------------------------------------------------------- void VISU::Prs3d_i diff --git a/src/VISU_I/VISU_Prs3d_i.hh b/src/VISU_I/VISU_Prs3d_i.hh index ce9415d7..3afc8c0f 100644 --- a/src/VISU_I/VISU_Prs3d_i.hh +++ b/src/VISU_I/VISU_Prs3d_i.hh @@ -273,6 +273,9 @@ namespace VISU void SetSObject(SALOMEDS::SObject_var theSObject); + void + SetIO(const Handle(SALOME_InteractiveObject)& theIO); + protected: vtkTimeStamp myUpdateTime; vtkTimeStamp myParamsTime;