Mantis issue 0020812: Register() and Destroy() of the GenericObj.

This commit is contained in:
jfa 2010-06-22 14:43:41 +00:00
parent 5faccfa115
commit 946f0a4e5c
11 changed files with 354 additions and 233 deletions

View File

@ -19,12 +19,11 @@
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// SMESH SMESHGUI : GUI for SMESH component
// File : SMESHGUI.cxx
// Author : Nicolas REJNERI, Open CASCADE S.A.S.
// SMESH SMESHGUI : GUI for SMESH component
// File : SMESHGUI.cxx
// Author : Nicolas REJNERI, Open CASCADE S.A.S.
// SMESH includes
//
// SMESH includes
#include "SMESHGUI.h"
#include "SMESHGUI_AddMeshElementDlg.h"
#include "SMESHGUI_AddQuadraticElementDlg.h"
@ -145,6 +144,10 @@
#include <Standard_ErrorHandler.hxx>
#include <NCollection_DataMap.hxx>
//To disable automatic genericobj management, the following line should be commented.
//Otherwise, it should be uncommented. Refer to KERNEL_SRC/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx
#define WITHGENERICOBJ
//namespace{
// Declarations
//=============================================================
@ -241,6 +244,13 @@
aPixmap->SetPixMap( "ICON_SMESH_TREE_MESH_IMPORTED" );
if ( theCommandID == 112 ) // mesh names aren't taken from the file for UNV import
SMESH::SetName( aMeshSO, QFileInfo(filename).fileName() );
#ifdef WITHGENERICOBJ
// obj has been published in study. Its refcount has been incremented.
// It is safe to decrement its refcount
// so that it will be destroyed when the entry in study will be removed
aMeshes[i]->Destroy();
#endif
}
else {
isEmpty = true;
@ -1299,7 +1309,9 @@ LightApp_Module( "SMESH" )
//=============================================================================
SMESHGUI::~SMESHGUI()
{
#ifdef WITHGENERICOBJ
SMESH::GetFilterManager()->Destroy();
#endif
SMESH::GetFilterManager() = SMESH::FilterManager::_nil();
}
@ -1665,7 +1677,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case 232:
::SetDisplayMode(theCommandID, myMarkerMap);
break;
// Display Entity
case 216: // 0D elements
case 217: // Edges
@ -1772,7 +1784,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
}
else
aSel->setSelectedObjects( to_process );
break;
}
@ -3438,12 +3450,12 @@ void SMESHGUI::initialize( CAM_Application* app )
//-------------------------------------------------
// Representation of the 2D Quadratic elements
//-------------------------------------------------
//-------------------------------------------------
anId = popupMgr()->insert( tr( "MEN_QUADRATIC_REPRESENT" ), -1, -1 );
popupMgr()->insert( action( 231 ), anId, -1 ); // LINE REPRESENTATION
popupMgr()->setRule( action( 231 ), aMeshInVTK + "and isVisible",QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( 231 ), "quadratic2DMode = 'eLines'", QtxPopupMgr::ToggleRule );
popupMgr()->insert( action( 232 ), anId, -1 ); // ARC REPRESENTATION
popupMgr()->setRule( action( 232 ), aMeshInVTK + "and isVisible", QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( 232 ), "quadratic2DMode = 'eArcs'", QtxPopupMgr::ToggleRule );
@ -3485,7 +3497,7 @@ void SMESHGUI::initialize( CAM_Application* app )
aMeshInVtkHasVolumes = aMeshInVTK + "&&" + hasVolumes;
anId = popupMgr()->insert( tr( "MEN_CTRL" ), -1, -1 );
popupMgr()->insert( action( 200 ), anId, -1 ); // RESET
popupMgr()->setRule( action( 200 ), aMeshInVTK + "&& controlMode <> 'eNone'", QtxPopupMgr::VisibleRule );
@ -3566,7 +3578,7 @@ void SMESHGUI::initialize( CAM_Application* app )
popupMgr()->setRule( action( 201 ), aMeshInVTK + "&& controlMode <> 'eNone'", QtxPopupMgr::VisibleRule );
popupMgr()->insert( separator(), -1, -1 );
//-------------------------------------------------
// Display / Erase
//-------------------------------------------------
@ -3616,7 +3628,7 @@ bool SMESHGUI::reusableOperation( const int id )
{
// compute, evaluate and precompute are not reusable operations
return ( id == 701 || id == 711 || id == 712 ) ? false : SalomeApp_Module::reusableOperation( id );
}
}
bool SMESHGUI::activateModule( SUIT_Study* study )
{
@ -3789,8 +3801,8 @@ void SMESHGUI::createPreferences()
"SMESH", "max_angle" );
setPreferenceProperty( maxAngle, "min", 1 );
setPreferenceProperty( maxAngle, "max", 90 );
int exportgroup = addPreference( tr( "PREF_GROUP_EXPORT" ), genTab );
setPreferenceProperty( exportgroup, "columns", 2 );
@ -3821,15 +3833,15 @@ void SMESHGUI::createPreferences()
"SMESH", "nb_segments_per_edge" );
setPreferenceProperty( nbSeg, "min", 1 );
setPreferenceProperty( nbSeg, "max", 10000000 );
// Quantities with individual precision settings
int precGroup = addPreference( tr( "SMESH_PREF_GROUP_PRECISION" ), genTab );
setPreferenceProperty( precGroup, "columns", 2 );
const int nbQuantities = 6;
int precs[nbQuantities], ii = 0;
precs[ii++] = addPreference( tr( "SMESH_PREF_length_precision" ), precGroup,
LightApp_Preferences::IntSpin, "SMESH", "length_precision" );
LightApp_Preferences::IntSpin, "SMESH", "length_precision" );
precs[ii++] = addPreference( tr( "SMESH_PREF_angle_precision" ), precGroup,
LightApp_Preferences::IntSpin, "SMESH", "angle_precision" );
precs[ii++] = addPreference( tr( "SMESH_PREF_len_tol_precision" ), precGroup,
@ -3839,14 +3851,14 @@ void SMESHGUI::createPreferences()
precs[ii++] = addPreference( tr( "SMESH_PREF_area_precision" ), precGroup,
LightApp_Preferences::IntSpin, "SMESH", "area_precision" );
precs[ii ] = addPreference( tr( "SMESH_PREF_vol_precision" ), precGroup,
LightApp_Preferences::IntSpin, "SMESH", "vol_precision" );
LightApp_Preferences::IntSpin, "SMESH", "vol_precision" );
// Set property for precision value for spinboxes
for ( ii = 0; ii < nbQuantities; ii++ ){
setPreferenceProperty( precs[ii], "min", -14 );
setPreferenceProperty( precs[ii], "max", 14 );
setPreferenceProperty( precs[ii], "precision", 2 );
}
}
// Mesh tab ------------------------------------------------------------------------
int meshTab = addPreference( tr( "PREF_TAB_MESH" ) );
@ -4845,7 +4857,7 @@ void SMESHGUI::restoreVisualParameters (int savePoint)
int SMESHGUI::addVtkFontPref( const QString& label, const int pId, const QString& param )
{
int tfont = addPreference( label, pId, LightApp_Preferences::Font, "VISU", param );
setPreferenceProperty( tfont, "mode", QtxFontEdit::Custom );
QStringList fam;

View File

@ -19,12 +19,11 @@
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// SMESH SMESHGUI : GUI for SMESH component
// File : SMESHGUI_BuildCompoundDlg.cxx
// Author : Alexander KOVALEV, Open CASCADE S.A.S.
// SMESH includes
// SMESH SMESHGUI : GUI for SMESH component
// File : SMESHGUI_BuildCompoundDlg.cxx
// Author : Alexander KOVALEV, Open CASCADE S.A.S.
// SMESH includes
//
#include "SMESHGUI_BuildCompoundDlg.h"
#include "SMESHGUI.h"
@ -67,6 +66,10 @@
#define SPACING 6
#define MARGIN 11
//To disable automatic genericobj management, the following line should be commented.
//Otherwise, it should be uncommented. Refer to KERNEL_SRC/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx
#define WITHGENERICOBJ
//=================================================================================
// name : SMESHGUI_BuildCompoundDlg
// Purpose :
@ -143,7 +146,7 @@ SMESHGUI_BuildCompoundDlg::SMESHGUI_BuildCompoundDlg( SMESHGUI* theModule )
GroupArgsLayout->addWidget(TextLabelMeshes, 0, 0);
GroupArgsLayout->addWidget(SelectButton, 0, 1);
GroupArgsLayout->addWidget(LineEditMeshes, 0, 2, 1, 2);
GroupArgsLayout->addWidget(TextLabelUnion, 1, 0, 1, 3);
GroupArgsLayout->addWidget(TextLabelUnion, 1, 0, 1, 3);
GroupArgsLayout->addWidget(ComboBoxUnion, 1, 3);
GroupArgsLayout->addWidget(CheckBoxCommon, 2, 0, 1, 4);
GroupArgsLayout->addWidget(CheckBoxMerge, 3, 0, 1, 4);
@ -301,16 +304,16 @@ bool SMESHGUI_BuildCompoundDlg::ClickOnApply()
SMESH::SMESH_Gen_var aSMESHGen = SMESHGUI::GetSMESHGen();
// concatenate meshes
if(CheckBoxCommon->isChecked())
aCompoundMesh = aSMESHGen->ConcatenateWithGroups(myMeshArray,
!(ComboBoxUnion->currentIndex()),
CheckBoxMerge->isChecked(),
aCompoundMesh = aSMESHGen->ConcatenateWithGroups(myMeshArray,
!(ComboBoxUnion->currentIndex()),
CheckBoxMerge->isChecked(),
SpinBoxTol->GetValue());
else
aCompoundMesh = aSMESHGen->Concatenate(myMeshArray,
!(ComboBoxUnion->currentIndex()),
CheckBoxMerge->isChecked(),
aCompoundMesh = aSMESHGen->Concatenate(myMeshArray,
!(ComboBoxUnion->currentIndex()),
CheckBoxMerge->isChecked(),
SpinBoxTol->GetValue());
aCompoundMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
SMESH::SetName( SMESH::FindSObject( aCompoundMesh ), LineEditName->text() );
@ -325,7 +328,7 @@ bool SMESHGUI_BuildCompoundDlg::ClickOnApply()
if ( SMESHGUI::automaticUpdate() ) {
mySelectionMgr->clearSelected();
SMESH::UpdateView();
_PTR(SObject) aSO = SMESH::FindSObject(aCompoundMesh.in());
if ( SMESH_Actor* anActor = SMESH::CreateActor(aSO->GetStudy(), aSO->GetID().c_str()) )
SMESH::DisplayActor(SMESH::GetActiveWindow(), anActor);
@ -333,6 +336,14 @@ bool SMESHGUI_BuildCompoundDlg::ClickOnApply()
SMESHGUI::Modified();
#ifdef WITHGENERICOBJ
// obj has been published in study. Its refcount has been incremented.
// It is safe to decrement its refcount
// so that it will be destroyed when the entry in study will be removed
if (!CORBA::is_nil(aCompoundMesh))
aCompoundMesh->Destroy();
#endif
return true;
}
return false;
@ -368,7 +379,7 @@ void SMESHGUI_BuildCompoundDlg::ClickOnCancel()
void SMESHGUI_BuildCompoundDlg::ClickOnHelp()
{
LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
if (app)
if (app)
app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
else {
SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
@ -503,7 +514,6 @@ void SMESHGUI_BuildCompoundDlg::keyPressEvent( QKeyEvent* e )
//=================================================================================
void SMESHGUI_BuildCompoundDlg::onSelectMerge(bool toMerge)
{
TextLabelTol->setEnabled(toMerge);
SpinBoxTol->setEnabled(toMerge);
if(!toMerge)

View File

@ -19,12 +19,11 @@
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// SMESH SMESHGUI : GUI for SMESH component
// File : SMESHGUI_Hypotheses.cxx
// Author : Julia DOROVSKIKH, Open CASCADE S.A.S.
// SMESH includes
// SMESH SMESHGUI : GUI for SMESH component
// File : SMESHGUI_Hypotheses.cxx
// Author : Julia DOROVSKIKH, Open CASCADE S.A.S.
// SMESH includes
//
#include "SMESHGUI_Hypotheses.h"
#include "SMESHGUI.h"
@ -53,6 +52,10 @@
#define SPACING 6
#define MARGIN 11
//To disable automatic genericobj management, the following line should be commented.
//Otherwise, it should be uncommented. Refer to KERNEL_SRC/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx
#define WITHGENERICOBJ
SMESHGUI_GenericHypothesisCreator::SMESHGUI_GenericHypothesisCreator( const QString& theHypType )
: myHypType( theHypType ), myIsCreate( false ), myDlg( 0 )
{
@ -86,14 +89,22 @@ void SMESHGUI_GenericHypothesisCreator::create( bool isAlgo,
myIsCreate = true;
// Create hypothesis/algorithm
if (isAlgo)
SMESH::CreateHypothesis( hypType(), theHypName, isAlgo );
else
{
SMESH::SMESH_Hypothesis_var aHypothesis =
if (isAlgo) {
SMESH::SMESH_Hypothesis_var anAlgo =
SMESH::CreateHypothesis( hypType(), theHypName, isAlgo );
#ifdef WITHGENERICOBJ
if (!CORBA::is_nil(anAlgo))
anAlgo->Destroy();
#endif
}
else {
SMESH::SMESH_Hypothesis_var aHypothesis =
SMESH::CreateHypothesis( hypType(), theHypName, false );
editHypothesis( aHypothesis.in(), theHypName, theParent, obj, slot );
#ifdef WITHGENERICOBJ
if (!CORBA::is_nil(aHypothesis))
aHypothesis->Destroy();
#endif
}
}
@ -111,13 +122,16 @@ void SMESHGUI_GenericHypothesisCreator::edit( SMESH::SMESH_Hypothesis_ptr theHyp
editHypothesis( theHypothesis, theHypName, theParent, obj, slot );
}
void SMESHGUI_GenericHypothesisCreator::editHypothesis( SMESH::SMESH_Hypothesis_ptr h,
void SMESHGUI_GenericHypothesisCreator::editHypothesis( SMESH::SMESH_Hypothesis_ptr h,
const QString& theHypName,
QWidget* theParent,
QObject* obj, const QString& slot )
{
myHypName = theHypName;
myHypo = SMESH::SMESH_Hypothesis::_duplicate( h );
#ifdef WITHGENERICOBJ
myHypo->Register();
#endif
SMESHGUI_HypothesisDlg* Dlg = new SMESHGUI_HypothesisDlg( this, theParent );
connect( Dlg, SIGNAL( finished( int ) ), this, SLOT( onDialogFinished( int ) ) );
@ -140,7 +154,7 @@ void SMESHGUI_GenericHypothesisCreator::editHypothesis( SMESH::SMESH_Hypothesis_
else
emit finished( QDialog::Accepted );
}
QFrame* SMESHGUI_GenericHypothesisCreator::buildStdFrame()
{
if( CORBA::is_nil( hypothesis() ) )
@ -169,7 +183,7 @@ QFrame* SMESHGUI_GenericHypothesisCreator::buildStdFrame()
GroupC1Layout->addWidget( lab, i, 0 );
QWidget* w = getCustomWidget( *anIt, GroupC1, i );
if ( !w )
if ( !w )
switch( (*anIt).myValue.type() )
{
case QVariant::Int:
@ -287,6 +301,9 @@ void SMESHGUI_GenericHypothesisCreator::onDialogFinished( int result )
}
}
SMESHGUI::GetSMESHGUI()->updateObjBrowser( true, 0 );
#ifdef WITHGENERICOBJ
myHypo->Destroy();
#endif
myHypo = SMESH::SMESH_Hypothesis::_nil();
myInitParamsHypo = SMESH::SMESH_Hypothesis::_nil();
@ -316,26 +333,22 @@ bool SMESHGUI_GenericHypothesisCreator::getStdParamFromDlg( ListOfStdParams& par
item.myValue = sb->value();
params.append( item );
}
else if( (*anIt)->inherits( "SalomeApp_DoubleSpinBox" ) )
{
SalomeApp_DoubleSpinBox* sb = ( SalomeApp_DoubleSpinBox* )( *anIt );
item.myValue = sb->value();
params.append( item );
}
else if( (*anIt)->inherits( "QLineEdit" ) )
{
QLineEdit* line = ( QLineEdit* )( *anIt );
item.myValue = line->text();
params.append( item );
}
else if ( getParamFromCustomWidget( item, *anIt ))
{
params.append( item );
}
else
res = false;
}
@ -351,7 +364,7 @@ QStringList SMESHGUI_GenericHypothesisCreator::getVariablesFromDlg() const
if( (*anIt)->inherits( "QAbstractSpinBox" ) ) {
QAbstractSpinBox* sb = ( QAbstractSpinBox* )( *anIt );
aResult.append(sb->text());
}
}
}
return aResult;
}
@ -440,7 +453,7 @@ SMESHGUI_GenericHypothesisCreator::ListOfWidgets& SMESHGUI_GenericHypothesisCrea
}
QtxDialog* SMESHGUI_GenericHypothesisCreator:: dlg() const
{
{
return myDlg;
}
@ -565,7 +578,7 @@ SMESHGUI_HypothesisDlg::SMESHGUI_HypothesisDlg( SMESHGUI_GenericHypothesisCreato
QHBoxLayout* titLay = new QHBoxLayout( titFrame );
titLay->setMargin( 0 );
titLay->setSpacing( SPACING );
myIconLabel = new QLabel( titFrame );
myIconLabel->setScaledContents( false );
myIconLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
@ -634,7 +647,7 @@ void SMESHGUI_HypothesisDlg::onHelp()
#endif
SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
arg(app->resourceMgr()->stringValue("ExternalBrowser",
arg(app->resourceMgr()->stringValue("ExternalBrowser",
platform)).
arg(myHelpFileName));
}
@ -642,7 +655,7 @@ void SMESHGUI_HypothesisDlg::onHelp()
void SMESHGUI_HypothesisDlg::setHIcon( const QPixmap& p )
{
myIconLabel->setPixmap( p );
myIconLabel->setPixmap( p );
}
void SMESHGUI_HypothesisDlg::setType( const QString& t )
@ -672,7 +685,7 @@ HypothesisData::HypothesisData( const QString& theTypeName,
IconId( theIconId ),
Dim( theDim ),
IsAux( theIsAux ),
NeededHypos( theNeededHypos ),
NeededHypos( theNeededHypos ),
OptionalHypos( theOptionalHypos ),
InputTypes( theInputTypes ),
OutputTypes( theOutputTypes ),
@ -681,7 +694,7 @@ HypothesisData::HypothesisData( const QString& theTypeName,
{
}
HypothesesSet::HypothesesSet( const QString& theSetName )
HypothesesSet::HypothesesSet( const QString& theSetName )
: myHypoSetName( theSetName ),
myIsAlgo( false )
{
@ -690,8 +703,8 @@ HypothesesSet::HypothesesSet( const QString& theSetName )
HypothesesSet::HypothesesSet( const QString& theSetName,
const QStringList& theHypoList,
const QStringList& theAlgoList )
: myHypoSetName( theSetName ),
myHypoList( theHypoList ),
: myHypoSetName( theSetName ),
myHypoList( theHypoList ),
myAlgoList( theAlgoList ),
myIsAlgo( false )
{
@ -747,4 +760,3 @@ QString HypothesesSet::current() const
{
return list()->at(myIndex);
}

View File

@ -19,12 +19,11 @@
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// SMESH SMESHGUI : GUI for SMESH component
// File : SMESHGUI_MeshOp.cxx
// Author : Sergey LITONIN, Open CASCADE S.A.S.
// SMESH SMESHGUI : GUI for SMESH component
// File : SMESHGUI_MeshOp.cxx
// Author : Sergey LITONIN, Open CASCADE S.A.S.
// SMESH includes
//
#include "SMESHGUI_MeshOp.h"
#include "SMESHGUI.h"
@ -72,6 +71,10 @@
#include <SALOMEconfig.h>
#include CORBA_CLIENT_HEADER(SMESH_Gen)
//To disable automatic genericobj management, the following line should be commented.
//Otherwise, it should be uncommented. Refer to KERNEL_SRC/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx
#define WITHGENERICOBJ
//================================================================================
/*!
* \brief Constructor
@ -280,7 +283,6 @@ SUIT_SelectionFilter* SMESHGUI_MeshOp::createFilter( const int theId ) const
* \retval bool - check result
*/
//================================================================================
bool SMESHGUI_MeshOp::isSubshapeOk() const
{
if ( !myToCreate || myIsMesh ) // not submesh creation
@ -343,11 +345,10 @@ bool SMESHGUI_MeshOp::isSubshapeOk() const
//================================================================================
/*!
* \brief Return name of the algorithm that does not support submeshes and makes
* submesh creation useless
* submesh creation useless
* \retval char* - string is to be deleted!!!
*/
//================================================================================
char* SMESHGUI_MeshOp::isSubmeshIgnored() const
{
if ( myToCreate && !myIsMesh ) {
@ -393,7 +394,6 @@ char* SMESHGUI_MeshOp::isSubmeshIgnored() const
* \retval _PTR(SObject) - the found submesh SObject
*/
//================================================================================
_PTR(SObject) SMESHGUI_MeshOp::getSubmeshByGeom() const
{
QString aMeshEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Mesh );
@ -581,7 +581,7 @@ void SMESHGUI_MeshOp::selectionDone()
bool editSubmesh = ( !sm->_is_nil() &&
SUIT_MessageBox::question( myDlg, tr( "SMESH_WARNING" ),
tr( "EDIT_SUBMESH_QUESTION"),
SUIT_MessageBox::Yes |
SUIT_MessageBox::Yes |
SUIT_MessageBox::No,
SUIT_MessageBox::No )
== SUIT_MessageBox::Yes );
@ -743,7 +743,6 @@ bool SMESHGUI_MeshOp::isValid( QString& theMess ) const
* \retval bool - check result
*/
//================================================================================
static bool isCompatible(const HypothesisData* theAlgoData,
const HypothesisData* theHypData,
const int theHypType)
@ -886,7 +885,6 @@ void SMESHGUI_MeshOp::existingHyps( const int theDim,
* \retval SMESH::SMESH_Hypothesis_var - the hypothesis holding parameter values
*/
//================================================================================
SMESH::SMESH_Hypothesis_var
SMESHGUI_MeshOp::getInitParamsHypothesis( const QString& aHypType,
const QString& aServerLib ) const
@ -972,7 +970,6 @@ SMESHGUI_MeshOp::getInitParamsHypothesis( const QString& aHypType,
* \retval int - dimention
*/
//================================================================================
static int getTabDim (const QObject* tab, SMESHGUI_MeshDlg* dlg )
{
int aDim = -1;
@ -1030,7 +1027,6 @@ namespace
* \param theTypeName - specifies hypothesis to be created
*/
//================================================================================
void SMESHGUI_MeshOp::createHypothesis(const int theDim,
const int theType,
const QString& theTypeName)
@ -1064,7 +1060,12 @@ void SMESHGUI_MeshOp::createHypothesis(const int theDim,
QString aClientLibName = aData->ClientLibName;
if (aClientLibName == "") {
// Call hypothesis creation server method (without GUI)
SMESH::CreateHypothesis(theTypeName, aHypName, false);
SMESH::SMESH_Hypothesis_var aHyp =
SMESH::CreateHypothesis(theTypeName, aHypName, false);
#ifdef WITHGENERICOBJ
if (!CORBA::is_nil(aHyp))
aHyp->Destroy();
#endif
} else {
// Get hypotheses creator client (GUI)
// BUG 0020378
@ -1086,13 +1087,13 @@ void SMESHGUI_MeshOp::createHypothesis(const int theDim,
aGeomEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom );
aMeshEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Mesh );
anObjEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Obj );
if ( aMeshEntry != "" ) { // Get Geom object from Mesh
_PTR(SObject) pObj = studyDS()->FindObjectID( aMeshEntry.toLatin1().data() );
GEOM::GEOM_Object_var aGeomVar = SMESH::GetShapeOnMeshOrSubMesh( pObj );
aMeshEntry = ( aGeomVar->_is_nil() ) ? "" : aMeshEntry = aGeomVar->GetStudyEntry();
}
if ( aMeshEntry == "" && aGeomEntry == "" ) {
_PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry.toLatin1().data() );
GEOM::GEOM_Object_var aGeomVar = SMESH::GetShapeOnMeshOrSubMesh( pObj );
@ -1117,7 +1118,7 @@ void SMESHGUI_MeshOp::createHypothesis(const int theDim,
}
}
}
aCreator->setShapeEntry( aGeomEntry );
if ( aMeshEntry != "" )
aCreator->setMainShapeEntry( aMeshEntry );
@ -1125,8 +1126,14 @@ void SMESHGUI_MeshOp::createHypothesis(const int theDim,
aCreator->create(initParamHyp, aHypName, myDlg, this, SLOT( onHypoCreated( int ) ) );
dialog = true;
}
else
SMESH::CreateHypothesis(theTypeName, aHypName, false);
else {
SMESH::SMESH_Hypothesis_var aHyp =
SMESH::CreateHypothesis(theTypeName, aHypName, false);
#ifdef WITHGENERICOBJ
if (!CORBA::is_nil(aHyp))
aHyp->Destroy();
#endif
}
}
if( !dialog )
@ -1274,7 +1281,6 @@ void SMESHGUI_MeshOp::onHypoEdited( int result )
* \retval HypothesisData* - result data, may be 0
*/
//================================================================================
HypothesisData* SMESHGUI_MeshOp::hypData( const int theDim,
const int theHypType,
const int theIndex)
@ -1292,7 +1298,6 @@ HypothesisData* SMESHGUI_MeshOp::hypData( const int theDim,
* \param theIndex - algorithm index
*/
//================================================================================
void SMESHGUI_MeshOp::onAlgoSelected( const int theIndex,
const int theDim )
{
@ -1588,7 +1593,13 @@ bool SMESHGUI_MeshOp::createMesh( QString& theMess )
if ( !anAlgoVar->_is_nil() )
SMESH::AddHypothesisOnMesh( aMeshVar, anAlgoVar );
}
#ifdef WITHGENERICOBJ
// obj has been published in study. Its refcount has been incremented.
// It is safe to decrement its refcount
// so that it will be destroyed when the entry in study will be removed
if (aMeshSO)
aMeshVar->Destroy();
#endif
}
return true;
}
@ -1676,7 +1687,7 @@ bool SMESHGUI_MeshOp::createSubMesh( QString& theMess )
QString aNewGeomGroupName ("Auto_group_for_");
aNewGeomGroupName += aName;
SALOMEDS::SObject_var aNewGroupSO =
geomGen->AddInStudy(aSMESHGen->GetCurrentStudy(), aGeomVar,
geomGen->AddInStudy(aSMESHGen->GetCurrentStudy(), aGeomVar,
aNewGeomGroupName.toLatin1().data(), mainGeom);
}
}
@ -1846,7 +1857,12 @@ SMESH::SMESH_Hypothesis_var SMESHGUI_MeshOp::getAlgo( const int theDim )
if (aClientLibName == "")
{
// Call hypothesis creation server method (without GUI)
SMESH::CreateHypothesis(aHypName, aHypData->Label, true);
SMESH::SMESH_Hypothesis_var aHyp =
SMESH::CreateHypothesis(aHypName, aHypData->Label, true);
#ifdef WITHGENERICOBJ
if (!CORBA::is_nil(aHyp))
aHyp->Destroy();
#endif
}
else
{
@ -1858,8 +1874,14 @@ SMESH::SMESH_Hypothesis_var SMESHGUI_MeshOp::getAlgo( const int theDim )
// Create algorithm
if (aCreator)
aCreator->create(true, aHypName, myDlg, 0, QString::null );
else
SMESH::CreateHypothesis(aHypName, aHypData->Label, true);
else {
SMESH::SMESH_Hypothesis_var aHyp =
SMESH::CreateHypothesis(aHypName, aHypData->Label, true);
#ifdef WITHGENERICOBJ
if (!CORBA::is_nil(aHyp))
aHyp->Destroy();
#endif
}
}
QStringList tmpList;
_PTR(SComponent) aFather = SMESH::GetActiveStudyDocument()->FindComponent( "SMESH" );
@ -2160,14 +2182,14 @@ bool SMESHGUI_MeshOp::editMeshOrSubMesh( QString& theMess )
//================================================================================
/*!
* \brief Verifies whether given operator is valid for this one
* \param theOtherOp - other operation
* \return Returns TRUE if the given operator is valid for this one, FALSE otherwise
*
* method redefined from base class verifies whether given operator is valid for
* this one (i.e. can be started "above" this operator). In current implementation method
* retuns false if theOtherOp operation is not intended for deleting objects or mesh
* elements.
*/
* \param theOtherOp - other operation
* \return Returns TRUE if the given operator is valid for this one, FALSE otherwise
*
* method redefined from base class verifies whether given operator is valid for
* this one (i.e. can be started "above" this operator). In current implementation method
* retuns false if theOtherOp operation is not intended for deleting objects or mesh
* elements.
*/
//================================================================================
bool SMESHGUI_MeshOp::isValid( SUIT_Operation* theOp ) const
{
@ -2177,10 +2199,9 @@ bool SMESHGUI_MeshOp::isValid( SUIT_Operation* theOp ) const
//================================================================================
/*!
* \brief SLOT. Is called when the user selects a way of geometry selection
* \param theByMesh - true if the user wants to find geometry by mesh element
* \param theByMesh - true if the user wants to find geometry by mesh element
*/
//================================================================================
void SMESHGUI_MeshOp::onGeomSelectionByMesh( bool theByMesh )
{
if ( theByMesh ) {
@ -2212,7 +2233,6 @@ void SMESHGUI_MeshOp::onGeomSelectionByMesh( bool theByMesh )
* \brief SLOT. Is called when Ok is pressed in SMESHGUI_ShapeByMeshDlg
*/
//================================================================================
void SMESHGUI_MeshOp::onPublishShapeByMeshDlg(SUIT_Operation* op)
{
if ( myShapeByMeshOp == op ) {
@ -2236,7 +2256,6 @@ void SMESHGUI_MeshOp::onPublishShapeByMeshDlg(SUIT_Operation* op)
* \brief SLOT. Is called when Close is pressed in SMESHGUI_ShapeByMeshDlg
*/
//================================================================================
void SMESHGUI_MeshOp::onCloseShapeByMeshDlg(SUIT_Operation* op)
{
if ( myShapeByMeshOp == op && myDlg ) {
@ -2247,10 +2266,9 @@ void SMESHGUI_MeshOp::onCloseShapeByMeshDlg(SUIT_Operation* op)
//================================================================================
/*!
* \brief Selects a SObject
* \param theSObj - the SObject to select
* \param theSObj - the SObject to select
*/
//================================================================================
void SMESHGUI_MeshOp::selectObject( _PTR(SObject) theSObj ) const
{
if ( LightApp_SelectionMgr* sm = selectionMgr() ) {

View File

@ -19,12 +19,11 @@
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// SMESH SMESHGUI : GUI for SMESH component
// File : SMESHGUI_RotationDlg.cxx
// Author : Michael ZORIN, Open CASCADE S.A.S.
// SMESH includes
// SMESH SMESHGUI : GUI for SMESH component
// File : SMESHGUI_RotationDlg.cxx
// Author : Michael ZORIN, Open CASCADE S.A.S.
// SMESH includes
//
#include "SMESHGUI_RotationDlg.h"
#include "SMESHGUI.h"
@ -84,6 +83,10 @@ enum { MOVE_ELEMS_BUTTON = 0, COPY_ELEMS_BUTTON, MAKE_MESH_BUTTON }; //!< action
#define SPACING 8
#define MARGIN 11
//To disable automatic genericobj management, the following line should be commented.
//Otherwise, it should be uncommented. Refer to KERNEL_SRC/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx
#define WITHGENERICOBJ
//=================================================================================
// class : SMESHGUI_RotationDlg()
// purpose :
@ -430,22 +433,31 @@ bool SMESHGUI_RotationDlg::ClickOnApply()
else {
if(CheckBoxMesh->isChecked())
aMeshEditor->RotateObject(mySelectedObject, anAxis, anAngle, true);
else
else
aMeshEditor->Rotate(anElementsId, anAxis, anAngle, true);
}
if( !myMesh->_is_nil())
myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
break;
case MAKE_MESH_BUTTON:
case MAKE_MESH_BUTTON: {
SMESH::SMESH_Mesh_var mesh;
if(CheckBoxMesh->isChecked())
if (CheckBoxMesh->isChecked())
mesh = aMeshEditor->RotateObjectMakeMesh(mySelectedObject, anAxis, anAngle, makeGroups,
LineEditNewMesh->text().toLatin1().data());
else
else
mesh = aMeshEditor->RotateMakeMesh(anElementsId, anAxis, anAngle, makeGroups,
LineEditNewMesh->text().toLatin1().data());
if( !mesh->_is_nil())
mesh->SetParameters( aParameters.join(":").toLatin1().constData() );
if (!mesh->_is_nil()) {
mesh->SetParameters(aParameters.join(":").toLatin1().constData());
#ifdef WITHGENERICOBJ
// obj has been published in study. Its refcount has been incremented.
// It is safe to decrement its refcount
// so that it will be destroyed when the entry in study will be removed
mesh->Destroy();
#endif
}
break;
}
}
} catch (...) {
}
@ -500,7 +512,7 @@ void SMESHGUI_RotationDlg::ClickOnCancel()
void SMESHGUI_RotationDlg::ClickOnHelp()
{
LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
if (app)
if (app)
app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
else {
QString platform;
@ -542,9 +554,9 @@ void SMESHGUI_RotationDlg::onTextChange (const QString& theNewText)
if (aMesh) {
if (send == LineEditElements) {
Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
TColStd_MapOfInteger newIndices;
QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts);
for (int i = 0; i < aListId.count(); i++) {
const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt());
@ -556,7 +568,7 @@ void SMESHGUI_RotationDlg::onTextChange (const QString& theNewText)
mySelector->AddOrRemoveIndex( anIO, newIndices, false );
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->highlight( anIO, true, true );
myElementsId = theNewText;
}
}
@ -649,7 +661,7 @@ void SMESHGUI_RotationDlg::SelectionIntoArgument()
} else if (!SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO)->_is_nil()) { //SUBMESH
// get submesh
SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO);
// get IDs from submesh
SMESH::long_array_var anElementsIds = new SMESH::long_array;
anElementsIds = aSubMesh->GetElementsId();
@ -715,7 +727,7 @@ void SMESHGUI_RotationDlg::SelectionIntoArgument()
LineEditElements->setText(aString);
LineEditElements->repaint();
LineEditElements->setEnabled(false); // to update lineedit IPAL 19809
LineEditElements->setEnabled(true);
LineEditElements->setEnabled(true);
setNewMeshName();
}
myBusy = false;

View File

@ -16,12 +16,11 @@
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// SMESH SMESHGUI : GUI for SMESH component
// File : SMESHGUI_ScaleDlg.cxx
// Author : Michael ZORIN, Open CASCADE S.A.S.
// SMESH includes
// SMESH SMESHGUI : GUI for SMESH component
// File : SMESHGUI_ScaleDlg.cxx
// Author : Michael ZORIN, Open CASCADE S.A.S.
// SMESH includes
//
#include "SMESHGUI_ScaleDlg.h"
#include "SMESHGUI.h"
@ -99,6 +98,10 @@ private:
#define SPACING 6
#define MARGIN 11
//To disable automatic genericobj management, the following line should be commented.
//Otherwise, it should be uncommented. Refer to KERNEL_SRC/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx
#define WITHGENERICOBJ
//=================================================================================
// class : SMESHGUI_ScaleDlg()
// purpose :
@ -481,7 +484,7 @@ bool SMESHGUI_ScaleDlg::ClickOnApply()
break;
case COPY_ELEMS_BUTTON:
if ( makeGroups ) {
SMESH::ListOfGroups_var groups;
SMESH::ListOfGroups_var groups;
if(CheckBoxMesh->isChecked()) {
groups = aMeshEditor->ScaleMakeGroups(mySelectedObject, aPoint, aScaleFact);
}
@ -502,9 +505,9 @@ bool SMESHGUI_ScaleDlg::ClickOnApply()
if( !myMesh->_is_nil())
myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
break;
case MAKE_MESH_BUTTON:
SMESH::SMESH_Mesh_var mesh;
if(CheckBoxMesh->isChecked()) {
case MAKE_MESH_BUTTON: {
SMESH::SMESH_Mesh_var mesh;
if (CheckBoxMesh->isChecked()) {
mesh = aMeshEditor->ScaleMakeMesh(mySelectedObject, aPoint, aScaleFact, makeGroups,
LineEditNewMesh->text().toLatin1().data());
}
@ -513,12 +516,21 @@ bool SMESHGUI_ScaleDlg::ClickOnApply()
aPoint, aScaleFact, makeGroups,
LineEditNewMesh->text().toLatin1().data());
}
if( !mesh->_is_nil())
mesh->SetParameters( aParameters.join(":").toLatin1().constData() );
if (!mesh->_is_nil()) {
mesh->SetParameters(aParameters.join(":").toLatin1().constData());
#ifdef WITHGENERICOBJ
// obj has been published in study. Its refcount has been incremented.
// It is safe to decrement its refcount
// so that it will be destroyed when the entry in study will be removed
mesh->Destroy();
#endif
}
break;
}
}
} catch (...) {
}
SMESH::UpdateView();
if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ||
actionButton == MAKE_MESH_BUTTON )
@ -530,7 +542,7 @@ bool SMESHGUI_ScaleDlg::ClickOnApply()
SMESHGUI::Modified();
}
return true;
}
@ -570,7 +582,7 @@ void SMESHGUI_ScaleDlg::ClickOnCancel()
void SMESHGUI_ScaleDlg::ClickOnHelp()
{
LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
if (app)
if (app)
app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
else {
QString platform;
@ -581,7 +593,7 @@ void SMESHGUI_ScaleDlg::ClickOnHelp()
#endif
SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
arg(app->resourceMgr()->stringValue("ExternalBrowser",
arg(app->resourceMgr()->stringValue("ExternalBrowser",
platform)).
arg(myHelpFileName));
}
@ -611,7 +623,7 @@ void SMESHGUI_ScaleDlg::onTextChange (const QString& theNewText)
if (aMesh) {
Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
TColStd_MapOfInteger newIndices;
QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts);
@ -628,7 +640,7 @@ void SMESHGUI_ScaleDlg::onTextChange (const QString& theNewText)
mySelector->AddOrRemoveIndex( anIO, newIndices, false );
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->highlight( anIO, true, true );
myElementsId = theNewText;
}
@ -745,7 +757,7 @@ void SMESHGUI_ScaleDlg::SelectionIntoArgument()
aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, IO, aString);
myElementsId = aString;
if (aNbUnits < 1)
return;
return;
}
myNbOkElements = true;
@ -782,7 +794,7 @@ void SMESHGUI_ScaleDlg::SelectionIntoArgument()
LineEditElements->setText(aString);
LineEditElements->repaint();
LineEditElements->setEnabled(false); // to fully update lineedit IPAL 19809
LineEditElements->setEnabled(true);
LineEditElements->setEnabled(true);
setNewMeshName();
}

View File

@ -19,12 +19,11 @@
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// SMESH SMESHGUI : GUI for SMESH component
// File : SMESHGUI_SymmetryDlg.cxx
// Author : Michael ZORIN, Open CASCADE S.A.S.
// SMESH includes
// SMESH SMESHGUI : GUI for SMESH component
// File : SMESHGUI_SymmetryDlg.cxx
// Author : Michael ZORIN, Open CASCADE S.A.S.
// SMESH includes
//
#include "SMESHGUI_SymmetryDlg.h"
#include "SMESHGUI.h"
@ -84,6 +83,10 @@ enum { MOVE_ELEMS_BUTTON = 0, COPY_ELEMS_BUTTON, MAKE_MESH_BUTTON }; //!< action
#define SPACING 6
#define MARGIN 11
//To disable automatic genericobj management, the following line should be commented.
//Otherwise, it should be uncommented. Refer to KERNEL_SRC/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx
#define WITHGENERICOBJ
//=================================================================================
// class : SMESHGUI_SymmetryDlg()
// purpose :
@ -500,7 +503,7 @@ bool SMESHGUI_SymmetryDlg::ClickOnApply()
aMeshEditor->MirrorObject(mySelectedObject, aMirror, aMirrorType, false );
else
aMeshEditor->Mirror(anElementsId, aMirror, aMirrorType, false );
if( !myMesh->_is_nil())
myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
break;
@ -525,20 +528,27 @@ bool SMESHGUI_SymmetryDlg::ClickOnApply()
}
case MAKE_MESH_BUTTON: {
SMESH::SMESH_Mesh_var mesh;
if(CheckBoxMesh->isChecked())
if (CheckBoxMesh->isChecked())
mesh = aMeshEditor->MirrorObjectMakeMesh(mySelectedObject, aMirror, aMirrorType, makeGroups,
LineEditNewMesh->text().toLatin1().data());
else
mesh = aMeshEditor->MirrorMakeMesh(anElementsId, aMirror, aMirrorType, makeGroups,
LineEditNewMesh->text().toLatin1().data());
if( !mesh->_is_nil())
mesh->SetParameters( aParameters.join(":").toLatin1().constData() );
if (!mesh->_is_nil()) {
mesh->SetParameters(aParameters.join(":").toLatin1().constData());
#ifdef WITHGENERICOBJ
// obj has been published in study. Its refcount has been incremented.
// It is safe to decrement its refcount
// so that it will be destroyed when the entry in study will be removed
mesh->Destroy();
#endif
}
break;
}
}
} catch (...) {
}
SMESH::UpdateView();
if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ||
actionButton == MAKE_MESH_BUTTON )
@ -589,7 +599,7 @@ void SMESHGUI_SymmetryDlg::ClickOnCancel()
void SMESHGUI_SymmetryDlg::ClickOnHelp()
{
LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
if (app)
if (app)
app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
else {
QString platform;
@ -632,7 +642,7 @@ void SMESHGUI_SymmetryDlg::onTextChange (const QString& theNewText)
Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
TColStd_MapOfInteger newIndices;
QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts);
if (send == LineEditElements) {
@ -646,7 +656,7 @@ void SMESHGUI_SymmetryDlg::onTextChange (const QString& theNewText)
mySelector->AddOrRemoveIndex( anIO, newIndices, false );
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->highlight( anIO, true, true );
myElementsId = theNewText;
}
}
@ -736,7 +746,6 @@ void SMESHGUI_SymmetryDlg::SelectionIntoArgument()
aNbUnits++;
}
}
} else if (!SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO)->_is_nil()) { //SUBMESH
// get submesh
SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO);
@ -749,7 +758,6 @@ void SMESHGUI_SymmetryDlg::SelectionIntoArgument()
myElementsId += QString(" %1").arg(anElementsIds[i]);
}
aNbUnits = anElementsIds->length();
} else { // GROUP
// get smesh group
SMESH::SMESH_GroupBase_var aGroup =
@ -772,7 +780,7 @@ void SMESHGUI_SymmetryDlg::SelectionIntoArgument()
if (aNbUnits < 1)
return;
}
myNbOkElements = true;
} else {
aNbUnits = SMESH::GetNameOfSelectedNodes(mySelector, IO, aString);
@ -807,7 +815,7 @@ void SMESHGUI_SymmetryDlg::SelectionIntoArgument()
LineEditElements->setText(aString);
LineEditElements->repaint();
LineEditElements->setEnabled(false); // to update lineedit IPAL 19809
LineEditElements->setEnabled(true);
LineEditElements->setEnabled(true);
setNewMeshName();
}
myBusy = false;

View File

@ -19,12 +19,11 @@
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// SMESH SMESHGUI : GUI for SMESH component
// File : SMESHGUI_TranslationDlg.cxx
// Author : Michael ZORIN, Open CASCADE S.A.S.
// SMESH includes
// SMESH SMESHGUI : GUI for SMESH component
// File : SMESHGUI_TranslationDlg.cxx
// Author : Michael ZORIN, Open CASCADE S.A.S.
// SMESH includes
//
#include "SMESHGUI_TranslationDlg.h"
#include "SMESHGUI.h"
@ -102,6 +101,10 @@ private:
#define SPACING 6
#define MARGIN 11
//To disable automatic genericobj management, the following line should be commented.
//Otherwise, it should be uncommented. Refer to KERNEL_SRC/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx
#define WITHGENERICOBJ
//=================================================================================
// class : SMESHGUI_TranslationDlg()
// purpose :
@ -494,7 +497,7 @@ bool SMESHGUI_TranslationDlg::ClickOnApply()
break;
case COPY_ELEMS_BUTTON:
if ( makeGroups ) {
SMESH::ListOfGroups_var groups;
SMESH::ListOfGroups_var groups;
if(CheckBoxMesh->isChecked())
groups = aMeshEditor->TranslateObjectMakeGroups(mySelectedObject,aVector);
else
@ -510,19 +513,26 @@ bool SMESHGUI_TranslationDlg::ClickOnApply()
myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
break;
case MAKE_MESH_BUTTON:
SMESH::SMESH_Mesh_var mesh;
if(CheckBoxMesh->isChecked())
SMESH::SMESH_Mesh_var mesh;
if (CheckBoxMesh->isChecked())
mesh = aMeshEditor->TranslateObjectMakeMesh(mySelectedObject, aVector, makeGroups,
LineEditNewMesh->text().toLatin1().data());
else
mesh = aMeshEditor->TranslateMakeMesh(anElementsId, aVector, makeGroups,
LineEditNewMesh->text().toLatin1().data());
if( !mesh->_is_nil())
mesh->SetParameters( aParameters.join(":").toLatin1().constData() );
if (!mesh->_is_nil()) {
mesh->SetParameters(aParameters.join(":").toLatin1().constData());
#ifdef WITHGENERICOBJ
// obj has been published in study. Its refcount has been incremented.
// It is safe to decrement its refcount
// so that it will be destroyed when the entry in study will be removed
mesh->Destroy();
#endif
}
}
} catch (...) {
}
SMESH::UpdateView();
if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ||
actionButton == MAKE_MESH_BUTTON )
@ -534,7 +544,7 @@ bool SMESHGUI_TranslationDlg::ClickOnApply()
SMESHGUI::Modified();
}
return true;
}
@ -574,7 +584,7 @@ void SMESHGUI_TranslationDlg::ClickOnCancel()
void SMESHGUI_TranslationDlg::ClickOnHelp()
{
LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
if (app)
if (app)
app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
else {
QString platform;
@ -585,7 +595,7 @@ void SMESHGUI_TranslationDlg::ClickOnHelp()
#endif
SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
arg(app->resourceMgr()->stringValue("ExternalBrowser",
arg(app->resourceMgr()->stringValue("ExternalBrowser",
platform)).
arg(myHelpFileName));
}
@ -615,7 +625,7 @@ void SMESHGUI_TranslationDlg::onTextChange (const QString& theNewText)
if (aMesh) {
Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
TColStd_MapOfInteger newIndices;
QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts);
@ -632,7 +642,7 @@ void SMESHGUI_TranslationDlg::onTextChange (const QString& theNewText)
mySelector->AddOrRemoveIndex( anIO, newIndices, false );
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->highlight( anIO, true, true );
myElementsId = theNewText;
}
@ -750,7 +760,7 @@ void SMESHGUI_TranslationDlg::SelectionIntoArgument()
aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, IO, aString);
myElementsId = aString;
if (aNbUnits < 1)
return;
return;
}
myNbOkElements = true;
@ -786,7 +796,7 @@ void SMESHGUI_TranslationDlg::SelectionIntoArgument()
LineEditElements->setText(aString);
LineEditElements->repaint();
LineEditElements->setEnabled(false); // to fully update lineedit IPAL 19809
LineEditElements->setEnabled(true);
LineEditElements->setEnabled(true);
setNewMeshName();
}

View File

@ -19,14 +19,14 @@
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
// File : SMESH_Gen_i_1.cxx
// Created : Thu Oct 21 17:24:06 2004
// Author : Edward AGAPOV (eap)
// Module : SMESH
// $Header:
//
// File : SMESH_Gen_i_1.cxx
// Created : Thu Oct 21 17:24:06 2004
// Author : Edward AGAPOV (eap)
// Module : SMESH
// $Header : $
#include "SMESH_Gen_i.hxx"
#include "SMESH_Mesh_i.hxx"

View File

@ -19,12 +19,11 @@
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
// File : SMESH_Mesh_i.cxx
// Author : Paul RASCLE, EDF
// Module : SMESH
//
#include "SMESH_Mesh_i.hxx"
#include "SMESH_Filter_i.hxx"
@ -90,7 +89,9 @@ using SMESH::TPythonDump;
int SMESH_Mesh_i::myIdGenerator = 0;
//To disable automatic genericobj management, the following line should be commented.
//Otherwise, it should be uncommented. Refer to KERNEL_SRC/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx
#define WITHGENERICOBJ
//=============================================================================
/*!
@ -119,17 +120,43 @@ SMESH_Mesh_i::SMESH_Mesh_i( PortableServer::POA_ptr thePOA,
SMESH_Mesh_i::~SMESH_Mesh_i()
{
INFOS("~SMESH_Mesh_i");
map<int, SMESH::SMESH_GroupBase_ptr>::iterator it;
for ( it = _mapGroups.begin(); it != _mapGroups.end(); it++ ) {
SMESH_GroupBase_i* aGroup = dynamic_cast<SMESH_GroupBase_i*>( SMESH_Gen_i::GetServant( it->second ).in() );
if ( aGroup ) {
// this method is colled from destructor of group (PAL6331)
// destroy groups
map<int, SMESH::SMESH_GroupBase_ptr>::iterator itGr;
for (itGr = _mapGroups.begin(); itGr != _mapGroups.end(); itGr++) {
SMESH_GroupBase_i* aGroup = dynamic_cast<SMESH_GroupBase_i*>(SMESH_Gen_i::GetServant(itGr->second).in());
if (aGroup) {
// this method is called from destructor of group (PAL6331)
//_impl->RemoveGroup( aGroup->GetLocalID() );
#ifdef WITHGENERICOBJ
aGroup->Destroy();
#endif
}
}
_mapGroups.clear();
#ifdef WITHGENERICOBJ
// destroy submeshes
map<int, SMESH::SMESH_subMesh_ptr>::iterator itSM;
for ( itSM = _mapSubMeshIor.begin(); itSM != _mapSubMeshIor.end(); itSM++ ) {
SMESH_subMesh_i* aSubMesh = dynamic_cast<SMESH_subMesh_i*>(SMESH_Gen_i::GetServant(itSM->second).in());
if (aSubMesh) {
aSubMesh->Destroy();
}
}
_mapSubMeshIor.clear();
// destroy hypotheses
map<int, SMESH::SMESH_Hypothesis_ptr>::iterator itH;
for ( itH = _mapHypo.begin(); itH != _mapHypo.end(); itH++ ) {
SMESH_Hypothesis_i* aHypo = dynamic_cast<SMESH_Hypothesis_i*>(SMESH_Gen_i::GetServant(itH->second).in());
if (aHypo) {
aHypo->Destroy();
}
}
_mapHypo.clear();
#endif
delete _impl;
}
@ -474,6 +501,9 @@ SMESH_Hypothesis::Hypothesis_Status
status = _impl->AddHypothesis(myLocSubShape, hypId);
if ( !SMESH_Hypothesis::IsStatusFatal(status) ) {
_mapHypo[hypId] = SMESH::SMESH_Hypothesis::_duplicate( myHyp );
#ifdef WITHGENERICOBJ
_mapHypo[hypId]->Register();
#endif
// assure there is a corresponding submesh
if ( !_impl->IsMainShape( myLocSubShape )) {
int shapeId = _impl->GetMeshDS()->ShapeToIndex( myLocSubShape );

View File

@ -19,12 +19,11 @@
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
// File : SMESH_Mesh_i.hxx
// Author : Paul RASCLE, EDF
// Module : SMESH
//
#ifndef _SMESH_MESH_I_HXX_
#define _SMESH_MESH_I_HXX_
@ -98,7 +97,7 @@ public:
SMESH::SMESH_Group_ptr CreateGroup( SMESH::ElementType theElemType, const char* theName )
throw (SALOME::SALOME_Exception);
SMESH::SMESH_GroupOnGeom_ptr CreateGroupFromGEOM(SMESH::ElementType theElemType,
const char* theName,
GEOM::GEOM_Object_ptr theGeomObj )
@ -106,49 +105,49 @@ public:
void RemoveGroup( SMESH::SMESH_GroupBase_ptr theGroup )
throw (SALOME::SALOME_Exception);
void RemoveGroupWithContents( SMESH::SMESH_GroupBase_ptr theGroup )
throw (SALOME::SALOME_Exception);
SMESH::ListOfGroups* GetGroups()
throw (SALOME::SALOME_Exception);
CORBA::Long NbGroups()
throw (SALOME::SALOME_Exception);
SMESH::SMESH_Group_ptr UnionGroups( SMESH::SMESH_GroupBase_ptr theGroup1,
SMESH::SMESH_GroupBase_ptr theGroup2,
SMESH::SMESH_Group_ptr UnionGroups( SMESH::SMESH_GroupBase_ptr theGroup1,
SMESH::SMESH_GroupBase_ptr theGroup2,
const char* theName )
throw (SALOME::SALOME_Exception);
SMESH::SMESH_Group_ptr UnionListOfGroups( const SMESH::ListOfGroups& theGroups,
SMESH::SMESH_Group_ptr UnionListOfGroups( const SMESH::ListOfGroups& theGroups,
const char* theName)
throw (SALOME::SALOME_Exception);
SMESH::SMESH_Group_ptr IntersectGroups( SMESH::SMESH_GroupBase_ptr theGroup1,
SMESH::SMESH_GroupBase_ptr theGroup2,
SMESH::SMESH_Group_ptr IntersectGroups( SMESH::SMESH_GroupBase_ptr theGroup1,
SMESH::SMESH_GroupBase_ptr theGroup2,
const char* theName )
throw (SALOME::SALOME_Exception);
SMESH::SMESH_Group_ptr IntersectListOfGroups( const SMESH::ListOfGroups& theGroups,
SMESH::SMESH_Group_ptr IntersectListOfGroups( const SMESH::ListOfGroups& theGroups,
const char* theName )
throw (SALOME::SALOME_Exception);
SMESH::SMESH_Group_ptr CutGroups( SMESH::SMESH_GroupBase_ptr theGroup1,
SMESH::SMESH_GroupBase_ptr theGroup2,
SMESH::SMESH_Group_ptr CutGroups( SMESH::SMESH_GroupBase_ptr theGroup1,
SMESH::SMESH_GroupBase_ptr theGroup2,
const char* theName )
throw (SALOME::SALOME_Exception);
SMESH::SMESH_Group_ptr CutListOfGroups( const SMESH::ListOfGroups& theMainGroups,
const SMESH::ListOfGroups& theToolGroups,
SMESH::SMESH_Group_ptr CutListOfGroups( const SMESH::ListOfGroups& theMainGroups,
const SMESH::ListOfGroups& theToolGroups,
const char* theName )
throw (SALOME::SALOME_Exception);
SMESH::SMESH_Group_ptr CreateDimGroup( const SMESH::ListOfGroups& theGroups,
SMESH::ElementType theElemType,
SMESH::SMESH_Group_ptr CreateDimGroup( const SMESH::ListOfGroups& theGroups,
SMESH::ElementType theElemType,
const char* theName )
throw (SALOME::SALOME_Exception);
SMESH::SMESH_Group_ptr ConvertToStandalone( SMESH::SMESH_GroupOnGeom_ptr theGeomGroup );
@ -303,16 +302,16 @@ public:
SMESH::long_array* GetElementsByType( SMESH::ElementType theElemType )
throw (SALOME::SALOME_Exception);
SMESH::long_array* GetNodesId()
throw (SALOME::SALOME_Exception);
SMESH::ElementType GetElementType( CORBA::Long id, bool iselem )
throw (SALOME::SALOME_Exception);
SMESH::EntityType GetElementGeomType( CORBA::Long id )
throw (SALOME::SALOME_Exception);
/*!
* Returns ID of elements for given submesh
*/
@ -326,15 +325,15 @@ public:
*/
SMESH::long_array* GetSubMeshNodesId(CORBA::Long ShapeID, CORBA::Boolean all)
throw (SALOME::SALOME_Exception);
/*!
* Returns type of elements for given submesh
*/
SMESH::ElementType GetSubMeshElementType(CORBA::Long ShapeID)
throw (SALOME::SALOME_Exception);
char* Dump();
// Internal methods not available through CORBA
// They are called by corresponding interface methods
SMESH_Hypothesis::Hypothesis_Status addHypothesis(GEOM::GEOM_Object_ptr aSubShapeObject,
@ -342,7 +341,7 @@ public:
SMESH_Hypothesis::Hypothesis_Status removeHypothesis(GEOM::GEOM_Object_ptr aSubShapeObject,
SMESH::SMESH_Hypothesis_ptr anHyp);
static SMESH::Hypothesis_Status
ConvertHypothesisStatus (SMESH_Hypothesis::Hypothesis_Status theStatus);
@ -369,7 +368,7 @@ public:
/*!
* \brief Update hypotheses assigned to geom groups if the latter change
*
*
* NPAL16168: "geometrical group edition from a submesh don't modifiy mesh computation"
*/
void CheckGeomGroupModif();
@ -393,7 +392,7 @@ public:
* If there is not node for given ID - returns empty list
*/
SMESH::double_array* GetNodeXYZ(CORBA::Long id);
/*!
* For given node returns list of IDs of inverse elements
* If there is not node for given ID - returns empty list
@ -412,7 +411,7 @@ public:
CORBA::Long GetShapeID(CORBA::Long id);
/*!
* For given element returns ID of result shape after
* For given element returns ID of result shape after
* ::FindShape() from SMESH_MeshEditor
* If there is not element for given ID - returns -1
*/
@ -435,25 +434,25 @@ public:
* If there is not node for given index - returns -2
*/
CORBA::Long GetElemNode(CORBA::Long id, CORBA::Long index);
/*!
* Returns true if given node is medium node
* in given quadratic element
*/
CORBA::Boolean IsMediumNode(CORBA::Long ide, CORBA::Long idn);
/*!
* Returns true if given node is medium node
* in one of quadratic elements
*/
CORBA::Boolean IsMediumNodeOfAnyElem(CORBA::Long idn,
SMESH::ElementType theElemType);
/*!
* Returns number of edges for given element
*/
CORBA::Long ElemNbEdges(CORBA::Long id);
/*!
* Returns number of faces for given element
*/
@ -472,12 +471,12 @@ public:
* Returns true if given element is polygon
*/
CORBA::Boolean IsPoly(CORBA::Long id);
/*!
* Returns true if given element is quadratic
*/
CORBA::Boolean IsQuadratic(CORBA::Long id);
/*!
* Returns bary center for given element
*/
@ -492,7 +491,7 @@ public:
* Sets list of notebook variables used for Mesh operations separated by ":" symbol
*/
void SetParameters (const char* theParameters);
/*!
* Returns list of notebook variables used for Mesh operations separated by ":" symbol
*/
@ -516,7 +515,6 @@ public:
*/
static void CollectMeshInfo(const SMDS_ElemIteratorPtr theItr,
SMESH::long_array& theInfo);
/*!
* \brief Return submesh objects list in meshing order
@ -527,7 +525,7 @@ public:
*/
virtual ::CORBA::Boolean SetMeshOrder(const SMESH::submesh_array_array& theSubMeshArray);
std::map<int, SMESH_subMesh_i*> _mapSubMesh_i; //NRI
std::map<int, ::SMESH_subMesh*> _mapSubMesh; //NRI
@ -581,8 +579,7 @@ private:
* \brief Return new group contents if it has been changed and update group data
*/
TopoDS_Shape newGroupShape( TGeomGroupData & groupData);
};
#endif