X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_ShapeByMeshDlg.cxx;h=b17fed16fd0713ebb412cca2a8daf608201d8229;hb=f816f204d33b5250ee211247a798a1af42c528ea;hp=fbd51ae0b3f1ce3b75cfdd870c308d5b9bd77350;hpb=bd8f1aee7c78f7d2eb82bd4fec5e08c9e3d280ce;p=modules%2Fsmesh.git diff --git a/src/SMESHGUI/SMESHGUI_ShapeByMeshDlg.cxx b/src/SMESHGUI/SMESHGUI_ShapeByMeshDlg.cxx index fbd51ae0b..b17fed16f 100644 --- a/src/SMESHGUI/SMESHGUI_ShapeByMeshDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ShapeByMeshDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2016 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 @@ -6,7 +6,7 @@ // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -287,7 +287,7 @@ void SMESHGUI_ShapeByMeshOp::SetMesh (SMESH::SMESH_Mesh_ptr thePtr) myHasSolids = nbShapes[ TopAbs_SOLID ]; } - // disable inexistant elem types + // disable inexistent elem types for ( int i = 0; i < myDlg->myElemTypeGroup->buttons().count(); ++i ) { if ( QAbstractButton* button = myDlg->myElemTypeGroup->button( i ) ) button->setEnabled( hasElement[ i ] ); @@ -319,19 +319,18 @@ void SMESHGUI_ShapeByMeshOp::commitOperation() else { GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen(); - _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); - if (geomGen->_is_nil() || !aStudy) + if (geomGen->_is_nil()) return; GEOM::GEOM_IShapesOperations_wrap aShapesOp = - geomGen->GetIShapesOperations(aStudy->StudyId()); + geomGen->GetIShapesOperations(); if (aShapesOp->_is_nil() ) return; TopAbs_ShapeEnum aGroupType = TopAbs_SHAPE; - std::map aGeomObjectsMap; + std::map aGeomObjectsMap; GEOM::GEOM_Object_wrap aGeomObject; GEOM::GEOM_Object_var aMeshShape = myMesh->GetShapeToMesh(); @@ -343,7 +342,7 @@ void SMESHGUI_ShapeByMeshOp::commitOperation() if (aGeomObject->_is_nil()) continue; - double anId = aShapesOp->GetSubShapeIndex(aMeshShape, aGeomObject); + int anId = aShapesOp->GetSubShapeIndex(aMeshShape, aGeomObject); if (aShapesOp->IsDone() && !aGeomObjectsMap.count(anId) ) { aGeomObjectsMap[anId] = aGeomObject; @@ -364,7 +363,7 @@ void SMESHGUI_ShapeByMeshOp::commitOperation() else if (aNumberOfGO > 1) { GEOM::GEOM_IGroupOperations_wrap aGroupOp = - geomGen->GetIGroupOperations(aStudy->StudyId()); + geomGen->GetIGroupOperations(); if(aGroupOp->_is_nil()) return; @@ -372,13 +371,13 @@ void SMESHGUI_ShapeByMeshOp::commitOperation() aGeomObjects->length( aNumberOfGO ); int i = 0; - std::map::iterator anIter; + std::map::iterator anIter; for (anIter = aGeomObjectsMap.begin(); anIter!=aGeomObjectsMap.end(); anIter++) - aGeomObjects[i++] = (*anIter).second.in(); + aGeomObjects[i++] = GEOM::GEOM_Object::_duplicate( (*anIter).second.in() ); //create geometry group aGeomObject = aGroupOp->CreateGroup(aMeshShape, aGroupType); - aGroupOp->UnionList(myGeomObj, aGeomObjects); + aGroupOp->UnionList(aGeomObject, aGeomObjects); if (!aGroupOp->IsDone()) return; @@ -386,9 +385,8 @@ void SMESHGUI_ShapeByMeshOp::commitOperation() // publish the GEOM object in study QString aNewGeomGroupName ( myDlg->myGeomName->text() ); - SALOMEDS::Study_var aStudyVar = _CAST(Study,aStudy)->GetStudy(); SALOMEDS::SObject_wrap aNewGroupSO = - geomGen->AddInStudy( aStudyVar, aGeomObject, + geomGen->AddInStudy( aGeomObject, aNewGeomGroupName.toLatin1().data(), aMeshShape); // get a GEOM_Object already published, which doesn't need UnRegister() @@ -420,7 +418,7 @@ void SMESHGUI_ShapeByMeshOp::onSelectionDone() try { SALOME_ListIO aList; - selectionMgr()->selectedObjects(aList, SVTK_Viewer::Type()); + selectionMgr()->selectedObjects(aList); if (!myIsMultipleAllowed && aList.Extent() != 1) return;