mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-24 16:30:34 +05:00
Transfer BreakLink from Object to Gen
This commit is contained in:
parent
c47c00f480
commit
96a86667a9
@ -172,6 +172,7 @@
|
|||||||
#include <SALOMEDS_Study.hxx>
|
#include <SALOMEDS_Study.hxx>
|
||||||
#include <SALOMEDS_SObject.hxx>
|
#include <SALOMEDS_SObject.hxx>
|
||||||
#include "utilities.h"
|
#include "utilities.h"
|
||||||
|
#include <SALOME_LifeCycleCORBA.hxx>
|
||||||
|
|
||||||
// OCCT includes
|
// OCCT includes
|
||||||
#include <Standard_ErrorHandler.hxx>
|
#include <Standard_ErrorHandler.hxx>
|
||||||
@ -1392,7 +1393,8 @@ namespace
|
|||||||
if (selected.Extent()) {
|
if (selected.Extent()) {
|
||||||
Handle(SALOME_InteractiveObject) anIObject = selected.First();
|
Handle(SALOME_InteractiveObject) anIObject = selected.First();
|
||||||
_PTR(Study) aStudy = SMESH::getStudy();
|
_PTR(Study) aStudy = SMESH::getStudy();
|
||||||
_PTR(SObject) aSObj = aStudy->FindObjectID(anIObject->getEntry());
|
std::string aEntry = anIObject->getEntry();
|
||||||
|
_PTR(SObject) aSObj = aStudy->FindObjectID(aEntry);
|
||||||
if (aSObj) {
|
if (aSObj) {
|
||||||
std::string aName = aSObj->GetName();
|
std::string aName = aSObj->GetName();
|
||||||
QMessageBox::StandardButton aRes = SUIT_MessageBox::warning(SMESHGUI::desktop(),
|
QMessageBox::StandardButton aRes = SUIT_MessageBox::warning(SMESHGUI::desktop(),
|
||||||
@ -1400,9 +1402,26 @@ namespace
|
|||||||
QObject::tr("MSG_BREAK_SHAPER_LINK").arg(aName.c_str()),
|
QObject::tr("MSG_BREAK_SHAPER_LINK").arg(aName.c_str()),
|
||||||
SUIT_MessageBox::Yes | SUIT_MessageBox::No, SUIT_MessageBox::No);
|
SUIT_MessageBox::Yes | SUIT_MessageBox::No, SUIT_MessageBox::No);
|
||||||
if (aRes == SUIT_MessageBox::Yes) {
|
if (aRes == SUIT_MessageBox::Yes) {
|
||||||
GEOM::GEOM_Object_var aObject = SMESH::SObjectToInterface<GEOM::GEOM_Object>(aSObj);
|
SUIT_DataOwnerPtrList aList;
|
||||||
if (!aObject->_is_nil())
|
aSel->selected(aList, "ObjectBrowser", true);
|
||||||
aObject->BreakLinks();
|
SUIT_DataOwner* aOwn = aList.first();
|
||||||
|
LightApp_DataOwner* sowner = dynamic_cast<LightApp_DataOwner*>(aOwn);
|
||||||
|
QString aREntry = sowner->entry();
|
||||||
|
|
||||||
|
static GEOM::GEOM_Gen_var geomGen;
|
||||||
|
if (CORBA::is_nil(geomGen)) {
|
||||||
|
SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>
|
||||||
|
(SUIT_Session::session()->activeApplication());
|
||||||
|
if (app) {
|
||||||
|
SALOME_LifeCycleCORBA* ls = new SALOME_LifeCycleCORBA(app->namingService());
|
||||||
|
Engines::EngineComponent_var comp =
|
||||||
|
ls->FindOrLoad_Component("FactoryServer", "SHAPERSTUDY");
|
||||||
|
geomGen = GEOM::GEOM_Gen::_narrow(comp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!CORBA::is_nil(geomGen)) {
|
||||||
|
geomGen->BreakLink(aREntry.toStdString().c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,8 @@
|
|||||||
#include <SalomeApp_Application.h>
|
#include <SalomeApp_Application.h>
|
||||||
#include <LightApp_VTKSelector.h>
|
#include <LightApp_VTKSelector.h>
|
||||||
#include <SVTK_ViewWindow.h>
|
#include <SVTK_ViewWindow.h>
|
||||||
|
#include <LightApp_SelectionMgr.h>
|
||||||
|
#include <LightApp_DataOwner.h>
|
||||||
|
|
||||||
// IDL includes
|
// IDL includes
|
||||||
#include <SALOMEconfig.h>
|
#include <SALOMEconfig.h>
|
||||||
@ -77,6 +79,8 @@ void SMESHGUI_Selection::init( const QString& client, LightApp_SelectionMgr* mgr
|
|||||||
|
|
||||||
if( mgr )
|
if( mgr )
|
||||||
{
|
{
|
||||||
|
myOwners.clear();
|
||||||
|
mgr->selected(myOwners, client);
|
||||||
for( int i=0, n=count(); i<n; i++ ) {
|
for( int i=0, n=count(); i<n; i++ ) {
|
||||||
myTypes.append( typeName( type( entry( i ) ) ) );
|
myTypes.append( typeName( type( entry( i ) ) ) );
|
||||||
myControls.append( controlMode( i ) );
|
myControls.append( controlMode( i ) );
|
||||||
@ -614,10 +618,21 @@ bool SMESHGUI_Selection::hasGeomReference( int ind ) const
|
|||||||
bool SMESHGUI_Selection::canBreakLink( int ind ) const
|
bool SMESHGUI_Selection::canBreakLink( int ind ) const
|
||||||
{
|
{
|
||||||
if ( ind >= 0 && ind < myTypes.count()) {
|
if ( ind >= 0 && ind < myTypes.count()) {
|
||||||
_PTR(SObject) aSObject = SMESH::getStudy()->FindObjectID( entry( ind ).toUtf8().data() );
|
if (isReference(ind)) {
|
||||||
GEOM::GEOM_Object_var aObject = SMESH::SObjectToInterface<GEOM::GEOM_Object>(aSObject);
|
SUIT_DataOwner* aOwn = myOwners.at(ind);
|
||||||
if (!aObject->_is_nil())
|
LightApp_DataOwner* sowner = dynamic_cast<LightApp_DataOwner*>(aOwn);
|
||||||
return aObject->IsParametrical();
|
QString aEntry = sowner->entry();
|
||||||
|
_PTR(SObject) aSObject = SMESH::getStudy()->FindObjectID(aEntry.toStdString());
|
||||||
|
_PTR(SObject) aFatherObj = aSObject->GetFather();
|
||||||
|
_PTR(SComponent) aComponent = aFatherObj->GetFatherComponent();
|
||||||
|
if (aComponent->ComponentDataType() == "SMESH") {
|
||||||
|
QString aObjEntry = entry(ind);
|
||||||
|
_PTR(SObject) aGeomSObject = SMESH::getStudy()->FindObjectID(aObjEntry.toStdString());
|
||||||
|
GEOM::GEOM_Object_var aObject = SMESH::SObjectToInterface<GEOM::GEOM_Object>(aGeomSObject);
|
||||||
|
if (!aObject->_is_nil())
|
||||||
|
return aObject->IsParametrical();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
// SALOME GUI includes
|
// SALOME GUI includes
|
||||||
#include <LightApp_Selection.h>
|
#include <LightApp_Selection.h>
|
||||||
|
#include <SUIT_DataOwner.h>
|
||||||
|
|
||||||
// SALOME KERNEL includes
|
// SALOME KERNEL includes
|
||||||
#include <SALOMEDSClient_definitions.hxx>
|
#include <SALOMEDSClient_definitions.hxx>
|
||||||
@ -96,6 +97,7 @@ private:
|
|||||||
QStringList myTypes;
|
QStringList myTypes;
|
||||||
QStringList myControls;
|
QStringList myControls;
|
||||||
QList<SMESH_Actor*> myActors;
|
QList<SMESH_Actor*> myActors;
|
||||||
|
SUIT_DataOwnerPtrList myOwners;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SMESHGUI_SELECTION_H
|
#endif // SMESHGUI_SELECTION_H
|
||||||
|
Loading…
Reference in New Issue
Block a user