From: ouv Date: Fri, 12 Jan 2007 15:24:56 +0000 (+0000) Subject: DumpPytnon X-Git-Tag: T_before_integration_15-01-2007 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=172472d70ed4c7fa4efe06261d8607840b100621;p=modules%2Fvisu.git DumpPytnon --- diff --git a/src/VISU_I/VISU_ColoredPrs3dCache_i.cc b/src/VISU_I/VISU_ColoredPrs3dCache_i.cc index 07fbb5bf..9d285a70 100644 --- a/src/VISU_I/VISU_ColoredPrs3dCache_i.cc +++ b/src/VISU_I/VISU_ColoredPrs3dCache_i.cc @@ -35,6 +35,8 @@ #include "VISU_PipeLine.hxx" +#include "SALOME_Event.hxx" + #include "VTKViewer_Algorithm.h" #include "SVTK_Functor.h" @@ -386,6 +388,7 @@ VISU::ColoredPrs3dCache_i ::CreateHolder(VISU::VISUType theType, const VISU::ColoredPrs3dHolder::BasicInput& theInput) { + if(MYDEBUG) cout << "CreateHolder " << theType << endl; CORBA::Float aRequiredMemory = 0.0; if(IsPossible(theType, theInput, aRequiredMemory, "")){ VISU::ColoredPrs3dHolder_i* aHolder = new VISU::ColoredPrs3dHolder_i(*this); @@ -491,6 +494,7 @@ VISU::ColoredPrs3dCache_i ::RegisterInHolder(VISU::ColoredPrs3d_i* thePrs3d, const std::string& theHolderEntry) { + if(MYDEBUG) cout << "RegisterInHolder " << theHolderEntry.c_str() << " " << thePrs3d << endl; TPrs3dPtr aPrs3d(thePrs3d); myHolderMap[theHolderEntry].push_front(aPrs3d); thePrs3d->SetHolderEntry( theHolderEntry ); @@ -526,6 +530,7 @@ VISU::ColoredPrs3dCache_i ::GetLastVisitedPrs(VISU::ColoredPrs3dHolder_i* theHolder) { const TLastVisitedPrsList& aList = GetLastVisitedPrsList(theHolder); + if(MYDEBUG) cout << "GetLastVisitedPrs " << theHolder->GetEntry().c_str() << " " << aList.size() << endl; if( !aList.empty() ) return aList.front(); return VISU::TPrs3dPtr(); @@ -551,6 +556,53 @@ VISU::ColoredPrs3dCache_i return VISU::TPrs3dPtr(); } +struct TFindActorEvent: public SALOME_Event +{ + VISU::TPrs3dPtr myPrs3d; + SVTK_ViewWindow* myViewWindow; + + typedef VISU_Actor* TResult; + TResult myResult; + + TFindActorEvent(VISU::TPrs3dPtr thePrs3d, SVTK_ViewWindow* theViewWindow): + myPrs3d(thePrs3d), + myViewWindow(theViewWindow), + myResult(NULL) + {} + + virtual + void + Execute() + { + myResult = VISU::FindActor(myViewWindow, myPrs3d); + } +}; + +struct TAddActorEvent: public SALOME_Event +{ + VISU_Actor* myActor; + SVTK_ViewWindow* myViewWindow; +public: + TAddActorEvent(VISU_Actor* theActor, SVTK_ViewWindow* theViewWindow): + myActor(theActor), + myViewWindow(theViewWindow) + {} + virtual void Execute(){ + myViewWindow->AddActor(myActor); + } +}; + +struct TRenderEvent: public SALOME_Event +{ + SVTK_ViewWindow* myViewWindow; +public: + TRenderEvent(SVTK_ViewWindow* theViewWindow): + myViewWindow(theViewWindow) + {} + virtual void Execute(){ + myViewWindow->getRenderWindow()->Render(); + } +}; //---------------------------------------------------------------------------- bool @@ -563,12 +615,12 @@ VISU::ColoredPrs3dCache_i if(MYDEBUG) cout << "VISU::ColoredPrs3dCache_i::UpdateLastVisitedPrs" << endl; TPrs3dPtr aLastVisitedPrs3d = GetLastVisitedPrs(theHolder); TLastVisitedPrsList& aLastVisitedPrsList = GetLastVisitedPrsList(theHolder); - TPrs3dPtr aPrs3d = FindPrsByInput(aLastVisitedPrsList, theInput); + TPrs3dPtr aPrs3d; bool anIsCheckPossible = GetMemoryMode() == VISU::ColoredPrs3dCache::LIMITED; std::string aHolderEntry = theHolder->GetEntry(); VISU::VISUType aPrsType = theHolder->GetPrsType(); CORBA::Float aRequiredMemory = 0.0; - if(aPrs3d){ + if(aPrs3d = FindPrsByInput(aLastVisitedPrsList, theInput)){ aLastVisitedPrsList.push_front(aPrs3d); if(MYDEBUG) cout << "FindPrsByInput " << aPrs3d << endl; }else if(anIsCheckPossible && IsPossible(aPrsType, theInput, aRequiredMemory, aHolderEntry)){ @@ -597,28 +649,43 @@ VISU::ColoredPrs3dCache_i if(SUIT_ViewWindow* aView = aView3d->GetViewWindow()){ if(SVTK_ViewWindow* aViewWindow = dynamic_cast(aView)){ // Find actor that corresponds to the holder - VISU_Actor* anActor = VISU::FindActor(aViewWindow, aLastVisitedPrs3d); + VISU_Actor* anActor = ProcessEvent(new TFindActorEvent(aLastVisitedPrs3d,aViewWindow)); + //VISU_Actor* anActor = VISU::FindActor(aViewWindow, aLastVisitedPrs3d); // If the holder was erased from view then do nothing - if(!anActor || !anActor->GetVisibility()) + if(anActor && !anActor->GetVisibility()) return true; - if(aPrs3d != aLastVisitedPrs3d){ + if(!anActor) + { + anActor = aLastVisitedPrs3d->CreateActor(); + ProcessVoidEvent(new TAddActorEvent(anActor,aViewWindow)); + //aViewWindow->AddActor(anActor); + anActor->SetVisibility(true); + } + + if(aPrs3d != aLastVisitedPrs3d) + { // To erase non active presentation aLastVisitedPrs3d->SetActiveState(false); - anActor->SetVisibility(false); + if(anActor) + anActor->SetVisibility(false); + // To find the new one that corresponds to fresh presentation - VISU_Actor* aNewActor = VISU::FindActor(aViewWindow, aPrs3d); + VISU_Actor* aNewActor = ProcessEvent(new TFindActorEvent(aPrs3d,aViewWindow)); + //VISU_Actor* aNewActor = VISU::FindActor(aViewWindow, aPrs3d); if(!aNewActor){ aNewActor = aPrs3d->CreateActor(); - aViewWindow->AddActor(aNewActor); + ProcessVoidEvent(new TAddActorEvent(aNewActor,aViewWindow)); + //aViewWindow->AddActor(aNewActor); }else aNewActor->SetVisibility(true); aNewActor->DeepCopy(anActor); + aPrs3d->SetActiveState(true); - //aLastVisitedPrs3d->RemoveActors(); } - aViewWindow->getRenderWindow()->Render(); + ProcessVoidEvent(new TRenderEvent(aViewWindow)); + //aViewWindow->getRenderWindow()->Render(); return true; } } diff --git a/src/VISU_I/VISU_ColoredPrs3dCache_i.hh b/src/VISU_I/VISU_ColoredPrs3dCache_i.hh index 56ab4a22..8017b59b 100644 --- a/src/VISU_I/VISU_ColoredPrs3dCache_i.hh +++ b/src/VISU_I/VISU_ColoredPrs3dCache_i.hh @@ -240,6 +240,9 @@ namespace VISU void RemoveHolder(VISU::ColoredPrs3dHolder_i* theHolder); + TColoredPrs3dHolderMap + GetHolderMap() { return myHolderMap; } + public: static const std::string myComment; diff --git a/src/VISU_I/VISU_ColoredPrs3dHolder_i.cc b/src/VISU_I/VISU_ColoredPrs3dHolder_i.cc index 32b2bc39..cefa3e48 100644 --- a/src/VISU_I/VISU_ColoredPrs3dHolder_i.cc +++ b/src/VISU_I/VISU_ColoredPrs3dHolder_i.cc @@ -29,6 +29,8 @@ #include "VISU_ColoredPrs3dCache_i.hh" #include "VISU_ColoredPrs3d_i.hh" +#include "SALOME_Event.hxx" + using namespace VISU; using namespace std; @@ -90,6 +92,38 @@ VISU::ColoredPrs3dHolder_i CreateAttributes(GetStudyDocument(), aFatherEntry, "", anIOR.in(), GetName(), "", theComment, true); } +//---------------------------------------------------------------------------- +struct TApplyEvent: public SALOME_Event +{ + VISU::ColoredPrs3dCache_i& myCache; + VISU::ColoredPrs3dHolder_i* myHolder; + VISU::ColoredPrs3d_i* myPrs3d; + VISU::ColoredPrs3dHolder::BasicInput myInput; + VISU::View3D_ptr myView3D; + + typedef CORBA::Boolean TResult; + TResult myResult; + + TApplyEvent(VISU::ColoredPrs3dCache_i& theCache, + VISU::ColoredPrs3dHolder_i* theHolder, + VISU::ColoredPrs3d_i* thePrs3d, + VISU::ColoredPrs3dHolder::BasicInput theInput, + VISU::View3D_ptr theView3D): + myCache(theCache), + myHolder(theHolder), + myPrs3d(thePrs3d), + myInput(theInput), + myView3D(theView3D) + {} + + virtual + void + Execute() + { + myResult = myCache.UpdateLastVisitedPrs(myHolder, myPrs3d, myInput, myView3D); + } +}; + //---------------------------------------------------------------------------- CORBA::Boolean VISU::ColoredPrs3dHolder_i @@ -97,8 +131,10 @@ VISU::ColoredPrs3dHolder_i const VISU::ColoredPrs3dHolder::BasicInput& theInput, VISU::View3D_ptr theView3D) { + VISU::ColoredPrs3d_i* aPrs3d = dynamic_cast( VISU::GetServant(thePrs3d).in() ); - return myCache.UpdateLastVisitedPrs(this, aPrs3d, theInput, theView3D); + return ProcessEvent(new TApplyEvent(myCache, this, aPrs3d, theInput, theView3D)); + //return myCache.UpdateLastVisitedPrs(this, aPrs3d, theInput, theView3D); } //---------------------------------------------------------------------------- diff --git a/src/VISU_I/VISU_DumpPython.cc b/src/VISU_I/VISU_DumpPython.cc index fe78c72a..c2e892a0 100644 --- a/src/VISU_I/VISU_DumpPython.cc +++ b/src/VISU_I/VISU_DumpPython.cc @@ -41,6 +41,8 @@ #include "VISU_Table_i.hh" #include "VISU_GaussPoints_i.hh" #include "VISU_ScalarMapOnDeformedShape_i.hh" +#include "VISU_ColoredPrs3dCache_i.hh" +#include "VISU_ColoredPrs3dHolder_i.hh" #include "utilities.h" @@ -59,6 +61,8 @@ namespace VISU { static std::string PREFIX(" "); + static std::string aResultName; + typedef std::map TName2EntryMap; typedef std::map TEntry2NameMap; @@ -526,6 +530,7 @@ namespace VISU switch(aType){ case VISU::TRESULT: if(Result_i* aServant = dynamic_cast(GetServant(anObj).in())){ + aResultName = aName; std::string aFileName = aServant->GetFileName(); Result_i::ECreationId anId = aServant->GetCreationId(); if(anId == Result_i::eImportFile || anId == Result_i::eCopyAndImportFile){ @@ -1096,6 +1101,36 @@ namespace VISU } } return; + case VISU::TCOLOREDPRS3DCACHE: + if(ColoredPrs3dCache_i* aServant = dynamic_cast(GetServant(anObj).in())){ + theStr<GetHolderMap(); + TColoredPrs3dHolderMap::const_iterator aHolderIter = aHolderMap.begin(); + TColoredPrs3dHolderMap::const_iterator aHolderIterEnd = aHolderMap.end(); + for(; aHolderIter != aHolderIterEnd; aHolderIter++){ + const TLastVisitedPrsList& aPrsList = aHolderIter->second; + if(TPrs3dPtr aPrs3d = aPrsList.front()) + { + ColoredPrs3dHolder::BasicInput_var anInput = aPrs3d->GetBasicInput(); + + std::string anEntity; + switch(anInput->myEntity){ + case VISU::NODE : anEntity = "VISU.NODE"; break; + case VISU::EDGE : anEntity = "VISU.EDGE"; break; + case VISU::FACE : anEntity = "VISU.FACE"; break; + case VISU::CELL : anEntity = "VISU.CELL"; break; + } + + theStr<myMeshName<<"',"<myFieldName<<"',"<myTimeStampNumber<<")"<GetComment(); + theStr<