diff --git a/doc/salome/gui/GEOM/images/bring_example.png b/doc/salome/gui/GEOM/images/bring_example.png
new file mode 100755
index 000000000..62be78dfd
Binary files /dev/null and b/doc/salome/gui/GEOM/images/bring_example.png differ
diff --git a/doc/salome/gui/GEOM/images/dialog.png b/doc/salome/gui/GEOM/images/dialog.png
index 19f374314..09459032f 100755
Binary files a/doc/salome/gui/GEOM/images/dialog.png and b/doc/salome/gui/GEOM/images/dialog.png differ
diff --git a/doc/salome/gui/GEOM/input/bring_to_front.doc b/doc/salome/gui/GEOM/input/bring_to_front.doc
new file mode 100644
index 000000000..efb29e1f0
--- /dev/null
+++ b/doc/salome/gui/GEOM/input/bring_to_front.doc
@@ -0,0 +1,10 @@
+/*!
+
+\page bring_to_front_page Bring To Front
+
+\n This option is relevant for better viewing of the complex 3D models.
+This item allow to bring to front of viewer selected geometrical object.
+
+\image html bring_example.png
+
+*/
diff --git a/doc/salome/gui/GEOM/input/viewing_geom_obj.doc b/doc/salome/gui/GEOM/input/viewing_geom_obj.doc
index b269619a9..fdb4e7798 100644
--- a/doc/salome/gui/GEOM/input/viewing_geom_obj.doc
+++ b/doc/salome/gui/GEOM/input/viewing_geom_obj.doc
@@ -21,6 +21,10 @@ object.
viewer and from the Object Browser.
\subpage display_mode_page "Display Mode" - allows to select between
Wireframe and Shading presentation.
+\subpage bring_to_front_page "Bring To Front" - allows to bring to
+front of the viewer selected geometrical object.
+Clear Top Level State - allows to remove from foregroung of the viewer
+geometrical objects which were added there via Bring To Front command.
\subpage color_page "Color" - allows to change the filling color in
the standard Select Color menu.
\subpage transparency_page "Transparency" - allows to change the
diff --git a/resources/SalomeApp.xml.in b/resources/SalomeApp.xml.in
index f910e6569..ae902aa02 100644
--- a/resources/SalomeApp.xml.in
+++ b/resources/SalomeApp.xml.in
@@ -49,6 +49,7 @@
+
diff --git a/src/GEOMGUI/GEOMGUI_Selection.cxx b/src/GEOMGUI/GEOMGUI_Selection.cxx
index ca089eb23..d7977004b 100644
--- a/src/GEOMGUI/GEOMGUI_Selection.cxx
+++ b/src/GEOMGUI/GEOMGUI_Selection.cxx
@@ -149,6 +149,8 @@ QVariant GEOMGUI_Selection::parameter( const int idx, const QString& p ) const
v = isAutoColor( idx );
else if ( p == "isVectorsMode" )
v = isVectorsMode( idx );
+ else if ( p == "topLevel" )
+ v = topLevel( idx );
else if ( p == "hasHiddenChildren" )
v = hasHiddenChildren( idx );
else if ( p == "hasShownChildren" )
@@ -512,3 +514,40 @@ QString GEOMGUI_Selection::selectionMode() const
}
return "";
}
+
+bool GEOMGUI_Selection::topLevel( const int index ) const {
+ bool res = false;
+
+#ifdef USE_VISUAL_PROP_MAP
+ bool found = false;
+ QVariant v = visibleProperty( entry( index ), TOP_LEVEL_PROP );
+ if ( v.canConvert() ) {
+ res = v.toBool();
+ found = true;
+ }
+
+ if ( !found ) {
+#endif
+ SALOME_View* view = GEOM_Displayer::GetActiveView();
+ QString viewType = activeViewType();
+ if ( view && viewType == OCCViewer_Viewer::Type() ) {
+ SALOME_Prs* prs = view->CreatePrs( entry( index ).toLatin1().constData() );
+ if ( prs ) {
+ if ( viewType == OCCViewer_Viewer::Type() ) { // assuming OCC
+ SOCC_Prs* occPrs = (SOCC_Prs*) prs;
+ AIS_ListOfInteractive lst;
+ occPrs->GetObjects( lst );
+ if ( lst.Extent() ) {
+ Handle(AIS_InteractiveObject) io = lst.First();
+ if ( !io.IsNull() ) {
+ Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(io);
+ if ( !aSh.IsNull() )
+ res = (bool)aSh->isTopLevel();
+ }
+ }
+ }
+ }
+ }
+ }
+ return res;
+}
diff --git a/src/GEOMGUI/GEOMGUI_Selection.h b/src/GEOMGUI/GEOMGUI_Selection.h
index edcdcfada..ed9ed7182 100644
--- a/src/GEOMGUI/GEOMGUI_Selection.h
+++ b/src/GEOMGUI/GEOMGUI_Selection.h
@@ -69,6 +69,7 @@ private:
bool hasHiddenChildren( const int ) const;
bool hasShownChildren( const int ) const;
bool compoundOfVertices( const int ) const;
+ bool topLevel( const int ) const;
bool isComponent( const int ) const;
GEOM::GEOM_Object_ptr getObject( const int ) const;
diff --git a/src/GEOMGUI/GEOM_Displayer.cxx b/src/GEOMGUI/GEOM_Displayer.cxx
index 8d7bb7603..ea0fbcade 100644
--- a/src/GEOMGUI/GEOM_Displayer.cxx
+++ b/src/GEOMGUI/GEOM_Displayer.cxx
@@ -666,15 +666,18 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs )
AISShape->SetDisplayMode( aPropMap.value(DISPLAY_MODE_PROP).toInt() );
AISShape->SetDisplayVectors(aPropMap.value(VECTOR_MODE_PROP).toInt());
- //Color property
- if(aPropMap.contains(COLOR_PROP)) {
+ if(aPropMap.contains(TOP_LEVEL_PROP)) {
+ AISShape->setTopLevel( aPropMap.value(TOP_LEVEL_PROP).value() );
+ }
+
+ if(aPropMap.contains(COLOR_PROP)) {
Quantity_Color quant_col = SalomeApp_Tools::color( aPropMap.value(COLOR_PROP).value());
AISShape->SetShadingColor( quant_col );
} else
useObjColor = true;
}else {
MESSAGE("myDisplayMode = "<< myDisplayMode)
- AISShape->SetDisplayMode( myDisplayMode );
+ AISShape->SetDisplayMode( myDisplayMode );
AISShape->SetShadingColor( myShadingColor );
}
@@ -848,7 +851,7 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs )
AISShape->SetOwnDeviationCoefficient(aDC);
}
}
-
+
if ( HasTexture() )
{
AISShape->SetTextureFileName(TCollection_AsciiString(myTexture.c_str()));
@@ -856,7 +859,7 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs )
AISShape->DisableTextureModulate();
AISShape->SetDisplayMode(3);
}
-
+
if ( HasWidth() )
AISShape->SetWidth( GetWidth() );
@@ -899,7 +902,7 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs )
anAspect->SetTypeOfMarker( myTypeOfMarker );
AISShape->Attributes()->SetPointAspect( anAspect );
}
- } else if(!hasColor) {
+ } else if( !hasColor ) {
//In case if color wasn't defined in the property map of the object
//and GEOM_Object color also wasn't defined get default color from Resource Mgr.
QColor col = aResMgr->colorValue( "Geometry", "shading_color", QColor( 255, 0, 0 ) );
@@ -2025,6 +2028,10 @@ PropMap GEOM_Displayer::getDefaultPropertyMap(const QString& viewer_type) {
//11. Width of iso-lines
aDefaultMap.insert( ISOS_WIDTH_PROP , aResMgr->integerValue("Geometry", "isolines_width", 1));
+ if(viewer_type == SOCC_Viewer::Type()) {
+
+ aDefaultMap.insert(TOP_LEVEL_PROP, Standard_False);
+ }
return aDefaultMap;
}
diff --git a/src/GEOMGUI/GEOM_msg_en.ts b/src/GEOMGUI/GEOM_msg_en.ts
index 0854f89bf..802b44394 100644
--- a/src/GEOMGUI/GEOM_msg_en.ts
+++ b/src/GEOMGUI/GEOM_msg_en.ts
@@ -2363,6 +2363,30 @@ Please, select face, shell or solid and try again
MEN_DISPLAY_ONLY
Show Only
+
+ MEN_BRING_TO_FRONT
+ Bring To Front
+
+
+ TOP_BRING_TO_FRONT
+ Bring To Front
+
+
+ STB_BRING_TO_FRONT
+ Bring To Front
+
+
+ MEN_CLS_BRING_TO_FRONT
+ Clear Top Level State
+
+
+ TOP_CLS_BRING_TO_FRONT
+ Clear Top Level State
+
+
+ STB_CLS_BRING_TO_FRONT
+ Clear Top Level State
+
MEN_EDGE
Edge
@@ -2935,6 +2959,10 @@ Please, select face, shell or solid and try again
PREF_ISOS_COLOR
Color of isolines
+
+ PREF_TOPLEVEL_COLOR
+ Top level color
+
PREF_LINE_COLOR
Color of edges, vectors, wires
diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx
index 09aa1abf1..4eebd7280 100644
--- a/src/GEOMGUI/GeometryGUI.cxx
+++ b/src/GEOMGUI/GeometryGUI.cxx
@@ -426,6 +426,8 @@ void GeometryGUI::OnGUIEvent( int id )
case GEOMOp::OpMaterialProperties: // POPUP MENU - MATERIAL PROPERTIES
case GEOMOp::OpEdgeWidth: // POPUP MENU - LINE WIDTH - EDGE WIDTH
case GEOMOp::OpIsosWidth: // POPUP MENU - LINE WIDTH - ISOS WIDTH
+ case GEOMOp::OpBringToFront: // POPUP MENU - BRING TO FRONT
+ case GEOMOp::OpClsBringToFront: //
libName = "GEOMToolsGUI";
break;
case GEOMOp::OpDisplayMode: // MENU VIEW - WIREFRAME/SHADING
@@ -844,6 +846,8 @@ 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::OpBringToFront, "BRING_TO_FRONT", "", 0, true );
+ createGeomAction( GEOMOp::OpClsBringToFront, "CLS_BRING_TO_FRONT" );
createGeomAction( GEOMOp::OpHide, "ERASE" );
createGeomAction( GEOMOp::OpWireframe, "POP_WIREFRAME", "", 0, true );
@@ -1216,6 +1220,17 @@ void GeometryGUI::initialize( CAM_Application* app )
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 ); // -----------
+
+#if OCC_VERSION_LARGE > 0x06050200
+ //QString bringRule = clientOCCorOB + " and ($component={'GEOM'}) and (selcount>0) and isOCC=true and topLevel=false";
+ QString bringRule = clientOCCorOB + " and ($component={'GEOM'}) and (selcount>0) and isOCC=true";
+ mgr->insert( action(GEOMOp::OpBringToFront ), -1, -1 ); // bring to front
+ mgr->setRule(action(GEOMOp::OpBringToFront), bringRule, QtxPopupMgr::VisibleRule );
+ mgr->setRule(action(GEOMOp::OpBringToFront), "topLevel=true", QtxPopupMgr::ToggleRule );
+ mgr->insert( action(GEOMOp::OpClsBringToFront ), -1, -1 ); // clear bring to front
+ mgr->setRule( action(GEOMOp::OpClsBringToFront ), clientOCC, QtxPopupMgr::VisibleRule );
+#endif
+ mgr->insert( separator(), -1, -1 ); // -----------
dispmodeId = mgr->insert( tr( "MEN_DISPLAY_MODE" ), -1, -1 ); // display mode menu
mgr->insert( action( GEOMOp::OpWireframe ), dispmodeId, -1 ); // wireframe
mgr->setRule( action( GEOMOp::OpWireframe ), clientOCCorVTK_AndSomeVisible, QtxPopupMgr::VisibleRule );
@@ -1308,7 +1323,6 @@ 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( separator(), -1, -1 );
mgr->insert( separator(), -1, -1 ); // -----------
mgr->insert( action( GEOMOp::OpUnpublishObject ), -1, -1 ); // Unpublish object
@@ -1693,6 +1707,12 @@ void GeometryGUI::createPreferences()
addPreference( tr( "PREF_ISOS_COLOR" ), genGroup,
LightApp_Preferences::Color, "Geometry", "isos_color" );
+ addPreference( tr( "PREF_TOPLEVEL_COLOR" ), genGroup,
+ LightApp_Preferences::Color, "Geometry", "toplevel_color" );
+
+ addPreference( "", genGroup, LightApp_Preferences::Space );
+
+
int step = addPreference( tr( "PREF_STEP_VALUE" ), genGroup,
LightApp_Preferences::IntSpin, "Geometry", "SettingsGeomStep" );
@@ -1964,6 +1984,13 @@ void GeometryGUI::storeVisualParameters (int savePoint)
param = occParam + TRANSPARENCY_PROP;
ip->setParameter(entry, param, QString::number(aProps.value(TRANSPARENCY_PROP).toDouble()).toLatin1().data());
}
+
+ if(aProps.contains(TOP_LEVEL_PROP)) {
+ param = occParam + TOP_LEVEL_PROP;
+ Standard_Boolean val = aProps.value(TOP_LEVEL_PROP).value();
+ if (val == Standard_True)
+ ip->setParameter(entry, param, "1");
+ }
}
if(aProps.contains(ISOS_PROP)) {
@@ -2092,9 +2119,12 @@ void GeometryGUI::restoreVisualParameters (int savePoint)
} else if(paramNameStr == OPACITY_PROP) {
aListOfMap[viewIndex].insert(TRANSPARENCY_PROP, 1. - val.toDouble());
- } else if(paramNameStr == TRANSPARENCY_PROP) {
- aListOfMap[viewIndex].insert(TRANSPARENCY_PROP, val.toDouble());
+ } else if(paramNameStr == TRANSPARENCY_PROP) {
+ aListOfMap[viewIndex].insert( TRANSPARENCY_PROP, val.toDouble() );
+ } else if(paramNameStr == TOP_LEVEL_PROP) {
+ aListOfMap[viewIndex].insert( TRANSPARENCY_PROP, val == "1" ? Standard_True : Standard_False );
+
} else if(paramNameStr == DISPLAY_MODE_PROP) {
aListOfMap[viewIndex].insert( DISPLAY_MODE_PROP, val.toInt());
@@ -2179,6 +2209,15 @@ void GeometryGUI::onViewAboutToShow()
}
}
+/*!
+ \brief Return action by id
+ \param id identifier of the action
+ \return action
+*/
+QAction* GeometryGUI::getAction(const int id) {
+ return action(id);
+}
+
/*!
\brief Check if this object is can't be renamed in place
diff --git a/src/GEOMGUI/GeometryGUI.h b/src/GEOMGUI/GeometryGUI.h
index b584fd7e3..ccb81254b 100644
--- a/src/GEOMGUI/GeometryGUI.h
+++ b/src/GEOMGUI/GeometryGUI.h
@@ -56,6 +56,7 @@
class QDialog;
class QMenu;
+class QAction;
class GEOMGUI_OCCSelector;
class LightApp_VTKSelector;
class LightApp_Selection;
@@ -131,6 +132,8 @@ public:
virtual void storeVisualParameters (int savePoint);
virtual void restoreVisualParameters(int savePoint);
+ QAction* getAction(const int id);
+
public slots:
virtual bool deactivateModule( SUIT_Study* );
virtual bool activateModule( SUIT_Study* );
diff --git a/src/GEOMGUI/GeometryGUI_Operations.h b/src/GEOMGUI/GeometryGUI_Operations.h
index a4ad5eadf..c21e405e2 100644
--- a/src/GEOMGUI/GeometryGUI_Operations.h
+++ b/src/GEOMGUI/GeometryGUI_Operations.h
@@ -70,6 +70,8 @@ namespace GEOMOp {
OpShadingWithEdges = 2202, // POPUP MENU - DISPLAY MODE - SHADING WITH EDGES
OpVectors = 2203, // POPUP MENU - DISPLAY MODE - SHOW EDGE DIRECTION
OpTexture = 2204, // POPUP MENU - DISPLAY MODE - TEXTURE
+ OpBringToFront = 2205, // POPUP MENU - BRING TO FRONT
+ OpClsBringToFront = 2206,
// BasicGUI ------------------//--------------------------------
OpPoint = 3000, // MENU NEW ENTITY - BASIC - POINT
OpLine = 3001, // MENU NEW ENTITY - BASIC - LINE
diff --git a/src/GEOMToolsGUI/GEOMToolsGUI.cxx b/src/GEOMToolsGUI/GEOMToolsGUI.cxx
index 05259bf29..0234bd4bc 100644
--- a/src/GEOMToolsGUI/GEOMToolsGUI.cxx
+++ b/src/GEOMToolsGUI/GEOMToolsGUI.cxx
@@ -373,6 +373,12 @@ bool GEOMToolsGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent)
case GEOMOp::OpIsosWidth:
OnIsosWidth();
break;
+ case GEOMOp::OpBringToFront:
+ OnBringToFront();
+ break;
+ case GEOMOp::OpClsBringToFront:
+ OnClsBringToFront();
+ break;
default:
SUIT_Session::session()->activeApplication()->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
break;
diff --git a/src/GEOMToolsGUI/GEOMToolsGUI.h b/src/GEOMToolsGUI/GEOMToolsGUI.h
index 2141f0c97..e6b80f3cc 100644
--- a/src/GEOMToolsGUI/GEOMToolsGUI.h
+++ b/src/GEOMToolsGUI/GEOMToolsGUI.h
@@ -78,6 +78,8 @@ private:
void OnMaterialProperties();
void OnEdgeWidth();
void OnIsosWidth();
+ void OnBringToFront();
+ void OnClsBringToFront();
// Shortcut commands
void OnChangeTransparency( bool );
diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx b/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx
index 31b734b33..3a002dbfa 100644
--- a/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx
+++ b/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx
@@ -23,6 +23,8 @@
// File : GEOMToolsGUI_1.cxx
// Author : Sergey ANIKIN, Open CASCADE S.A.S. (sergey.anikin@opencascade.com)
+#define protected public
+
#include
#include "GEOMToolsGUI.h"
@@ -81,6 +83,9 @@
#include
#include
#include
+#include
+#include
+
#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1
#include
@@ -89,6 +94,7 @@
#endif
// QT Includes
+#include
#include
#include
#include
@@ -103,7 +109,6 @@
// VTK includes
#include
-
void GEOMToolsGUI::OnCheckGeometry()
{
SalomeApp_Application* app =
@@ -296,13 +301,17 @@ void GEOMToolsGUI::OnColor()
}
} // if ( isVTK )
else if ( isOCC ) {
- Handle(AIS_InteractiveObject) io = GEOMBase::GetAIS( selected.First() );
+ Handle(AIS_InteractiveObject) io = GEOMBase::GetAIS( selected.First() );
if ( !io.IsNull() ) {
Quantity_Color aColor;
- io->Color( aColor );
- QColor initcolor ((int)( aColor.Red() * 255.0 ),
- (int)( aColor.Green() * 255.0 ),
- (int)( aColor.Blue() * 255.0 ));
+ io->Color( aColor );
+ QColor ic = QColor((int )( aColor.Red() * 255.0 ),
+ (int)( aColor.Green() * 255.0 ),
+ (int)( aColor.Blue() * 255.0 ));
+
+ QVariant v = appStudy->getObjectProperty(mgrId,selected.First()->getEntry(), COLOR_PROP, ic);
+
+ QColor initcolor = v.value();
QColor c = QColorDialog::getColor( initcolor, app->desktop() );
if ( c.isValid() ) {
SUIT_OverrideCursor();
@@ -343,16 +352,16 @@ void GEOMToolsGUI::OnColor()
ic->SetLocalAttributes(io, aCurDrawer, Standard_False);
}
}
-
+
io->SetColor( aColor );
if ( io->IsKind( STANDARD_TYPE(GEOM_AISShape) ) ) {
Handle(GEOM_AISShape) aGAISShape = Handle(GEOM_AISShape)::DownCast( io );
aGAISShape->SetShadingColor( aColor );
aGAISShape->storeBoundaryColors();
}
-
+
appStudy->setObjectProperty(mgrId,It.Value()->getEntry(), COLOR_PROP, c);
-
+
io->Redisplay( Standard_True );
// store color to GEOM_Object
@@ -367,7 +376,7 @@ void GEOMToolsGUI::OnColor()
aSColor.G = (double)c.green() / 255.0;
aSColor.B = (double)c.blue() / 255.0;
anObject->SetColor( aSColor );
- anObject->SetAutoColor( false );
+ anObject->SetAutoColor( false );
}
} // for
ic->UpdateCurrentViewer();
@@ -406,8 +415,8 @@ void GEOMToolsGUI::OnTexture()
io = GEOMBase::GetAIS( It.Value(), true );
if ( !io.IsNull() ) {
if ( io->IsKind( STANDARD_TYPE(GEOM_AISShape) ) )
- Handle(GEOM_AISShape)::DownCast( io )->SetTextureFileName(TCollection_AsciiString(aTexture.toStdString().c_str()));
- io->Redisplay( Standard_True );
+ Handle(GEOM_AISShape)::DownCast( io )->SetTextureFileName(TCollection_AsciiString(aTexture.toStdString().c_str()));
+ io->Redisplay( Standard_True );
} // if ( !io.IsNull() )
} // for
ic->UpdateCurrentViewer();
@@ -570,7 +579,7 @@ void GEOMToolsGUI::OnNbIsos( ActionType actionType )
Handle(AIS_Drawer) CurDrawer = CurObject->Attributes();
QVariant v = aStudy->getObjectProperty( aMgrId, CurObject->getIO()->getEntry(), EDGE_WIDTH_PROP , QVariant() );
-
+
int width = v.isValid() ? v.toInt() : 1;
CurDrawer->SetUIsoAspect( new Prs3d_IsoAspect(Quantity_NOC_GRAY75, Aspect_TOL_SOLID, width , newNbUIso) );
@@ -1187,3 +1196,112 @@ void GEOMToolsGUI::OnIsosWidth() {
GeometryGUI::Modified();
} // end vtkviewer
}
+
+void GEOMToolsGUI::OnBringToFront() {
+ SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
+ if ( !app )
+ return;
+
+ SalomeApp_Module* mod = dynamic_cast(app->activeModule());
+ if(!mod)
+ return;
+
+ GEOM_Displayer* disp = dynamic_cast(mod->displayer());
+
+ if(!disp)
+ return;
+
+ LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
+ if ( !aSelMgr )
+ return;
+
+ SALOME_ListIO selected;
+ aSelMgr->selectedObjects( selected );
+ if ( selected.IsEmpty() )
+ return;
+
+ SalomeApp_Study* appStudy = dynamic_cast(app->activeStudy());
+ if(!appStudy)
+ return;
+
+ SUIT_ViewWindow* window = app->desktop()->activeWindow();
+
+ OCCViewer_Viewer* vm = dynamic_cast( window->getViewManager()->getViewModel() );
+ if ( !vm )
+ return;
+
+ bool isOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() );
+
+ QAction* a = getGeometryGUI()->action( GEOMOp::OpBringToFront );
+ bool checked = a->isChecked();
+
+ if ( isOCC ) {
+ GEOMBase* gb = new GEOMBase();
+ Handle(GEOM_AISShape) aisShape;
+
+ Handle(AIS_InteractiveContext) ic = vm->getAISContext();
+ SALOME_ListIO anIOlst;
+ for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
+ aisShape = gb->ConvertIOinGEOMAISShape( It.Value(), true );
+ if ( !aisShape.IsNull() ) {
+ aisShape->setTopLevel(checked);
+ int aMgrId = window->getViewManager()->getGlobalId();
+ appStudy->setObjectProperty( aMgrId, aisShape->getIO()->getEntry(), TOP_LEVEL_PROP, checked );
+ anIOlst.Append(aisShape->getIO());
+ }
+ } // for...
+ disp->Redisplay(anIOlst);
+ GeometryGUI::Modified();
+ } // if ( isOCC )
+}
+
+void GEOMToolsGUI::OnClsBringToFront() {
+ SalomeApp_Application* app =
+ dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
+ if(!app)
+ return;
+
+ SalomeApp_Module* mod = dynamic_cast(app->activeModule());
+ if(!mod)
+ return;
+
+ GEOM_Displayer* disp = dynamic_cast(mod->displayer());
+
+ if(!disp)
+ return;
+
+
+ SalomeApp_Study* appStudy = dynamic_cast(app->activeStudy());
+ if(!appStudy)
+ return;
+
+ SUIT_ViewWindow* window = app->desktop()->activeWindow();
+
+ bool isOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() );
+
+ if(isOCC){ // if is OCCViewer
+
+ OCCViewer_Viewer* vm = dynamic_cast( window->getViewManager()->getViewModel() );
+ Handle (AIS_InteractiveContext) ic = vm->getAISContext();
+
+ SALOME_ListIO anIOlst;
+ AIS_ListOfInteractive aList;
+ ic->DisplayedObjects( aList );
+ for ( AIS_ListIteratorOfListOfInteractive it( aList ); it.More(); it.Next() ) {
+
+ Handle(GEOM_AISShape) CurObject = Handle(GEOM_AISShape)::DownCast(it.Value());
+
+ if(CurObject.IsNull())
+ continue;
+
+ CurObject->setTopLevel(Standard_False);
+
+ int aMgrId = window->getViewManager()->getGlobalId();
+ appStudy->setObjectProperty( aMgrId, QString(CurObject->getIO()->getEntry()), TOP_LEVEL_PROP, Standard_False );
+ anIOlst.Append(CurObject->getIO());
+ }
+ disp->Redisplay(anIOlst);
+ GeometryGUI::Modified();
+ }
+}
+
diff --git a/src/OBJECT/GEOM_AISShape.cxx b/src/OBJECT/GEOM_AISShape.cxx
index 9313c6ee7..81a6dbe1c 100644
--- a/src/OBJECT/GEOM_AISShape.cxx
+++ b/src/OBJECT/GEOM_AISShape.cxx
@@ -72,6 +72,11 @@
#include
#include
+#include
+
+#include
+#include
+
static void getEntityOwners( const Handle(AIS_InteractiveObject)& theObj,
const Handle(AIS_InteractiveContext)& theIC,
@@ -139,6 +144,8 @@ GEOM_AISShape::GEOM_AISShape(const TopoDS_Shape& shape,
myUIsoNumber = -1;
myVIsoNumber = -1;
+
+ myTopLevel = Standard_False;
}
void GEOM_AISShape::setIO(const Handle(SALOME_InteractiveObject)& io){
@@ -174,17 +181,30 @@ void GEOM_AISShape::Compute(const Handle(PrsMgr_PresentationManager3d)& aPresent
const Standard_Integer aMode)
{
if (IsInfinite()) aPrs->SetInfiniteState(Standard_True); //pas de prise en compte lors du FITALL
+
+ Handle(AIS_InteractiveContext) anIC = GetContext();
-// StdSelect_DisplayMode d = (StdSelect_DisplayMode) aMode;
+ // StdSelect_DisplayMode d = (StdSelect_DisplayMode) aMode;
switch (aMode) {
case 0://StdSelect_DM_Wireframe:
{
+
restoreIsoNumbers();
// Restore wireframe edges colors
restoreBoundaryColors();
+
+ if(isTopLevel()) {
+ SetColor(topLevelColor());
+
+ Handle(Prs3d_LineAspect) anAspect = Attributes()->WireAspect();
+ anAspect->SetColor( topLevelColor() );
+ Attributes()->SetWireAspect( anAspect );
+ }
+
StdPrs_WFDeflectionShape::Add(aPrs,myshape,myDrawer);
+
break;
}
case 1://StdSelect_DM_Shading:
@@ -200,7 +220,10 @@ void GEOM_AISShape::Compute(const Handle(PrsMgr_PresentationManager3d)& aPresent
}
case 3: //StdSelect_DM_HLR:
{
- AIS_TexturedShape::Compute(aPresentationManager, aPrs, aMode);
+ if(!isTopLevel())
+ AIS_TexturedShape::Compute(aPresentationManager, aPrs, aMode);
+ else
+ shadingMode(aPresentationManager, aPrs, AIS_Shaded);
break;
}
}
@@ -373,7 +396,7 @@ void GEOM_AISShape::shadingMode(const Handle(PrsMgr_PresentationManager3d)& aPre
// P->SetPrimitivesAspect(a4bis);
// G->SetGroupPrimitivesAspect(a4bis);
//a4bis->SetInteriorColor(myShadingColor);
- myDrawer->ShadingAspect()->SetColor(myShadingColor);
+ myDrawer->ShadingAspect()->SetColor(isTopLevel() ? topLevelColor() : myShadingColor);
// PAL12113: AIS_Shape::Compute() works correctly with shapes containing no faces
//StdPrs_ShadedShape::Add(aPrs,myshape,myDrawer);
@@ -433,3 +456,19 @@ void GEOM_AISShape::restoreBoundaryColors()
anAspect->SetColor( myUnFreeBoundaryColor );
myDrawer->SetUnFreeBoundaryAspect( anAspect );
}
+
+
+Standard_Boolean GEOM_AISShape::isTopLevel() {
+ return myTopLevel;
+}
+
+void GEOM_AISShape::setTopLevel(Standard_Boolean f) {
+ myTopLevel = f;
+}
+
+Quantity_Color GEOM_AISShape::topLevelColor() {
+ SUIT_Session* session = SUIT_Session::session();
+ SUIT_ResourceMgr* resMgr = session->resourceMgr();
+ QColor c = resMgr->colorValue( "Geometry", "toplevel_color", QColor( 170, 85, 0 ) );
+ return SalomeApp_Tools::color(c);
+}
diff --git a/src/OBJECT/GEOM_AISShape.hxx b/src/OBJECT/GEOM_AISShape.hxx
index 387b3ef37..21e1c5a7e 100644
--- a/src/OBJECT/GEOM_AISShape.hxx
+++ b/src/OBJECT/GEOM_AISShape.hxx
@@ -99,6 +99,8 @@ public:
void setIO(const Handle(SALOME_InteractiveObject)& name) ;
void setName(const Standard_CString aName) ;
Standard_CString getName() ;
+ Standard_Boolean isTopLevel();
+ void setTopLevel(Standard_Boolean);
Handle_SALOME_InteractiveObject getIO() ;
void highlightSubShapes(const TColStd_IndexedMapOfInteger& aIndexMap, const Standard_Boolean aHighlight );
~GEOM_AISShape();
@@ -126,6 +128,8 @@ public:
void storeBoundaryColors();
+ static Quantity_Color topLevelColor();
+
protected:
void shadingMode(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,
const Handle(Prs3d_Presentation)& aPrs,
@@ -146,6 +150,7 @@ protected:
private:
TCollection_AsciiString myName;
bool myDisplayVectors;
+ Standard_Boolean myTopLevel;
};
diff --git a/src/OBJECT/GEOM_Actor.cxx b/src/OBJECT/GEOM_Actor.cxx
index 9b956bf68..bc9c5c9f1 100644
--- a/src/OBJECT/GEOM_Actor.cxx
+++ b/src/OBJECT/GEOM_Actor.cxx
@@ -1012,7 +1012,7 @@ void GEOM_Actor::SetIsosWidth(const int width) {
}
int GEOM_Actor::GetIsosWidth() const {
- return myWireframeFaceActor->GetProperty()->GetLineWidth();
+ return (int)myWireframeFaceActor->GetProperty()->GetLineWidth();
}
void GEOM_Actor::SetWidth(const int width) {
@@ -1025,7 +1025,7 @@ void GEOM_Actor::SetWidth(const int width) {
}
int GEOM_Actor::GetWidth() const {
- return myIsolatedEdgeActor->GetProperty()->GetLineWidth();
+ return (int)myIsolatedEdgeActor->GetProperty()->GetLineWidth();
}
void GEOM_Actor::RestoreIsoNumbers()
diff --git a/src/OBJECT/GEOM_Constants.h b/src/OBJECT/GEOM_Constants.h
index 655dfc125..de4adb9c8 100644
--- a/src/OBJECT/GEOM_Constants.h
+++ b/src/OBJECT/GEOM_Constants.h
@@ -46,6 +46,7 @@
#define FRONT_MATERIAL_PROP "FrontMaterial" //Object front material property
#define BACK_MATERIAL_PROP "BackMaterial" //Object back material property
#define EDGE_WIDTH_PROP "EdgeWidth" //Width of the edge
-#define ISOS_WIDTH_PROP "IsosWidth" //Width of the iso-lines
+#define ISOS_WIDTH_PROP "IsosWidth" //Width of the iso-lines
+#define TOP_LEVEL_PROP "TopLevelFlag" //Top level flag
#endif //GEOM_CONSTANTS_H