mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-30 19:30:35 +05:00
Bug 0019389: Impossible to create a group with a selection in another group.
This commit is contained in:
parent
4324ec1b43
commit
c174b59dd5
@ -63,6 +63,10 @@
|
|||||||
|
|
||||||
#include "utilities.h"
|
#include "utilities.h"
|
||||||
|
|
||||||
|
// VTK Includes
|
||||||
|
#include <vtkRenderer.h>
|
||||||
|
#include <vtkActorCollection.h>
|
||||||
|
|
||||||
// OCCT Includes
|
// OCCT Includes
|
||||||
#include <TColStd_MapOfInteger.hxx>
|
#include <TColStd_MapOfInteger.hxx>
|
||||||
|
|
||||||
@ -485,17 +489,19 @@ void SMESHGUI_GroupDlg::init (SMESH::SMESH_Mesh_ptr theMesh)
|
|||||||
myGroup = SMESH::SMESH_Group::_nil();
|
myGroup = SMESH::SMESH_Group::_nil();
|
||||||
myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_nil();
|
myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_nil();
|
||||||
|
|
||||||
myActor = SMESH::FindActorByObject(myMesh);
|
// NPAL19389: create a group with a selection in another group
|
||||||
SMESH::SetPickable(myActor);
|
// set actor of myMesh, if it is visible, else try
|
||||||
|
// any visible actor of group or submesh of myMesh
|
||||||
|
SetAppropriateActor();
|
||||||
|
|
||||||
setDefaultGroupColor();
|
setDefaultGroupColor();
|
||||||
|
|
||||||
SALOME_ListIO aList;
|
SALOME_ListIO aList;
|
||||||
mySelectionMgr->selectedObjects( aList );
|
mySelectionMgr->selectedObjects( aList );
|
||||||
if( !aList.IsEmpty() )
|
if ( !aList.IsEmpty() )
|
||||||
{
|
{
|
||||||
QString aName = aList.First()->getName();
|
QString aName = aList.First()->getName();
|
||||||
myMeshGroupLine->setText(aName) ;
|
myMeshGroupLine->setText(aName);
|
||||||
myMeshGroupLine->home( false );
|
myMeshGroupLine->home( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -534,8 +540,14 @@ void SMESHGUI_GroupDlg::init (SMESH::SMESH_GroupBase_ptr theGroup)
|
|||||||
|
|
||||||
myGroup = SMESH::SMESH_Group::_narrow( theGroup );
|
myGroup = SMESH::SMESH_Group::_narrow( theGroup );
|
||||||
|
|
||||||
if ( !myGroup->_is_nil() )
|
if (!myGroup->_is_nil())
|
||||||
{
|
{
|
||||||
|
// NPAL19389: create a group with a selection in another group
|
||||||
|
// set actor of myMesh, if it is visible, else set
|
||||||
|
// actor of myGroup, if it is visible, else try
|
||||||
|
// any visible actor of group or submesh of myMesh
|
||||||
|
// commented, because an attempt to set selection on not displayed cells leads to error
|
||||||
|
//SetAppropriateActor();
|
||||||
myActor = SMESH::FindActorByObject(myMesh);
|
myActor = SMESH::FindActorByObject(myMesh);
|
||||||
if ( !myActor )
|
if ( !myActor )
|
||||||
myActor = SMESH::FindActorByObject(myGroup);
|
myActor = SMESH::FindActorByObject(myGroup);
|
||||||
@ -549,6 +561,8 @@ void SMESHGUI_GroupDlg::init (SMESH::SMESH_GroupBase_ptr theGroup)
|
|||||||
setSelectionMode(aType);
|
setSelectionMode(aType);
|
||||||
myTypeId = aType;
|
myTypeId = aType;
|
||||||
|
|
||||||
|
setShowEntityMode(); // depends on myTypeId
|
||||||
|
|
||||||
myIdList.clear();
|
myIdList.clear();
|
||||||
if (!myGroup->IsEmpty()) {
|
if (!myGroup->IsEmpty()) {
|
||||||
SMESH::long_array_var anElements = myGroup->GetListOfID();
|
SMESH::long_array_var anElements = myGroup->GetListOfID();
|
||||||
@ -566,9 +580,15 @@ void SMESHGUI_GroupDlg::init (SMESH::SMESH_GroupBase_ptr theGroup)
|
|||||||
|
|
||||||
if ( !myGroupOnGeom->_is_nil() )
|
if ( !myGroupOnGeom->_is_nil() )
|
||||||
{
|
{
|
||||||
|
// NPAL19389: create a group with a selection in another group
|
||||||
|
// set actor of myMesh, if it is visible, else set
|
||||||
|
// actor of myGroupOnGeom, if it is visible, else try
|
||||||
|
// any visible actor of group or submesh of myMesh
|
||||||
|
// commented, because an attempt to set selection on not displayed cells leads to error
|
||||||
|
//SetAppropriateActor();
|
||||||
myActor = SMESH::FindActorByObject(myMesh);
|
myActor = SMESH::FindActorByObject(myMesh);
|
||||||
if ( !myActor )
|
if ( !myActor )
|
||||||
myActor = SMESH::FindActorByObject(myGroup);
|
myActor = SMESH::FindActorByObject(myGroupOnGeom);
|
||||||
SMESH::SetPickable(myActor);
|
SMESH::SetPickable(myActor);
|
||||||
|
|
||||||
myGrpTypeGroup->setButton(1);
|
myGrpTypeGroup->setButton(1);
|
||||||
@ -781,7 +801,7 @@ bool SMESHGUI_GroupDlg::onApply()
|
|||||||
myGroup->SetColor(aColor);
|
myGroup->SetColor(aColor);
|
||||||
|
|
||||||
_PTR(SObject) aMeshGroupSO = SMESH::FindSObject(myGroup);
|
_PTR(SObject) aMeshGroupSO = SMESH::FindSObject(myGroup);
|
||||||
if(SMESH_Actor *anActor = SMESH::FindActorByEntry(aMeshGroupSO->GetID().c_str()))
|
if (SMESH_Actor *anActor = SMESH::FindActorByEntry(aMeshGroupSO->GetID().c_str()))
|
||||||
anActor->SetSufaceColor( aColor.R, aColor.G, aColor.B );
|
anActor->SetSufaceColor( aColor.R, aColor.G, aColor.B );
|
||||||
|
|
||||||
QValueList<int> aAddList;
|
QValueList<int> aAddList;
|
||||||
@ -906,7 +926,7 @@ bool SMESHGUI_GroupDlg::onApply()
|
|||||||
myGroupOnGeom->SetColor(aColor);
|
myGroupOnGeom->SetColor(aColor);
|
||||||
|
|
||||||
_PTR(SObject) aMeshGroupSO = SMESH::FindSObject(myGroupOnGeom);
|
_PTR(SObject) aMeshGroupSO = SMESH::FindSObject(myGroupOnGeom);
|
||||||
if(SMESH_Actor *anActor = SMESH::FindActorByEntry(aMeshGroupSO->GetID().c_str()))
|
if (SMESH_Actor *anActor = SMESH::FindActorByEntry(aMeshGroupSO->GetID().c_str()))
|
||||||
anActor->SetSufaceColor( aColor.R, aColor.G, aColor.B );
|
anActor->SetSufaceColor( aColor.R, aColor.G, aColor.B );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -935,7 +955,7 @@ void SMESHGUI_GroupDlg::onOK()
|
|||||||
void SMESHGUI_GroupDlg::onListSelectionChanged()
|
void SMESHGUI_GroupDlg::onListSelectionChanged()
|
||||||
{
|
{
|
||||||
// MESSAGE("SMESHGUI_GroupDlg::onListSelectionChanged(); myActor = " << myActor);
|
// MESSAGE("SMESHGUI_GroupDlg::onListSelectionChanged(); myActor = " << myActor);
|
||||||
if( myIsBusy || !myActor) return;
|
if ( myIsBusy || !myActor) return;
|
||||||
myIsBusy = true;
|
myIsBusy = true;
|
||||||
|
|
||||||
if (myCurrentLineEdit == 0) {
|
if (myCurrentLineEdit == 0) {
|
||||||
@ -962,7 +982,7 @@ void SMESHGUI_GroupDlg::onListSelectionChanged()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void SMESHGUI_GroupDlg::onObjectSelectionChanged()
|
void SMESHGUI_GroupDlg::onObjectSelectionChanged()
|
||||||
{
|
{
|
||||||
if ( myIsBusy || !isEnabled()) return;
|
if (myIsBusy || !isEnabled()) return;
|
||||||
if (myCurrentLineEdit == myGeomGroupLine && !myGeomGroupBtn->isOn()) return;
|
if (myCurrentLineEdit == myGeomGroupLine && !myGeomGroupBtn->isOn()) return;
|
||||||
|
|
||||||
myIsBusy = true;
|
myIsBusy = true;
|
||||||
@ -973,11 +993,13 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged()
|
|||||||
int aNbSel = aList.Extent();
|
int aNbSel = aList.Extent();
|
||||||
myElements->clearSelection();
|
myElements->clearSelection();
|
||||||
|
|
||||||
if (myCurrentLineEdit) {
|
if (myCurrentLineEdit)
|
||||||
|
{
|
||||||
myCurrentLineEdit->setText("");
|
myCurrentLineEdit->setText("");
|
||||||
QString aString = "";
|
QString aString = "";
|
||||||
|
|
||||||
if (myCurrentLineEdit == myMeshGroupLine) {
|
if (myCurrentLineEdit == myMeshGroupLine)
|
||||||
|
{
|
||||||
mySelectSubMesh->setEnabled(false);
|
mySelectSubMesh->setEnabled(false);
|
||||||
mySelectGroup->setEnabled(false);
|
mySelectGroup->setEnabled(false);
|
||||||
myGroupLine->setText("");
|
myGroupLine->setText("");
|
||||||
@ -1021,11 +1043,13 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged()
|
|||||||
}
|
}
|
||||||
myGroup = SMESH::SMESH_Group::_nil();
|
myGroup = SMESH::SMESH_Group::_nil();
|
||||||
|
|
||||||
myActor = SMESH::FindActorByObject(myMesh);
|
// NPAL19389: create a group with a selection in another group
|
||||||
SMESH::SetPickable(myActor);
|
// set actor of myMesh, if it is visible, else try
|
||||||
|
// any visible actor of group or submesh of myMesh
|
||||||
|
SetAppropriateActor();
|
||||||
|
|
||||||
aString = aList.First()->getName();
|
aString = aList.First()->getName();
|
||||||
myMeshGroupLine->setText(aString) ;
|
myMeshGroupLine->setText(aString);
|
||||||
myMeshGroupLine->home( false );
|
myMeshGroupLine->home( false );
|
||||||
|
|
||||||
mySelectSubMesh->setEnabled(true);
|
mySelectSubMesh->setEnabled(true);
|
||||||
@ -1069,9 +1093,9 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged()
|
|||||||
|
|
||||||
myIsBusy = false;
|
myIsBusy = false;
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
} else if (myCurrentLineEdit == myGeomGroupLine) {
|
else if (myCurrentLineEdit == myGeomGroupLine)
|
||||||
|
{
|
||||||
myGeomObjects = new GEOM::ListOfGO();
|
myGeomObjects = new GEOM::ListOfGO();
|
||||||
|
|
||||||
// The mesh SObject
|
// The mesh SObject
|
||||||
@ -1092,8 +1116,8 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged()
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
SALOME_ListIteratorOfListIO anIt (aList);
|
SALOME_ListIteratorOfListIO anIt (aList);
|
||||||
for (; anIt.More(); anIt.Next()) {
|
for (; anIt.More(); anIt.Next())
|
||||||
|
{
|
||||||
testResult = Standard_False;
|
testResult = Standard_False;
|
||||||
aGeomGroup = GEOMBase::ConvertIOinGEOMObject(anIt.Value(), testResult);
|
aGeomGroup = GEOMBase::ConvertIOinGEOMObject(anIt.Value(), testResult);
|
||||||
|
|
||||||
@ -1101,7 +1125,6 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged()
|
|||||||
if (!testResult || CORBA::is_nil(aGeomGroup))
|
if (!testResult || CORBA::is_nil(aGeomGroup))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
||||||
// Check if group constructed on the same shape as a mesh or on its child
|
// Check if group constructed on the same shape as a mesh or on its child
|
||||||
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
|
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
|
||||||
GEOM::GEOM_IGroupOperations_var anOp =
|
GEOM::GEOM_IGroupOperations_var anOp =
|
||||||
@ -1150,13 +1173,13 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged()
|
|||||||
aNbSel = i;
|
aNbSel = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(aNbSel >= 1) {
|
if (aNbSel >= 1) {
|
||||||
if(aNbSel > 1) {
|
if (aNbSel > 1) {
|
||||||
if(myCurrentLineEdit == mySubMeshLine)
|
if (myCurrentLineEdit == mySubMeshLine)
|
||||||
aString = tr("SMESH_SUBMESH_SELECTED").arg(aNbSel);
|
aString = tr("SMESH_SUBMESH_SELECTED").arg(aNbSel);
|
||||||
else if(myCurrentLineEdit == myGroupLine)
|
else if (myCurrentLineEdit == myGroupLine)
|
||||||
aString = tr("SMESH_GROUP_SELECTED").arg(aNbSel);
|
aString = tr("SMESH_GROUP_SELECTED").arg(aNbSel);
|
||||||
else if(myCurrentLineEdit == myGeomGroupLine)
|
else if (myCurrentLineEdit == myGeomGroupLine)
|
||||||
aString = tr("%1 Objects").arg(aNbSel);
|
aString = tr("%1 Objects").arg(aNbSel);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1176,9 +1199,46 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged()
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateButtons();
|
updateButtons();
|
||||||
|
}
|
||||||
|
else // !myCurrentLineEdit: local selection of nodes or elements
|
||||||
|
{
|
||||||
|
if (aNbSel == 1 && myActor && myActor->hasIO())
|
||||||
|
{
|
||||||
|
#ifdef ENABLE_SWITCH_ACTOR_DURING_ELEMENTS_SELECTION
|
||||||
|
// NPAL19389: create a group with a selection in another group
|
||||||
|
// Switch myActor to the newly selected one, if the last
|
||||||
|
// is visible and belongs to group or submesh of myMesh
|
||||||
|
Handle(SALOME_InteractiveObject) curIO = myActor->getIO();
|
||||||
|
Handle(SALOME_InteractiveObject) selIO = aList.First();
|
||||||
|
if (curIO->hasEntry() && selIO->hasEntry()) {
|
||||||
|
const char* selEntry = selIO->getEntry();
|
||||||
|
if (strcmp(curIO->getEntry(), selEntry) != 0) {
|
||||||
|
// different objects: selected and myActor
|
||||||
|
SVTK_ViewWindow* aViewWindow = SMESH::GetCurrentVtkView();
|
||||||
|
if (aViewWindow && aViewWindow->isVisible(selIO)) {
|
||||||
|
// newly selected actor is visible
|
||||||
|
|
||||||
|
// mesh entry
|
||||||
|
_PTR(SObject) aSObject = SMESH::FindSObject(myMesh);
|
||||||
|
if (aSObject) {
|
||||||
|
CORBA::String_var meshEntry = aSObject->GetID().c_str();
|
||||||
|
int len = strlen(meshEntry);
|
||||||
|
|
||||||
|
if (strncmp(selEntry, meshEntry, len) == 0) {
|
||||||
|
// selected object is myMesh or a part of it
|
||||||
|
SMESH_Actor* anActor = SMESH::FindActorByEntry(selEntry);
|
||||||
|
if (anActor) {
|
||||||
|
myActor = anActor;
|
||||||
|
SMESH::SetPickable(myActor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// NPAL19389 END
|
||||||
|
#endif // ENABLE_SWITCH_ACTOR_DURING_ELEMENTS_SELECTION
|
||||||
|
|
||||||
} else {
|
|
||||||
if (aNbSel == 1 && myActor ) {
|
|
||||||
QString aListStr = "";
|
QString aListStr = "";
|
||||||
int aNbItems = 0;
|
int aNbItems = 0;
|
||||||
if (myTypeId == 0) {
|
if (myTypeId == 0) {
|
||||||
@ -1200,12 +1260,17 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged()
|
|||||||
if (!myActor) {
|
if (!myActor) {
|
||||||
if (!myGroup->_is_nil())
|
if (!myGroup->_is_nil())
|
||||||
myActor = SMESH::FindActorByObject(myGroup);
|
myActor = SMESH::FindActorByObject(myGroup);
|
||||||
else if(!myGroupOnGeom->_is_nil())
|
else if (!myGroupOnGeom->_is_nil())
|
||||||
myActor = SMESH::FindActorByObject(myGroupOnGeom);
|
myActor = SMESH::FindActorByObject(myGroupOnGeom);
|
||||||
else
|
else
|
||||||
myActor = SMESH::FindActorByObject(myMesh);
|
myActor = SMESH::FindActorByObject(myMesh);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// somehow, if we display the mesh, while selecting from another actor,
|
||||||
|
// the mesh becomes pickable, and there is no way to select any element
|
||||||
|
if (myActor)
|
||||||
|
SMESH::SetPickable(myActor);
|
||||||
|
|
||||||
myIsBusy = false;
|
myIsBusy = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1398,7 +1463,6 @@ void SMESHGUI_GroupDlg::onAdd()
|
|||||||
mySelector->SetSelectionMode(ActorSelection);
|
mySelector->SetSelectionMode(ActorSelection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (myCurrentLineEdit == 0) {
|
if (myCurrentLineEdit == 0) {
|
||||||
//if (aNbSel != 1) { myIsBusy = false; return; }
|
//if (aNbSel != 1) { myIsBusy = false; return; }
|
||||||
QString aListStr = "";
|
QString aListStr = "";
|
||||||
@ -1716,7 +1780,8 @@ void SMESHGUI_GroupDlg::onHelp()
|
|||||||
{
|
{
|
||||||
LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
|
LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
|
||||||
if (app)
|
if (app)
|
||||||
app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
|
app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""),
|
||||||
|
myHelpFileName);
|
||||||
else {
|
else {
|
||||||
QString platform;
|
QString platform;
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
@ -1724,7 +1789,8 @@ void SMESHGUI_GroupDlg::onHelp()
|
|||||||
#else
|
#else
|
||||||
platform = "application";
|
platform = "application";
|
||||||
#endif
|
#endif
|
||||||
SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"),
|
SUIT_MessageBox::warn1
|
||||||
|
(0, QObject::tr("WRN_WARNING"),
|
||||||
QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
|
QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
|
||||||
arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName),
|
arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName),
|
||||||
QObject::tr("BUT_OK"));
|
QObject::tr("BUT_OK"));
|
||||||
@ -1944,7 +2010,7 @@ SALOMEDS::Color SMESHGUI_GroupDlg::getGroupColor() const
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void SMESHGUI_GroupDlg::setGroupQColor( const QColor& theColor )
|
void SMESHGUI_GroupDlg::setGroupQColor( const QColor& theColor )
|
||||||
{
|
{
|
||||||
if( theColor.isValid() )
|
if ( theColor.isValid() )
|
||||||
{
|
{
|
||||||
QPalette pal = myColorBtn->palette();
|
QPalette pal = myColorBtn->palette();
|
||||||
pal.setColor(QColorGroup::Button, theColor);
|
pal.setColor(QColorGroup::Button, theColor);
|
||||||
@ -1968,13 +2034,13 @@ QColor SMESHGUI_GroupDlg::getGroupQColor() const
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void SMESHGUI_GroupDlg::setDefaultGroupColor()
|
void SMESHGUI_GroupDlg::setDefaultGroupColor()
|
||||||
{
|
{
|
||||||
if( myMesh->_is_nil() )
|
if ( myMesh->_is_nil() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool isAutoColor = myMesh->GetAutoColor();
|
bool isAutoColor = myMesh->GetAutoColor();
|
||||||
|
|
||||||
QColor aQColor;
|
QColor aQColor;
|
||||||
if( !isAutoColor )
|
if ( !isAutoColor )
|
||||||
{
|
{
|
||||||
int r = 0, g = 0, b = 0;
|
int r = 0, g = 0, b = 0;
|
||||||
SMESH::GetColor( "SMESH", "fill_color", r, g, b, QColor( 0, 170, 255 ) );
|
SMESH::GetColor( "SMESH", "fill_color", r, g, b, QColor( 0, 170, 255 ) );
|
||||||
@ -1985,7 +2051,7 @@ void SMESHGUI_GroupDlg::setDefaultGroupColor()
|
|||||||
SMESH::ListOfGroups aListOfGroups = *myMesh->GetGroups();
|
SMESH::ListOfGroups aListOfGroups = *myMesh->GetGroups();
|
||||||
|
|
||||||
QValueList<SALOMEDS::Color> aReservedColors;
|
QValueList<SALOMEDS::Color> aReservedColors;
|
||||||
for( int i = 0, n = aListOfGroups.length(); i < n; i++ )
|
for ( int i = 0, n = aListOfGroups.length(); i < n; i++ )
|
||||||
{
|
{
|
||||||
SMESH::SMESH_GroupBase_var aGroupObject = aListOfGroups[i];
|
SMESH::SMESH_GroupBase_var aGroupObject = aListOfGroups[i];
|
||||||
SALOMEDS::Color aReservedColor = aGroupObject->GetColor();
|
SALOMEDS::Color aReservedColor = aGroupObject->GetColor();
|
||||||
@ -2002,11 +2068,95 @@ void SMESHGUI_GroupDlg::setDefaultGroupColor()
|
|||||||
setGroupQColor( aQColor );
|
setGroupQColor( aQColor );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : SetAppropriateActor()
|
||||||
|
// purpose : Find more appropriate of visible actors, set it to myActor, allow picking
|
||||||
|
// NPAL19389: create a group with a selection in another group.
|
||||||
|
// if mesh actor is not visible - find any first visible group or submesh
|
||||||
|
//=================================================================================
|
||||||
|
bool SMESHGUI_GroupDlg::SetAppropriateActor()
|
||||||
|
{
|
||||||
|
bool isActor = false;
|
||||||
|
|
||||||
|
if (myMesh->_is_nil()) return false;
|
||||||
|
|
||||||
|
SVTK_ViewWindow* aViewWindow = SMESH::GetCurrentVtkView();
|
||||||
|
|
||||||
|
// try mesh actor
|
||||||
|
myActor = SMESH::FindActorByObject(myMesh);
|
||||||
|
if (myActor && myActor->hasIO())
|
||||||
|
{
|
||||||
|
isActor = true;
|
||||||
|
if (aViewWindow && !aViewWindow->isVisible(myActor->getIO()))
|
||||||
|
isActor = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// try current group actor
|
||||||
|
if (!isActor) {
|
||||||
|
if (!myGroup->_is_nil()) {
|
||||||
|
myActor = SMESH::FindActorByObject(myGroup);
|
||||||
|
if (myActor && myActor->hasIO())
|
||||||
|
{
|
||||||
|
isActor = true;
|
||||||
|
if (aViewWindow && !aViewWindow->isVisible(myActor->getIO()))
|
||||||
|
isActor = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// try current group on geometry actor
|
||||||
|
if (!isActor) {
|
||||||
|
if (!myGroupOnGeom->_is_nil()) {
|
||||||
|
myActor = SMESH::FindActorByObject(myGroupOnGeom);
|
||||||
|
if (myActor && myActor->hasIO())
|
||||||
|
{
|
||||||
|
isActor = true;
|
||||||
|
if (aViewWindow && !aViewWindow->isVisible(myActor->getIO()))
|
||||||
|
isActor = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// try any visible actor of group or submesh of current mesh
|
||||||
|
if (!isActor && aViewWindow) {
|
||||||
|
// mesh entry
|
||||||
|
_PTR(SObject) aSObject = SMESH::FindSObject(myMesh);
|
||||||
|
if (aSObject) {
|
||||||
|
CORBA::String_var meshEntry = aSObject->GetID().c_str();
|
||||||
|
int len = strlen(meshEntry);
|
||||||
|
|
||||||
|
// iterate on all actors in current view window, search for
|
||||||
|
// any visible actor, that belongs to group or submesh of current mesh
|
||||||
|
vtkActorCollection *aCollection = aViewWindow->getRenderer()->GetActors();
|
||||||
|
aCollection->InitTraversal();
|
||||||
|
for (vtkActor *anAct = aCollection->GetNextActor();
|
||||||
|
anAct && !isActor;
|
||||||
|
anAct = aCollection->GetNextActor())
|
||||||
|
{
|
||||||
|
SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct);
|
||||||
|
if (anActor && anActor->hasIO()) {
|
||||||
|
Handle(SALOME_InteractiveObject) anIO = anActor->getIO();
|
||||||
|
if (aViewWindow->isVisible(anIO)) {
|
||||||
|
if (anIO->hasEntry() && strncmp(anIO->getEntry(), meshEntry, len) == 0) {
|
||||||
|
myActor = anActor;
|
||||||
|
isActor = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isActor)
|
||||||
|
SMESH::SetPickable(myActor);
|
||||||
|
|
||||||
|
return isActor;
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : setShowEntityMode
|
//function : setShowEntityMode
|
||||||
//purpose : make shown only entity corresponding to my type
|
//purpose : make shown only entity corresponding to my type
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
void SMESHGUI_GroupDlg::setShowEntityMode()
|
void SMESHGUI_GroupDlg::setShowEntityMode()
|
||||||
{
|
{
|
||||||
if ( !myMesh->_is_nil() ) {
|
if ( !myMesh->_is_nil() ) {
|
||||||
@ -2027,7 +2177,6 @@ void SMESHGUI_GroupDlg::setShowEntityMode()
|
|||||||
//function : restoreShowEntityMode
|
//function : restoreShowEntityMode
|
||||||
//purpose : restore ShowEntity mode of myActor
|
//purpose : restore ShowEntity mode of myActor
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
void SMESHGUI_GroupDlg::restoreShowEntityMode()
|
void SMESHGUI_GroupDlg::restoreShowEntityMode()
|
||||||
{
|
{
|
||||||
if ( myStoredShownEntity && !myMesh->_is_nil() ) {
|
if ( myStoredShownEntity && !myMesh->_is_nil() ) {
|
||||||
|
@ -132,6 +132,7 @@ private:
|
|||||||
void setSelectionMode(int theMode);
|
void setSelectionMode(int theMode);
|
||||||
void updateButtons();
|
void updateButtons();
|
||||||
void updateGeomPopup();
|
void updateGeomPopup();
|
||||||
|
bool SetAppropriateActor();
|
||||||
void setShowEntityMode();
|
void setShowEntityMode();
|
||||||
void restoreShowEntityMode();
|
void restoreShowEntityMode();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user