mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-15 04:10:33 +05:00
Update of tree wdg from dialog; Show/Hide all pop-up menu.
This commit is contained in:
parent
b8db699e10
commit
71725ed92f
@ -25,6 +25,7 @@
|
||||
|
||||
#include "GEOMGUI_Selection.h"
|
||||
#include <GEOMGUI_DimensionProperty.h>
|
||||
#include <GEOMGUI_AnnotationAttrs.h>
|
||||
|
||||
#include "GeometryGUI.h"
|
||||
#include "GEOM_Displayer.h"
|
||||
@ -198,6 +199,10 @@ QVariant GEOMGUI_Selection::parameter( const int idx, const QString& p ) const
|
||||
v = hasHiddenDimensions(idx);
|
||||
else if ( p == "hasVisibleDimensions" )
|
||||
v = hasVisibleDimensions(idx);
|
||||
else if ( p == "hasHiddenAnnotations" )
|
||||
v = hasHiddenAnnotations(idx);
|
||||
else if ( p == "hasVisibleAnnotations" )
|
||||
v = hasVisibleAnnotations(idx);
|
||||
else
|
||||
v = LightApp_Selection::parameter( idx, p );
|
||||
|
||||
@ -853,3 +858,58 @@ bool GEOMGUI_Selection::hasVisibleDimensions( const int theIndex ) const
|
||||
return isAnyVisible;
|
||||
}
|
||||
|
||||
bool GEOMGUI_Selection::hasAnnotations( const int theIndex, bool& theHidden, bool& theVisible ) const
|
||||
{
|
||||
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( study() );
|
||||
if ( !appStudy )
|
||||
return false;
|
||||
|
||||
QString anEntry = entry( theIndex );
|
||||
_PTR(Study) aStudy = appStudy->studyDS();
|
||||
if ( !aStudy || anEntry.isNull() )
|
||||
return false;
|
||||
|
||||
_PTR(SObject) aSObj = appStudy->studyDS()->FindObjectID( anEntry.toStdString() );
|
||||
|
||||
const Handle(GEOMGUI_AnnotationAttrs)
|
||||
aShapeAnnotations = GEOMGUI_AnnotationAttrs::FindAttributes( aSObj );
|
||||
|
||||
if ( aShapeAnnotations.IsNull() )
|
||||
return false;
|
||||
|
||||
theHidden = false;
|
||||
theVisible = false;
|
||||
|
||||
const int aCount = aShapeAnnotations->GetNbAnnotation();
|
||||
for ( int anI = 0; anI < aCount; ++anI )
|
||||
{
|
||||
if ( aShapeAnnotations->GetIsVisible( anI ) )
|
||||
theVisible = true;
|
||||
else
|
||||
theHidden = true;
|
||||
}
|
||||
|
||||
return aCount > 0;
|
||||
}
|
||||
|
||||
bool GEOMGUI_Selection::hasHiddenAnnotations( const int theIndex ) const
|
||||
{
|
||||
bool isAnyVisible, isAnyHidden = false;
|
||||
if ( !hasAnnotations( theIndex, isAnyHidden, isAnyVisible ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return isAnyHidden;
|
||||
}
|
||||
|
||||
bool GEOMGUI_Selection::hasVisibleAnnotations( const int theIndex ) const
|
||||
{
|
||||
bool isAnyVisible, isAnyHidden = false;
|
||||
if ( !hasAnnotations( theIndex, isAnyHidden, isAnyVisible ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return isAnyVisible;
|
||||
}
|
||||
|
@ -85,6 +85,10 @@ private:
|
||||
bool hasHiddenDimensions( const int ) const;
|
||||
bool hasVisibleDimensions( const int ) const;
|
||||
|
||||
bool hasAnnotations( const int, bool&, bool& ) const;
|
||||
bool hasHiddenAnnotations( const int ) const;
|
||||
bool hasVisibleAnnotations( const int ) const;
|
||||
|
||||
GEOM::GEOM_Object_ptr getObject( const int ) const;
|
||||
GEOM::GEOM_BaseObject_ptr getBaseObject( const int ) const;
|
||||
|
||||
|
41
src/GEOMGUI/GEOMGUI_TextTreeWdg.cxx
Executable file → Normal file
41
src/GEOMGUI/GEOMGUI_TextTreeWdg.cxx
Executable file → Normal file
@ -124,6 +124,11 @@ namespace
|
||||
// ----------------------------------------------------------------------------
|
||||
// Text tree widget implementation
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
//=================================================================================
|
||||
// function : Constructor
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
GEOMGUI_TextTreeWdg::GEOMGUI_TextTreeWdg( SalomeApp_Application* app )
|
||||
: myDisplayer(NULL)
|
||||
{
|
||||
@ -181,12 +186,19 @@ GEOMGUI_TextTreeWdg::GEOMGUI_TextTreeWdg( SalomeApp_Application* app )
|
||||
connect( app->objectBrowser(), SIGNAL( updated() ), this, SLOT( updateTree() ) );
|
||||
|
||||
GeometryGUI* aGeomGUI = dynamic_cast<GeometryGUI*>( app->module( "Geometry" ) );
|
||||
connect( aGeomGUI, SIGNAL( DimensionsUpdated( const QString& ) ), this, SLOT( updateBranch( const QString& ) ) );
|
||||
connect( aGeomGUI, SIGNAL( DimensionsUpdated( const QString& ) ),
|
||||
this, SLOT( updateDimensionBranch( const QString& ) ) );
|
||||
connect( aGeomGUI, SIGNAL( SignalAnnotationsUpdated( const QString& ) ),
|
||||
this, SLOT( updateAnnotationBranch( const QString& ) ) );
|
||||
connect( this, SIGNAL( itemClicked( QTreeWidgetItem*, int) ),
|
||||
this, SLOT( onItemClicked( QTreeWidgetItem*, int ) ) );
|
||||
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : Destructor
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
GEOMGUI_TextTreeWdg::~GEOMGUI_TextTreeWdg()
|
||||
{
|
||||
//std::cout<<"~GEOMGUI_TextTreeWdg"<<std::endl;
|
||||
@ -228,7 +240,7 @@ void GEOMGUI_TextTreeWdg::updateTree()
|
||||
if ( !valSO->ReferencedObject( refSO ) ) {
|
||||
// update tree of object's dimensions
|
||||
QString anEntry = valSO->GetID().c_str();
|
||||
updateBranch( anEntry );
|
||||
updateBranches( anEntry );
|
||||
aDimensionObjEntries.removeAll( anEntry );
|
||||
anAnnotationObjEntries.removeAll( anEntry );
|
||||
}
|
||||
@ -245,15 +257,30 @@ void GEOMGUI_TextTreeWdg::updateTree()
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : updateBranch
|
||||
// function : updateBranches
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void GEOMGUI_TextTreeWdg::updateBranch( const QString& theEntry )
|
||||
void GEOMGUI_TextTreeWdg::updateBranches( const QString& theEntry )
|
||||
{
|
||||
// dimension property branch
|
||||
fillBranch( DimensionShape, theEntry );
|
||||
updateDimensionBranch( theEntry );
|
||||
updateAnnotationBranch( theEntry );
|
||||
}
|
||||
|
||||
// annotation property branch
|
||||
//=================================================================================
|
||||
// function : updateDimensionBranch
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void GEOMGUI_TextTreeWdg::updateDimensionBranch( const QString& theEntry )
|
||||
{
|
||||
fillBranch( DimensionShape, theEntry );
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : updateAnnotationBranch
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void GEOMGUI_TextTreeWdg::updateAnnotationBranch( const QString& theEntry )
|
||||
{
|
||||
fillBranch( AnnotationShape, theEntry );
|
||||
}
|
||||
|
||||
|
4
src/GEOMGUI/GEOMGUI_TextTreeWdg.h
Executable file → Normal file
4
src/GEOMGUI/GEOMGUI_TextTreeWdg.h
Executable file → Normal file
@ -72,7 +72,9 @@ protected:
|
||||
|
||||
public slots:
|
||||
void updateTree();
|
||||
void updateBranch( const QString& theEntry );
|
||||
void updateBranches( const QString& theEntry );
|
||||
void updateDimensionBranch( const QString& theEntry );
|
||||
void updateAnnotationBranch( const QString& theEntry );
|
||||
|
||||
private slots:
|
||||
void onItemClicked(QTreeWidgetItem*, int );
|
||||
|
@ -5056,6 +5056,30 @@ Please, select face, shell or solid and try again</translation>
|
||||
<source>TOP_POP_HIDE_ALL_DIMENSIONS</source>
|
||||
<translation>Show all visible measures (dimension) created for the object</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_POP_SHOW_ALL_ANNOTATIONS</source>
|
||||
<translation>Show all annotations</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>STB_POP_SHOW_ALL_ANNOTATIONS</source>
|
||||
<translation>Show all shape annotations for the object</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TOP_POP_SHOW_ALL_ANNOTATIONS</source>
|
||||
<translation>Show all shape annotations for the object</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_POP_HIDE_ALL_ANNOTATIONS</source>
|
||||
<translation>Hide all annotations</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>STB_POP_HIDE_ALL_ANNOTATIONS</source>
|
||||
<translation>Hide all shape annotations for the object</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TOP_POP_HIDE_ALL_ANNOTATIONS</source>
|
||||
<translation>Hide all shape annotations for the object</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TOP_POP_AUTO_COLOR</source>
|
||||
<translation>Auto color</translation>
|
||||
|
@ -3494,36 +3494,47 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SHAPE_ANNOTATIONS</source>
|
||||
<translation type="unfinished">Shape annotations</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SHAPE_ANNOTATIONS_FONT</source>
|
||||
<translation type="unfinished">Font</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SHAPE_ANNOTATIONS_FONT_COLOR</source>
|
||||
<translation type="unfinished">Font color</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SHAPE_ANNOTATIONS_LINE_COLOR</source>
|
||||
<translation type="unfinished">Line color</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SHAPE_ANNOTATIONS_LINE_WIDTH</source>
|
||||
<translation type="unfinished">Line width</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SHAPE_ANNOTATIONS_LINE_STYLE</source>
|
||||
<translation type="unfinished">Line style</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SHAPE_ANNOTATIONS_AUTOHIDE</source>
|
||||
<translation type="unfinished">Hide when attachment is invisible</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SHAPE_ANNOTATIONS_LINESTYLE_SOLID</source>
|
||||
<translation type="unfinished">Solid</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SHAPE_ANNOTATIONS_LINESTYLE_DASH</source>
|
||||
<translation type="unfinished">Dashed</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SHAPE_ANNOTATIONS_LINESTYLE_DOT</source>
|
||||
<translation type="unfinished">Dotted</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SHAPE_ANNOTATIONS_LINESTYLE_DOTDASH</source>
|
||||
<translation type="unfinished">Mixed</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_HIDE_INPUT_OBJECT</source>
|
||||
@ -5021,6 +5032,30 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
|
||||
<source>TOP_POP_HIDE_ALL_DIMENSIONS</source>
|
||||
<translation>Afficher toutes les cotations visibles créées sur l'objet</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_POP_SHOW_ALL_ANNOTATIONS</source>
|
||||
<translation type="unfinished">Show all annotations</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>STB_POP_SHOW_ALL_ANNOTATIONS</source>
|
||||
<translation type="unfinished">Show all shape annotations for the object</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TOP_POP_SHOW_ALL_ANNOTATIONS</source>
|
||||
<translation type="unfinished">Show all shape annotations for the object</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_POP_HIDE_ALL_ANNOTATIONS</source>
|
||||
<translation type="unfinished">Hide all annotations</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>STB_POP_HIDE_ALL_ANNOTATIONS</source>
|
||||
<translation type="unfinished">Hide all shape annotations for the object</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TOP_POP_HIDE_ALL_ANNOTATIONS</source>
|
||||
<translation type="unfinished">Hide all shape annotations for the object</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TOP_POP_AUTO_COLOR</source>
|
||||
<translation>Couleur automatique</translation>
|
||||
|
@ -3497,36 +3497,47 @@
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SHAPE_ANNOTATIONS</source>
|
||||
<translation type="unfinished">Shape annotations</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SHAPE_ANNOTATIONS_FONT</source>
|
||||
<translation type="unfinished">Font</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SHAPE_ANNOTATIONS_FONT_COLOR</source>
|
||||
<translation type="unfinished">Font color</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SHAPE_ANNOTATIONS_LINE_COLOR</source>
|
||||
<translation type="unfinished">Line color</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SHAPE_ANNOTATIONS_LINE_WIDTH</source>
|
||||
<translation type="unfinished">Line width</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SHAPE_ANNOTATIONS_LINE_STYLE</source>
|
||||
<translation type="unfinished">Line style</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SHAPE_ANNOTATIONS_AUTOHIDE</source>
|
||||
<translation type="unfinished">Hide when attachment is invisible</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SHAPE_ANNOTATIONS_LINESTYLE_SOLID</source>
|
||||
<translation type="unfinished">Solid</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SHAPE_ANNOTATIONS_LINESTYLE_DASH</source>
|
||||
<translation type="unfinished">Dashed</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SHAPE_ANNOTATIONS_LINESTYLE_DOT</source>
|
||||
<translation type="unfinished">Dotted</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_SHAPE_ANNOTATIONS_LINESTYLE_DOTDASH</source>
|
||||
<translation type="unfinished">Mixed</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>PREF_HIDE_INPUT_OBJECT</source>
|
||||
@ -5024,6 +5035,30 @@
|
||||
<source>TOP_POP_HIDE_ALL_DIMENSIONS</source>
|
||||
<translation>オブジェクトのために作成されたすべての見える基準寸法を表示</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_POP_SHOW_ALL_ANNOTATIONS</source>
|
||||
<translation type="unfinished">Show all annotations</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>STB_POP_SHOW_ALL_ANNOTATIONS</source>
|
||||
<translation type="unfinished">Show all shape annotations for the object</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TOP_POP_SHOW_ALL_ANNOTATIONS</source>
|
||||
<translation type="unfinished">Show all shape annotations for the object</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_POP_HIDE_ALL_ANNOTATIONS</source>
|
||||
<translation type="unfinished">Hide all annotations</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>STB_POP_HIDE_ALL_ANNOTATIONS</source>
|
||||
<translation type="unfinished">Hide all shape annotations for the object</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TOP_POP_HIDE_ALL_ANNOTATIONS</source>
|
||||
<translation type="unfinished">Hide all shape annotations for the object</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TOP_POP_AUTO_COLOR</source>
|
||||
<translation>自動色</translation>
|
||||
|
20
src/GEOMGUI/GeometryGUI.cxx
Executable file → Normal file
20
src/GEOMGUI/GeometryGUI.cxx
Executable file → Normal file
@ -667,6 +667,8 @@ void GeometryGUI::OnGUIEvent( int id, const QVariant& theParam )
|
||||
#endif
|
||||
case GEOMOp::OpShowAllDimensions: // POPUP MENU - SHOW ALL DIMENSIONS
|
||||
case GEOMOp::OpHideAllDimensions: // POPUP MENU - HIDE ALL DIMENSIONS
|
||||
case GEOMOp::OpShowAllAnnotations: // POPUP MENU - SHOW ALL ANNOTATIONS
|
||||
case GEOMOp::OpHideAllAnnotations: // POPUP MENU - HIDE ALL ANNOTATIONS
|
||||
libName = "MeasureGUI";
|
||||
break;
|
||||
case GEOMOp::OpGroupCreate: // MENU GROUP - CREATE
|
||||
@ -1120,6 +1122,8 @@ void GeometryGUI::initialize( CAM_Application* app )
|
||||
createGeomAction( GEOMOp::OpReduceStudy, "POP_REDUCE_STUDY" );
|
||||
createGeomAction( GEOMOp::OpShowAllDimensions, "POP_SHOW_ALL_DIMENSIONS" );
|
||||
createGeomAction( GEOMOp::OpHideAllDimensions, "POP_HIDE_ALL_DIMENSIONS" );
|
||||
createGeomAction( GEOMOp::OpShowAllAnnotations, "POP_SHOW_ALL_ANNOTATIONS" );
|
||||
createGeomAction( GEOMOp::OpHideAllAnnotations, "POP_HIDE_ALL_ANNOTATIONS" );
|
||||
|
||||
// Create actions for increase/decrease transparency shortcuts
|
||||
createGeomAction( GEOMOp::OpIncrTransparency, "", "", 0, false,
|
||||
@ -1645,6 +1649,10 @@ void GeometryGUI::initialize( CAM_Application* app )
|
||||
mgr->setRule( action( GEOMOp::OpShowAllDimensions ), aDimensionRule.arg( "hasHiddenDimensions" ), QtxPopupMgr::VisibleRule );
|
||||
mgr->insert( action( GEOMOp::OpHideAllDimensions ), -1, -1 ); // hide all dimensions
|
||||
mgr->setRule( action( GEOMOp::OpHideAllDimensions ), aDimensionRule.arg( "hasVisibleDimensions" ), QtxPopupMgr::VisibleRule );
|
||||
mgr->insert( action( GEOMOp::OpShowAllAnnotations ), -1, -1 ); // show all annotations
|
||||
mgr->setRule( action( GEOMOp::OpShowAllAnnotations ), aDimensionRule.arg( "hasHiddenAnnotations" ), QtxPopupMgr::VisibleRule );
|
||||
mgr->insert( action( GEOMOp::OpHideAllAnnotations ), -1, -1 ); // hide all annotations
|
||||
mgr->setRule( action( GEOMOp::OpHideAllAnnotations ), aDimensionRule.arg( "hasVisibleAnnotations" ), QtxPopupMgr::VisibleRule );
|
||||
|
||||
mgr->insert( separator(), -1, -1 ); // -----------
|
||||
mgr->insert( action( GEOMOp::OpUnpublishObject ), -1, -1 ); // Unpublish object
|
||||
@ -2767,6 +2775,13 @@ void GeometryGUI::preferencesChanged( const QString& section, const QString& par
|
||||
param == QString("dimensions_length_units") ||
|
||||
param == QString("dimensions_angle_units") ||
|
||||
param == QString("dimensions_use_text3d") ||
|
||||
param == QString("shape_annotation_font_color") ||
|
||||
param == QString("shape_annotation_line_color") ||
|
||||
param == QString("shape_annotation_font") ||
|
||||
param == QString("shape_annotation_line_width") ||
|
||||
param == QString("shape_annotation_autohide") ||
|
||||
param == QString("shape_annotation_line_style") ||
|
||||
param == QString("shape_annotation_line_style") ||
|
||||
param == QString("label_color") )
|
||||
{
|
||||
SalomeApp_Application* anApp = getApp();
|
||||
@ -3590,3 +3605,8 @@ void GeometryGUI::emitDimensionsUpdated( QString entry )
|
||||
{
|
||||
emit DimensionsUpdated( entry );
|
||||
}
|
||||
|
||||
void GeometryGUI::emitAnnotationsUpdated( QString entry )
|
||||
{
|
||||
emit SignalAnnotationsUpdated( entry );
|
||||
}
|
||||
|
@ -150,6 +150,7 @@ public:
|
||||
const int row, Qt::DropAction action );
|
||||
|
||||
void emitDimensionsUpdated( QString entry );
|
||||
void emitAnnotationsUpdated( QString entry );
|
||||
|
||||
public slots:
|
||||
virtual bool deactivateModule( SUIT_Study* );
|
||||
@ -179,6 +180,7 @@ signals :
|
||||
void SignalDefaultStepValueChanged( double newVal );
|
||||
void SignalDependencyTreeParamChanged( const QString&, const QString& );
|
||||
void SignalDependencyTreeRenameObject( const QString& );
|
||||
void SignalAnnotationsUpdated( const QString& );
|
||||
void DimensionsUpdated( const QString& );
|
||||
|
||||
protected:
|
||||
|
@ -209,6 +209,8 @@ namespace GEOMOp {
|
||||
#endif
|
||||
OpAnnotation = 5020, // MENU MEASURES - ANNOTATION
|
||||
OpEditAnnotation = 5021, // POPUP MENU - EDIT ANNOTATION
|
||||
OpShowAllAnnotations = 5022, // POPUP MENU - SHOW ALL ANNOTATIONS
|
||||
OpHideAllAnnotations = 5023, // POPUP MENU - HIDE ALL ANNOTATIONS
|
||||
// GroupGUI --------------------//--------------------------------
|
||||
OpGroupCreate = 6000, // MENU GROUP - CREATE
|
||||
OpGroupEdit = 6001, // MENU GROUP - EDIT
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "GeometryGUI_Operations.h"
|
||||
|
||||
#include <GEOMGUI_DimensionProperty.h>
|
||||
#include <GEOMGUI_AnnotationAttrs.h>
|
||||
|
||||
#include <LightApp_SelectionMgr.h>
|
||||
#include <SUIT_OverrideCursor.h>
|
||||
@ -163,6 +164,12 @@ bool MeasureGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
|
||||
case GEOMOp::OpHideAllDimensions:
|
||||
ChangeDimensionsVisibility( false );
|
||||
break; // HIDE ALL DIMENSIONS
|
||||
case GEOMOp::OpShowAllAnnotations:
|
||||
ChangeAnnotationsVisibility( true );
|
||||
break; // SHOW ALL ANNOTATIONS
|
||||
case GEOMOp::OpHideAllAnnotations:
|
||||
ChangeAnnotationsVisibility( false );
|
||||
break; // HIDE ALL ANNOTATIONS
|
||||
default:
|
||||
app->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) );
|
||||
break;
|
||||
@ -182,42 +189,23 @@ bool MeasureGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
|
||||
void MeasureGUI::ChangeDimensionsVisibility( const bool theIsVisible )
|
||||
{
|
||||
SalomeApp_Application* anApp = getGeometryGUI()->getApp();
|
||||
if (!anApp)
|
||||
{
|
||||
if ( !anApp )
|
||||
return;
|
||||
}
|
||||
|
||||
SalomeApp_Study* anActiveStudy = dynamic_cast<SalomeApp_Study*>( anApp->activeStudy() );
|
||||
if ( !anActiveStudy )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
LightApp_SelectionMgr* aSelMgr = anApp->selectionMgr();
|
||||
if ( !aSelMgr )
|
||||
{
|
||||
Handle(SALOME_InteractiveObject) anIObject = getSingleSelectedIO();
|
||||
if ( anIObject.IsNull()
|
||||
|| !anIObject->hasEntry() )
|
||||
return;
|
||||
}
|
||||
|
||||
SALOME_ListIO aListIO;
|
||||
aSelMgr->selectedObjects( aListIO );
|
||||
if ( aListIO.Extent() != 1 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Handle(SALOME_InteractiveObject) anIObject = aListIO.First();
|
||||
if ( !anIObject->hasEntry() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SUIT_OverrideCursor wc;
|
||||
|
||||
GEOMGUI_DimensionProperty aDimensions( anActiveStudy, anIObject->getEntry() );
|
||||
|
||||
for ( int anIt = 0; anIt < aDimensions.GetNumber(); ++anIt )
|
||||
{
|
||||
for ( int anIt = 0; anIt < aDimensions.GetNumber(); ++anIt ) {
|
||||
aDimensions.SetVisible( anIt, theIsVisible );
|
||||
}
|
||||
|
||||
@ -226,6 +214,73 @@ void MeasureGUI::ChangeDimensionsVisibility( const bool theIsVisible )
|
||||
GEOM_Displayer( anActiveStudy ).Redisplay( anIObject, true );
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : ChangeAnnotationsVisibility
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
void MeasureGUI::ChangeAnnotationsVisibility( const bool theIsVisible )
|
||||
{
|
||||
SalomeApp_Application* anApp = getGeometryGUI()->getApp();
|
||||
if ( !anApp )
|
||||
return;
|
||||
|
||||
SalomeApp_Study* anActiveStudy = dynamic_cast<SalomeApp_Study*>( anApp->activeStudy() );
|
||||
if ( !anActiveStudy )
|
||||
return;
|
||||
|
||||
Handle(SALOME_InteractiveObject) anIObject = getSingleSelectedIO();
|
||||
if ( anIObject.IsNull()
|
||||
|| !anIObject->hasEntry() )
|
||||
return;
|
||||
|
||||
_PTR(SObject) aSObj = anActiveStudy->studyDS()->FindObjectID( anIObject->getEntry() );
|
||||
|
||||
const Handle(GEOMGUI_AnnotationAttrs)
|
||||
aShapeAnnotations = GEOMGUI_AnnotationAttrs::FindAttributes( aSObj );
|
||||
|
||||
if ( aShapeAnnotations.IsNull() )
|
||||
return;
|
||||
|
||||
const int aCount = aShapeAnnotations->GetNbAnnotation();
|
||||
|
||||
if ( aCount > 0 ) {
|
||||
|
||||
SUIT_OverrideCursor wc;
|
||||
|
||||
for ( int anI = 0; anI <= aCount; ++anI ) {
|
||||
|
||||
aShapeAnnotations->SetIsVisible( anI, theIsVisible );
|
||||
}
|
||||
|
||||
GEOM_Displayer( anActiveStudy ).Redisplay( anIObject, true );
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : getSingleSelectedIO
|
||||
// purpose : returns selected interactive object for single selection.
|
||||
//=======================================================================
|
||||
Handle(SALOME_InteractiveObject) MeasureGUI::getSingleSelectedIO()
|
||||
{
|
||||
SalomeApp_Application* anApp = getGeometryGUI()->getApp();
|
||||
if ( !anApp ) {
|
||||
return Handle(SALOME_InteractiveObject)();
|
||||
}
|
||||
|
||||
LightApp_SelectionMgr* aSelMgr = anApp->selectionMgr();
|
||||
if ( !aSelMgr ) {
|
||||
return Handle(SALOME_InteractiveObject)();
|
||||
}
|
||||
|
||||
SALOME_ListIO aListIO;
|
||||
aSelMgr->selectedObjects( aListIO );
|
||||
if ( aListIO.Extent() != 1 ) {
|
||||
return Handle(SALOME_InteractiveObject)();
|
||||
}
|
||||
|
||||
return aListIO.First();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : onFinished
|
||||
// purpose : called then "Manage Dimension" dialog is closed.
|
||||
|
@ -27,8 +27,12 @@
|
||||
#ifndef MEASUREGUI_H
|
||||
#define MEASUREGUI_H
|
||||
|
||||
// GEOM includes
|
||||
#include <GEOMGUI.h>
|
||||
|
||||
// GUI includes
|
||||
#include <SALOME_InteractiveObject.hxx>
|
||||
|
||||
class QDialog;
|
||||
|
||||
//=================================================================================
|
||||
@ -52,6 +56,14 @@ public:
|
||||
|
||||
// Show/hide all dimension created for object
|
||||
void ChangeDimensionsVisibility( const bool theIsVisible );
|
||||
|
||||
// Show/hide all shape annotations created for GEOM object
|
||||
void ChangeAnnotationsVisibility( const bool theIsVisible );
|
||||
|
||||
private:
|
||||
// Returns selected interactive object for single selection
|
||||
Handle(SALOME_InteractiveObject) getSingleSelectedIO();
|
||||
|
||||
private:
|
||||
QDialog* myManageDimensionDlg;
|
||||
private slots:
|
||||
|
2
src/MeasureGUI/MeasureGUI_AnnotationDlg.cxx
Executable file → Normal file
2
src/MeasureGUI/MeasureGUI_AnnotationDlg.cxx
Executable file → Normal file
@ -596,7 +596,7 @@ bool MeasureGUI_AnnotationDlg::execute()
|
||||
|
||||
aShapeAnnotations->Append( myAnnotationProperties );
|
||||
|
||||
/* myGeomGUI->emitDimensionsUpdated( QString( myShape->GetStudyEntry() ) ); */
|
||||
myGeomGUI->emitAnnotationsUpdated( QString( myShape->GetStudyEntry() ) );
|
||||
}
|
||||
else {
|
||||
/*SalomeApp_Study* aStudy = getStudy();
|
||||
|
Loading…
Reference in New Issue
Block a user