Join modifications from V3_2_0_maintainance branch

This commit is contained in:
jfa 2007-08-31 08:28:40 +00:00
parent b0c06e93e6
commit 7f32c96d19
3 changed files with 63 additions and 84 deletions

View File

@ -1190,9 +1190,9 @@ void SMESH_ActorDef::UpdateHighlight(){
myHighlitableActor->SetRepresentation(SMESH_DeviceActor::eWireframe); myHighlitableActor->SetRepresentation(SMESH_DeviceActor::eWireframe);
}else if(myRepresentation == ePoint || GetPointRepresentation()){ }else if(myRepresentation == ePoint || GetPointRepresentation()){
myHighlitableActor->SetHighlited(anIsVisible); myHighlitableActor->SetHighlited(anIsVisible);
myHighlitableActor->SetVisibility(anIsVisible);
myHighlitableActor->GetExtractUnstructuredGrid()-> myHighlitableActor->GetExtractUnstructuredGrid()->
SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints); SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
myHighlitableActor->SetVisibility(anIsVisible);
myHighlitableActor->SetRepresentation(SMESH_DeviceActor::ePoint); myHighlitableActor->SetRepresentation(SMESH_DeviceActor::ePoint);
} }
} }

View File

@ -305,7 +305,6 @@ void SMESHGUI_ExtrusionDlg::Init (bool ResetControls)
myBusy = false; myBusy = false;
LineEditElements->clear(); LineEditElements->clear();
myElementsId = "";
myNbOkElements = 0; myNbOkElements = 0;
myActor = 0; myActor = 0;
@ -391,13 +390,6 @@ bool SMESHGUI_ExtrusionDlg::ClickOnApply()
return false; return false;
if (myNbOkElements) { if (myNbOkElements) {
QStringList aListElementsId = QStringList::split(" ", myElementsId, false);
SMESH::long_array_var anElementsId = new SMESH::long_array;
anElementsId->length(aListElementsId.count());
for (int i = 0; i < aListElementsId.count(); i++)
anElementsId[i] = aListElementsId[i].toInt();
SMESH::DirStruct aVector; SMESH::DirStruct aVector;
aVector.PS.x = SpinBox_Dx->GetValue(); aVector.PS.x = SpinBox_Dx->GetValue();
@ -409,7 +401,7 @@ bool SMESHGUI_ExtrusionDlg::ClickOnApply()
try { try {
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor(); SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
QApplication::setOverrideCursor(Qt::waitCursor); QApplication::setOverrideCursor(Qt::waitCursor);
aMeshEditor->ExtrusionSweep(anElementsId.inout(), aVector, aNbSteps); aMeshEditor->ExtrusionSweep(myElementsId.inout(), aVector, aNbSteps);
QApplication::restoreOverrideCursor(); QApplication::restoreOverrideCursor();
} catch (...) { } catch (...) {
} }
@ -490,26 +482,37 @@ void SMESHGUI_ExtrusionDlg::onTextChange (const QString& theNewText)
myNbOkElements = 0; myNbOkElements = 0;
// hilight entered elements/nodes // hilight entered elements/nodes
SMDS_Mesh* aMesh = 0;
if (myActor)
aMesh = myActor->GetObject()->GetMesh();
if (aMesh) { if (!myIO.IsNull()) {
QStringList aListId = QStringList::split(" ", theNewText, false); QStringList aListId = QStringList::split(" ", theNewText, false);
if (send == LineEditElements) { if (send == LineEditElements)
const Handle(SALOME_InteractiveObject)& anIO = myActor->getIO(); {
SMDS_Mesh* aMesh = myActor ? myActor->GetObject()->GetMesh() : 0;
SMESH::ElementType SMESHType = GetConstructorId() ? SMESH::FACE : SMESH::EDGE;
SMDSAbs_ElementType SMDSType = GetConstructorId() ? SMDSAbs_Face: SMDSAbs_Edge;
myElementsId = new SMESH::long_array;
myElementsId->length( aListId.count() );
TColStd_MapOfInteger newIndices; TColStd_MapOfInteger newIndices;
for (int i = 0; i < aListId.count(); i++) { for (int i = 0; i < aListId.count(); i++) {
const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt()); int id = aListId[ i ].toInt();
if (e) bool validId = false;
newIndices.Add(e->GetID()); if ( id > 0 ) {
myNbOkElements++; if ( aMesh ) {
const SMDS_MeshElement * e = aMesh->FindElement( id );
validId = ( e && e->GetType() == SMDSType );
} else {
validId = ( myMesh->GetElementType( id, true ) == SMESHType );
}
}
if ( validId && newIndices.Add( id ))
myElementsId[ newIndices.Extent()-1 ] = id;
} }
mySelector->AddOrRemoveIndex(anIO, newIndices, false); myElementsId->length( myNbOkElements = newIndices.Extent() );
mySelector->AddOrRemoveIndex(myIO, newIndices, false);
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->highlight( anIO, true, true ); aViewWindow->highlight( myIO, true, true );
myElementsId = theNewText;
} }
} }
@ -532,6 +535,7 @@ void SMESHGUI_ExtrusionDlg::SelectionIntoArgument()
// clear // clear
myActor = 0; myActor = 0;
myIO.Nullify();
QString aString = ""; QString aString = "";
// set busy flag // set busy flag
@ -552,81 +556,53 @@ void SMESHGUI_ExtrusionDlg::SelectionIntoArgument()
myMesh = SMESH::GetMeshByIO(IO); myMesh = SMESH::GetMeshByIO(IO);
if (myMesh->_is_nil()) if (myMesh->_is_nil())
return; return;
myIO = IO;
myActor = SMESH::FindActorByObject(myMesh); myActor = SMESH::FindActorByObject(myMesh);
if (!myActor)
return;
if (myEditCurrentArgument == LineEditElements) { if (myEditCurrentArgument == LineEditElements) {
int aNbElements = 0; int aNbElements = 0;
myElementsId = "";
if (CheckBoxMesh->isChecked()) { if (CheckBoxMesh->isChecked()) {
int aConstructorId = GetConstructorId(); SMESH::ElementType neededType = GetConstructorId() ? SMESH::FACE : SMESH::EDGE;
SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString); SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
if (!SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO)->_is_nil()) { //MESH SMESH::SMESH_Mesh_var mesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO);
// get IDs from mesh
SMDS_Mesh* aSMDSMesh = myActor->GetObject()->GetMesh();
if (!aSMDSMesh)
return;
if (aConstructorId == 0) { if (!mesh->_is_nil()) { //MESH
SMDS_EdgeIteratorPtr anIter = aSMDSMesh->edgesIterator(); // get elements from mesh
myElementsId = mesh->GetElementsByType(neededType);
aNbElements = myElementsId->length();
} else {
SMESH::SMESH_subMesh_var aSubMesh =
SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO);
if (!aSubMesh->_is_nil()) { //SUBMESH
// get IDs from submesh
myElementsId = aSubMesh->GetElementsByType(neededType);
aNbElements = myElementsId->length();
} else {
SMESH::SMESH_GroupBase_var aGroup =
SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IO);
while (anIter->more()) { if (!aGroup->_is_nil() && aGroup->GetType() == neededType) { // GROUP
const SMDS_MeshEdge * edge = anIter->next(); // get IDs from smesh group
if (edge) { myElementsId = aGroup->GetListOfID();
myElementsId += QString(" %1").arg(edge->GetID()); aNbElements = myElementsId->length();
aNbElements++;
}
}
} else if (aConstructorId == 1) {
SMDS_FaceIteratorPtr anIter = aSMDSMesh->facesIterator();
while (anIter->more()) {
const SMDS_MeshFace * face = anIter->next();
if (face) {
myElementsId += QString(" %1").arg(face->GetID());
aNbElements++;
}
} }
} }
} 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;
if (aConstructorId == 0)
anElementsIds = aSubMesh->GetElementsByType(SMESH::EDGE);
else if (aConstructorId == 1)
anElementsIds = aSubMesh->GetElementsByType(SMESH::FACE);
for (int i = 0; i < anElementsIds->length(); i++)
myElementsId += QString(" %1").arg(anElementsIds[i]);
aNbElements = anElementsIds->length();
} else { // GROUP
// get smesh group
SMESH::SMESH_GroupBase_var aGroup =
SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IO);
if (aGroup->_is_nil())
return;
if ((aConstructorId == 0 && aGroup->GetType() != SMESH::EDGE) ||
(aConstructorId == 1 && aGroup->GetType()!= SMESH::FACE))
return;
// get IDs from smesh group
SMESH::long_array_var anElementsIds = new SMESH::long_array;
anElementsIds = aGroup->GetListOfID();
for (int i = 0; i < anElementsIds->length(); i++)
myElementsId += QString(" %1").arg(anElementsIds[i]);
aNbElements = anElementsIds->length();
} }
} else { } else {
aNbElements = SMESH::GetNameOfSelectedElements(mySelector, IO, aString); // get indices of selcted elements
myElementsId = aString; TColStd_IndexedMapOfInteger aMapIndex;
mySelector->GetIndex(IO,aMapIndex);
aNbElements = aMapIndex.Extent();
myElementsId = new SMESH::long_array;
myElementsId->length( aNbElements );
aString = "";
for ( int i = 0; i < aNbElements; ++i )
aString += QString(" %1").arg( myElementsId[ i ] = aMapIndex( i+1 ) );
} }
if (aNbElements < 1) if (aNbElements < 1)

View File

@ -33,6 +33,7 @@
#include "LightApp_SelectionMgr.h" #include "LightApp_SelectionMgr.h"
#include "SUIT_SelectionFilter.h" #include "SUIT_SelectionFilter.h"
#include "Handle_SALOME_InteractiveObject.hxx"
// QT Includes // QT Includes
#include <qdialog.h> #include <qdialog.h>
@ -81,13 +82,15 @@ private:
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */ SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */ LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
QLineEdit* myEditCurrentArgument; /* Current LineEdit */ QLineEdit* myEditCurrentArgument; /* Current LineEdit */
QString myElementsId; //QString myElementsId;
int myNbOkElements; /* to check when elements are defined */ int myNbOkElements; /* to check when elements are defined */
SVTK_Selector* mySelector; SVTK_Selector* mySelector;
bool myBusy; bool myBusy;
SMESH::SMESH_Mesh_var myMesh; SMESH::SMESH_Mesh_var myMesh;
SMESH::long_array_var myElementsId;
SMESH_Actor* myActor; SMESH_Actor* myActor;
Handle(SALOME_InteractiveObject) myIO;
SUIT_SelectionFilter* myMeshOrSubMeshOrGroupFilter; SUIT_SelectionFilter* myMeshOrSubMeshOrGroupFilter;
// widgets // widgets