void VisuGUI_SelectionDlg::onSelectionEvent() {
SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>(myModule);
- if (!aViewWindow) return;
+ if (!aViewWindow)
+ return;
switch (aViewWindow->SelectionMode()) {
case NodeSelection:
return;
}
- if (myFl) return;
+ if (myFl)
+ return;
myFl = true;
int aType = myWidgetStack->id(myWidgetStack->visibleWidget());
- SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>
- (SUIT_Session::session()->activeApplication());
-
SVTK_Selector* aSelector = aViewWindow->GetSelector();
- VISU::Prs3d_i* aPrs3d = NULL;
_PTR(SObject) aSObject;
+ VISU::Prs3d_i* aPrs3d = NULL;
Handle(SALOME_InteractiveObject) anIO;
- SALOME_ListIO aListIO;
- mySelectionMgr->selectedObjects(aListIO);
-
- if (aListIO.Extent() == 1) {
- anIO = aListIO.First();
-
- if (anIO->hasEntry()) {
- SalomeApp_Study* theStudy = dynamic_cast<SalomeApp_Study*>(anApp->activeStudy());
- _PTR(Study) aStudy = theStudy->studyDS();
- aSObject = aStudy->FindObjectID(anIO->getEntry());
-
- if (aSObject) {
- CORBA::Object_var anObject = VISU::ClientSObjectToObject(aSObject);
-
- if (!CORBA::is_nil(anObject)) {
- PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
-
- if (aServant.in()) {
- aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
- }
- }
- }
+ VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(myModule);
+ if(aSelectionInfo.size() == 1){
+ // Get selected SObject
+ VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+ VISU::TObjectInfo anObjectInfo = aSelectionItem.myObjectInfo;
+ aPrs3d = GetPrs3dFromBase(anObjectInfo.myBase);
+ if(aPrs3d){
+ anIO = aSelectionItem.myIO;
+ aSObject = anObjectInfo.mySObject;
}
}
+
if (aPrs3d) {
VISU::Storable::TRestoringMap aMap;
TGetVTKIdMethod theMethod,
bool theIsCell,
const SalomeApp_Module* theModule,
- LightApp_SelectionMgr* theSelectionMgr,
QLabel* theMeshName,
QString theValue,
QLabel* theFieldName)
{
- SalomeApp_Application* anApp = theModule->getApp();
SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>(theModule);
- if (!aViewWindow) return false;
+ if (!aViewWindow)
+ return false;
SVTK_Selector* aSelector = aViewWindow->GetSelector();
+ _PTR(SObject) aSObject;
VISU::Prs3d_i* aPrs3d = NULL;
Handle(SALOME_InteractiveObject) anIO;
- SALOME_ListIO aListIO;
- theSelectionMgr->selectedObjects(aListIO, SVTK_Viewer::Type());
-
- if (aListIO.Extent() == 1) {
- anIO = aListIO.First();
-
- if (anIO->hasEntry()) {
- SalomeApp_Study* theStudy = dynamic_cast<SalomeApp_Study*>(anApp->activeStudy());
- _PTR(Study) aStudy = theStudy->studyDS();
- _PTR(SObject) aSObject = aStudy->FindObjectID(anIO->getEntry());
-
- if (aSObject) {
- CORBA::Object_var anObject = VISU::ClientSObjectToObject(aSObject);
-
- if (!CORBA::is_nil(anObject)) {
- PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
-
- if (aServant.in()) {
- aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in());
- }
- }
- }
+ VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(theModule);
+ if(aSelectionInfo.size() == 1){
+ // Get selected SObject
+ VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+ VISU::TObjectInfo anObjectInfo = aSelectionItem.myObjectInfo;
+ aPrs3d = GetPrs3dFromBase(anObjectInfo.myBase);
+ if(aPrs3d){
+ anIO = aSelectionItem.myIO;
+ aSObject = anObjectInfo.mySObject;
}
}
-
if (aPrs3d) {
int anObjId = theText.toInt();
VISU_PipeLine* aPipeLine = aPrs3d->GetPipeLine();
aMethod,
false,
myModule,
- mySelectionMgr,
myMeshName,
tr("WRN_NO_AVAILABLE_DATA"),
myFieldName);
aMethod,
true,
myModule,
- mySelectionMgr,
myMeshName,
tr("WRN_NO_AVAILABLE_DATA"),
myFieldName);