#include "VISU_CutLines_i.hh"
#include "VISU_Vectors_i.hh"
#include "VISU_StreamLines_i.hh"
+#include "VISU_Plot3D_i.hh"
#include "VISU_Table_i.hh"
#include "VISU_TimeAnimation.h"
#include "SUIT_Session.h"
#include "SalomeApp_Study.h"
#include "SalomeApp_Application.h"
-#include "SalomeApp_SelectionMgr.h"
+#include "LightApp_SelectionMgr.h"
#include "SVTK_ViewModel.h"
#include "SVTK_ViewWindow.h"
#include "SALOME_Event.hxx"
Storable::Registry(CutLines_i::myComment.c_str(),&(Restore<CutLines_i>));
Storable::Registry(IsoSurfaces_i::myComment.c_str(),&(Restore<IsoSurfaces_i>));
Storable::Registry(StreamLines_i::myComment.c_str(),&(Restore<StreamLines_i>));
+ Storable::Registry(Plot3D_i::myComment.c_str(),&(Restore<Plot3D_i>));
Storable::Registry(Vectors_i::myComment.c_str(),&(Restore<Vectors_i>));
Storable::Registry(Table_i::myComment.c_str(),&(Table_i::Restore));
Storable::Registry(Curve_i::myComment.c_str(),&(Curve_i::Restore));
void VISU_Gen_i::SetCurrentStudy (SALOMEDS::Study_ptr theStudy)
{
- class TEvent: public SALOME_Event {
- QString myStudyName;
+ class TEvent: public SALOME_Event {
+ std::string myStudyName;
public:
- TEvent(const QString& theStudyName):myStudyName(theStudyName)
- {}
+ TEvent(const std::string theStudyName):myStudyName(theStudyName)
+ {}
virtual void Execute()
{
bool isActive = false;
++anIter;
if (SUIT_Study* aSStudy = anApp->activeStudy()) {
if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy)) {
- MESSAGE("There is an application with active study : " << aStudy->studyName());
- if (myStudyName == aStudy->studyName()) {
- isActive = true;
- break;
+ if (_PTR(Study) aCStudy = aStudy->studyDS()) {
+ MESSAGE("There is an application with active study : StudyId = "
+ << aCStudy->StudyId() << "; Name = '" << aCStudy->Name() << "'");
+ if (myStudyName == aCStudy->Name()) {
+ isActive = true;
+ break;
+ }
}
}
}
MESSAGE("!!! anApp->onLoadDoc(myStudyName) !!!");
// Has to be loaded in an empty or in a new application
SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>(aFirstApp);
- anApp->onLoadDoc(myStudyName);
+ anApp->onLoadDoc(myStudyName.c_str());
}
}
};
-
+
if (!CORBA::is_nil(theStudy))
{
CORBA::String_var aName = theStudy->Name();
- QString aStudyName (aName.in());
+ std::string aStudyName (aName.in());
MESSAGE("StudyId = " << theStudy->StudyId() << "; Name = '" << aName.in() << "'");
myStudyDocument = SALOMEDS::Study::_duplicate(theStudy);
- ProcessVoidEvent(new TEvent(aStudyName));
+ ProcessVoidEvent(new TEvent(aStudyName));
} else {
MESSAGE("CORBA::is_nil(theStudy)");
}
return aResult._retn();
}
- Result_ptr VISU_Gen_i::ClientImportMed (_PTR(SObject) theMedSObject)
- {
- SALOMEDS::SObject_ptr aMedSObject = GetSObject(theMedSObject);
- return ImportMed(aMedSObject);
- }
-
Result_ptr VISU_Gen_i::ImportMed (SALOMEDS::SObject_ptr theMedSObject)
{
if (myStudyDocument->GetProperties()->IsLocked())
return Prs3dOnField<VISU::StreamLines_i>(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn();
}
+ Plot3D_ptr VISU_Gen_i::Plot3DOnField(Result_ptr theResult,
+ const char* theMeshName,
+ VISU::Entity theEntity,
+ const char* theFieldName,
+ CORBA::Double theIteration)
+ {
+ return Prs3dOnField<VISU::Plot3D_i>(theResult,theMeshName,theEntity,theFieldName,theIteration)._retn();
+ }
+
CutPlanes_ptr VISU_Gen_i::CutPlanesOnField(Result_ptr theResult,
const char* theMeshName,
VISU::Entity theEntity,
return VISU::Animation::_nil();
}
- void DeletePrs3d (Prs3d_ptr thePrs3d)
- {
- Prs3d_i* aPrs3d = dynamic_cast<Prs3d_i*>(GetServant(thePrs3d).in());
- if (!aPrs3d)
- return;
-
- // 1. Find appropriate application (code like in VISU_ViewManager_i.cxx)
- SALOMEDS::Study_var myStudyDocument = aPrs3d->GetStudyDocument();
- SalomeApp_Application* anApp = NULL;
- CORBA::String_var studyName = myStudyDocument->Name();
- std::string aStudyName = studyName.in();
- SUIT_Session* aSession = SUIT_Session::session();
- QPtrList<SUIT_Application> anApplications = aSession->applications();
- QPtrListIterator<SUIT_Application> anIter (anApplications);
- while (SUIT_Application* aSUITApp = anIter.current()) {
- ++anIter;
- if (SUIT_Study* aSStudy = aSUITApp->activeStudy()) {
- if (SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy)) {
- if (_PTR(Study) aCStudy = aStudy->studyDS()) {
- if (aStudyName == aCStudy->Name()) {
- anApp = dynamic_cast<SalomeApp_Application*>(aSUITApp);
- break;
- }
- }
- }
- }
- }
- if (!anApp)
- return;
-
- // 2. Remove corresponding IO from selection
- SALOMEDS::SObject_var aSObject = aPrs3d->GetSObject();
- CORBA::String_var anEntry = aSObject->GetID();
-
- SalomeApp_SelectionMgr* aSelectionMgr = anApp->selectionMgr();
- SALOME_ListIO aListIO, aNewListIO;
- aSelectionMgr->selectedObjects(aListIO);
-
- for (SALOME_ListIteratorOfListIO it (aListIO); it.More(); it.Next()) {
- if (it.Value()->hasEntry()) {
- std::string aCurEntry (it.Value()->getEntry());
- if (aCurEntry != std::string( anEntry.in() ) ) {
- aNewListIO.Append(it.Value());
- }
- }
- }
-
- aSelectionMgr->setSelectedObjects(aNewListIO);
-
- // 3. Remove Actors
- ViewManagerList aViewManagerList;
- anApp->viewManagers(SVTK_Viewer::Type(), aViewManagerList);
- QPtrListIterator<SUIT_ViewManager> anVMIter (aViewManagerList);
- for (; anVMIter.current(); ++anVMIter) {
- SUIT_ViewManager* aViewManager = anVMIter.current();
- QPtrVector<SUIT_ViewWindow> aViews = aViewManager->getViews();
- for (int i = 0, iEnd = aViews.size(); i < iEnd; i++) {
- if (SUIT_ViewWindow* aViewWindow = aViews.at(i)) {
- if (SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>(aViewWindow)) {
- //VISU_Actor* anActor = aVISUViewManager->GetActor(aPrs3d, vw);
- VISU_Actor* anActor = NULL;
- vtkActorCollection *anActColl = vw->getRenderer()->GetActors();
- anActColl->InitTraversal();
- vtkActor *aVTKActor = anActColl->GetNextActor();
- for (; !anActor && aVTKActor; aVTKActor = anActColl->GetNextActor()) {
- if (VISU_Actor* anVISUActor = dynamic_cast<VISU_Actor*>(aVTKActor)) {
- if (aPrs3d == anVISUActor->GetPrs3d()) {
- anActor = anVISUActor->GetParent();
- }
- }
- }
- if (anActor) {
- vw->RemoveActor(anActor);
- anActor->Delete();
- }
- }
- }
- }
- }
-
- aPrs3d->RemoveFromStudy();
- aPrs3d->Destroy();
-
- //jfa tmp:theModule->updateObjBrowser(); //update Object browser
- }
-
void VISU_Gen_i::DeleteResult (Result_ptr theResult)
{
class TEvent: public SALOME_Event {
Result_ptr myResult;
public:
TEvent(Result_ptr theResult): myResult(theResult) {}
- virtual void Execute(){
+ virtual void Execute()
+ {
if (Result_i* aResult = dynamic_cast<Result_i*>(GetServant(myResult).in())) {
SALOMEDS::SObject_var aSObject = aResult->GetSObject();
- SALOMEDS::Study_var aStudyDocument = aSObject->GetStudy();
- SALOMEDS::ChildIterator_var aChildIter = aStudyDocument->NewChildIterator(aSObject);
- for(aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()){
- SALOMEDS::SObject_var aChildSObject = aChildIter->Value();
- CORBA::Object_var aChildObj = VISU::SObjectToObject(aChildSObject);
- if(CORBA::is_nil(aChildObj)) continue;
- VISU::Prs3d_var aPrs3d = VISU::Prs3d::_narrow(aChildObj);
- if(CORBA::is_nil(aPrs3d)) continue;
- VISU::DeletePrs3d(aPrs3d);
- }
-
- aResult->RemoveFromStudy();
- aResult->Destroy();
+ VISU::RemoveFromStudy(aSObject,
+ false, // not only attribute
+ true); // destroy sub-objects
//jfa tmp:if (QAD_Desktop* aDesktop = QAD_Application::getDesktop())
//jfa tmp: if (QAD_Study* aStudy = aDesktop->findStudy(aStudyDocument))
//jfa tmp: aStudy->updateObjBrowser(); //update Object browser
}
+
+ myResult->Destroy();
}
};
public:
TEvent(Prs3d_ptr thePrs3d): myPrs3d(thePrs3d) {}
virtual void Execute() {
- VISU::DeletePrs3d(myPrs3d);
+ myPrs3d->RemoveFromStudy();
+
+ //update Object browser
+ /*jfa tmp:if (QAD_Desktop* aDesktop = QAD_Application::getDesktop()) {
+ if (Prs3d_i* aPrs3d = dynamic_cast<Prs3d_i*>(GetServant(myPrs3d).in())) {
+ SALOMEDS::SObject_var aSObject = aPrs3d->GetSObject();
+ SALOMEDS::Study_var aStudyDocument = aSObject->GetStudy();
+ if (QAD_Study* aStudy = aDesktop->findStudy(aStudyDocument))
+ aStudy->updateObjBrowser();
+ }
+ }*/
+
+ myPrs3d->Destroy();
}
};
anIOR->SetValue(anIORValue);
return aResultSO._retn();
}
-
}