X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESH_I%2FSMESH_MeshEditor_i.cxx;h=d01cf35f5ec872d1f41cb5beb3768c9b0f780f41;hp=600c5e7a3b2ac19a671dce076273ca0e37454fd9;hb=38a77c4a9810f4715212368ac53315689ba9150f;hpb=6c4a9f32ed7b4416d79e0d0d293919609a8eb178 diff --git a/src/SMESH_I/SMESH_MeshEditor_i.cxx b/src/SMESH_I/SMESH_MeshEditor_i.cxx index 600c5e7a3..d01cf35f5 100644 --- a/src/SMESH_I/SMESH_MeshEditor_i.cxx +++ b/src/SMESH_I/SMESH_MeshEditor_i.cxx @@ -114,8 +114,6 @@ namespace MeshEditor_I { _myMeshDS = new SMESHDS_Mesh( _id, true ); myPreviewType = previewElements; } - //!< Destructor - virtual ~TPreviewMesh() { delete _myMeshDS; _myMeshDS = 0; } //!< Copy a set of elements void Copy(const TIDSortedElemSet & theElements, TIDSortedElemSet& theCopyElements, @@ -182,6 +180,12 @@ namespace MeshEditor_I { { GetMeshDS()->ClearMesh(); } + void Remove( SMDSAbs_ElementType type ) + { + SMDS_ElemIteratorPtr eIt = GetMeshDS()->elementsIterator( type ); + while ( eIt->more() ) + GetMeshDS()->RemoveFreeElement( eIt->next(), /*sm=*/0, /*fromGroups=*/false ); + } };// struct TPreviewMesh static SMESH_NodeSearcher * theNodeSearcher = 0; @@ -439,6 +443,17 @@ SMESH_MeshEditor_i::~SMESH_MeshEditor_i() delete myPreviewEditor; myPreviewEditor = 0; } +//================================================================================ +/*! + * \brief Returns the mesh + */ +//================================================================================ + +SMESH::SMESH_Mesh_ptr SMESH_MeshEditor_i::GetMesh() +{ + return myMesh_i->_this(); +} + //================================================================================ /*! * \brief Clear members @@ -2387,6 +2402,10 @@ SMESH_MeshEditor_i::RotationSweepObjects(const SMESH::ListOfIDSources & theNodes << TVar( theTolerance ) << ", " << theMakeGroups << " )"; } + else + { + getPreviewMesh()->Remove( SMDSAbs_Volume ); + } return aGroups ? aGroups : new SMESH::ListOfGroups; @@ -2447,8 +2466,8 @@ namespace MeshEditor_I ExtrusionParams(CORBA::Double theStepSize, CORBA::Long theNbOfSteps, CORBA::Short theDim, - CORBA::Boolean theUseInputElemsOnly, CORBA::Boolean theByAverageNormal, + CORBA::Boolean theUseInputElemsOnly, CORBA::Boolean theMakeGroups ): ::SMESH_MeshEditor::ExtrusParam ( theStepSize, theNbOfSteps, @@ -2505,14 +2524,14 @@ SMESH_MeshEditor_i::ExtrusionSweepObjects(const SMESH::ListOfIDSources & theNode idSourceToSet( theFaces[i], getMeshDS(), elemsNodes[0], SMDSAbs_Face ); TIDSortedElemSet* workElements = & elemsNodes[0], copyElements[2]; + SMDSAbs_ElementType previewType = SMDSAbs_All; //SMDSAbs_Face; if ( myIsPreviewMode ) { - SMDSAbs_ElementType previewType = SMDSAbs_All; //SMDSAbs_Face; // if ( (*elemsNodes.begin())->GetType() == SMDSAbs_Node ) // previewType = SMDSAbs_Edge; SMDSAbs_ElementType select = SMDSAbs_All, avoid = SMDSAbs_Volume; - TPreviewMesh * tmpMesh = getPreviewMesh(); + TPreviewMesh * tmpMesh = getPreviewMesh( previewType ); tmpMesh->Copy( elemsNodes[0], copyElements[0], select, avoid ); tmpMesh->Copy( elemsNodes[1], copyElements[1], select, avoid ); workElements = & copyElements[0]; @@ -2540,6 +2559,10 @@ SMESH_MeshEditor_i::ExtrusionSweepObjects(const SMESH::ListOfIDSources & theNode << TVar( theNbOfSteps ) << ", " << theToMakeGroups << " )"; } + else + { + getPreviewMesh( previewType )->Remove( SMDSAbs_Volume ); + } return aGroups ? aGroups : new SMESH::ListOfGroups; @@ -2584,9 +2607,9 @@ SMESH_MeshEditor_i::ExtrusionByNormal(const SMESH::ListOfIDSources& objects, idSourceToSet( objects[i], getMeshDS(), elemsNodes[0], elemType ); TIDSortedElemSet* workElements = & elemsNodes[0], copyElements[2]; + SMDSAbs_ElementType previewType = SMDSAbs_Face; if ( myIsPreviewMode ) { - SMDSAbs_ElementType previewType = SMDSAbs_Face; SMDSAbs_ElementType select = SMDSAbs_All, avoid = SMDSAbs_Volume; TPreviewMesh * tmpMesh = getPreviewMesh( previewType ); tmpMesh->Copy( elemsNodes[0], copyElements[0], select, avoid ); @@ -2607,10 +2630,15 @@ SMESH_MeshEditor_i::ExtrusionByNormal(const SMESH::ListOfIDSources& objects, << ", " << TVar( stepSize ) << ", " << TVar( nbOfSteps ) << ", " << byAverageNormal + << ", " << useInputElemsOnly << ", " << makeGroups << ", " << dim << " )"; } + else + { + getPreviewMesh( previewType )->Remove( SMDSAbs_Volume ); + } declareMeshModified( /*isReComputeSafe=*/true ); // does not influence Compute() @@ -2663,6 +2691,10 @@ SMESH_MeshEditor_i::AdvancedExtrusion(const SMESH::long_array & theIDsOfElements << theSewTolerance << ", " << theMakeGroups << " )"; } + else + { + getPreviewMesh()->Remove( SMDSAbs_Volume ); + } return aGroups ? aGroups : new SMESH::ListOfGroups; @@ -2829,7 +2861,12 @@ SMESH_MeshEditor_i::ExtrusionAlongPathObjects(const SMESH::ListOfIDSources & the << "SMESH.PointStruct( " << ( theHasRefPoint ? theRefPoint.x : 0 ) << ", " << ( theHasRefPoint ? theRefPoint.y : 0 ) << ", " - << ( theHasRefPoint ? theRefPoint.z : 0 ) << " ))"; + << ( theHasRefPoint ? theRefPoint.z : 0 ) << " ), " + << theMakeGroups << " )"; + } + else + { + getPreviewMesh()->Remove( SMDSAbs_Volume ); } return aGroups._retn();