void Remove(LightApp_SelectionMgr* theSelectionMgr,
const Handle(SALOME_InteractiveObject)& theIO);
- void RestoreSelection(VisuGUI* theModule, VISU::Prs3d_i* thePrs3d);
+ void RestoreSelection(VisuGUI* theModule, VISU::Prs3d_i* thePrs3d = NULL);
bool IsRemovableSelected(const SalomeApp_Module* theModule);
namespace VISU
{
//----------------------------------------------------------------------------
+ VISU_Actor*
+ PublishInView(VisuGUI* theModule,
+ Prs3d_i* thePrs,
+ SVTK_ViewWindow* theViewWindow,
+ bool theIsHighlight)
+ {
+ if (theViewWindow) {
+ QApplication::setOverrideCursor( Qt::waitCursor );
+ try {
+ if (VISU_Actor* anActor = thePrs->CreateActor()) {
+ theViewWindow->AddActor(anActor);
+ if (theIsHighlight)
+ theViewWindow->highlight(anActor->getIO(),true);
+ theViewWindow->getRenderer()->ResetCameraClippingRange();
+ theViewWindow->Repaint();
+ QApplication::restoreOverrideCursor();
+ return anActor;
+ }
+ } catch(std::exception& exc) {
+ thePrs->RemoveActors();
+
+ QApplication::restoreOverrideCursor();
+ INFOS(exc.what());
+ SUIT_MessageBox::warn1
+ (GetDesktop(theModule), QObject::tr("WRN_VISU"),
+ QObject::tr("ERR_CANT_CREATE_ACTOR") + ": " + QObject::tr(exc.what()),
+ QObject::tr("BUT_OK"));
+ }
+ }
+ return NULL;
+ }
+
+
+ //---------------------------------------------------------------
+ VISU_Actor*
+ UpdateViewer(VisuGUI* theModule,
+ VISU::Prs3d_i* thePrs,
+ bool theDispOnly,
+ const bool theIsHighlight)
+ {
+ if (SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(theModule)) {
+ vtkRenderer *aRen = aViewWindow->getRenderer();
+ vtkActorCollection *anActColl = aRen->GetActors();
+ anActColl->InitTraversal();
+ VISU_Actor* aResActor = NULL;
+ bool isOk = true;
+ while (vtkActor *anAct = anActColl->GetNextActor()) {
+ if (VISU_Actor* anActor = dynamic_cast<VISU_Actor*>(anAct)) {
+ if (VISU::Prs3d_i* aPrs3d = anActor->GetPrs3d()) {
+ if (thePrs == aPrs3d) {
+ try {
+ aResActor = anActor;
+ thePrs->UpdateActors();
+ aResActor->VisibilityOn();
+ } catch (std::runtime_error& exc) {
+ thePrs->RemoveActors();
+ isOk = false;
+
+ INFOS(exc.what());
+ SUIT_MessageBox::warn1
+ (GetDesktop(theModule), QObject::tr("WRN_VISU"),
+ QObject::tr("ERR_CANT_BUILD_PRESENTATION") + ": " + QObject::tr(exc.what()),
+ QObject::tr("BUT_OK"));
+ }
+ } else if (theDispOnly) {
+ anActor->VisibilityOff();
+ }
+ } else if (theDispOnly && anActor->GetVisibility()) {
+ anActor->VisibilityOff();
+ }
+ }
+ }
+ if (aResActor) {
+ if (theIsHighlight && isOk)
+ aViewWindow->highlight(aResActor->getIO(), true);
+ aViewWindow->getRenderer()->ResetCameraClippingRange();
+ aViewWindow->Repaint();
+ return aResActor;
+ }
+ return PublishInView(theModule, thePrs, aViewWindow, theIsHighlight);
+ }
+ return NULL;
+ }
+
+
+ //---------------------------------------------------------------
void
ErasePrs3d(VisuGUI* theModule,
VISU::Prs3d_i* thePrs,
//---------------------------------------------------------------
- inline
VISU_Actor*
PublishInView(VisuGUI* theModule,
Prs3d_i* thePrs,
SVTK_ViewWindow* theViewWindow,
- const bool theIsHighlight = false)
- {
- if (theViewWindow) {
- QApplication::setOverrideCursor( Qt::waitCursor );
- try {
- if (VISU_Actor* anActor = thePrs->CreateActor()) {
- theViewWindow->AddActor(anActor);
- if (theIsHighlight)
- theViewWindow->highlight(anActor->getIO(),true);
- theViewWindow->getRenderer()->ResetCameraClippingRange();
- theViewWindow->Repaint();
- QApplication::restoreOverrideCursor();
- return anActor;
- }
- } catch(std::exception& exc) {
- thePrs->RemoveActors();
-
- QApplication::restoreOverrideCursor();
- INFOS(exc.what());
- SUIT_MessageBox::warn1
- (GetDesktop(theModule), QObject::tr("WRN_VISU"),
- QObject::tr("ERR_CANT_CREATE_ACTOR") + ": " + QObject::tr(exc.what()),
- QObject::tr("BUT_OK"));
- }
- }
- return NULL;
- }
+ const bool theIsHighlight = false);
//---------------------------------------------------------------
UpdateViewer(VisuGUI* theModule,
VISU::Prs3d_i* thePrs,
bool theDispOnly = false,
- const bool theIsHighlight = false)
- {
- if (SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(theModule)) {
- vtkRenderer *aRen = aViewWindow->getRenderer();
- vtkActorCollection *anActColl = aRen->GetActors();
- anActColl->InitTraversal();
- VISU_Actor* aResActor = NULL;
- bool isOk = true;
- while (vtkActor *anAct = anActColl->GetNextActor()) {
- if (VISU_Actor* anActor = dynamic_cast<VISU_Actor*>(anAct)) {
- if (VISU::Prs3d_i* aPrs3d = anActor->GetPrs3d()) {
- if (thePrs == aPrs3d) {
- try {
- aResActor = anActor;
- thePrs->UpdateActors();
- aResActor->VisibilityOn();
- } catch (std::runtime_error& exc) {
- thePrs->RemoveActors();
- isOk = false;
-
- INFOS(exc.what());
- SUIT_MessageBox::warn1
- (GetDesktop(theModule), QObject::tr("WRN_VISU"),
- QObject::tr("ERR_CANT_BUILD_PRESENTATION") + ": " + QObject::tr(exc.what()),
- QObject::tr("BUT_OK"));
- }
- } else if (theDispOnly) {
- anActor->VisibilityOff();
- }
- } else if (theDispOnly && anActor->GetVisibility()) {
- anActor->VisibilityOff();
- }
- }
- }
- if (aResActor) {
- if (theIsHighlight && isOk)
- aViewWindow->highlight(aResActor->getIO(), true);
- aViewWindow->getRenderer()->ResetCameraClippingRange();
- aViewWindow->Repaint();
- return aResActor;
- }
- return PublishInView(theModule, thePrs, aViewWindow, theIsHighlight);
- }
- return NULL;
- }
+ const bool theIsHighlight = false);
//---------------------------------------------------------------