return false;
}
+ LightApp_DataObject*
+ FindDataObject(SUIT_DataObject* theDataObject,
+ const QString& theEntry,
+ int theLevel)
+ {
+ int aLevel = theDataObject->level() + 2;
+ QString aSourceEntry = theEntry.section(':',0,aLevel);
+ DataObjectList aList;
+ theDataObject->children(aList);
+ DataObjectListIterator aDataObjectIter(aList);
+ while(SUIT_DataObject* aDataObject = aDataObjectIter.current()){
+ if(LightApp_DataObject* aChildDataObject = dynamic_cast<LightApp_DataObject*>(aDataObject)){
+ QString anEntry = aChildDataObject->entry();
+ QString aCurrentEntry = anEntry.section(':',0,aLevel);
+ if(aSourceEntry == aCurrentEntry){
+ if(theLevel == aLevel){
+ return aChildDataObject;
+ }else{
+ return FindDataObject(aChildDataObject,theEntry,theLevel);
+ }
+ }
+ }
+ ++aDataObjectIter;
+ }
+ return NULL;
+ }
+
+ LightApp_DataObject*
+ FindDataObject(CAM_Module* theModule,
+ _PTR(SObject) theSObject)
+ {
+ CAM_DataModel* aDataModel = theModule->dataModel();
+ CAM_DataObject* aRootDataObject = aDataModel->root();
+ if(_PTR(SComponent) aComponent = theSObject)
+ return dynamic_cast<LightApp_DataObject*>(aRootDataObject);
+
+ int aLevel = theSObject->Depth();
+ std::string anEntry = theSObject->GetID();
+ return FindDataObject(aRootDataObject,anEntry.c_str(),aLevel);
+ }
+
void
UpdateObjBrowser(SalomeApp_Module* theModule,
bool theIsUpdateDataModel,
_PTR(SObject) theSObject)
{
LightApp_DataObject* aDataObject = NULL;
- if(theSObject){
- std::string anEntry = theSObject->GetID();
- SalomeApp_Application* anApp = theModule->getApp();
- OB_Browser* aBrowser = anApp->objectBrowser();
- DataObjectList aList = aBrowser->getSelected();
- DataObjectListIterator anIter(aList);
- while(SUIT_DataObject* anObject = anIter.current()){
- aDataObject = dynamic_cast<LightApp_DataObject*>(anObject);
- if(aDataObject){
- if(anEntry == aDataObject->entry().latin1()){
- break;
- }
- }
- ++anIter;
- }
- }
+ if(theSObject)
+ aDataObject = FindDataObject(theModule,theSObject);
+
theModule->updateObjBrowser(theIsUpdateDataModel,aDataObject);
theModule->getApp()->updateActions();
}
}
}
PlotContainer( theModule, pContainer, VISU::eDisplay );
+
+ QString anEntry = pContainer->GetEntry();
+ _PTR(Study) aStudy = theTableSO->GetStudy();
+ _PTR(SObject) aContainerSO = aStudy->FindObjectID(anEntry.latin1());
+ _PTR(SObject) aParentSO = aContainerSO->GetFather();
+ UpdateObjBrowser(theModule,true,aParentSO);
}
}
}