erasePreview();
if ( hasCommand() )
abortCommand();
-
- globalSelection( GEOM_ALLOBJECTS, true );
-
+ SalomeApp_Application* app = (SalomeApp_Application*)(SUIT_Session::session()->activeApplication());
+ if (app) {
+ GeometryGUI* aGeomGUI = dynamic_cast<GeometryGUI*>( app->module( "Geometry" ) );
+ if(aGeomGUI)
+ globalSelection(aGeomGUI->getLocalSelectionMode() , true );
+ }
+
if (myDisplayer)
delete myDisplayer;
}
#include "GEOM_Displayer.h"
#include <LightApp_DataOwner.h>
+#include <SalomeApp_Application.h>
#include <SalomeApp_Study.h>
#include <OCCViewer_ViewModel.h>
QtxValue GEOMGUI_Selection::globalParam( const QString& p ) const
{
if ( p == "isOCC" ) return QtxValue( activeViewType() == OCCViewer_Viewer::Type() );
-
+ if ( p == "selectionmode" ){
+ return QtxValue(selectionMode());
+ }
return LightApp_Selection::globalParam( p );
}
}
return GEOM::GEOM_Object::_nil();
}
+
+QString GEOMGUI_Selection:: selectionMode() const
+{
+ SalomeApp_Application* app = (SalomeApp_Application*)(SUIT_Session::session()->activeApplication());
+ if (app) {
+ GeometryGUI* aGeomGUI = dynamic_cast<GeometryGUI*>( app->module( "Geometry" ) );
+ if(aGeomGUI)
+ switch(aGeomGUI->getLocalSelectionMode())
+ {
+ case GEOM_POINT : return "VERTEX";
+ case GEOM_EDGE : return "EDGE";
+ case GEOM_WIRE : return "WIRE";
+ case GEOM_FACE : return "FACE";
+ case GEOM_SHELL : return "SHELL";
+ case GEOM_SOLID : return "SOLID";
+ case GEOM_COMPOUND : return "COMPOUND";
+ case GEOM_ALLOBJECTS : return "ALL";
+ default: return "";
+ }
+ }
+}
bool isVisible( const int ) const;
QString typeName( const int ) const;
QString displayMode( const int ) const;
+ QString selectionMode() const;
bool isComponent( const int ) const;
GEOM::GEOM_Object_ptr getObject( const int ) const;
msgid "ICO_POP_CREATE_GROUP"
msgstr "group_new.png"
+
+msgid "ICO_VERTEX_SEL_ONLY"
+msgstr "point2.png"
+
+msgid "ICO_EDGE_SEL_ONLY"
+msgstr "build_edge.png"
+
+msgid "ICO_WIRE_SEL_ONLY"
+msgstr "build_wire.png"
+
+msgid "ICO_FACE_SEL_ONLY"
+msgstr "build_face.png"
+
+msgid "ICO_SHELL_SEL_ONLY"
+msgstr "build_shell.png"
+
+msgid "ICO_SOLID_SEL_ONLY"
+msgstr "build_solid.png"
+
+msgid "ICO_COMPOUND_SEL_ONLY"
+msgstr "build_compound.png"
\ No newline at end of file
msgid "DEP_OBJECT"
msgstr "Selected object has been used to create another one\n It can't be deleted "
+
+msgid "MEN_SELECT_ONLY"
+msgstr "Select Only"
+
+msgid "STB_VERTEX_SEL_ONLY"
+msgstr "Select only a Points"
+
+msgid "STB_EDGE_SEL_ONLY"
+msgstr "Select only a Edges"
+
+msgid "STB_WIRE_SEL_ONLY"
+msgstr "Select only a Wires"
+
+msgid "STB_FACE_SEL_ONLY"
+msgstr "Select only a Faces"
+
+msgid "STB_SHELL_SEL_ONLY"
+msgstr "Select only a Shells"
+
+msgid "STB_SOLID_SEL_ONLY"
+msgstr "Select only a Solids"
+
+msgid "STB_COMPOUND_SEL_ONLY"
+msgstr "Select only a Compounds"
+
+msgid "STB_ALL_SEL_ONLY"
+msgstr "Select all Objects"
+
+msgid "MEN_VERTEX_SEL_ONLY"
+msgstr "Vertex"
+
+msgid "MEN_EDGE_SEL_ONLY"
+msgstr "Edge"
+
+msgid "MEN_WIRE_SEL_ONLY"
+msgstr "Wire"
+
+msgid "MEN_FACE_SEL_ONLY"
+msgstr "Face"
+
+msgid "MEN_SHELL_SEL_ONLY"
+msgstr "Shell"
+
+msgid "MEN_SOLID_SEL_ONLY"
+msgstr "Solid"
+
+msgid "MEN_COMPOUND_SEL_ONLY"
+msgstr "Compound"
+
+msgid "MEN_ALL_SEL_ONLY"
+msgstr "Select All"
myVTKSelectors.setAutoDelete( true );
myDisplayer = 0;
+ myLocalSelectionMode = GEOM_ALLOBJECTS;
}
//=======================================================================
id == 121 || // MENU FILE - EXPORT BREP
id == 122 || // MENU FILE - EXPORT IGES
id == 123 || // MENU FILE - EXPORT STEP
+ id == 2171 || // POPUP VIEWER - SELECT ONLY - VERTEX
+ id == 2172 || // POPUP VIEWER - SELECT ONLY - EDGE
+ id == 2173 || // POPUP VIEWER - SELECT ONLY - WIRE
+ id == 2174 || // POPUP VIEWER - SELECT ONLY - FACE
+ id == 2175 || // POPUP VIEWER - SELECT ONLY - SHELL
+ id == 2176 || // POPUP VIEWER - SELECT ONLY - SOLID
+ id == 2177 || // POPUP VIEWER - SELECT ONLY - COMPOUND
+ id == 2178 || // POPUP VIEWER - SELECT ONLY - SELECT ALL
id == 31 || // MENU EDIT - COPY
id == 33 || // MENU EDIT - DELETE
id == 411 || // MENU SETTINGS - ADD IN STUDY
createGeomAction( 212, "DISPLAY_ALL" );
createGeomAction( 214, "ERASE_ALL" );
createGeomAction( 216, "DISPLAY" );
+ createGeomAction( 2171, "VERTEX_SEL_ONLY" ,"", 0, true );
+ createGeomAction( 2172, "EDGE_SEL_ONLY", "", 0, true );
+ createGeomAction( 2173, "WIRE_SEL_ONLY", "", 0, true );
+ createGeomAction( 2174, "FACE_SEL_ONLY", "", 0, true );
+ createGeomAction( 2175, "SHELL_SEL_ONLY", "", 0, true );
+ createGeomAction( 2176, "SOLID_SEL_ONLY", "", 0, true );
+ createGeomAction( 2177, "COMPOUND_SEL_ONLY", "", 0, true );
+ createGeomAction( 2178, "ALL_SEL_ONLY", "", 0, true );
createGeomAction( 213, "DISPLAY_ONLY" );
createGeomAction( 215, "ERASE" );
mgr->insert( action( 214 ), -1, -1 ); // erase All
mgr->setRule( action( 214 ), clientOCCorVTK, true );
+ QString selectOnly = "(client='OCCViewer' or client='VTKViewer') and (selcount=0)";
+
+ int selectolnyId = mgr->insert( tr("MEN_SELECT_ONLY"), -1, -1); //select only menu
+ mgr->insert( action(2171), selectolnyId, -1); //Vertex
+ mgr->setRule(action(2171), selectOnly, true);
+ mgr->setRule(action(2171), selectOnly + " and selectionmode='VERTEX'", false);
+ mgr->insert( action(2172), selectolnyId, -1); //Edge
+ mgr->setRule(action(2172), selectOnly, true);
+ mgr->setRule(action(2172), selectOnly + " and selectionmode='EDGE'", false);
+ mgr->insert( action(2173), selectolnyId, -1); //Wire
+ mgr->setRule(action(2173), selectOnly, true);
+ mgr->setRule(action(2173), selectOnly + " and selectionmode='WIRE'", false);
+ mgr->insert( action(2174), selectolnyId, -1); //Face
+ mgr->setRule(action(2174), selectOnly, true);
+ mgr->setRule(action(2174), selectOnly + " and selectionmode='FACE'", false);
+ mgr->insert( action(2175), selectolnyId, -1); //Shell
+ mgr->setRule(action(2175), selectOnly, true);
+ mgr->setRule(action(2175), selectOnly + " and selectionmode='SHELL'", false);
+ mgr->insert( action(2176), selectolnyId, -1); //Solid
+ mgr->setRule(action(2176), selectOnly, true);
+ mgr->setRule(action(2176), selectOnly + " and selectionmode='SOLID'", false);
+ mgr->insert( action(2177), selectolnyId, -1); //Compound
+ mgr->setRule(action(2177), selectOnly, true);
+ mgr->setRule(action(2177), selectOnly + " and selectionmode='COMPOUND'", false);
+ mgr->insert( separator(), selectolnyId, -1);
+ mgr->insert( action(2178), selectolnyId, -1); //Clear selection filter
+ mgr->setRule(action(2178), selectOnly, true);
+ mgr->setRule(action(2178), selectOnly + " and selectionmode='ALL'", false);
+
mgr->insert( action( 213 ), -1, -1 ); // display only
mgr->setRule( action( 213 ), rule.arg( types ).arg( "true" ), true );
mgr->insert( separator(), -1, -1 );
myDisplayer = new GEOM_Displayer( dynamic_cast<SalomeApp_Study*>( getApp()->activeStudy() ) );
return myDisplayer;
}
+
+void GeometryGUI::setLocalSelectionMode(const int mode)
+{
+ myLocalSelectionMode = mode;
+}
+int GeometryGUI::getLocalSelectionMode() const
+{
+ return myLocalSelectionMode;
+}
virtual void contextMenuPopup( const QString&, QPopupMenu*, QString& );
virtual void createPreferences();
virtual void preferencesChanged( const QString&, const QString& );
-
+ int getLocalSelectionMode() const;
+ void setLocalSelectionMode(const int mode);
public slots:
virtual bool deactivateModule( SUIT_Study* );
QPtrList<LightApp_VTKSelector> myVTKSelectors;
LightApp_Displayer* myDisplayer;
+ int myLocalSelectionMode; //Select Only
friend class DisplayGUI;
};
#include <SalomeApp_Application.h>
#include <SalomeApp_Study.h>
#include <LightApp_SelectionMgr.h>
+#include <GEOMImpl_Types.hxx>
#include <SALOME_ListIteratorOfListIO.hxx>
#include <SALOME_Prs.h>
Export();
break;
}
+ case 2171: // POPUP VIEWER - SELECT ONLY - VERTEX
+ {
+ OnSelectOnly( GEOM_POINT );
+ break;
+ }
+ case 2172: // POPUP VIEWER - SELECT ONLY - EDGE
+ {
+ OnSelectOnly( GEOM_EDGE );
+ break;
+ }
+ case 2173: // POPUP VIEWER - SELECT ONLY - WIRE
+ {
+ OnSelectOnly( GEOM_WIRE );
+ break;
+ }
+ case 2174: // POPUP VIEWER - SELECT ONLY - FACE
+ {
+ OnSelectOnly( GEOM_FACE );
+ break;
+ }
+ case 2175: // POPUP VIEWER - SELECT ONLY - SHELL
+ {
+ OnSelectOnly( GEOM_SHELL );
+ break;
+ }
+ case 2176: // POPUP VIEWER - SELECT ONLY - SOLID
+ {
+ OnSelectOnly( GEOM_SOLID );
+ break;
+ }
+ case 2177: // POPUP VIEWER - SELECT ONLY - COMPOUND
+ {
+ OnSelectOnly( GEOM_COMPOUND );
+ break;
+ }
+ case 2178: // POPUP VIEWER - SELECT ONLY - SELECT ALL
+ {
+ OnSelectOnly( GEOM_ALLOBJECTS );
+ break;
+ }
case 411: // SETTINGS - ADD IN STUDY
{
// SAN -- TO BE REMOVED !!!
return false;
}
+//=================================================================================
+// function : deactivate()
+// purpose : Called when GEOM component is deactivated
+//=================================================================================
+void GEOMToolsGUI::deactivate()
+{
+ SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
+ if ( app ) {
+ SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
+ GEOM_Displayer aDisp (appStudy);
+ aDisp.GlobalSelection();
+ getGeometryGUI()->setLocalSelectionMode(GEOM_ALLOBJECTS);
+ }
+}
+
//=====================================================================================
// EXPORTED METHODS
//=====================================================================================
~GEOMToolsGUI();
bool OnGUIEvent( int theCommandID, SUIT_Desktop* parent );
+ virtual void deactivate();
private:
// Import and export topology methods
void OnTransparency();
void OnNbIsos();
void OnOpen();
-
+ void OnSelectOnly(int mode);
+
// returns name of Module (Component) of given objects (usually selected objects)
// if objects belong to different Components, a NULL string is returned.
QString getParentComponent( _PTR( Study ), const SALOME_ListIO& );
}
*/
}
+
+void GEOMToolsGUI::OnSelectOnly(int mode)
+{
+ SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
+ if ( app ) {
+ SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
+ GEOM_Displayer aDisp (appStudy);
+ aDisp.GlobalSelection(mode);
+ getGeometryGUI()->setLocalSelectionMode(mode);
+ }
+}