Mantis issue 0021689: [CEA 571] Improve visualization of selected object in GEOM

This commit is contained in:
jfa 2012-10-02 07:26:48 +00:00
parent 9ef623eade
commit 722fbca6f9
12 changed files with 151 additions and 52 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 35 KiB

View File

@ -74,18 +74,23 @@ on the viewer background:
<li><b>Select Only</b> provides a filter for exclusive selection of objects of a certain type.</li>
</ul>
The the following commands appear in the Object Browser context menu
The following commands appear in the Object Browser context menu
under certain conditions:
\image html ob_popup_menu.png <br>
<ul>
<li>\ref work_with_groups_page "Create Group" - allows creating groups of geometrical objects.</li>
<li><b>Hide Children</b> / <b>Show Children</b> - hides / shows child
<li><b>Conceal child items</b> / <b>Disclose child items</b> - hides / shows child
sub-objects in the Object Browser, if the selected geometric object has
child objects. When some child objects are hidden, the name of the
parent object is hilghlighted with bold font.</li>
<li><b>Show Only Children</b> - erase in current viewer all objects
and then display only children of the selected object(s).
</li>
<li><b>Unpublish</b> - unpublish the selected geometric object from the Object Browser
and erase it from all viewers. To publish unpublished geometric objects select in the
context menu of the <b>Geometry</b> root object <b>Publish...</b> item.

View File

@ -18,12 +18,11 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// GEOM GEOMGUI : GUI for Geometry component
// File : DisplayGUI.cxx
// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
//
#include "DisplayGUI.h"
#include <GeometryGUI.h>
#include "GeometryGUI_Operations.h"
@ -110,6 +109,10 @@ bool DisplayGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent)
getGeometryGUI()->EmitSignalDeactivateDialog();
DisplayOnly();
break;
case GEOMOp::OpShowOnlyChildren: // POPUP MENU - SHOW ONLY CHILDREN
getGeometryGUI()->EmitSignalDeactivateDialog();
DisplayOnlyChildren();
break;
case GEOMOp::OpHideAll: // MENU VIEW - HIDE ALL
EraseAll();
break;
@ -217,6 +220,62 @@ void DisplayGUI::DisplayOnly()
Display();
}
//=====================================================================================
// function : DisplayGUI::DisplayOnlyChildren()
// purpose : Display only children of selected GEOM objects and erase other
//=====================================================================================
void DisplayGUI::DisplayOnlyChildren()
{
EraseAll();
SALOME_ListIO listIO;
SalomeApp_Application* app = getGeometryGUI()->getApp();
if (!app) return;
SalomeApp_Study* anActiveStudy = dynamic_cast<SalomeApp_Study*>(app->activeStudy());
if (!anActiveStudy) return;
LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
if (!aSelMgr) return;
// get selection
SALOME_ListIO aList;
//aSelMgr->selectedObjects(aList);
aSelMgr->selectedObjects(aList, "ObjectBrowser", false);
SALOME_ListIteratorOfListIO It (aList);
SUIT_OverrideCursor();
for (; It.More(); It.Next()) {
Handle(SALOME_InteractiveObject) anIObject = It.Value();
if (anIObject->hasEntry()) {
_PTR(SObject) SO (anActiveStudy->studyDS()->FindObjectID(anIObject->getEntry()));
if (SO) {
_PTR(SComponent) SC (SO->GetFatherComponent());
if (QString(SO->GetID().c_str()) == QString(SO->GetFatherComponent()->GetID().c_str())) {
// if component is selected, pass it
}
else {
_PTR(ChildIterator) anIter (anActiveStudy->studyDS()->NewChildIterator(SO));
anIter->InitEx(true);
while (anIter->More()) {
_PTR(SObject) valSO (anIter->Value());
_PTR(SObject) refSO;
if (!valSO->ReferencedObject(refSO)) {
listIO.Append(new SALOME_InteractiveObject(valSO->GetID().c_str(),
SC->ComponentDataType().c_str(),
valSO->GetName().c_str()));
}
anIter->Next();
}
}
}
}
}
GEOM_Displayer(anActiveStudy).Display(listIO, true);
}
//=====================================================================================
// function : DisplayGUI::Display()
// purpose : Display selected GEOM objects

View File

@ -18,12 +18,11 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// GEOM GEOMGUI : GUI for Geometry component
// File : DisplayGUI.h
// Author : Damien COQUERET, Open CASCADE S.A.S.
//
#ifndef DISPLAYGUI_H
#define DISPLAYGUI_H
@ -53,6 +52,8 @@ public:
void Display();
// Display selected GEOM objects and erase other
void DisplayOnly();
// Display only children of selected GEOM objects and erase other
void DisplayOnlyChildren();
// Erase selected GEOM objects
void Erase();

View File

@ -18,11 +18,10 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : GEOMGUI_Selection.cxx
// Author : Alexander SOLOVYOV, Open CASCADE S.A.S. (alexander.solovyov@opencascade.com)
//
#include "GEOMGUI_Selection.h"
#include "GeometryGUI.h"
@ -159,10 +158,12 @@ QVariant GEOMGUI_Selection::parameter( const int idx, const QString& p ) const
v = isVectorsMode( idx );
else if ( p == "topLevel" )
v = topLevel( idx );
else if ( p == "hasHiddenChildren" )
v = hasHiddenChildren( idx );
else if ( p == "hasShownChildren" )
v = hasShownChildren( idx );
else if ( p == "hasChildren" )
v = hasChildren( idx );
else if ( p == "hasConcealedChildren" )
v = hasConcealedChildren( idx );
else if ( p == "hasDisclosedChildren" )
v = hasDisclosedChildren( idx );
else if ( p == "compoundOfVertices" )
v = compoundOfVertices( idx );
else if ( p == "imported" )
@ -446,7 +447,23 @@ bool GEOMGUI_Selection::isCompoundOfVertices( GEOM::GEOM_Object_ptr obj )
return ret;
}
bool GEOMGUI_Selection::hasHiddenChildren( const int index ) const
bool GEOMGUI_Selection::hasChildren( const int index ) const
{
bool ok = false;
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( study() );
if ( appStudy ) {
QString anEntry = entry( index );
_PTR(Study) study = appStudy->studyDS();
if ( study && !anEntry.isEmpty() ) {
_PTR(SObject) aSO( study->FindObjectID( anEntry.toStdString() ) );
ok = hasChildren( aSO );
}
}
return ok;
}
bool GEOMGUI_Selection::hasConcealedChildren( const int index ) const
{
bool OK = false;
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( study() );
@ -462,7 +479,7 @@ bool GEOMGUI_Selection::hasHiddenChildren( const int index ) const
return OK;
}
bool GEOMGUI_Selection::hasShownChildren( const int index ) const
bool GEOMGUI_Selection::hasDisclosedChildren( const int index ) const
{
bool OK = false;
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( study() );

View File

@ -18,11 +18,10 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : GEOMGUI_Selection.h
// Author : Alexander SOLOVYOV, Open CASCADE S.A.S. (alexander.solovyov@opencascade.com)
//
#ifndef GEOMGUI_SELECTION_H
#define GEOMGUI_SELECTION_H
@ -66,8 +65,9 @@ private:
QString displayMode( const int ) const;
QString selectionMode() const;
bool isVectorsMode( const int ) const;
bool hasHiddenChildren( const int ) const;
bool hasShownChildren( const int ) const;
bool hasChildren( const int ) const;
bool hasConcealedChildren( const int ) const;
bool hasDisclosedChildren( const int ) const;
bool compoundOfVertices( const int ) const;
bool topLevel( const int ) const;
bool isPhysicalMaterial( const int ) const;

View File

@ -2446,6 +2446,10 @@ Please, select face, shell or solid and try again</translation>
<source>MEN_DISPLAY_ONLY</source>
<translation>Show Only</translation>
</message>
<message>
<source>MEN_SHOW_ONLY_CHILDREN</source>
<translation>Show Only Children</translation>
</message>
<message>
<source>MEN_BRING_TO_FRONT</source>
<translation>Bring To Front</translation>
@ -2703,12 +2707,12 @@ Please, select face, shell or solid and try again</translation>
<translation>Create Group</translation>
</message>
<message>
<source>MEN_POP_SHOW_CHILDREN</source>
<translation>Show Children</translation>
<source>MEN_POP_DISCLOSE_CHILDREN</source>
<translation>Disclose child items</translation>
</message>
<message>
<source>MEN_POP_HIDE_CHILDREN</source>
<translation>Hide Children</translation>
<source>MEN_POP_CONCEAL_CHILDREN</source>
<translation>Conceal child items</translation>
</message>
<message>
<source>MEN_POP_UNPUBLISH_OBJ</source>
@ -3274,6 +3278,10 @@ Please, select face, shell or solid and try again</translation>
<source>STB_DISPLAY_ONLY</source>
<translation>Show only</translation>
</message>
<message>
<source>STB_SHOW_ONLY_CHILDREN</source>
<translation>Show Only Children</translation>
</message>
<message>
<source>STB_EDGE</source>
<translation>Build an edge</translation>
@ -3478,10 +3486,6 @@ Please, select face, shell or solid and try again</translation>
<source>STB_POP_CREATE_GROUP</source>
<translation>Create Group</translation>
</message>
<message>
<source>STB_POP_SHOW_CHILDREN</source>
<translation>Show child objects</translation>
</message>
<message>
<source>STB_POP_UNPUBLISH_OBJ</source>
<translation>Unpublish object</translation>
@ -3491,8 +3495,12 @@ Please, select face, shell or solid and try again</translation>
<translation>Publish object</translation>
</message>
<message>
<source>STB_POP_HIDE_CHILDREN</source>
<translation>Hide child objects</translation>
<source>STB_POP_DISCLOSE_CHILDREN</source>
<translation>Disclose child items</translation>
</message>
<message>
<source>STB_POP_CONCEAL_CHILDREN</source>
<translation>Conceal child items</translation>
</message>
<message>
<source>STB_POP_ISOS</source>
@ -3894,6 +3902,10 @@ Please, select face, shell or solid and try again</translation>
<source>TOP_DISPLAY_ONLY</source>
<translation>Show only</translation>
</message>
<message>
<source>TOP_SHOW_ONLY_CHILDREN</source>
<translation>Show Only Children</translation>
</message>
<message>
<source>TOP_EDGE</source>
<translation>Build edge</translation>
@ -4094,10 +4106,6 @@ Please, select face, shell or solid and try again</translation>
<source>TOP_POP_CREATE_GROUP</source>
<translation>Create Group</translation>
</message>
<message>
<source>TOP_POP_SHOW_CHILDREN</source>
<translation>Show Children</translation>
</message>
<message>
<source>TOP_POP_UNPUBLISH_OBJ</source>
<translation>Unpublish object</translation>
@ -4107,8 +4115,12 @@ Please, select face, shell or solid and try again</translation>
<translation>Publish object</translation>
</message>
<message>
<source>TOP_POP_HIDE_CHILDREN</source>
<translation>Hide Children</translation>
<source>TOP_POP_DISCLOSE_CHILDREN</source>
<translation>Disclose child items</translation>
</message>
<message>
<source>TOP_POP_CONCEAL_CHILDREN</source>
<translation>Conceal child items</translation>
</message>
<message>
<source>TOP_POP_ISOS</source>

View File

@ -376,8 +376,9 @@ void GeometryGUI::OnGUIEvent( int id )
NotViewerDependentCommands << GEOMOp::OpDelete
<< GEOMOp::OpShow
<< GEOMOp::OpShowOnly
<< GEOMOp::OpShowChildren
<< GEOMOp::OpHideChildren
<< GEOMOp::OpShowOnlyChildren
<< GEOMOp::OpDiscloseChildren
<< GEOMOp::OpConcealChildren
<< GEOMOp::OpUnpublishObject
<< GEOMOp::OpPublishObject
<< GEOMOp::OpPointMarker;
@ -419,8 +420,8 @@ void GeometryGUI::OnGUIEvent( int id )
case GEOMOp::OpDecrNbIsos: // SHORTCUT - DECREASE NB ISOS
case GEOMOp::OpAutoColor: // POPUP MENU - AUTO COLOR
case GEOMOp::OpNoAutoColor: // POPUP MENU - DISABLE AUTO COLOR
case GEOMOp::OpShowChildren: // POPUP MENU - SHOW CHILDREN
case GEOMOp::OpHideChildren: // POPUP MENU - HIDE CHILDREN
case GEOMOp::OpDiscloseChildren: // POPUP MENU - DISCLOSE CHILD ITEMS
case GEOMOp::OpConcealChildren: // POPUP MENU - CONCEAL CHILD ITEMS
case GEOMOp::OpUnpublishObject: // POPUP MENU - UNPUBLISH
case GEOMOp::OpPublishObject: // ROOT GEOM OBJECT - POPUP MENU - PUBLISH
case GEOMOp::OpPointMarker: // POPUP MENU - POINT MARKER
@ -436,6 +437,7 @@ void GeometryGUI::OnGUIEvent( int id )
case GEOMOp::OpDMShadingWithEdges: // MENU VIEW - SHADING
case GEOMOp::OpShowAll: // MENU VIEW - SHOW ALL
case GEOMOp::OpShowOnly: // MENU VIEW - DISPLAY ONLY
case GEOMOp::OpShowOnlyChildren: // MENU VIEW - SHOW ONLY CHILDREN
case GEOMOp::OpHideAll: // MENU VIEW - ERASE ALL
case GEOMOp::OpHide: // MENU VIEW - ERASE
case GEOMOp::OpShow: // MENU VIEW - DISPLAY
@ -859,6 +861,7 @@ void GeometryGUI::initialize( CAM_Application* app )
createGeomAction( GEOMOp::OpSelectCompound, "COMPOUND_SEL_ONLY", "", 0, true );
createGeomAction( GEOMOp::OpSelectAll, "ALL_SEL_ONLY", "", 0, true );
createGeomAction( GEOMOp::OpShowOnly, "DISPLAY_ONLY" );
createGeomAction( GEOMOp::OpShowOnlyChildren, "SHOW_ONLY_CHILDREN" );
createGeomAction( GEOMOp::OpBringToFront, "BRING_TO_FRONT", "", 0, true );
createGeomAction( GEOMOp::OpClsBringToFront, "CLS_BRING_TO_FRONT" );
createGeomAction( GEOMOp::OpHide, "ERASE" );
@ -878,8 +881,8 @@ void GeometryGUI::initialize( CAM_Application* app )
createGeomAction( GEOMOp::OpAutoColor, "POP_AUTO_COLOR" );
createGeomAction( GEOMOp::OpNoAutoColor, "POP_DISABLE_AUTO_COLOR" );
createGeomAction( GEOMOp::OpGroupCreatePopup, "POP_CREATE_GROUP" );
createGeomAction( GEOMOp::OpShowChildren, "POP_SHOW_CHILDREN" );
createGeomAction( GEOMOp::OpHideChildren, "POP_HIDE_CHILDREN" );
createGeomAction( GEOMOp::OpDiscloseChildren, "POP_DISCLOSE_CHILDREN" );
createGeomAction( GEOMOp::OpConcealChildren, "POP_CONCEAL_CHILDREN" );
createGeomAction( GEOMOp::OpUnpublishObject, "POP_UNPUBLISH_OBJ" );
createGeomAction( GEOMOp::OpPublishObject, "POP_PUBLISH_OBJ" );
createGeomAction( GEOMOp::OpPointMarker, "POP_POINT_MARKER" );
@ -1242,11 +1245,11 @@ void GeometryGUI::initialize( CAM_Application* app )
mgr->setRule( action( GEOMOp::OpDelete ), QString("$type in {'Shape' 'Group'} and selcount>0"), QtxPopupMgr::VisibleRule );
mgr->insert( action( GEOMOp::OpGroupCreatePopup ), -1, -1 ); // create group
mgr->setRule( action( GEOMOp::OpGroupCreatePopup ), QString("client='ObjectBrowser' and type='Shape' and selcount=1 and isOCC=true"), QtxPopupMgr::VisibleRule );
mgr->insert( action( GEOMOp::OpShowChildren ), -1, -1 ); // show children
mgr->setRule( action( GEOMOp::OpShowChildren ), QString("client='ObjectBrowser' and type='Shape' and selcount=1 and hasHiddenChildren=true"), QtxPopupMgr::VisibleRule );
mgr->insert( action( GEOMOp::OpDiscloseChildren ), -1, -1 ); // disclose child items
mgr->setRule( action( GEOMOp::OpDiscloseChildren ), QString("client='ObjectBrowser' and type='Shape' and selcount=1 and hasConcealedChildren=true"), QtxPopupMgr::VisibleRule );
mgr->insert( action( GEOMOp::OpHideChildren ), -1, -1 ); // hide children
mgr->setRule( action( GEOMOp::OpHideChildren ), QString("client='ObjectBrowser' and type='Shape' and selcount=1 and hasShownChildren=true"), QtxPopupMgr::VisibleRule );
mgr->insert( action( GEOMOp::OpConcealChildren ), -1, -1 ); // conceal shild items
mgr->setRule( action( GEOMOp::OpConcealChildren ), QString("client='ObjectBrowser' and type='Shape' and selcount=1 and hasDisclosedChildren=true"), QtxPopupMgr::VisibleRule );
mgr->insert( action( GEOMOp::OpGroupEdit ), -1, -1 ); // edit group
mgr->setRule( action( GEOMOp::OpGroupEdit ), QString("client='ObjectBrowser' and type='Group' and selcount=1 and isOCC=true"), QtxPopupMgr::VisibleRule );
mgr->insert( separator(), -1, -1 ); // -----------
@ -1353,6 +1356,8 @@ void GeometryGUI::initialize( CAM_Application* app )
mgr->setRule(action(GEOMOp::OpSelectAll), selectOnly + " and selectionmode='ALL'", QtxPopupMgr::ToggleRule);
mgr->insert( action(GEOMOp::OpShowOnly ), -1, -1 ); // display only
mgr->setRule(action(GEOMOp::OpShowOnly ), rule.arg( types ).arg( "true" ), QtxPopupMgr::VisibleRule );
mgr->insert( action(GEOMOp::OpShowOnlyChildren ), -1, -1 ); // display only children
mgr->setRule(action(GEOMOp::OpShowOnlyChildren ), (canDisplay + "and ($type in {%1}) and client='ObjectBrowser' and hasChildren=true").arg( types ), QtxPopupMgr::VisibleRule );
mgr->insert( separator(), -1, -1 ); // -----------
mgr->insert( action( GEOMOp::OpUnpublishObject ), -1, -1 ); // Unpublish object

View File

@ -50,13 +50,12 @@ namespace GEOMOp {
OpPointMarker = 1210, // POPUP MENU - POINT MARKER
OpSetTexture = 1211, // POPUP MENU - SETTEXTURE
OpMaterialProperties = 1212, // POPUP MENU - MATERIAL PROPERTIES
OpShowChildren = 1250, // POPUP MENU - SHOW CHILDREN
OpHideChildren = 1251, // POPUP MENU - HIDE CHILDREN
OpDiscloseChildren = 1250, // POPUP MENU - DISCLOSE CHILD ITEMS
OpConcealChildren = 1251, // POPUP MENU - CONCEAL CHILD ITEMS
OpUnpublishObject = 1253, // POPUP MENU - UNPUBLISH
OpPublishObject = 1254, // GEOM ROOT OBJECT - POPUP MENU - PUBLISH
OpEdgeWidth = 1260, // POPUP MENU - LINE WIDTH - EDGE WIDTH
OpIsosWidth = 1261, // POPUP MENU - LINE WIDTH - ISOS WIDTH
// DisplayGUI ------------------//--------------------------------
OpSwitchVectors = 2001, // MENU VIEW - DISPLAY MODE - SHOW/HIDE EDGE DIRECTION
OpShowAll = 2002, // MENU VIEW - SHOW ALL
@ -67,6 +66,7 @@ namespace GEOMOp {
OpShow = 2100, // POPUP MENU - SHOW
OpShowOnly = 2101, // POPUP MENU - SHOW ONLY
OpHide = 2102, // POPUP MENU - HIDE
OpShowOnlyChildren = 2103, // POPUP MENU - SHOW ONLY CHILDREN
OpWireframe = 2200, // POPUP MENU - DISPLAY MODE - WIREFRAME
OpShading = 2201, // POPUP MENU - DISPLAY MODE - SHADING
OpShadingWithEdges = 2202, // POPUP MENU - DISPLAY MODE - SHADING WITH EDGES

View File

@ -355,9 +355,9 @@ bool GEOMToolsGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent)
case GEOMOp::OpNoAutoColor: // POPUP - DISABLE AUTO COLOR
OnDisableAutoColor();
break;
case GEOMOp::OpShowChildren: // POPUP - SHOW CHILDREN
case GEOMOp::OpHideChildren: // POPUP - HIDE CHILDREN
OnShowHideChildren( theCommandID == GEOMOp::OpShowChildren );
case GEOMOp::OpDiscloseChildren: // POPUP - SHOW CHILDREN
case GEOMOp::OpConcealChildren: // POPUP - HIDE CHILDREN
OnDiscloseConcealChildren( theCommandID == GEOMOp::OpDiscloseChildren );
break;
case GEOMOp::OpPointMarker: // POPUP - POINT MARKER
OnPointMarker();

View File

@ -77,7 +77,7 @@ private:
void OnNbIsos( ActionType actionType = SHOWDLG );
void OnDeflection();
void OnSelectOnly(int mode);
void OnShowHideChildren( bool );
void OnDiscloseConcealChildren( bool );
void OnUnpublishObject();
void OnPublishObject() ;
void OnPointMarker();

View File

@ -952,7 +952,7 @@ void GEOMToolsGUI::OnSelectOnly(int mode)
}
}
void GEOMToolsGUI::OnShowHideChildren( bool show )
void GEOMToolsGUI::OnDiscloseConcealChildren( bool show )
{
SALOME_ListIO selected;
SalomeApp_Application* app =