X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_RotationDlg.cxx;h=7e2f2af840827724eb549d49cd2b9eeef32436c4;hb=d4f9cc5a7901c51b255a8a21e21de1adf5f4b4e5;hp=a34ec8c65d4441a5b3201ada7c3c363455e8be25;hpb=845309d9194395babe18cf4fa92cc958879e0b5d;p=modules%2Fsmesh.git diff --git a/src/SMESHGUI/SMESHGUI_RotationDlg.cxx b/src/SMESHGUI/SMESHGUI_RotationDlg.cxx index a34ec8c65..7e2f2af84 100644 --- a/src/SMESHGUI/SMESHGUI_RotationDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_RotationDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,11 +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" @@ -83,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 : @@ -133,6 +137,7 @@ SMESHGUI_RotationDlg::SMESHGUI_RotationDlg( SMESHGUI* theModule ) SelectElementsButton->setIcon(image1); LineEditElements = new QLineEdit(GroupArguments); LineEditElements->setValidator(myIdValidator); + LineEditElements->setMaxLength(-1); myFilterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), GroupArguments ); connect(myFilterBtn, SIGNAL(clicked()), this, SLOT(setFilters())); @@ -428,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 (...) { } @@ -455,6 +469,8 @@ bool SMESHGUI_RotationDlg::ClickOnApply() Init(false); mySelectedObject = SMESH::SMESH_IDSource::_nil(); SelectionIntoArgument(); + + SMESHGUI::Modified(); } return true; @@ -496,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; @@ -538,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()); @@ -552,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; } } @@ -605,7 +621,7 @@ void SMESHGUI_RotationDlg::SelectionIntoArgument() myActor = SMESH::FindActorByObject(myMesh); if (!myActor) myActor = SMESH::FindActorByEntry(IO->getEntry()); - if (!myActor) + if (!myActor && !CheckBoxMesh->isChecked()) return; int aNbUnits = 0; @@ -645,7 +661,7 @@ void SMESHGUI_RotationDlg::SelectionIntoArgument() } else if (!SMESH::IObjectToInterface(IO)->_is_nil()) { //SUBMESH // get submesh SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface(IO); - + // get IDs from submesh SMESH::long_array_var anElementsIds = new SMESH::long_array; anElementsIds = aSubMesh->GetElementsId(); @@ -711,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;