// Author : Sergey LITONIN
// Module : SALOME
-#include "SMESHGUI_Operation.h"
+#include <SMESHGUI_Operation.h>
+#include <SMESHGUI.h>
+#include <SMESHGUI_VTKUtils.h>
+
+#include <SVTK_ViewWindow.h>
+#include <SVTK_Selector.h>
/*
// name : SMESHGUI_Operation
// Purpose : Constructor
//=======================================================================
-SMESHGUI_Operation::SMESHGUI_Operation( SalomeApp_Application* theApp )
-: SalomeApp_Operation( theApp )
+SMESHGUI_Operation::SMESHGUI_Operation( SalomeApp_Application* app )
+: SalomeApp_Operation( app ),
+ myViewWindow( 0 ),
+ mySelector( 0 )
{
}
}
+void SMESHGUI_Operation::setSelectionMode( const Selection_Mode mode )
+{
+ if( myViewWindow )
+ myViewWindow->SetSelectionMode( mode );
+}
+
+void SMESHGUI_Operation::highlight( const Handle( SALOME_InteractiveObject )& obj,
+ const bool hilight, const bool immediately )
+{
+ if( myViewWindow )
+ myViewWindow->highlight( obj, hilight, immediately );
+}
+void SMESHGUI_Operation::addOrRemoveIndex( const Handle( SALOME_InteractiveObject )& obj,
+ const TColStd_MapOfInteger& indices, const bool isModeShift )
+{
+ if( mySelector )
+ mySelector->AddOrRemoveIndex( obj, indices, isModeShift );
+}
+SMESHGUI* SMESHGUI_Operation::getSMESHGUI() const
+{
+ return dynamic_cast<SMESHGUI*>( module() );
+}
+
+SVTK_ViewWindow* SMESHGUI_Operation::getViewWindow() const
+{
+ return myViewWindow;
+}
+
+SVTK_Selector* SMESHGUI_Operation::getSelector() const
+{
+ return mySelector;
+}
+
+void SMESHGUI_Operation::startOperation()
+{
+ SalomeApp_Operation::startOperation();
+ myViewWindow = SMESH::GetViewWindow( getSMESHGUI() );
+ mySelector = myViewWindow ? myViewWindow->GetSelector() : 0;
+}
#define SMESHGUI_Operation_H
#include <SalomeApp_Operation.h>
+#include <SALOME_InteractiveObject.hxx>
+#include <SVTK_Selection.h>
+
+class SMESHGUI;
+class SVTK_ViewWindow;
+class SVTK_Selector;
+class TColStd_MapOfInteger;
+
/*
Class : SMESHGUI_Operation
Q_OBJECT
public:
-
SMESHGUI_Operation( SalomeApp_Application* );
virtual ~SMESHGUI_Operation();
+protected:
+ void setSelectionMode( const Selection_Mode );
+ void highlight( const Handle( SALOME_InteractiveObject )&, const bool, const bool = true );
+ void addOrRemoveIndex( const Handle( SALOME_InteractiveObject )&, const TColStd_MapOfInteger&, const bool );
+
+ virtual void startOperation();
+
+ SMESHGUI* getSMESHGUI() const;
+ SVTK_ViewWindow* getViewWindow() const;
+ SVTK_Selector* getSelector() const;
+
+private:
+ SVTK_ViewWindow* myViewWindow;
+ SVTK_Selector* mySelector;
};
#endif