Version: 6.3.1
Public Member Functions | Protected Member Functions | Private Attributes

SMESHGUI_Displayer Class Reference

#include <SMESHGUI_Displayer.h>

Inheritance diagram for SMESHGUI_Displayer:
Inheritance graph
[legend]

Public Member Functions

 SMESHGUI_Displayer (SalomeApp_Application *)
 ~SMESHGUI_Displayer ()
virtual SALOME_Prs * buildPresentation (const QString &, SALOME_View *=0)
virtual bool canBeDisplayed (const QString &, const QString &) const

Protected Member Functions

SalomeApp_Study * study () const

Private Attributes

SalomeApp_Application * myApp

Detailed Description

Definition at line 39 of file SMESHGUI_Displayer.h.


Constructor & Destructor Documentation

SMESHGUI_Displayer::SMESHGUI_Displayer ( SalomeApp_Application *  app)

Definition at line 47 of file SMESHGUI_Displayer.cxx.

: LightApp_Displayer(),
  myApp( app )
{
}
SMESHGUI_Displayer::~SMESHGUI_Displayer ( )

Definition at line 53 of file SMESHGUI_Displayer.cxx.

{
}

Member Function Documentation

SALOME_Prs * SMESHGUI_Displayer::buildPresentation ( const QString &  entry,
SALOME_View *  theViewFrame = 0 
) [virtual]

Definition at line 57 of file SMESHGUI_Displayer.cxx.

References SMESH.CreateActor(), SMESH.DisplayActor(), SMESH.FindActorByEntry(), SMESH.RemoveActor(), and study().

{
  SALOME_Prs* prs = 0;

  SALOME_View* aViewFrame = theViewFrame ? theViewFrame : GetActiveView();

  if ( aViewFrame )
  {
    SVTK_Viewer* vtk_viewer = dynamic_cast<SVTK_Viewer*>( aViewFrame );
    if( vtk_viewer )
    {
      SUIT_ViewWindow* wnd = vtk_viewer->getViewManager()->getActiveView();
      SMESH_Actor* anActor = SMESH::FindActorByEntry( wnd, entry.toLatin1().data() );
      if( !anActor )
        anActor = SMESH::CreateActor( study()->studyDS(), entry.toLatin1().data(), true );
      if( anActor )
      {
        SMESH::DisplayActor( wnd, anActor );
        prs = LightApp_Displayer::buildPresentation( entry.toLatin1().data(), aViewFrame );
      }
      if( prs )
        UpdatePrs( prs );
      else if( anActor )
        SMESH::RemoveActor( vtk_viewer->getViewManager()->getActiveView(), anActor );
    }
  }

  return prs;
}
bool SMESHGUI_Displayer::canBeDisplayed ( const QString &  entry,
const QString &  viewer_type 
) const [virtual]

Definition at line 92 of file SMESHGUI_Displayer.cxx.

References _PTR(), myApp, SMESH_AdvancedEditor.res, SMESH.SObjectToObject(), and study().

                                                                                                {
  bool res = false;
  if(viewer_type != SVTK_Viewer::Type())
    return res;
  
  SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( myApp->activeStudy() );
  if( !study )
    return res;
  
  
  _PTR(SObject) obj = study->studyDS()->FindObjectID( (const char*)entry.toLatin1() );
  CORBA::Object_var anObj = SMESH::SObjectToObject( obj );
  
    /*
    if( !CORBA::is_nil( anObj ) ) {
    SMESH::SMESH_Mesh_var mesh = SMESH::SMESH_Mesh::_narrow( anObj );
    if ( ! mesh->_is_nil() )
    res = (mesh->NbNodes() > 0);
    
    SMESH::SMESH_subMesh_var aSubMeshObj = SMESH::SMESH_subMesh::_narrow( anObj );
    if ( !aSubMeshObj->_is_nil() )
    res = (aSubMeshObj->GetNumberOfNodes(true) > 0);
    
    SMESH::SMESH_GroupBase_var aGroupObj = SMESH::SMESH_GroupBase::_narrow( anObj );
    if ( !aGroupObj->_is_nil() )
    res = !aGroupObj->IsEmpty();
    }*/
  if( !CORBA::is_nil( anObj ) ) {
    if(!SMESH::SMESH_Mesh::_narrow( anObj )->_is_nil() ||
       !SMESH::SMESH_subMesh::_narrow( anObj )->_is_nil() ||
       !SMESH::SMESH_GroupBase::_narrow( anObj )->_is_nil())
    res = true;
  }
  return res;
}
SalomeApp_Study * SMESHGUI_Displayer::study ( ) const [protected]

Definition at line 87 of file SMESHGUI_Displayer.cxx.

References myApp.

Referenced by buildPresentation(), and canBeDisplayed().

{
  return dynamic_cast<SalomeApp_Study*>( myApp->activeStudy() );
}

Field Documentation

SalomeApp_Application* SMESHGUI_Displayer.myApp [private]

Definition at line 52 of file SMESHGUI_Displayer.h.

Referenced by canBeDisplayed(), and study().

Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS