Salome HOME
Update Help for VISU module.
[modules/visu.git] / src / VISUGUI / VisuGUI_Displayer.cxx
index 0d604a34559ce4bf70959f55340b1cd07cae876a..bcfffa772294744ddb3810aca7e4ef7ed5c8c996 100644 (file)
@@ -212,3 +212,30 @@ SPlot2d_Prs* VisuGUI_Displayer::buildTable( Plot2d_ViewWindow* wnd, VISU::Table_
   }
   return prs;
 }
+
+bool VisuGUI_Displayer::canBeDisplayed( const QString& entry, const QString& viewer_type ) const
+{
+  SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( myApp->activeStudy() );
+  if( !study )
+    return false;
+
+  _PTR(SObject) obj = study->studyDS()->FindObjectID( entry.latin1() );
+  CORBA::Object_var anObj = VISU::ClientSObjectToObject( obj );
+  if( CORBA::is_nil( anObj ) )
+    return false;
+
+  if( viewer_type==SVTK_Viewer::Type() )
+  {
+    VISU::Prs3d_i* thePrs = dynamic_cast<VISU::Prs3d_i*>( VISU::GetServant( anObj ).in() );
+    return thePrs;
+  }
+  else if( viewer_type==SPlot2d_Viewer::Type() )
+  {
+    VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>( VISU::GetServant( anObj ).in() );
+    VISU::Container_i* aCont = dynamic_cast<VISU::Container_i*>( VISU::GetServant( anObj ).in() );
+    VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant( anObj ).in() );
+    return aCurve || aCont || aTable;
+  }
+  else 
+    return false;
+}