-// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CADE
+// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
/// may only be needed to be called in case if mesh objects are
/// created when no active study is set to %SMESH component.
/// In this case, mentioned functions can be used to forcibly
-/// publish existing objects in the currrently active study.
+/// publish existing objects in the currently active study.
///
/// Note that if there are no open study, these methods will do
/// nothing.
///////////////////////////////////////////////////////////////
/// \internal
/// \brief Get study object by its study UID or IOR.
- /// \param studyId Study UID.
/// \param uid Object's study UID or IOR.
/// \return Pointer to study object (null object if it isn't
/// found).
///////////////////////////////////////////////////////////////
- _PTR(SObject) uid2object(int studyId, const std::string& uid)
+ _PTR(SObject) uid2object(const std::string& uid)
{
_PTR(SObject) sobject;
- if ( studyId > 0 )
{
- _PTR(Study) study = SalomeApp_Application::studyMgr()->GetStudyByID( studyId );
+ _PTR(Study) study = SMESH::getStudy();
if ( study )
{
- sobject = study->FindObjectID( uid );
- if ( !sobject )
- sobject = study->FindObjectIOR( uid );
+ sobject = study->FindObjectID( uid );
+ if ( !sobject )
+ sobject = study->FindObjectIOR( uid );
}
}
return sobject;
{
if ( uid )
{
- ViewManagerList vms = app->viewManagers();
- for ( int i = 0; i < vms.count() && !window; i++ )
- {
- SUIT_ViewManager* vm = vms[i];
- QVector<SUIT_ViewWindow*> vws = vm->getViews();
- for ( int j = 0; j < vws.count() && !window; j++)
- {
- SUIT_ViewWindow* vw = vws[0];
- if ( uid == vw->getId() )
- window = dynamic_cast<SALOME_View*>( vm->getViewModel() );
- }
- }
+ ViewManagerList vms = app->viewManagers();
+ for ( int i = 0; i < vms.count() && !window; i++ )
+ {
+ SUIT_ViewManager* vm = vms[i];
+ QVector<SUIT_ViewWindow*> vws = vm->getViews();
+ for ( int j = 0; j < vws.count() && !window; j++)
+ {
+ SUIT_ViewWindow* vw = vws[0];
+ if ( uid == vw->getId() )
+ window = dynamic_cast<SALOME_View*>( vm->getViewModel() );
+ }
+ }
}
else
{
- SUIT_ViewManager* vm = app->getViewManager( SVTK_Viewer::Type(), create );
- if ( vm )
- {
- window = dynamic_cast<SALOME_View*>( vm->getViewModel() );
- }
+ SUIT_ViewManager* vm = app->getViewManager( SVTK_Viewer::Type(), create );
+ if ( vm )
+ {
+ window = dynamic_cast<SALOME_View*>( vm->getViewModel() );
+ }
}
}
return window;
foreach( SUIT_ViewManager* vm, vms )
{
if ( vm && vm->getType() == SVTK_Viewer::Type() )
- {
+ {
SALOME_View* view = dynamic_cast<SALOME_View*>( vm->getViewModel() );
if ( view )
- views << view;
- }
+ views << view;
+ }
}
}
return views;
if ( actor )
{
actor->GetNodeColor( props.nodeColor.r,
- props.nodeColor.g,
- props.nodeColor.b );
+ props.nodeColor.g,
+ props.nodeColor.b );
props.markerType = actor->GetMarkerType();
props.markerScale = actor->GetMarkerScale();
-
+
actor->GetEdgeColor( props.edgeColor.r,
- props.edgeColor.g,
- props.edgeColor.b );
+ props.edgeColor.g,
+ props.edgeColor.b );
props.edgeWidth = qMax( (int)actor->GetLineWidth(), 1 );
-
+
actor->GetSufaceColor( props.surfaceColor.r,
- props.surfaceColor.g,
- props.surfaceColor.b,
- props.surfaceColor.delta );
-
+ props.surfaceColor.g,
+ props.surfaceColor.b,
+ props.surfaceColor.delta );
+
actor->GetVolumeColor( props.volumeColor.r,
- props.volumeColor.g,
- props.volumeColor.b,
- props.volumeColor.delta );
-
+ props.volumeColor.g,
+ props.volumeColor.b,
+ props.volumeColor.delta );
+
actor->Get0DColor( props.elem0dColor.r,
- props.elem0dColor.g,
- props.elem0dColor.b );
+ props.elem0dColor.g,
+ props.elem0dColor.b );
props.elem0dSize = qMax( (int)actor->Get0DSize(), 1 );
-
+
actor->GetBallColor( props.ballColor.r,
- props.ballColor.g,
- props.ballColor.b );
+ props.ballColor.g,
+ props.ballColor.b );
props.ballScale = qMax( actor->GetBallScale(), 1e-2 );
-
+
actor->GetOutlineColor( props.outlineColor.r,
- props.outlineColor.g,
- props.outlineColor.b );
+ props.outlineColor.g,
+ props.outlineColor.b );
props.outlineWidth = qMax( (int)actor->GetOutlineWidth(), 1 );
-
+
actor->GetFacesOrientationColor( props.orientationColor.r,
- props.orientationColor.g,
- props.orientationColor.b );
+ props.orientationColor.g,
+ props.orientationColor.b );
props.orientationScale = actor->GetFacesOrientationScale();
props.orientation3d = actor->GetFacesOrientation3DVectors();
-
+
props.shrinkFactor = actor->GetShrinkFactor();
-
+
props.opacity = actor->GetOpacity();
}
return props;
if ( actor )
{
actor->SetNodeColor( props.nodeColor.r,
- props.nodeColor.g,
- props.nodeColor.b );
+ props.nodeColor.g,
+ props.nodeColor.b );
if ( props.markerType != VTK::MT_USER )
- actor->SetMarkerStd( props.markerType, props.markerScale );
-
+ actor->SetMarkerStd( props.markerType, props.markerScale );
+
actor->SetEdgeColor( props.edgeColor.r,
- props.edgeColor.g,
- props.edgeColor.b );
+ props.edgeColor.g,
+ props.edgeColor.b );
actor->SetLineWidth( qMax( (double)props.edgeWidth, 1. ) );
-
+
actor->SetSufaceColor( props.surfaceColor.r,
- props.surfaceColor.g,
- props.surfaceColor.b,
- props.surfaceColor.delta );
-
+ props.surfaceColor.g,
+ props.surfaceColor.b,
+ props.surfaceColor.delta );
+
actor->SetVolumeColor( props.volumeColor.r,
- props.volumeColor.g,
- props.volumeColor.b,
- props.volumeColor.delta );
-
+ props.volumeColor.g,
+ props.volumeColor.b,
+ props.volumeColor.delta );
+
actor->Set0DColor( props.elem0dColor.r,
- props.elem0dColor.g,
- props.elem0dColor.b );
+ props.elem0dColor.g,
+ props.elem0dColor.b );
actor->Set0DSize( qMax( (double)props.elem0dSize, 1. ) );
-
+
actor->SetBallColor( props.ballColor.r,
- props.ballColor.g,
- props.ballColor.b );
+ props.ballColor.g,
+ props.ballColor.b );
actor->SetBallScale( qMax( props.ballScale, 1e-2 ) );
-
+
actor->SetOutlineColor( props.outlineColor.r,
- props.outlineColor.g,
- props.outlineColor.b );
+ props.outlineColor.g,
+ props.outlineColor.b );
actor->SetOutlineWidth( qMax( (double)props.outlineWidth, 1. ) );
-
+
actor->SetFacesOrientationColor( props.orientationColor.r,
- props.orientationColor.g,
- props.orientationColor.b );
+ props.orientationColor.g,
+ props.orientationColor.b );
actor->SetFacesOrientationScale( props.orientationScale );
actor->SetFacesOrientation3DVectors( props.orientation3d );
-
+
actor->SetShrinkFactor( props.shrinkFactor );
-
+
actor->SetOpacity( props.opacity );
-
+
view->Repaint();
}
}
/// \brief Constructor.
/////////////////////////////////////////////////////////////////
SMESH_Swig::SMESH_Swig()
- : myCachedStudyId( 0 )
{
init();
}
SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( session->activeApplication() );
if ( !SMESHGUI::GetSMESHGUI() )
- app->loadModule( "Mesh" );
+ app->loadModule( "Mesh" );
}
};
// load SMESH GUI if it's not yet loaded
- ProcessVoidEvent( new TInitEvent() );
-
- // set current study
- std::vector<std::string> studies = SalomeApp_Application::studyMgr()->GetOpenStudies();
- if ( studies.size() > 0 )
- {
- _PTR(Study) study = SalomeApp_Application::studyMgr()->GetStudyByName( studies[0] );
- int studyId = study->StudyId();
- if ( myCachedStudyId != studyId )
- {
- myCachedStudyId = studyId;
- SMESHGUI::GetSMESHGen()->SetCurrentStudy( _CAST(Study, study)->GetStudy() );
- }
- }
- else
+ if ( SUIT_Session::session() )
{
- myCachedStudyId = 0;
+ ProcessVoidEvent( new TInitEvent() );
+ SMESHGUI::GetSMESHGen()->UpdateStudy();
}
}
init();
std::string uid;
-
- if ( myCachedStudyId > 0 )
- {
- _PTR(Study) study = SalomeApp_Application::studyMgr()->GetStudyByID( myCachedStudyId );
- CORBA::Object_var object = string2object( ior );
- if ( study && !CORBA::is_nil( object ) )
+ CORBA::Object_var object = string2object( ior );
+ if ( !CORBA::is_nil( object ) )
{
SALOMEDS::SObject_var sobject =
- SMESHGUI::GetSMESHGen()->PublishInStudy( _CAST(Study, study)->GetStudy(),
- SALOMEDS::SObject::_nil(),
- object.in(),
- name );
+ SMESHGUI::GetSMESHGen()->PublishInStudy( SALOMEDS::SObject::_nil(),
+ object.in(),
+ name );
if ( !CORBA::is_nil( sobject ) )
- {
- uid = sobject->GetID();
- }
+ {
+ uid = sobject->GetID();
+ }
sobject->UnRegister();
}
- }
return strdup( uid.c_str() );
}
{
init();
- _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
+ _PTR(SObject) sobject = uid2object( uid );
if ( sobject )
sobject->SetAttrString( "AttributeName", name );
}
{
SALOME_View* view = uid2wnd( myViewUid, true ); // create view if it's not present
if ( view )
- LightApp_Displayer::FindDisplayer( "Mesh", true )->Display( myUid, myIsUpdate, view );
+ LightApp_Displayer::FindDisplayer( "Mesh", true )->Display( myUid, myIsUpdate, view );
}
};
init();
- _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
+ _PTR(SObject) sobject = uid2object( uid );
if ( sobject )
ProcessVoidEvent( new TDisplayEvent( sobject->GetID().c_str(), viewUid, updateViewer ) );
}
{
if ( myViewUid == -1 )
{
- QList<SALOME_View*> views = windows();
- foreach( SALOME_View* view, views )
- LightApp_Displayer::FindDisplayer( "Mesh", true )->Erase( myUid, true, myIsUpdate, view );
+ QList<SALOME_View*> views = windows();
+ foreach( SALOME_View* view, views )
+ LightApp_Displayer::FindDisplayer( "Mesh", true )->Erase( myUid, true, myIsUpdate, view );
}
else
{
- SALOME_View* view = uid2wnd( myViewUid );
- if ( view )
- LightApp_Displayer::FindDisplayer( "Mesh", true )->Erase( myUid, true, myIsUpdate, view );
+ SALOME_View* view = uid2wnd( myViewUid );
+ if ( view )
+ LightApp_Displayer::FindDisplayer( "Mesh", true )->Erase( myUid, true, myIsUpdate, view );
}
}
};
init();
- _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
+ _PTR(SObject) sobject = uid2object( uid );
if ( sobject )
ProcessVoidEvent( new TEraseEvent( sobject->GetID().c_str(), viewUid, updateViewer ) );
}
TUpdateEvent( const char* uid ) : myUid( uid ) {}
virtual void Execute()
{
- Handle(SALOME_InteractiveObject) io =
- new SALOME_InteractiveObject( myUid, "SMESH", "" );
+ Handle(SALOME_InteractiveObject) io =
+ new SALOME_InteractiveObject( myUid, "SMESH", "" );
SMESH::Update( io, true );
}
};
init();
- _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
+ _PTR(SObject) sobject = uid2object( uid );
if ( sobject )
ProcessVoidEvent( new TUpdateEvent( uid ) );
}
init();
- _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
+ _PTR(SObject) sobject = uid2object( uid );
if ( sobject )
props = ProcessEvent( new TGetPropsEvent( sobject->GetID().c_str(), viewUid ) );
QList<SALOME_View*> views = windows();
foreach( SALOME_View* view, views )
{
- setProperties( view, myUid, myProps );
+ setProperties( view, myUid, myProps );
}
}
else
{
init();
- _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
+ _PTR(SObject) sobject = uid2object( uid );
if ( sobject )
ProcessVoidEvent( new TSetPropsEvent( sobject->GetID().c_str(), props, viewUid ) );
}
init();
- _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
+ _PTR(SObject) sobject = uid2object( uid );
if ( sobject )
numbering = ProcessEvent( new TGetNodeNumberingEvent( sobject->GetID().c_str(), viewUid ) );
{
actor->SetPointsLabeled( myNumbering );
if ( view )
- view->Repaint();
+ view->Repaint();
}
}
};
{
init();
- _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
+ _PTR(SObject) sobject = uid2object( uid );
if ( sobject )
ProcessVoidEvent( new TSetNodeNumberingEvent( sobject->GetID().c_str(), numbering, viewUid ) );
}
init();
- _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
+ _PTR(SObject) sobject = uid2object( uid );
if ( sobject )
numbering = ProcessEvent( new TGetElementNumberingEvent( sobject->GetID().c_str(), viewUid ) );
{
actor->SetCellsLabeled( myNumbering );
if ( view )
- view->Repaint();
+ view->Repaint();
}
}
};
{
init();
- _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
+ _PTR(SObject) sobject = uid2object( uid );
if ( sobject )
ProcessVoidEvent( new TSetElementNumberingEvent( sobject->GetID().c_str(), numbering, viewUid ) );
}
init();
- _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
+ _PTR(SObject) sobject = uid2object( uid );
if ( sobject )
mode = ProcessEvent( new TGetDisplayModeEvent( sobject->GetID().c_str(), viewUid ) );
{
actor->SetRepresentation( myMode );
if ( view )
- view->Repaint();
+ view->Repaint();
}
}
};
{
init();
- _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
+ _PTR(SObject) sobject = uid2object( uid );
if ( sobject )
ProcessVoidEvent( new TSetDisplayModeEvent( sobject->GetID().c_str(), mode, viewUid ) );
}
init();
- _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
+ _PTR(SObject) sobject = uid2object( uid );
if ( sobject )
shrinkMode = ProcessEvent( new TGetShrinkModeEvent( sobject->GetID().c_str(), viewUid ) );
if ( actor )
{
if ( myShrink )
- actor->SetShrink();
+ actor->SetShrink();
else
- actor->UnShrink();
+ actor->UnShrink();
if ( view )
- view->Repaint();
+ view->Repaint();
}
}
};
{
init();
- _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
+ _PTR(SObject) sobject = uid2object( uid );
if ( sobject )
ProcessVoidEvent( new TSetShrinkModeEvent( sobject->GetID().c_str(), shrink, viewUid ) );
}
init();
- _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
+ _PTR(SObject) sobject = uid2object( uid );
if ( sobject )
opacity = ProcessEvent( new TGetOpacityEvent( sobject->GetID().c_str(), viewUid ) );
{
actor->SetOpacity( myOpacity );
if ( view )
- view->Repaint();
+ view->Repaint();
}
}
};
{
init();
- _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
+ _PTR(SObject) sobject = uid2object( uid );
if ( sobject )
ProcessVoidEvent( new TSetOpacityEvent( sobject->GetID().c_str(), opacity, viewUid ) );
}
init();
- _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
+ _PTR(SObject) sobject = uid2object( uid );
if ( sobject )
shown = ProcessEvent( new TGetOrientationEvent( sobject->GetID().c_str(), viewUid ) );
{
actor->SetFacesOriented( myShown );
if ( view )
- view->Repaint();
+ view->Repaint();
}
}
};
{
init();
- _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
+ _PTR(SObject) sobject = uid2object( uid );
if ( sobject )
ProcessVoidEvent( new TSetOrientationEvent( sobject->GetID().c_str(), shown, viewUid ) );
}
init();
- _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
+ _PTR(SObject) sobject = uid2object( uid );
if ( sobject )
entities = ProcessEvent( new TGetEntitiesEvent( sobject->GetID().c_str(), viewUid ) );
{
actor->SetEntityMode( myEntities );
if ( view )
- view->Repaint();
+ view->Repaint();
}
}
};
{
init();
- _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
+ _PTR(SObject) sobject = uid2object( uid );
if ( sobject )
ProcessVoidEvent( new TSetEntitiesEvent( sobject->GetID().c_str(), entities, viewUid ) );
}
init();
- _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
+ _PTR(SObject) sobject = uid2object( uid );
if ( sobject )
{
int entities = ProcessEvent( new TGetEntitiesEvent( sobject->GetID().c_str(), viewUid ) );
{
init();
- _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
+ _PTR(SObject) sobject = uid2object( uid );
if ( sobject )
{
int entities = ProcessEvent( new TGetEntitiesEvent( sobject->GetID().c_str(), viewUid ) );
/////////////////////////////////////////////////////////////////
/// \brief Initialize %SMESH GUI Python interface.
/// \deprecated Interface is initialized automatically.
-/// \param studyID Study UID (not used).
/////////////////////////////////////////////////////////////////
-void SMESH_Swig::Init(int /*studyID*/)
+void SMESH_Swig::Init()
{
deprecated("SMESH_Swig::Init");
// does nothing; initialization is done automatically.
/////////////////////////////////////////////////////////////////
/// \deprecated Publishing is done automatically.
-/// \deprecated Synonim of AddNewAlgorithm().
+/// \deprecated Synonym of AddNewAlgorithm().
/// \param ior IOR of the algorithm.
/// \param name Name of the algorithm (optional).
/// \return UID of the data object.
const char* SMESH_Swig::AddSubMesh(const char* /*meshUid*/,
const char* ior,
int /*shapeType*/,
- const char* name)
+ const char* name)
{
deprecated("SMESH_Swig::AddSubMesh", "SMESH_Swig::publish");
return publish( ior, name );
const char* /*shapeUid*/,
const char* ior,
int /*shapeType*/,
- const char* name)
+ const char* name)
{
deprecated("SMESH_Swig::AddSubMeshOnShape", "SMESH_Swig::publish");
return publish( ior, name );
if ( !selMgr )
return;
-
+
selMgr->clearFilters();
SVTK_ViewWindow* vw = SMESH::GetViewWindow();
return;
SMESH_Actor* actor = SMESH::FindActorByEntry( myUid );
-
+
if ( !actor || !actor->hasIO() )
return;
-
+
Handle(SALOME_InteractiveObject) io = actor->getIO();
SALOME_ListIO ios;
ios.Append( io );
if ( vw->SelectionMode() == ActorSelection )
return;
-
- TColStd_MapOfInteger idMap;
+
+ SVTK_TVtkIDsMap idMap;
std::vector<int>::const_iterator it;
for ( it = myIds.begin(); it != myIds.end(); ++it )
{
{
init();
- _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
+ _PTR(SObject) sobject = uid2object( uid );
if ( sobject )
ProcessVoidEvent( new TSelectListEvent( sobject->GetID().c_str(), ids, append ) );
}
-
+
/////////////////////////////////////////////////////////////////
/// \brief Select element of the mesh, sub-mesh or group.
/// \param uid Mesh object's study UID or IOR.
std::vector<int> ids;
ids.push_back( id );
- _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
+ _PTR(SObject) sobject = uid2object( uid );
if ( sobject )
ProcessVoidEvent( new TSelectListEvent( sobject->GetID().c_str(), ids, append ) );
}
if ( !selMgr )
return;
-
+
selMgr->clearFilters();
SVTK_ViewWindow* vw = SMESH::GetViewWindow();
return;
SMESH_Actor* actor = SMESH::FindActorByEntry( myUid );
-
+
if ( !actor || !actor->hasIO() )
return;
-
+
Handle(SALOME_InteractiveObject) io = actor->getIO();
SALOME_ListIO ios;
ios.Append( io );
if ( vw->SelectionMode() != EdgeOfCellSelection )
return;
-
- SVTK_IndexedMapOfIds idMap;
+
+ SVTK_IndexedMapOfVtkIds idMap;
std::vector<std::pair<int, int> >::const_iterator it;
for ( it = myIds.begin(); it != myIds.end(); ++it )
{
- std::vector<int> pair;
+ std::vector<vtkIdType> pair;
pair.push_back( (*it).first );
pair.push_back( (*it).second );
idMap.Add( pair );
{
init();
- _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
+ _PTR(SObject) sobject = uid2object( uid );
if ( sobject )
ProcessVoidEvent( new TSelectListOfPairEvent( sobject->GetID().c_str(), ids, append ) );
}
{
SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>( model->getViewManager()->getActiveView() );
if ( vw )
- myResult = (SelectionMode)vw->SelectionMode();
+ myResult = (SelectionMode)vw->SelectionMode();
}
}
};
SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>( model->getViewManager()->getActiveView() );
if ( vw )
{
- SelectionMode previousMode = (SelectionMode)vw->SelectionMode();
- bool switchPointMode = ( previousMode == Node && mySelectionMode != Node ) ||
- ( previousMode != Node && mySelectionMode == Node );
- if ( switchPointMode )
- {
- vtkRenderer* renderer = vw->getRenderer();
- VTK::ActorCollectionCopy actors( renderer->GetActors() );
- vtkActorCollection* collection = actors.GetActors();
- collection->InitTraversal();
- while ( vtkActor* vtkActor = collection->GetNextActor() )
- {
- if ( SMESH_Actor* actor = dynamic_cast<SMESH_Actor*>( vtkActor ) )
- {
- if ( actor->GetVisibility() )
- actor->SetPointRepresentation( mySelectionMode == Node );
- }
- }
- }
- vw->SetSelectionMode( mySelectionMode );
+ SelectionMode previousMode = (SelectionMode)vw->SelectionMode();
+ bool switchPointMode = ( previousMode == Node && mySelectionMode != Node ) ||
+ ( previousMode != Node && mySelectionMode == Node );
+ if ( switchPointMode )
+ {
+ vtkRenderer* renderer = vw->getRenderer();
+ VTK::ActorCollectionCopy actors( renderer->GetActors() );
+ vtkActorCollection* collection = actors.GetActors();
+ collection->InitTraversal();
+ while ( vtkActor* vtkActor = collection->GetNextActor() )
+ {
+ if ( SMESH_Actor* actor = dynamic_cast<SMESH_Actor*>( vtkActor ) )
+ {
+ if ( actor->GetVisibility() )
+ actor->SetPointRepresentation( mySelectionMode == Node );
+ }
+ }
+ }
+ vw->SetSelectionMode( mySelectionMode );
}
}
}
void SMESH_Swig::setSelectionMode(SelectionMode mode, int viewUid)
{
init();
- ProcessVoidEvent( new TSetSelectionModeEvent( mode, viewUid ) );
+ ProcessVoidEvent( new TSetSelectionModeEvent( mode, viewUid ) );
}
/////////////////////////////////////////////////////////////////
typedef std::vector<int> TResult;
TResult myResult;
const char* myUid;
-
+
TGetSelectedEvent( const char* uid )
: myUid( uid ) {}
-
+
virtual void Execute()
{
SVTK_ViewWindow* vw = SMESH::GetViewWindow();
if ( !vw )
return;
- SVTK_Selector* selector = vw->GetSelector();
+ SVTK_Selector* selector = vw->GetSelector();
if ( !selector )
return;
if ( !actor || !actor->hasIO() )
return;
- TColStd_IndexedMapOfInteger idMap;
+ SVTK_TIndexedMapOfVtkId idMap;
selector->GetIndex( actor->getIO(), idMap );
for ( int i = 1; i <= idMap.Extent(); i++ )
- myResult.push_back( idMap( i ) );
+ myResult.push_back( (int)idMap( i ) );
}
};
init();
- _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
+ _PTR(SObject) sobject = uid2object( uid );
if ( sobject )
ids = ProcessEvent( new TGetSelectedEvent( sobject->GetID().c_str() ) );
typedef std::vector<std::pair<int, int> > TResult;
TResult myResult;
const char* myUid;
-
+
TGetSelectedPairEvent( const char* uid )
: myUid( uid ) {}
-
+
virtual void Execute()
{
SVTK_ViewWindow* vw = SMESH::GetViewWindow();
if ( vw->SelectionMode() != EdgeOfCellSelection )
return;
- SVTK_Selector* selector = vw->GetSelector();
+ SVTK_Selector* selector = vw->GetSelector();
if ( !selector )
return;
if ( !actor || !actor->hasIO() )
return;
- SVTK_IndexedMapOfIds idMap;
+ SVTK_IndexedMapOfVtkIds idMap;
selector->GetCompositeIndex( actor->getIO(), idMap );
- for ( int i = 1; i <= idMap.Extent(); i++ )
- myResult.push_back( std::make_pair<int,int>( (int)idMap( i )[0], (int)idMap( i )[1]) );
+ for ( int i = 1; i <= idMap.Extent(); i++ ) {
+ myResult.push_back( std::make_pair( (int)idMap(i)[0], (int)idMap(i)[1]) );
+ }
}
};
init();
- _PTR(SObject) sobject = uid2object( myCachedStudyId, uid );
+ _PTR(SObject) sobject = uid2object( uid );
if ( sobject )
pairs = ProcessEvent( new TGetSelectedPairEvent( sobject->GetID().c_str() ) );