Salome HOME
projects
/
modules
/
smesh.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix mixed Python dump of a new and a closed study
[modules/smesh.git]
/
src
/
SMESHGUI
/
SMESHGUI_GroupDlg.cxx
diff --git
a/src/SMESHGUI/SMESHGUI_GroupDlg.cxx
b/src/SMESHGUI/SMESHGUI_GroupDlg.cxx
index 61b1dfcabb545a46a397ad09792061fa49e91078..36534f31ad8da3093cd5d62c3065f7f3c60e9dfe 100644
(file)
--- a/
src/SMESHGUI/SMESHGUI_GroupDlg.cxx
+++ b/
src/SMESHGUI/SMESHGUI_GroupDlg.cxx
@@
-192,7
+192,7
@@
void SMESHGUI_GroupDlg::initDialog( bool create)
QPixmap image0( SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap( "SMESH", tr( "ICON_SELECT" ) ) );
setWindowTitle( create ? tr( "SMESH_CREATE_GROUP_TITLE" ) : tr( "SMESH_EDIT_GROUP_TITLE" ) );
QPixmap image0( SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap( "SMESH", tr( "ICON_SELECT" ) ) );
setWindowTitle( create ? tr( "SMESH_CREATE_GROUP_TITLE" ) : tr( "SMESH_EDIT_GROUP_TITLE" ) );
- myHelpFileName = create ? "creating_groups
_page.html" : "editing_groups_page
.html";
+ myHelpFileName = create ? "creating_groups
.html" : "editing_groups
.html";
setSizeGripEnabled( true);
setSizeGripEnabled( true);
@@
-498,10
+498,7
@@
QString SMESHGUI_GroupDlg::GetDefaultName(const QString& theOperation)
QString aName = "";
// collect all object names of SMESH component
QString aName = "";
// collect all object names of SMESH component
- SalomeApp_Study* appStudy =
- dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
- if ( !appStudy ) return aName;
- _PTR(Study) aStudy = appStudy->studyDS();
+ _PTR(Study) aStudy = SMESH::getStudy();
std::set<std::string> aSet;
_PTR(SComponent) aMeshCompo (aStudy->FindComponent( "SMESH" ));
std::set<std::string> aSet;
_PTR(SComponent) aMeshCompo (aStudy->FindComponent( "SMESH" ));
@@
-519,7
+516,7
@@
QString SMESHGUI_GroupDlg::GetDefaultName(const QString& theOperation)
bool isUnique = false;
while (!isUnique) {
aName = theOperation + "_" + QString::number(++aNumber);
bool isUnique = false;
while (!isUnique) {
aName = theOperation + "_" + QString::number(++aNumber);
- isUnique = (aSet.count(std::string(
SMESH::toUtf8(aName
))) == 0);
+ isUnique = (aSet.count(std::string(
aName.toUtf8().constData(
))) == 0);
}
return aName;
}
return aName;
@@
-528,14
+525,13
@@
QString SMESHGUI_GroupDlg::GetDefaultName(const QString& theOperation)
void SMESHGUI_GroupDlg::setDefaultName() const
{
QString aResName;
void SMESHGUI_GroupDlg::setDefaultName() const
{
QString aResName;
- _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
int i=1;
QString aPrefix ="Group_";
_PTR(SObject) anObj;
do
{
aResName = aPrefix + QString::number( i++ );
int i=1;
QString aPrefix ="Group_";
_PTR(SObject) anObj;
do
{
aResName = aPrefix + QString::number( i++ );
- anObj =
aStudy->FindObject( SMESH::toUtf8(aResName
) );
+ anObj =
SMESH::getStudy()->FindObject( aResName.toUtf8().constData(
) );
}
while ( anObj );
myName->setText(aResName);
}
while ( anObj );
myName->setText(aResName);
@@
-601,7
+597,7
@@
void SMESHGUI_GroupDlg::init (SMESH::SMESH_GroupBase_ptr theGroup,
SALOMEDS::Color aColor = theGroup->GetColor();
setGroupColor( aColor );
SALOMEDS::Color aColor = theGroup->GetColor();
setGroupColor( aColor );
- myMeshGroupLine->setText(
SMESH::fromUtf8(theGroup->GetName()
));
+ myMeshGroupLine->setText(
theGroup->GetName(
));
int aType = 0;
switch(theGroup->GetType()) {
int aType = 0;
switch(theGroup->GetType()) {
@@
-664,7
+660,7
@@
void SMESHGUI_GroupDlg::init (SMESH::SMESH_GroupBase_ptr theGroup,
else if ( grpType == 1 ) // group on geom
{
QString aShapeName( "" );
else if ( grpType == 1 ) // group on geom
{
QString aShapeName( "" );
- _PTR(Study) aStudy = SMESH::
GetActiveStudyDocument
();
+ _PTR(Study) aStudy = SMESH::
getStudy
();
GEOM::GEOM_Object_var aGroupShape = myGroupOnGeom->GetShape();
if (!aGroupShape->_is_nil())
{
GEOM::GEOM_Object_var aGroupShape = myGroupOnGeom->GetShape();
if (!aGroupShape->_is_nil())
{
@@
-688,7
+684,7
@@
void SMESHGUI_GroupDlg::init (SMESH::SMESH_GroupBase_ptr theGroup,
{
myNameChanged = true;
myName->blockSignals(true);
{
myNameChanged = true;
myName->blockSignals(true);
- myName->setText(
SMESH::fromUtf8(theGroup->GetName()
));
+ myName->setText(
theGroup->GetName(
));
myName->blockSignals(false);
}
myName->blockSignals(false);
}
@@
-915,7
+911,7
@@
void SMESHGUI_GroupDlg::setSelectionMode (int theMode)
//=================================================================================
bool SMESHGUI_GroupDlg::onApply()
{
//=================================================================================
bool SMESHGUI_GroupDlg::onApply()
{
- if (
mySMESHGUI->isActive
StudyLocked())
+ if (
SMESHGUI::is
StudyLocked())
return false;
if (myName->text().trimmed().isEmpty())
return false;
if (myName->text().trimmed().isEmpty())
@@
-1050,11
+1046,11
@@
bool SMESHGUI_GroupDlg::onApply()
if (myMesh->_is_nil() || !myGeomObjects->length())
return false;
if (myMesh->_is_nil() || !myGeomObjects->length())
return false;
- _PTR(Study) aStudy = SMESH::
GetActiveStudyDocument
();
+ _PTR(Study) aStudy = SMESH::
getStudy
();
if (myGeomObjects->length() == 1) {
myGroupOnGeom = myMesh->CreateGroupFromGEOM(aType,
if (myGeomObjects->length() == 1) {
myGroupOnGeom = myMesh->CreateGroupFromGEOM(aType,
-
SMESH::toUtf8(myName->text()
),
+
myName->text().toUtf8(
),
myGeomObjects[0]);
}
else {
myGeomObjects[0]);
}
else {
@@
-1064,12
+1060,11
@@
bool SMESHGUI_GroupDlg::onApply()
// create a geometry group
GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen();
// create a geometry group
GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen();
- _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
- if (geomGen->_is_nil()
|| !aStudy
)
+ if (geomGen->_is_nil())
return false;
return false;
- GEOM::GEOM_IGroupOperations_wrap op = geomGen->GetIGroupOperations(
aStudy->StudyId()
);
+ GEOM::GEOM_IGroupOperations_wrap op = geomGen->GetIGroupOperations();
if (op->_is_nil())
return false;
if (op->_is_nil())
return false;
@@
-1095,12
+1090,12
@@
bool SMESHGUI_GroupDlg::onApply()
QString aNewGeomGroupName ( "Auto_group_for_" );
aNewGeomGroupName += myName->text();
SALOMEDS::SObject_var aNewGroupSO =
QString aNewGeomGroupName ( "Auto_group_for_" );
aNewGeomGroupName += myName->text();
SALOMEDS::SObject_var aNewGroupSO =
- geomGen->AddInStudy(a
SMESHGen->GetCurrentStudy(), a
GroupVar,
-
SMESH::toUtf8(aNewGeomGroupName
), aMeshShape);
+ geomGen->AddInStudy(aGroupVar,
+
aNewGeomGroupName.toUtf8(
), aMeshShape);
}
myGroupOnGeom = myMesh->CreateGroupFromGEOM(aType,
}
myGroupOnGeom = myMesh->CreateGroupFromGEOM(aType,
-
SMESH::toUtf8(myName->text()
),
+
myName->text().toUtf8(
),
aGroupVar);
}
resultGroup = SMESH::SMESH_GroupBase::_narrow( myGroupOnGeom );
aGroupVar);
}
resultGroup = SMESH::SMESH_GroupBase::_narrow( myGroupOnGeom );
@@
-1124,7
+1119,7
@@
bool SMESHGUI_GroupDlg::onApply()
return false;
myGroupOnFilter = myMesh->CreateGroupFromFilter(aType,
return false;
myGroupOnFilter = myMesh->CreateGroupFromFilter(aType,
-
SMESH::toUtf8(myName->text()
),
+
myName->text().toUtf8(
),
myFilter);
resultGroup = SMESH::SMESH_GroupBase::_narrow( myGroupOnFilter );
isCreation = true;
myFilter);
resultGroup = SMESH::SMESH_GroupBase::_narrow( myGroupOnFilter );
isCreation = true;
@@
-1148,7
+1143,7
@@
bool SMESHGUI_GroupDlg::onApply()
if( aMeshGroupSO )
anEntryList.append( aMeshGroupSO->GetID().c_str() );
if( aMeshGroupSO )
anEntryList.append( aMeshGroupSO->GetID().c_str() );
- resultGroup->SetName(
SMESH::toUtf8(myName->text().trimmed()
));
+ resultGroup->SetName(
myName->text().trimmed().toUtf8(
));
if ( isCreation )
{
if ( isCreation )
{
@@
-1179,7
+1174,7
@@
bool SMESHGUI_GroupDlg::onApply()
if ( !anActor ) return false;
myActorsList.append( anActor );
}
if ( !anActor ) return false;
myActorsList.append( anActor );
}
- anActor->setName(
SMESH::toUtf8(myName->text()
));
+ anActor->setName(
myName->text().toUtf8(
));
QColor c;
int delta;
switch ( myTypeId ) {
QColor c;
int delta;
switch ( myTypeId ) {
@@
-1412,13
+1407,12
@@
void SMESHGUI_GroupDlg::onObjectSelectionChanged()
continue;
// Check if group constructed on the same shape as a mesh or on its child
continue;
// Check if group constructed on the same shape as a mesh or on its child
- _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
// The main shape of the group
GEOM::GEOM_Object_var aGroupMainShape;
if (aGeomGroup->GetType() == 37) {
GEOM::GEOM_IGroupOperations_wrap anOp =
// The main shape of the group
GEOM::GEOM_Object_var aGroupMainShape;
if (aGeomGroup->GetType() == 37) {
GEOM::GEOM_IGroupOperations_wrap anOp =
- SMESH::GetGEOMGen()->GetIGroupOperations(
aStudy->StudyId()
);
+ SMESH::GetGEOMGen()->GetIGroupOperations();
aGroupMainShape = anOp->GetMainShape(aGeomGroup);
// aGroupMainShape is an existing servant => GEOM_Object_var not GEOM_Object_wrap
}
aGroupMainShape = anOp->GetMainShape(aGeomGroup);
// aGroupMainShape is an existing servant => GEOM_Object_var not GEOM_Object_wrap
}
@@
-1426,8
+1420,9
@@
void SMESHGUI_GroupDlg::onObjectSelectionChanged()
aGroupMainShape = aGeomGroup;
aGroupMainShape->Register();
}
aGroupMainShape = aGeomGroup;
aGroupMainShape->Register();
}
+ CORBA::String_var entry = aGroupMainShape->GetStudyEntry();
_PTR(SObject) aGroupMainShapeSO =
_PTR(SObject) aGroupMainShapeSO =
-
aStudy->FindObjectID(aGroupMainShape->GetStudyEntry()
);
+
SMESH::getStudy()->FindObjectID( entry.in()
);
_PTR(SObject) anObj, aRef;
bool isRefOrSubShape = false;
_PTR(SObject) anObj, aRef;
bool isRefOrSubShape = false;
@@
-1451,10
+1446,10
@@
void SMESHGUI_GroupDlg::onObjectSelectionChanged()
myGeomObjects->length(i);
if ( i == 0 )
myGeomObjects->length(i);
if ( i == 0 )
-
{
-
myIsBusy = false;
-
return;
-
}
+ {
+ myIsBusy = false;
+ return;
+ }
aNbSel = i;
}
aNbSel = i;
}
@@
-2006,9
+2001,8
@@
void SMESHGUI_GroupDlg::onAdd()
onListSelectionChanged();
} else if (myCurrentLineEdit == myGeomGroupLine && myGeomObjects->length() == 1) {
onListSelectionChanged();
} else if (myCurrentLineEdit == myGeomGroupLine && myGeomObjects->length() == 1) {
- _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
GEOM::GEOM_IGroupOperations_wrap aGroupOp =
GEOM::GEOM_IGroupOperations_wrap aGroupOp =
- SMESH::GetGEOMGen()->GetIGroupOperations(
aStudy->StudyId()
);
+ SMESH::GetGEOMGen()->GetIGroupOperations();
SMESH::ElementType aGroupType = SMESH::ALL;
switch(aGroupOp->GetType(myGeomObjects[0])) {
SMESH::ElementType aGroupType = SMESH::ALL;
switch(aGroupOp->GetType(myGeomObjects[0])) {
@@
-2021,8
+2015,8
@@
void SMESHGUI_GroupDlg::onAdd()
if (aGroupType == aType) {
_PTR(SObject) aGroupSO =
if (aGroupType == aType) {
_PTR(SObject) aGroupSO =
- //
aStudy->FindObjectIOR(aStudy
->ConvertObjectToIOR(myGeomGroup));
-
aStudy
->FindObjectID(myGeomObjects[0]->GetStudyEntry());
+ //
SMESH::getStudy()->FindObjectIOR(SMESH::getStudy()
->ConvertObjectToIOR(myGeomGroup));
+
SMESH::getStudy()
->FindObjectID(myGeomObjects[0]->GetStudyEntry());
// Construct filter
SMESH::FilterManager_var aFilterMgr = SMESH::GetFilterManager();
SMESH::Filter_var aFilter = aFilterMgr->CreateFilter();
// Construct filter
SMESH::FilterManager_var aFilterMgr = SMESH::GetFilterManager();
SMESH::Filter_var aFilter = aFilterMgr->CreateFilter();
@@
-2454,8
+2448,7
@@
void SMESHGUI_GroupDlg::onPublishShapeByMeshDlg(SUIT_Operation* op)
if ( !aGeomVar->_is_nil() )
{
QString ID = aGeomVar->GetStudyEntry();
if ( !aGeomVar->_is_nil() )
{
QString ID = aGeomVar->GetStudyEntry();
- _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
- if ( _PTR(SObject) aGeomSO = aStudy->FindObjectID( ID.toLatin1().data() )) {
+ if ( _PTR(SObject) aGeomSO = SMESH::getStudy()->FindObjectID( ID.toLatin1().data() )) {
SALOME_ListIO anIOList;
Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject
( aGeomSO->GetID().c_str(), "SMESH", aGeomSO->GetName().c_str() );
SALOME_ListIO anIOList;
Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject
( aGeomSO->GetID().c_str(), "SMESH", aGeomSO->GetName().c_str() );