mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-28 18:30:35 +05:00
Activate or create a new VTK viewer for Mesh automatic update after computation. Following curtomer remarks.
This commit is contained in:
parent
6907542f95
commit
1a264e7061
@ -17,7 +17,7 @@
|
|||||||
// License along with this library; if not, write to the Free Software
|
// License along with this library; if not, write to the Free Software
|
||||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
//
|
//
|
||||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
//
|
//
|
||||||
// File : SMESHGUI.cxx
|
// File : SMESHGUI.cxx
|
||||||
// Author : Nicolas REJNERI
|
// Author : Nicolas REJNERI
|
||||||
@ -307,7 +307,7 @@ using namespace std;
|
|||||||
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
|
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
|
||||||
if ( resMgr )
|
if ( resMgr )
|
||||||
toCreateGroups = resMgr->booleanValue( "SMESH", "auto_groups", false );
|
toCreateGroups = resMgr->booleanValue( "SMESH", "auto_groups", false );
|
||||||
|
|
||||||
if ( theCommandID != 122 && theCommandID != 125 )
|
if ( theCommandID != 122 && theCommandID != 125 )
|
||||||
aFilename = SUIT_FileDlg::getFileName(SMESHGUI::desktop(), "", aFilter, aTitle, false);
|
aFilename = SUIT_FileDlg::getFileName(SMESHGUI::desktop(), "", aFilter, aTitle, false);
|
||||||
else {
|
else {
|
||||||
@ -855,7 +855,7 @@ SMESH::SMESH_Gen_var SMESHGUI::myComponentSMESH = SMESH::SMESH_Gen::_nil();
|
|||||||
//=============================================================================
|
//=============================================================================
|
||||||
SMESHGUI::SMESHGUI() :
|
SMESHGUI::SMESHGUI() :
|
||||||
SalomeApp_Module( "SMESH" )
|
SalomeApp_Module( "SMESH" )
|
||||||
{
|
{
|
||||||
if ( CORBA::is_nil( myComponentSMESH ) )
|
if ( CORBA::is_nil( myComponentSMESH ) )
|
||||||
{
|
{
|
||||||
CORBA::Boolean anIsEmbeddedMode;
|
CORBA::Boolean anIsEmbeddedMode;
|
||||||
@ -1239,9 +1239,9 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// PAL13338 -->
|
// PAL13338 -->
|
||||||
if ( ( theCommandID==301 || theCommandID==302 ) && !checkLock(aStudy) && !automaticUpdate() )
|
if ( ( theCommandID==301 || theCommandID==302 ) && !checkLock(aStudy) && !automaticUpdate() )
|
||||||
SMESH::UpdateView();
|
SMESH::UpdateView();
|
||||||
// PAL13338 <--
|
// PAL13338 <--
|
||||||
|
|
||||||
@ -1299,93 +1299,86 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
|||||||
|
|
||||||
case 701: // COMPUTE MESH
|
case 701: // COMPUTE MESH
|
||||||
{
|
{
|
||||||
if(checkLock(aStudy)) break;
|
if (checkLock(aStudy)) break;
|
||||||
|
|
||||||
LightApp_SelectionMgr *Sel = selectionMgr();
|
LightApp_SelectionMgr *Sel = selectionMgr();
|
||||||
SALOME_ListIO selected; Sel->selectedObjects( selected );
|
SALOME_ListIO selected; Sel->selectedObjects( selected );
|
||||||
|
|
||||||
if ( vtkwnd ) {
|
int nbSel = selected.Extent();
|
||||||
int nbSel = selected.Extent();
|
if (nbSel != 1) {
|
||||||
if (nbSel != 1){
|
SUIT_MessageBox::warn1(desktop(),
|
||||||
SUIT_MessageBox::warn1(desktop(),
|
tr("SMESH_WRN_WARNING"),
|
||||||
tr("SMESH_WRN_WARNING"),
|
tr("SMESH_WRN_NO_AVAILABLE_DATA"),
|
||||||
tr("SMESH_WRN_NO_AVAILABLE_DATA"),
|
tr("SMESH_BUT_OK"));
|
||||||
tr("SMESH_BUT_OK"));
|
break;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
SMESH::SMESH_Mesh_var aMesh;
|
SMESH::SMESH_Mesh_var aMesh;
|
||||||
SMESH::SMESH_subMesh_var aSubMesh;
|
SMESH::SMESH_subMesh_var aSubMesh;
|
||||||
Handle(SALOME_InteractiveObject) IObject = selected.First();
|
Handle(SALOME_InteractiveObject) IObject = selected.First();
|
||||||
if (IObject->hasEntry()) {
|
if (IObject->hasEntry()) {
|
||||||
_PTR(SObject) aMeshSObj = aStudy->FindObjectID(IObject->getEntry());
|
_PTR(SObject) aMeshSObj = aStudy->FindObjectID(IObject->getEntry());
|
||||||
GEOM::GEOM_Object_var aShapeObject = SMESH::GetShapeOnMeshOrSubMesh( aMeshSObj );
|
GEOM::GEOM_Object_var aShapeObject = SMESH::GetShapeOnMeshOrSubMesh( aMeshSObj );
|
||||||
if ( aShapeObject->_is_nil() ) {
|
if ( aShapeObject->_is_nil() ) {
|
||||||
// imported mesh
|
// imported mesh
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if( aMeshSObj ) {
|
if ( aMeshSObj ) {
|
||||||
aMesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>(aMeshSObj);
|
aMesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>(aMeshSObj);
|
||||||
aSubMesh = SMESH::SObjectToInterface<SMESH::SMESH_subMesh>(aMeshSObj);
|
aSubMesh = SMESH::SObjectToInterface<SMESH::SMESH_subMesh>(aMeshSObj);
|
||||||
if ( !aSubMesh->_is_nil() )
|
if ( !aSubMesh->_is_nil() )
|
||||||
aMesh = aSubMesh->GetFather();
|
aMesh = aSubMesh->GetFather();
|
||||||
|
|
||||||
if (!aMesh->_is_nil()) {
|
if (!aMesh->_is_nil()) {
|
||||||
// if(!GetSMESHGen()->IsReadyToCompute(aMesh,aShapeObject)) {
|
SMESH::algo_error_array_var errors = GetSMESHGen()->GetAlgoState(aMesh,aShapeObject);
|
||||||
// SUIT_MessageBox::warn1(desktop(),
|
if ( errors->length() > 0 ) {
|
||||||
// tr("SMESH_WRN_WARNING"),
|
SUIT_MessageBox::warn1(desktop(),
|
||||||
// tr("SMESH_WRN_MISSING_PARAMETERS"),
|
tr("SMESH_WRN_WARNING"),
|
||||||
// tr("SMESH_BUT_OK"));
|
SMESH::GetMessageOnAlgoStateErrors( errors.in() ),
|
||||||
// break;
|
tr("SMESH_BUT_OK"));
|
||||||
// }
|
break;
|
||||||
SMESH::algo_error_array_var errors = GetSMESHGen()->GetAlgoState(aMesh,aShapeObject);
|
}
|
||||||
if ( errors->length() > 0 ) {
|
|
||||||
|
try {
|
||||||
|
if (GetSMESHGen()->Compute(aMesh, aShapeObject))
|
||||||
|
SMESH::ModifiedMesh(aMeshSObj, true);
|
||||||
|
else
|
||||||
SUIT_MessageBox::warn1(desktop(),
|
SUIT_MessageBox::warn1(desktop(),
|
||||||
tr("SMESH_WRN_WARNING"),
|
tr("SMESH_WRN_WARNING"),
|
||||||
SMESH::GetMessageOnAlgoStateErrors( errors.in() ),
|
tr("SMESH_WRN_COMPUTE_FAILED"),
|
||||||
tr("SMESH_BUT_OK"));
|
tr("SMESH_BUT_OK"));
|
||||||
break;
|
}
|
||||||
}
|
catch(const SALOME::SALOME_Exception & S_ex){
|
||||||
try{
|
SalomeApp_Tools::QtCatchCorbaException(S_ex);
|
||||||
if (GetSMESHGen()->Compute(aMesh,aShapeObject))
|
}
|
||||||
SMESH::ModifiedMesh(aMeshSObj,true);
|
|
||||||
else
|
updateObjBrowser();
|
||||||
SUIT_MessageBox::warn1(desktop(),
|
|
||||||
tr("SMESH_WRN_WARNING"),
|
if (automaticUpdate()) {
|
||||||
tr("SMESH_WRN_COMPUTE_FAILED"),
|
SVTK_ViewWindow* aVTKView = SMESH::GetViewWindow(this, /*create*/true);
|
||||||
tr("SMESH_BUT_OK"));
|
if (aVTKView) {
|
||||||
}
|
CORBA::Long anId = aStudy->StudyId();
|
||||||
catch(const SALOME::SALOME_Exception & S_ex){
|
TVisualObjPtr aVisualObj = SMESH::GetVisualObj(anId, IObject->getEntry());
|
||||||
SalomeApp_Tools::QtCatchCorbaException(S_ex);
|
if (aVisualObj) {
|
||||||
|
aVisualObj->Update();
|
||||||
|
SMESH_Actor* anActor = SMESH::FindActorByEntry(IObject->getEntry());
|
||||||
|
if (!anActor) {
|
||||||
|
anActor = SMESH::CreateActor(aStudy, IObject->getEntry());
|
||||||
|
if (anActor) {
|
||||||
|
SMESH::DisplayActor(aVTKView, anActor); //apo
|
||||||
|
SMESH::FitAll();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SMESH::RepaintCurrentView();
|
||||||
|
Sel->setSelectedObjects( selected );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CORBA::Long anId = aStudy->StudyId();
|
|
||||||
TVisualObjPtr aVisualObj = SMESH::GetVisualObj(anId,IObject->getEntry());
|
|
||||||
if ( automaticUpdate() && aVisualObj){
|
|
||||||
aVisualObj->Update();
|
|
||||||
SMESH_Actor* anActor = SMESH::FindActorByEntry(IObject->getEntry());
|
|
||||||
if(!anActor){
|
|
||||||
anActor = SMESH::CreateActor(aStudy,IObject->getEntry());
|
|
||||||
if(anActor){
|
|
||||||
SMESH::DisplayActor(view,anActor); //apo
|
|
||||||
SMESH::FitAll();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
SMESH::RepaintCurrentView();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else{
|
|
||||||
SUIT_MessageBox::warn1(desktop(),
|
|
||||||
tr("SMESH_WRN_WARNING"),
|
|
||||||
tr("SMESH_WRN_VIEWER_VTK"),
|
|
||||||
tr("SMESH_BUT_OK"));
|
|
||||||
}
|
|
||||||
updateObjBrowser();
|
|
||||||
Sel->setSelectedObjects( selected );
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case 702: // Create mesh
|
case 702: // Create mesh
|
||||||
startOperation( 702 );
|
startOperation( 702 );
|
||||||
@ -1943,18 +1936,18 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
|||||||
int type;
|
int type;
|
||||||
|
|
||||||
switch (theCommandID) {
|
switch (theCommandID) {
|
||||||
case 4034:
|
case 4034:
|
||||||
type = QUAD_EDGE; break;
|
type = QUAD_EDGE; break;
|
||||||
case 4035:
|
case 4035:
|
||||||
type = QUAD_TRIANGLE; break;
|
type = QUAD_TRIANGLE; break;
|
||||||
case 4036:
|
case 4036:
|
||||||
type = QUAD_QUADRANGLE; break;
|
type = QUAD_QUADRANGLE; break;
|
||||||
case 4037:
|
case 4037:
|
||||||
type = QUAD_TETRAHEDRON; break;
|
type = QUAD_TETRAHEDRON; break;
|
||||||
case 4038:
|
case 4038:
|
||||||
type = QUAD_PYRAMID; break;
|
type = QUAD_PYRAMID; break;
|
||||||
case 4039:
|
case 4039:
|
||||||
type = QUAD_PENTAHEDRON; break;
|
type = QUAD_PENTAHEDRON; break;
|
||||||
case 4040:
|
case 4040:
|
||||||
type = QUAD_HEXAHEDRON;
|
type = QUAD_HEXAHEDRON;
|
||||||
break;
|
break;
|
||||||
@ -3024,7 +3017,7 @@ void SMESHGUI::createPreferences()
|
|||||||
int exportgroup = addPreference( tr( "PREF_GROUP_EXPORT" ), genTab );
|
int exportgroup = addPreference( tr( "PREF_GROUP_EXPORT" ), genTab );
|
||||||
addPreference( tr( "PREF_AUTO_GROUPS" ), exportgroup, LightApp_Preferences::Bool, "SMESH", "auto_groups" );
|
addPreference( tr( "PREF_AUTO_GROUPS" ), exportgroup, LightApp_Preferences::Bool, "SMESH", "auto_groups" );
|
||||||
int renumber=addPreference( tr( "PREF_RENUMBER" ), exportgroup, LightApp_Preferences::Bool, "SMESH", "renumbering" );
|
int renumber=addPreference( tr( "PREF_RENUMBER" ), exportgroup, LightApp_Preferences::Bool, "SMESH", "renumbering" );
|
||||||
|
|
||||||
int meshTab = addPreference( tr( "PREF_TAB_MESH" ) );
|
int meshTab = addPreference( tr( "PREF_TAB_MESH" ) );
|
||||||
int nodeGroup = addPreference( tr( "PREF_GROUP_NODES" ), meshTab );
|
int nodeGroup = addPreference( tr( "PREF_GROUP_NODES" ), meshTab );
|
||||||
|
|
||||||
@ -3161,7 +3154,7 @@ void SMESHGUI::preferencesChanged( const QString& sect, const QString& name )
|
|||||||
float aTol = 1.00000009999999;
|
float aTol = 1.00000009999999;
|
||||||
std::string aWarning;
|
std::string aWarning;
|
||||||
SUIT_ResourceMgr* aResourceMgr = SMESH::GetResourceMgr(this);
|
SUIT_ResourceMgr* aResourceMgr = SMESH::GetResourceMgr(this);
|
||||||
if( name=="selection_object_color" || name=="selection_element_color" ||
|
if( name=="selection_object_color" || name=="selection_element_color" ||
|
||||||
name=="selection_width" || name=="highlight_color" || name=="highlight_width" ||
|
name=="selection_width" || name=="highlight_color" || name=="highlight_width" ||
|
||||||
name=="selection_precision_node" || name=="selection_precision_element" )
|
name=="selection_precision_node" || name=="selection_precision_element" )
|
||||||
SMESH::UpdateSelectionProp( this );
|
SMESH::UpdateSelectionProp( this );
|
||||||
@ -3169,7 +3162,7 @@ void SMESHGUI::preferencesChanged( const QString& sect, const QString& name )
|
|||||||
sbX1 = aResourceMgr->doubleValue("SMESH", "scalar_bar_vertical_x", sbX1);
|
sbX1 = aResourceMgr->doubleValue("SMESH", "scalar_bar_vertical_x", sbX1);
|
||||||
sbW = aResourceMgr->doubleValue("SMESH", "scalar_bar_vertical_width", sbW);
|
sbW = aResourceMgr->doubleValue("SMESH", "scalar_bar_vertical_width", sbW);
|
||||||
if(sbX1+sbW > aTol){
|
if(sbX1+sbW > aTol){
|
||||||
aWarning = "Origin and Size Vertical: X+Width > 1\n";
|
aWarning = "Origin and Size Vertical: X+Width > 1\n";
|
||||||
sbX1=0.01;
|
sbX1=0.01;
|
||||||
sbW=0.05;
|
sbW=0.05;
|
||||||
aResourceMgr->setValue("SMESH", "scalar_bar_vertical_x", sbX1);
|
aResourceMgr->setValue("SMESH", "scalar_bar_vertical_x", sbX1);
|
||||||
@ -3209,7 +3202,7 @@ void SMESHGUI::preferencesChanged( const QString& sect, const QString& name )
|
|||||||
aResourceMgr->setValue("SMESH", "scalar_bar_horizontal_height",sbH);
|
aResourceMgr->setValue("SMESH", "scalar_bar_horizontal_height",sbH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(aWarning.size() != 0){
|
if(aWarning.size() != 0){
|
||||||
aWarning += "The default values are applied instead.";
|
aWarning += "The default values are applied instead.";
|
||||||
SUIT_MessageBox::warn1(SMESHGUI::desktop(),
|
SUIT_MessageBox::warn1(SMESHGUI::desktop(),
|
||||||
|
@ -15,54 +15,56 @@
|
|||||||
// License along with this library; if not, write to the Free Software
|
// License along with this library; if not, write to the Free Software
|
||||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
//
|
//
|
||||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
|
|
||||||
|
|
||||||
#include "SMESHGUI_VTKUtils.h"
|
#include "SMESHGUI_VTKUtils.h"
|
||||||
#include "SMESHGUI_Utils.h"
|
#include "SMESHGUI_Utils.h"
|
||||||
#include "SMESHGUI_Filter.h"
|
#include "SMESHGUI_Filter.h"
|
||||||
|
|
||||||
#include <vtkRenderer.h>
|
#include "SMESHGUI.h"
|
||||||
#include <vtkActorCollection.h>
|
#include "SMESH_Actor.h"
|
||||||
|
#include "SMESH_ObjectDef.h"
|
||||||
#include <TColStd_IndexedMapOfInteger.hxx>
|
|
||||||
|
|
||||||
#include <SUIT_Desktop.h>
|
#include <SUIT_Desktop.h>
|
||||||
#include <SUIT_Session.h>
|
#include <SUIT_Session.h>
|
||||||
#include <SUIT_Study.h>
|
#include <SUIT_Study.h>
|
||||||
|
|
||||||
#include "LightApp_SelectionMgr.h"
|
#include <SALOME_ListIO.hxx>
|
||||||
|
#include <SALOME_ListIteratorOfListIO.hxx>
|
||||||
|
|
||||||
#include "SVTK_Selector.h"
|
#include <SVTK_Selector.h>
|
||||||
#include "SVTK_ViewModel.h"
|
#include <SVTK_ViewModel.h>
|
||||||
#include "SVTK_ViewWindow.h"
|
#include <SVTK_ViewWindow.h>
|
||||||
|
|
||||||
#include "utilities.h"
|
#include <LightApp_SelectionMgr.h>
|
||||||
|
#include <SalomeApp_Application.h>
|
||||||
|
#include <SalomeApp_Study.h>
|
||||||
|
|
||||||
#include "SALOMEconfig.h"
|
#include <utilities.h>
|
||||||
|
|
||||||
|
#include <SALOMEconfig.h>
|
||||||
#include CORBA_CLIENT_HEADER(SMESH_Gen)
|
#include CORBA_CLIENT_HEADER(SMESH_Gen)
|
||||||
#include CORBA_CLIENT_HEADER(SMESH_Mesh)
|
#include CORBA_CLIENT_HEADER(SMESH_Mesh)
|
||||||
#include CORBA_CLIENT_HEADER(SMESH_Group)
|
#include CORBA_CLIENT_HEADER(SMESH_Group)
|
||||||
#include CORBA_CLIENT_HEADER(SMESH_Hypothesis)
|
#include CORBA_CLIENT_HEADER(SMESH_Hypothesis)
|
||||||
|
|
||||||
#include "SMESHGUI.h"
|
|
||||||
#include "SMESH_Actor.h"
|
|
||||||
#include "SMESH_ObjectDef.h"
|
|
||||||
|
|
||||||
#include <SalomeApp_Application.h>
|
|
||||||
#include <LightApp_SelectionMgr.h>
|
|
||||||
#include <SalomeApp_Study.h>
|
|
||||||
|
|
||||||
#include <SALOMEDSClient_Study.hxx>
|
#include <SALOMEDSClient_Study.hxx>
|
||||||
#include <SALOMEDSClient_SObject.hxx>
|
#include <SALOMEDSClient_SObject.hxx>
|
||||||
|
|
||||||
#include <SALOME_ListIO.hxx>
|
// VTK
|
||||||
#include <SALOME_ListIteratorOfListIO.hxx>
|
#include <vtkRenderer.h>
|
||||||
|
#include <vtkActorCollection.h>
|
||||||
|
|
||||||
|
// OCCT
|
||||||
|
#include <TColStd_IndexedMapOfInteger.hxx>
|
||||||
|
|
||||||
|
// STL
|
||||||
#include <set>
|
#include <set>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
namespace SMESH{
|
|
||||||
|
namespace SMESH {
|
||||||
|
|
||||||
typedef map<TKeyOfVisualObj,TVisualObjPtr> TVisualObjCont;
|
typedef map<TKeyOfVisualObj,TVisualObjPtr> TVisualObjCont;
|
||||||
static TVisualObjCont VISUAL_OBJ_CONT;
|
static TVisualObjCont VISUAL_OBJ_CONT;
|
||||||
@ -75,7 +77,8 @@ namespace SMESH{
|
|||||||
if(anIter != VISUAL_OBJ_CONT.end()){
|
if(anIter != VISUAL_OBJ_CONT.end()){
|
||||||
aVisualObj = anIter->second;
|
aVisualObj = anIter->second;
|
||||||
}else{
|
}else{
|
||||||
SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( SMESHGUI::activeStudy()->application() );
|
SalomeApp_Application* app =
|
||||||
|
dynamic_cast<SalomeApp_Application*>( SMESHGUI::activeStudy()->application() );
|
||||||
_PTR(Study) aStudy = SMESHGUI::activeStudy()->studyDS();
|
_PTR(Study) aStudy = SMESHGUI::activeStudy()->studyDS();
|
||||||
_PTR(SObject) aSObj = aStudy->FindObjectID(theEntry);
|
_PTR(SObject) aSObj = aStudy->FindObjectID(theEntry);
|
||||||
if(aSObj){
|
if(aSObj){
|
||||||
@ -139,16 +142,41 @@ namespace SMESH{
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SVTK_ViewWindow*
|
/*! Return active view window, if it instantiates SVTK_ViewWindow class,
|
||||||
GetViewWindow(const SalomeApp_Module* theModule)
|
* overwise find or create corresponding view window, make it active and return it.
|
||||||
|
* \note Active VVTK_ViewWindow can be returned, because it inherits SVTK_ViewWindow.
|
||||||
|
*/
|
||||||
|
SVTK_ViewWindow* GetViewWindow (const SalomeApp_Module* theModule,
|
||||||
|
bool createIfNotFound)
|
||||||
{
|
{
|
||||||
if (SalomeApp_Application* anApp = theModule->getApp())
|
SalomeApp_Application* anApp;
|
||||||
return dynamic_cast<SVTK_ViewWindow*>(anApp->desktop()->activeWindow());
|
if (theModule)
|
||||||
|
anApp = theModule->getApp();
|
||||||
|
else
|
||||||
|
anApp = dynamic_cast<SalomeApp_Application*>
|
||||||
|
(SUIT_Session::session()->activeApplication());
|
||||||
|
|
||||||
|
if (anApp) {
|
||||||
|
if (SVTK_ViewWindow* aView = dynamic_cast<SVTK_ViewWindow*>(anApp->desktop()->activeWindow()))
|
||||||
|
return aView;
|
||||||
|
|
||||||
|
SUIT_ViewManager* aViewManager =
|
||||||
|
anApp->getViewManager(SVTK_Viewer::Type(), createIfNotFound);
|
||||||
|
if (aViewManager) {
|
||||||
|
if (SUIT_ViewWindow* aViewWindow = aViewManager->getActiveView()) {
|
||||||
|
if (SVTK_ViewWindow* aView = dynamic_cast<SVTK_ViewWindow*>(aViewWindow)) {
|
||||||
|
aViewWindow->raise();
|
||||||
|
aViewWindow->setFocus();
|
||||||
|
return aView;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
SVTK_ViewWindow* FindVtkViewWindow( SUIT_ViewManager* theMgr,
|
SVTK_ViewWindow* FindVtkViewWindow (SUIT_ViewManager* theMgr,
|
||||||
SUIT_ViewWindow* theWindow )
|
SUIT_ViewWindow * theWindow)
|
||||||
{
|
{
|
||||||
if( !theMgr )
|
if( !theMgr )
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -160,12 +188,10 @@ namespace SMESH{
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SVTK_ViewWindow* GetVtkViewWindow(SUIT_ViewWindow* theWindow){
|
SVTK_ViewWindow* GetVtkViewWindow(SUIT_ViewWindow* theWindow){
|
||||||
return dynamic_cast<SVTK_ViewWindow*>(theWindow);
|
return dynamic_cast<SVTK_ViewWindow*>(theWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* SUIT_ViewWindow* GetActiveWindow()
|
/* SUIT_ViewWindow* GetActiveWindow()
|
||||||
{
|
{
|
||||||
SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
|
SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
|
||||||
@ -182,8 +208,19 @@ namespace SMESH{
|
|||||||
return GetVtkViewWindow( GetActiveWindow() );
|
return GetVtkViewWindow( GetActiveWindow() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void RepaintCurrentView()
|
||||||
|
{
|
||||||
|
if (SVTK_ViewWindow* wnd = GetCurrentVtkView())
|
||||||
|
{
|
||||||
|
wnd->getRenderer()->Render();
|
||||||
|
wnd->Repaint(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void RepaintViewWindow(SVTK_ViewWindow* theWindow)
|
void RepaintViewWindow(SVTK_ViewWindow* theWindow)
|
||||||
{
|
{
|
||||||
|
theWindow->getRenderer()->Render();
|
||||||
theWindow->Repaint();
|
theWindow->Repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,6 +230,14 @@ namespace SMESH{
|
|||||||
theWindow->Repaint();
|
theWindow->Repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FitAll(){
|
||||||
|
if(SVTK_ViewWindow* wnd = GetCurrentVtkView() ){
|
||||||
|
wnd->onFitAll();
|
||||||
|
wnd->Repaint();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
SMESH_Actor* FindActorByEntry(SUIT_ViewWindow *theWindow,
|
SMESH_Actor* FindActorByEntry(SUIT_ViewWindow *theWindow,
|
||||||
const char* theEntry)
|
const char* theEntry)
|
||||||
{
|
{
|
||||||
@ -286,27 +331,6 @@ namespace SMESH{
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FitAll(){
|
|
||||||
if(SVTK_ViewWindow* wnd = GetCurrentVtkView() ){
|
|
||||||
wnd->onFitAll();
|
|
||||||
wnd->Repaint();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
vtkRenderer* GetCurrentRenderer(){
|
|
||||||
if(SVTK_ViewWindow* wnd = GetCurrentVtkView() )
|
|
||||||
return wnd->getRenderer();
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void RepaintCurrentView(){
|
|
||||||
if(SVTK_ViewWindow* wnd = GetCurrentVtkView() )
|
|
||||||
{
|
|
||||||
wnd->getRenderer()->Render();
|
|
||||||
wnd->Repaint(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void UpdateView(SUIT_ViewWindow *theWnd, EDisplaing theAction, const char* theEntry)
|
void UpdateView(SUIT_ViewWindow *theWnd, EDisplaing theAction, const char* theEntry)
|
||||||
{
|
{
|
||||||
if(SVTK_ViewWindow* aViewWnd = GetVtkViewWindow(theWnd)){
|
if(SVTK_ViewWindow* aViewWnd = GetVtkViewWindow(theWnd)){
|
||||||
@ -450,17 +474,17 @@ namespace SMESH{
|
|||||||
// update VTK viewer properties
|
// update VTK viewer properties
|
||||||
if(SVTK_ViewWindow* aVtkView = GetVtkViewWindow( views[i] )){
|
if(SVTK_ViewWindow* aVtkView = GetVtkViewWindow( views[i] )){
|
||||||
// mesh element selection
|
// mesh element selection
|
||||||
aVtkView->SetSelectionProp(aSelColor.red()/255.,
|
aVtkView->SetSelectionProp(aSelColor.red()/255.,
|
||||||
aSelColor.green()/255.,
|
aSelColor.green()/255.,
|
||||||
aSelColor.blue()/255.,
|
aSelColor.blue()/255.,
|
||||||
SW );
|
SW );
|
||||||
// tolerances
|
// tolerances
|
||||||
aVtkView->SetSelectionTolerance(SP1, SP2);
|
aVtkView->SetSelectionTolerance(SP1, SP2);
|
||||||
|
|
||||||
// pre-selection
|
// pre-selection
|
||||||
aVtkView->SetPreselectionProp(aPreColor.red()/255.,
|
aVtkView->SetPreselectionProp(aPreColor.red()/255.,
|
||||||
aPreColor.green()/255.,
|
aPreColor.green()/255.,
|
||||||
aPreColor.blue()/255.,
|
aPreColor.blue()/255.,
|
||||||
PW);
|
PW);
|
||||||
// update actors
|
// update actors
|
||||||
vtkRenderer* aRenderer = aVtkView->getRenderer();
|
vtkRenderer* aRenderer = aVtkView->getRenderer();
|
||||||
@ -468,10 +492,10 @@ namespace SMESH{
|
|||||||
aCollection->InitTraversal();
|
aCollection->InitTraversal();
|
||||||
while(vtkActor *anAct = aCollection->GetNextActor()){
|
while(vtkActor *anAct = aCollection->GetNextActor()){
|
||||||
if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)){
|
if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)){
|
||||||
anActor->SetHighlightColor(aHiColor.red()/255.,
|
anActor->SetHighlightColor(aHiColor.red()/255.,
|
||||||
aHiColor.green()/255.,
|
aHiColor.green()/255.,
|
||||||
aHiColor.blue()/255.);
|
aHiColor.blue()/255.);
|
||||||
anActor->SetPreHighlightColor(aPreColor.red()/255.,
|
anActor->SetPreHighlightColor(aPreColor.red()/255.,
|
||||||
aPreColor.green()/255.,
|
aPreColor.green()/255.,
|
||||||
aPreColor.blue()/255.);
|
aPreColor.blue()/255.);
|
||||||
}
|
}
|
||||||
@ -482,7 +506,7 @@ namespace SMESH{
|
|||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
SVTK_Selector*
|
SVTK_Selector*
|
||||||
GetSelector(SUIT_ViewWindow *theWindow)
|
GetSelector(SUIT_ViewWindow *theWindow)
|
||||||
{
|
{
|
||||||
if(SVTK_ViewWindow* aWnd = GetVtkViewWindow(theWindow))
|
if(SVTK_ViewWindow* aWnd = GetVtkViewWindow(theWindow))
|
||||||
|
@ -15,19 +15,29 @@
|
|||||||
// License along with this library; if not, write to the Free Software
|
// License along with this library; if not, write to the Free Software
|
||||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
//
|
//
|
||||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
|
|
||||||
#ifndef SMESHGUI_VTKUtils_HeaderFile
|
#ifndef SMESHGUI_VTKUtils_HeaderFile
|
||||||
#define SMESHGUI_VTKUtils_HeaderFile
|
#define SMESHGUI_VTKUtils_HeaderFile
|
||||||
|
|
||||||
class QString;
|
|
||||||
class vtkRenderer;
|
|
||||||
class TColStd_IndexedMapOfInteger;
|
|
||||||
|
|
||||||
#include "SALOMEDSClient_definitions.hxx"
|
#include "SALOMEDSClient_definitions.hxx"
|
||||||
#include "SALOME_InteractiveObject.hxx"
|
#include "SALOME_InteractiveObject.hxx"
|
||||||
#include "VTKViewer_Filter.h"
|
#include "VTKViewer_Filter.h"
|
||||||
|
|
||||||
|
#include "SMESH_Object.h"
|
||||||
|
#include "SMESHGUI_Utils.h"
|
||||||
|
|
||||||
|
#include <CORBA.h>
|
||||||
|
|
||||||
|
#include "SALOMEconfig.h"
|
||||||
|
#include CORBA_CLIENT_HEADER(SALOMEDS)
|
||||||
|
|
||||||
|
#include <boost/shared_ptr.hpp>
|
||||||
|
|
||||||
|
class QString;
|
||||||
|
|
||||||
|
class TColStd_IndexedMapOfInteger;
|
||||||
|
|
||||||
class SALOMEDSClient_Study;
|
class SALOMEDSClient_Study;
|
||||||
|
|
||||||
class SUIT_Study;
|
class SUIT_Study;
|
||||||
@ -38,44 +48,37 @@ class SVTK_ViewWindow;
|
|||||||
class SVTK_Selector;
|
class SVTK_Selector;
|
||||||
|
|
||||||
class LightApp_SelectionMgr;
|
class LightApp_SelectionMgr;
|
||||||
class SMESHGUI;
|
|
||||||
|
|
||||||
#include <CORBA.h>
|
|
||||||
|
|
||||||
#include "SALOMEconfig.h"
|
|
||||||
#include CORBA_CLIENT_HEADER(SALOMEDS)
|
|
||||||
|
|
||||||
#include <boost/shared_ptr.hpp>
|
|
||||||
#include "SMESH_Object.h"
|
|
||||||
|
|
||||||
class SMESH_Actor;
|
|
||||||
class SALOME_Actor;
|
|
||||||
class SVTK_ViewWindow;
|
|
||||||
class SalomeApp_Module;
|
class SalomeApp_Module;
|
||||||
|
|
||||||
namespace SMESH{
|
class SMESHGUI;
|
||||||
|
class SMESH_Actor;
|
||||||
|
class SALOME_Actor;
|
||||||
|
|
||||||
|
namespace SMESH {
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
typedef pair<int,string> TKeyOfVisualObj;
|
typedef pair<int,string> TKeyOfVisualObj;
|
||||||
|
|
||||||
TVisualObjPtr GetVisualObj(int theStudyId,
|
TVisualObjPtr GetVisualObj(int theStudyId,
|
||||||
const char* theEntry);
|
const char* theEntry);
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
SVTK_ViewWindow* GetViewWindow(const SalomeApp_Module* theModule);
|
SVTK_ViewWindow* GetViewWindow(const SalomeApp_Module* theModule = NULL,
|
||||||
|
bool createIfNotFound = false);
|
||||||
|
|
||||||
SUIT_ViewWindow* GetActiveWindow();
|
SVTK_ViewWindow* FindVtkViewWindow(SUIT_ViewManager*, SUIT_ViewWindow*);
|
||||||
|
|
||||||
SVTK_ViewWindow* FindVtkViewWindow( SUIT_ViewManager*,
|
SVTK_ViewWindow* GetVtkViewWindow(SUIT_ViewWindow*);
|
||||||
SUIT_ViewWindow* );
|
|
||||||
|
|
||||||
SVTK_ViewWindow* GetVtkViewWindow( SUIT_ViewWindow* );
|
|
||||||
|
|
||||||
SVTK_ViewWindow* GetCurrentVtkView();
|
SVTK_ViewWindow* GetCurrentVtkView();
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void RepaintCurrentView();
|
||||||
void RepaintViewWindow(SVTK_ViewWindow*);
|
void RepaintViewWindow(SVTK_ViewWindow*);
|
||||||
void RenderViewWindow(SVTK_ViewWindow*);
|
void RenderViewWindow(SVTK_ViewWindow*);
|
||||||
|
|
||||||
|
void FitAll();
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
SMESH_Actor* FindActorByEntry (SUIT_ViewWindow*, const char* theEntry);
|
SMESH_Actor* FindActorByEntry (SUIT_ViewWindow*, const char* theEntry);
|
||||||
SMESH_Actor* FindActorByEntry (const char* theEntry);
|
SMESH_Actor* FindActorByEntry (const char* theEntry);
|
||||||
@ -89,10 +92,10 @@ namespace SMESH{
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
enum EDisplaing {eDisplayAll, eDisplay, eDisplayOnly, eErase, eEraseAll};
|
enum EDisplaing {eDisplayAll, eDisplay, eDisplayOnly, eErase, eEraseAll};
|
||||||
void UpdateView (SUIT_ViewWindow*,
|
void UpdateView (SUIT_ViewWindow*,
|
||||||
EDisplaing theAction,
|
EDisplaing theAction,
|
||||||
const char* theEntry = "");
|
const char* theEntry = "");
|
||||||
void UpdateView (EDisplaing theAction,
|
void UpdateView (EDisplaing theAction,
|
||||||
const char* theEntry = "");
|
const char* theEntry = "");
|
||||||
|
|
||||||
void UpdateView();
|
void UpdateView();
|
||||||
@ -101,14 +104,6 @@ namespace SMESH{
|
|||||||
bool theDisplay);
|
bool theDisplay);
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
|
||||||
void FitAll();
|
|
||||||
|
|
||||||
void RepaintCurrentView();
|
|
||||||
|
|
||||||
vtkRenderer* GetCurrentRenderer();
|
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void SetPointRepresentation(bool theIsVisible);
|
void SetPointRepresentation(bool theIsVisible);
|
||||||
|
|
||||||
@ -118,20 +113,16 @@ namespace SMESH{
|
|||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
SVTK_Selector*
|
SVTK_Selector* GetSelector (SUIT_ViewWindow* = GetActiveWindow());
|
||||||
GetSelector(SUIT_ViewWindow* = GetActiveWindow());
|
|
||||||
|
|
||||||
void SetFilter (const Handle(VTKViewer_Filter)& theFilter,
|
void SetFilter (const Handle(VTKViewer_Filter)& theFilter,
|
||||||
SVTK_Selector* theSelector = GetSelector());
|
SVTK_Selector* theSelector = GetSelector());
|
||||||
|
|
||||||
Handle(VTKViewer_Filter)
|
Handle(VTKViewer_Filter) GetFilter (int theId, SVTK_Selector* theSelector = GetSelector());
|
||||||
GetFilter (int theId, SVTK_Selector* theSelector = GetSelector());
|
|
||||||
|
|
||||||
bool IsFilterPresent (int theId,
|
bool IsFilterPresent (int theId, SVTK_Selector* theSelector = GetSelector());
|
||||||
SVTK_Selector* theSelector = GetSelector());
|
|
||||||
|
|
||||||
void RemoveFilter (int theId,
|
void RemoveFilter (int theId, SVTK_Selector* theSelector = GetSelector());
|
||||||
SVTK_Selector* theSelector = GetSelector());
|
|
||||||
|
|
||||||
void RemoveFilters (SVTK_Selector* theSelector = GetSelector());
|
void RemoveFilters (SVTK_Selector* theSelector = GetSelector());
|
||||||
|
|
||||||
@ -139,36 +130,36 @@ namespace SMESH{
|
|||||||
SVTK_Selector* theSelector = GetSelector());
|
SVTK_Selector* theSelector = GetSelector());
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
int GetNameOfSelectedNodes(SVTK_Selector* theSelector,
|
int GetNameOfSelectedNodes(SVTK_Selector* theSelector,
|
||||||
const Handle(SALOME_InteractiveObject)& theIO,
|
const Handle(SALOME_InteractiveObject)& theIO,
|
||||||
QString& theName);
|
QString& theName);
|
||||||
|
|
||||||
int GetNameOfSelectedElements(SVTK_Selector* theSelector,
|
int GetNameOfSelectedElements(SVTK_Selector* theSelector,
|
||||||
const Handle(SALOME_InteractiveObject)& theIO,
|
const Handle(SALOME_InteractiveObject)& theIO,
|
||||||
QString& theName);
|
QString& theName);
|
||||||
|
|
||||||
int GetEdgeNodes(SVTK_Selector* theSelector,
|
int GetEdgeNodes(SVTK_Selector* theSelector,
|
||||||
const TVisualObjPtr& theVisualObj,
|
const TVisualObjPtr& theVisualObj,
|
||||||
int& theId1,
|
int& theId1,
|
||||||
int& theId2);
|
int& theId2);
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
int GetNameOfSelectedNodes (LightApp_SelectionMgr*,
|
int GetNameOfSelectedNodes (LightApp_SelectionMgr*,
|
||||||
const Handle(SALOME_InteractiveObject)& theIO,
|
const Handle(SALOME_InteractiveObject)& theIO,
|
||||||
QString& theName);
|
QString& theName);
|
||||||
|
|
||||||
int GetNameOfSelectedNodes (LightApp_SelectionMgr*,
|
int GetNameOfSelectedNodes (LightApp_SelectionMgr*,
|
||||||
QString& aName);
|
QString& aName);
|
||||||
|
|
||||||
int GetNameOfSelectedElements (LightApp_SelectionMgr*,
|
int GetNameOfSelectedElements (LightApp_SelectionMgr*,
|
||||||
const Handle(SALOME_InteractiveObject)& theIO,
|
const Handle(SALOME_InteractiveObject)& theIO,
|
||||||
QString& theName);
|
QString& theName);
|
||||||
|
|
||||||
int GetNameOfSelectedElements (LightApp_SelectionMgr*,
|
int GetNameOfSelectedElements (LightApp_SelectionMgr*,
|
||||||
QString& aName);
|
QString& aName);
|
||||||
|
|
||||||
int GetSelected (LightApp_SelectionMgr*,
|
int GetSelected (LightApp_SelectionMgr*,
|
||||||
TColStd_IndexedMapOfInteger& theMap,
|
TColStd_IndexedMapOfInteger& theMap,
|
||||||
const bool theIsElement = true );
|
const bool theIsElement = true );
|
||||||
|
|
||||||
int GetEdgeNodes (LightApp_SelectionMgr*, int& theId1, int& theId2);
|
int GetEdgeNodes (LightApp_SelectionMgr*, int& theId1, int& theId2);
|
||||||
|
Loading…
Reference in New Issue
Block a user