//---------------------------------------------------------------
struct TGetStudyEvent: public SALOME_Event
{
- int myStudyId;
+ SALOMEDS::Study_var myStudy;
- typedef _PTR(Study) TResult;
+ typedef SalomeApp_Study* TResult;
TResult myResult;
- TGetStudyEvent(int theStudyId):
- myStudyId(theStudyId)
+ TGetStudyEvent(SALOMEDS::Study_ptr theStudy):
+ myStudy(SALOMEDS::Study::_duplicate(theStudy)),
+ myResult(NULL)
{}
virtual
void
Execute()
{
+ if(CORBA::is_nil(myStudy))
+ return;
+
+ int aStudyId = myStudy->StudyId();
SUIT_Session* aSession = SUIT_Session::session();
QPtrList<SUIT_Application> anApplications = aSession->applications();
QPtrListIterator<SUIT_Application> anIter (anApplications);
if (SUIT_Study* aSStudy = anApp->activeStudy()) {
if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy)) {
if (_PTR(Study) aCStudy = aStudy->studyDS()) {
- if (myStudyId == aCStudy->StudyId()) {
- myResult = aCStudy;
+ if (aStudyId == aCStudy->StudyId()) {
+ myResult = aStudy;
break;
}
}
};
+ //---------------------------------------------------------------
+ SalomeApp_Study*
+ GetGUIStudy(SALOMEDS::Study_ptr theStudy)
+ {
+ return ProcessEvent(new TGetStudyEvent(theStudy));
+ }
+
+
//---------------------------------------------------------------
_PTR(Study)
- GetStudy(SALOMEDS::Study_var theStudy)
+ GetStudy(SALOMEDS::Study_ptr theStudy)
{
- return ProcessEvent(new TGetStudyEvent(theStudy->StudyId()));
+ if(SalomeApp_Study* aStudy = ProcessEvent(new TGetStudyEvent(theStudy)))
+ return aStudy->studyDS();
+
+ return _PTR(Study)();
}
//---------------------------------------------------------------
_PTR(SObject)
- GetClientSObject( SALOMEDS::SObject_var obj,
- _PTR(Study) study )
+ GetClientSObject(SALOMEDS::SObject_ptr theSObject,
+ _PTR(Study) theStudy)
{
- CORBA::String_var anEntry = obj->GetID();
- return study->FindObjectID( anEntry.in() );
-
+ CORBA::String_var anEntry = theSObject->GetID();
+ return theStudy->FindObjectID( anEntry.in() );
}
class SUIT_Session;
class SUIT_ResourceMgr;
+class SalomeApp_Study;
+
namespace VISU
{
VISU_I_EXPORT
_PTR(SObject)
- GetClientSObject(SALOMEDS::SObject_var, _PTR(Study));
+ GetClientSObject(SALOMEDS::SObject_ptr theSObject,
+ _PTR(Study) theStudy);
VISU_I_EXPORT
SALOMEDS::Study_var
- GetDSStudy(_PTR(Study));
+ GetDSStudy(_PTR(Study) theStudy);
+
+ VISU_I_EXPORT
+ SalomeApp_Study*
+ GetGUIStudy(SALOMEDS::Study_ptr theStudy);
VISU_I_EXPORT
_PTR(Study)
- GetStudy(SALOMEDS::Study_var);
+ GetStudy(SALOMEDS::Study_ptr theStudy);
VISU_I_EXPORT
void
// Module : VISU
#include "VISU_Prs3dUtils.hh"
-#include "VISU_PipeLine.hxx"
+#include "SalomeApp_Study.h"
+#include "SALOME_Event.hxx"
namespace VISU
TSetModified
::~TSetModified()
{
- if(myPrs3d->GetActorEntry() == "")
- return;
+ struct TEvent: public SALOME_Event
+ {
+ VISU::TSetModified* mySetModified;
+ TEvent(VISU::TSetModified* theSetModified):
+ mySetModified(theSetModified)
+ {}
+
+ virtual
+ void
+ Execute()
+ {
+ VISU::Prs3d_i* aPrs3d = mySetModified->myPrs3d;
- if(myPrs3d->GetMTime() > this->GetMTime()){
- SALOMEDS::Study_var aStudy = myPrs3d->GetStudyDocument();
- aStudy->Modified();
- }
+ if(!aPrs3d || aPrs3d->GetActorEntry() == "")
+ return;
+
+ if(aPrs3d->GetMTime() > mySetModified->GetMTime()){
+ if(SalomeApp_Study* aStudy = aPrs3d->GetGUIStudy()){
+ aPrs3d->GetStudyDocument()->Modified();
+ aStudy->Modified();
+ }
+ }
+ }
+ };
+
+ ProcessVoidEvent(new TEvent(this));
}
{
myName = theName;
if(theIsUpdateStudyAttr){
- SALOMEDS::SObject_var aSObject = myStudy->FindObjectID(GetEntry().c_str());
+ SALOMEDS::SObject_var aSObject = GetStudyDocument()->FindObjectID(GetEntry().c_str());
if(!aSObject->_is_nil()){
- SALOMEDS::StudyBuilder_var aBuilder = myStudy->NewBuilder();
+ SALOMEDS::StudyBuilder_var aBuilder = GetStudyDocument()->NewBuilder();
SALOMEDS::GenericAttribute_var anAttr = aBuilder->FindOrCreateAttribute( aSObject, "AttributeName" );
SALOMEDS::AttributeName_var aNameAttr = SALOMEDS::AttributeName::_narrow( anAttr );
aNameAttr->SetValue( theName.c_str() );
VISU::RemovableObject_i
::GetStudyDocument() const
{
- return myStudy;
+ return myStudyDocument;
+}
+
+
+//---------------------------------------------------------------
+SalomeApp_Study*
+VISU::RemovableObject_i
+::GetGUIStudy() const
+{
+ return myGUIStudy;
}
VISU::RemovableObject_i
::SetStudyDocument(SALOMEDS::Study_ptr theStudy)
{
- myStudy = SALOMEDS::Study::_duplicate(theStudy);
+ myStudyDocument = SALOMEDS::Study::_duplicate(theStudy);
+ myGUIStudy = VISU::GetGUIStudy(theStudy);
}
::GetEntry()
{
CORBA::String_var anIOR = GetID();
- SALOMEDS::SObject_var aSObject = myStudy->FindObjectIOR(anIOR.in());
+ SALOMEDS::SObject_var aSObject = GetStudyDocument()->FindObjectIOR(anIOR.in());
CORBA::String_var anEntry("");
if(!CORBA::is_nil(aSObject.in()))
anEntry = aSObject->GetID();
SALOMEDS::Study_var
GetStudyDocument() const;
+ SalomeApp_Study*
+ GetGUIStudy() const;
+
virtual
std::string
GetEntry();
private:
std::string myName;
- SALOMEDS::Study_var myStudy;
+ SalomeApp_Study* myGUIStudy;
+ SALOMEDS::Study_var myStudyDocument;
RemovableObject_i(const RemovableObject_i&);
};