Back to index

salome-geom  6.5.0
GEOMGUI_Selection.cxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 // File   : GEOMGUI_Selection.cxx
00024 // Author : Alexander SOLOVYOV, Open CASCADE S.A.S. (alexander.solovyov@opencascade.com)
00025 //
00026 #include "GEOMGUI_Selection.h"
00027 
00028 #include "GeometryGUI.h"
00029 #include "GEOM_Displayer.h"
00030 
00031 #include "Material_Model.h"
00032 
00033 #include <GEOM_Constants.h>
00034 
00035 #include <SalomeApp_Application.h>
00036 #include <SalomeApp_Study.h>
00037 
00038 #include "LightApp_DataOwner.h"
00039 
00040 #include <SUIT_Session.h>
00041 #include <SUIT_Desktop.h>
00042 #include <SUIT_ViewWindow.h>
00043 #include <SUIT_ViewManager.h>
00044 
00045 #include <SALOME_Prs.h>
00046 #include <SALOME_InteractiveObject.hxx>
00047 
00048 #include <SOCC_Prs.h>
00049 #include <SVTK_Prs.h>
00050 #include <SALOME_Actor.h>
00051 #include <GEOM_Actor.h>
00052 
00053 #include <OCCViewer_ViewModel.h>
00054 #include <SVTK_ViewModel.h>
00055 
00056 #include <GEOMImpl_Types.hxx>
00057 
00058 #include <GEOM_AISShape.hxx>
00059 #include <GEOM_VTKPropertyMaterial.hxx>
00060 
00061 // OCCT Includes
00062 #include <AIS.hxx>
00063 #include <AIS_InteractiveObject.hxx>
00064 #include <AIS_ListOfInteractive.hxx>
00065 #include <AIS_GraphicTool.hxx>
00066 #include <AIS_Drawer.hxx>
00067 #include <Aspect_TypeOfFacingModel.hxx>
00068 #include <Prs3d_ShadingAspect.hxx>
00069 #include<Graphic3d_MaterialAspect.hxx>
00070 
00071 // VTK Includes
00072 #include <vtkActorCollection.h>
00073 
00074 #define OCC_DISPLAY_MODE_TO_STRING( str, dm ) { \
00075     if ( dm == AIS_WireFrame ) \
00076       str = QString( "Wireframe" ); \
00077     else if ( dm == AIS_Shaded )    \
00078       str = QString( "Shading" ); \
00079     else if ( dm == GEOM_AISShape::ShadingWithEdges )    \
00080       str = QString( "ShadingWithEdges" ); \
00081     else if ( dm == GEOM_AISShape::TexturedShape )    \
00082       str = QString( "Texture" ); \
00083     else \
00084       str = QString(); }
00085 
00086 #define VTK_DISPLAY_MODE_TO_STRING( str, dm ) { \
00087     if ( dm == 0 ) \
00088       str = QString( "Wireframe" ); \
00089     else if ( dm == 1 )    \
00090       str = QString( "Shading" ); \
00091     else if ( dm == 3 )    \
00092       str = QString( "ShadingWithEdges" ); \
00093     else \
00094       str = QString(); }
00095 
00096 #define USE_VISUAL_PROP_MAP
00097 
00098 GEOMGUI_Selection::GEOMGUI_Selection()
00099 : LightApp_Selection()
00100 {
00101 }
00102 
00103 GEOMGUI_Selection::~GEOMGUI_Selection()
00104 {
00105 }
00106 
00107 void GEOMGUI_Selection::init( const QString& context, LightApp_SelectionMgr* selMgr )
00108 {
00109   LightApp_Selection::init( context, selMgr );
00110 
00111   myObjects.resize( count() );
00112 
00113   SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( study() );
00114   if ( appStudy ) {
00115     _PTR(Study) study = appStudy->studyDS();
00116     for ( int idx = 0; idx < count(); idx++ ) {
00117       QString anEntry = entry( idx );
00118       if ( study && !anEntry.isEmpty() ) {
00119        _PTR(SObject) aSO( study->FindObjectID( anEntry.toStdString() ) );
00120        if ( aSO ) {
00121          CORBA::Object_var varObj = GeometryGUI::ClientSObjectToObject( aSO );
00122          myObjects[idx] = GEOM::GEOM_Object::_narrow( varObj );
00123        }
00124       }
00125     }
00126   }
00127 }
00128 
00129 //QVariant GEOMGUI_Selection::contextParameter( const QString& p ) const
00130 QVariant GEOMGUI_Selection::parameter( const QString& p ) const
00131 {
00132   QVariant v;
00133   if ( p == "isOCC" )
00134     v = activeViewType() == OCCViewer_Viewer::Type();
00135   else if ( p == "selectionmode" )
00136     v = selectionMode();
00137   else if ( p == "hasImported" )
00138     v = hasImported();
00139   else if ( p == "allImported" )
00140     v = allImported();
00141   else
00142     v = LightApp_Selection::parameter( p );
00143   return v;
00144 }
00145 
00146 //QVariant GEOMGUI_Selection::objectParameter( const int idx, const QString& p ) const
00147 QVariant GEOMGUI_Selection::parameter( const int idx, const QString& p ) const
00148 {
00149   QVariant v;
00150   if ( p == "type" )
00151     v = typeName( idx );
00152   else if ( p == "typeid" )
00153     v = typeId( idx );
00154   else if ( p == "displaymode" )
00155     v = displayMode( idx );
00156   else if ( p == "isAutoColor" )
00157     v = isAutoColor( idx );
00158   else if ( p == "isVectorsMode" )
00159     v = isVectorsMode( idx );
00160   else if ( p == "topLevel" )
00161     v = topLevel( idx );
00162   else if ( p == "hasHiddenChildren" )
00163     v = hasHiddenChildren( idx );
00164   else if ( p == "hasShownChildren" )
00165     v = hasShownChildren( idx );
00166   else if ( p == "compoundOfVertices" )
00167     v = compoundOfVertices( idx );
00168   else if ( p == "imported" )
00169     v = isImported( idx );
00170   else if ( p == "isPhysicalMaterial" )
00171     v = isPhysicalMaterial(idx);
00172   else
00173     v = LightApp_Selection::parameter( idx, p );
00174 
00175   return v;
00176 }
00177 
00178 // the method to skip temporary objects from selection (called from LightApp)
00179 bool GEOMGUI_Selection::processOwner( const LightApp_DataOwner* theOwner )
00180 {
00181   return !theOwner->entry().contains("_");
00182 }
00183 
00184 QString GEOMGUI_Selection::typeName( const int index ) const
00185 {
00186   if ( isComponent( index ) )
00187     return "Component";
00188 
00189   static QString aGroup( "Group" );
00190   static QString aShape( "Shape" );
00191   static QString anUnknown( "Unknown" );
00192 
00193   GEOM::GEOM_Object_var anObj = getObject( index );
00194   if ( !CORBA::is_nil( anObj ) ) {
00195     const int aGeomType = anObj->GetType();
00196     if ( aGeomType == GEOM_GROUP )
00197       return aGroup;
00198     else
00199       return aShape;
00200   }
00201   return anUnknown;
00202 }
00203 
00204 int GEOMGUI_Selection::typeId( const int index ) const
00205 {
00206   int aType = -1;
00207   GEOM::GEOM_Object_var anObj = getObject( index );
00208   if ( !CORBA::is_nil( anObj ) )
00209     aType = (int)anObj->GetShapeType();
00210   return aType;
00211 }
00212 
00213 bool GEOMGUI_Selection::isVisible( const int index ) const
00214 {
00215   bool res = false;
00216 
00217 #ifdef USE_VISUAL_PROP_MAP
00218   bool found = false;
00219   QVariant v = visibleProperty( entry( index ), VISIBILITY_PROP );
00220   if ( v.canConvert( QVariant::Bool ) ) {
00221     res = v.toBool();
00222     found = true;
00223   }
00224 
00225   if ( !found ) {
00226 #endif
00227     GEOM::GEOM_Object_var obj = getObject( index );
00228     SALOME_View* view = GEOM_Displayer::GetActiveView();
00229     if ( !CORBA::is_nil( obj ) && view ) {
00230       Handle(SALOME_InteractiveObject) io = new SALOME_InteractiveObject( entry( index ).toLatin1().constData(), "GEOM", "TEMP_IO" );
00231       res = view->isVisible( io );
00232     }
00233 #ifdef USE_VISUAL_PROP_MAP
00234   }
00235 #endif
00236 
00237   return res;
00238 }
00239 
00240 bool GEOMGUI_Selection::isAutoColor( const int index ) const
00241 {
00242   GEOM::GEOM_Object_var obj = getObject( index );
00243   if ( !CORBA::is_nil( obj ) )
00244     return obj->GetAutoColor();
00245   return false;
00246 }
00247 
00248 bool GEOMGUI_Selection::isImported( const int index ) const
00249 {
00250   GEOM::GEOM_Object_var obj = getObject( index );
00251   if ( !CORBA::is_nil( obj ) )
00252     return obj->GetType() == GEOM_IMPORT;
00253   return false;
00254 }
00255 
00256 bool GEOMGUI_Selection::hasImported() const
00257 {
00258   bool res = false;
00259   for ( int i = 0; i < count() && !res; i++ )
00260     res = isImported( i );
00261   return res;
00262 }
00263 
00264 bool GEOMGUI_Selection::allImported() const
00265 {
00266   bool res = true;
00267   for ( int i = 0; i < count() && res; i++ )
00268     res = isImported( i );
00269   return res;
00270 }
00271 
00272 QVariant GEOMGUI_Selection::visibleProperty( const QString& entry, const QString& propName ) const
00273 {
00274   QVariant v;
00275   LightApp_Study* aStudy = study();
00276   if ( aStudy ) {
00277     LightApp_Application* anApp = ::qobject_cast<LightApp_Application*>( aStudy->application() );
00278     if ( anApp && anApp->activeViewManager() ) {
00279       int id = anApp->activeViewManager()->getGlobalId();
00280       v = aStudy->getObjectProperty( id, entry, propName, QVariant() );
00281     }
00282   }
00283   return v;
00284 }
00285 
00286 QString GEOMGUI_Selection::displayMode( const int index ) const
00287 {
00288   QString res;
00289   QString viewType = activeViewType();
00290 #ifdef USE_VISUAL_PROP_MAP
00291   QVariant v = visibleProperty( entry( index ), DISPLAY_MODE_PROP );
00292   if ( v.canConvert( QVariant::Int ) ) {
00293     int dm = v.toInt();
00294     if ( viewType == OCCViewer_Viewer::Type() ) {
00295       OCC_DISPLAY_MODE_TO_STRING( res, dm );
00296     } else if ( viewType == SVTK_Viewer::Type() ) {
00297       VTK_DISPLAY_MODE_TO_STRING( res, dm );
00298     }
00299   }
00300 
00301   if ( res.isEmpty() ) {
00302 #endif
00303     SALOME_View* view = GEOM_Displayer::GetActiveView();
00304     if ( view /*fix for 9320==>*/&& ( viewType == OCCViewer_Viewer::Type() || viewType == SVTK_Viewer::Type() ) ) {
00305       SALOME_Prs* prs = view->CreatePrs( entry( index ).toLatin1().constData() );
00306       if ( prs ) {
00307        if ( viewType == OCCViewer_Viewer::Type() ) { // assuming OCC
00308          SOCC_Prs* occPrs = (SOCC_Prs*) prs;
00309          AIS_ListOfInteractive lst;
00310          occPrs->GetObjects( lst );
00311          if ( lst.Extent() ) {
00312            Handle(AIS_InteractiveObject) io = lst.First();
00313            if ( !io.IsNull() ) {
00314              int dm = io->DisplayMode();
00315              OCC_DISPLAY_MODE_TO_STRING( res, dm );
00316              if ( res.isEmpty() ) { // return default display mode of AIS_InteractiveContext
00317               OCCViewer_Viewer* occViewer = (OCCViewer_Viewer*)SUIT_Session::session()->activeApplication()->
00318                 desktop()->activeWindow()->getViewManager()->getViewModel();
00319               Handle(AIS_InteractiveContext) ic = occViewer->getAISContext();
00320               dm = ic->DisplayMode();
00321               OCC_DISPLAY_MODE_TO_STRING( res, dm );
00322              }
00323            }
00324          }
00325        }
00326   else if ( viewType == SVTK_Viewer::Type() ) { // assuming VTK
00327          SVTK_Prs* vtkPrs = dynamic_cast<SVTK_Prs*>( prs );
00328          vtkActorCollection* lst = vtkPrs ? vtkPrs->GetObjects() : 0;
00329          if ( lst ) {
00330            lst->InitTraversal();
00331            vtkActor* actor = lst->GetNextActor();
00332            if ( actor ) {
00333              SALOME_Actor* salActor = dynamic_cast<SALOME_Actor*>( actor );
00334              if ( salActor ) {
00335               int dm = salActor->getDisplayMode();
00336               VTK_DISPLAY_MODE_TO_STRING( res, dm );
00337              } // if ( salome actor )
00338            } // if ( actor )
00339          } // if ( lst == vtkPrs->GetObjects() )
00340        } // if VTK
00341       }
00342     }
00343 
00344 #ifdef USE_VISUAL_PROP_MAP
00345   }
00346 #endif
00347 
00348   return res;
00349 }
00350 
00351 bool GEOMGUI_Selection::isVectorsMode( const int index ) const
00352 {
00353   bool res = false;
00354 
00355 #ifdef USE_VISUAL_PROP_MAP
00356   bool found = false;
00357   QVariant v = visibleProperty( entry( index ), VECTOR_MODE_PROP );
00358   if ( v.canConvert( QVariant::Bool ) ) {
00359     res = v.toBool();
00360     found = true;
00361   }
00362 
00363   if ( !found ) {
00364 #endif
00365     SALOME_View* view = GEOM_Displayer::GetActiveView();
00366     QString viewType = activeViewType();
00367     if ( view && ( viewType == OCCViewer_Viewer::Type() || viewType == SVTK_Viewer::Type() ) ) {
00368       SALOME_Prs* prs = view->CreatePrs( entry( index ).toLatin1().constData() );
00369       if ( prs ) {
00370        if ( viewType == OCCViewer_Viewer::Type() ) { // assuming OCC
00371          SOCC_Prs* occPrs = (SOCC_Prs*) prs;
00372          AIS_ListOfInteractive lst;
00373          occPrs->GetObjects( lst );
00374          if ( lst.Extent() ) {
00375            Handle(AIS_InteractiveObject) io = lst.First();
00376            if ( !io.IsNull() ) {
00377              Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(io);
00378              if ( !aSh.IsNull() )
00379               res = aSh->isShowVectors();
00380            }
00381          }
00382        } else if ( viewType == SVTK_Viewer::Type() ) { // assuming VTK
00383          SVTK_Prs* vtkPrs = dynamic_cast<SVTK_Prs*>( prs );
00384          vtkActorCollection* lst = vtkPrs ? vtkPrs->GetObjects() : 0;
00385          if ( lst ) {
00386            lst->InitTraversal();
00387            vtkActor* actor = lst->GetNextActor();
00388            if ( actor ) {
00389              GEOM_Actor* aGeomActor = GEOM_Actor::SafeDownCast(actor);
00390              if ( aGeomActor )
00391               res = aGeomActor->GetVectorMode();
00392            }
00393          }
00394        }
00395       }
00396     }
00397 #ifdef USE_VISUAL_PROP_MAP
00398   }
00399 #endif
00400 
00401   return res;
00402 }
00403 
00404 bool GEOMGUI_Selection::hasChildren( const _PTR(SObject)& obj )
00405 {
00406   bool ok = false;
00407   if ( obj ) {
00408     _PTR(ChildIterator) it ( obj->GetStudy()->NewChildIterator( obj ) );
00409     for ( ; it->More() && !ok; it->Next() ) {
00410       _PTR(SObject) child = it->Value();
00411       if ( child ) {
00412         _PTR(SObject) refObj;
00413         if ( child->ReferencedObject( refObj ) ) continue; // omit references
00414         if ( child->GetName() != "" ) ok = true;
00415       }
00416     }
00417   }
00418   return ok;
00419 }
00420 
00421 bool GEOMGUI_Selection::expandable( const _PTR(SObject)& obj )
00422 {
00423   bool exp = true;
00424   _PTR(GenericAttribute) anAttr;
00425   if ( obj && obj->FindAttribute( anAttr, "AttributeExpandable" ) ) {
00426     _PTR(AttributeExpandable) aAttrExp = anAttr;
00427     exp = aAttrExp->IsExpandable();
00428   }
00429   return exp;
00430 }
00431 
00432 bool GEOMGUI_Selection::isCompoundOfVertices( GEOM::GEOM_Object_ptr obj )
00433 {
00434   bool ret = false;
00435   /*
00436   SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>
00437   (SUIT_Session::session()->activeApplication()->activeStudy());*/
00438   if ( /*appStudy && */!CORBA::is_nil( obj ) )
00439     ret = obj->GetShapeType() == GEOM::COMPOUND && obj->GetMaxShapeType() == GEOM::VERTEX;
00440   return ret;
00441 }
00442 
00443 bool GEOMGUI_Selection::hasHiddenChildren( const int index ) const
00444 {
00445   bool OK = false;
00446   SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( study() );
00447 
00448   if ( appStudy ) {
00449     QString anEntry = entry( index );
00450     _PTR(Study) study = appStudy->studyDS();
00451     if ( study && !anEntry.isEmpty() ) {
00452       _PTR(SObject) aSO( study->FindObjectID( anEntry.toStdString() ) );
00453       OK = !expandable( aSO ) && hasChildren( aSO );
00454     }
00455   }
00456   return OK;
00457 }
00458 
00459 bool GEOMGUI_Selection::hasShownChildren( const int index ) const
00460 {
00461   bool OK = false;
00462   SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( study() );
00463 
00464   if ( appStudy )  {
00465     QString anEntry = entry( index );
00466     _PTR(Study) study = appStudy->studyDS();
00467     if ( study && !anEntry.isEmpty() ) {
00468       _PTR(SObject) aSO( study->FindObjectID( anEntry.toStdString() ) );
00469       OK = expandable( aSO ) && hasChildren( aSO );
00470     }
00471   }
00472   return OK;
00473 }
00474 
00475 bool GEOMGUI_Selection::compoundOfVertices( const int index ) const
00476 {
00477   GEOM::GEOM_Object_var obj = getObject( index );
00478   return isCompoundOfVertices( obj );
00479 }
00480 
00481 bool GEOMGUI_Selection::isComponent( const int index ) const
00482 {
00483   SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( study() );
00484 
00485   if ( appStudy ) {
00486     QString anEntry = entry( index );
00487     _PTR(Study) study = appStudy->studyDS();
00488     if ( study && !anEntry.isNull() ) {
00489       _PTR(SObject) aSO( study->FindObjectID( anEntry.toStdString() ) );
00490       if ( aSO && aSO->GetFatherComponent() )
00491         return aSO->GetFatherComponent()->GetIOR() == aSO->GetIOR();
00492     }
00493   }
00494   return false;
00495 }
00496 
00497 GEOM::GEOM_Object_ptr GEOMGUI_Selection::getObject( const int index ) const
00498 {
00499   GEOM::GEOM_Object_var o;
00500   if ( 0 <= index && index < myObjects.size() )
00501     o = GEOM::GEOM_Object::_duplicate( myObjects[index] );
00502   return o._retn();
00503 }
00504 
00505 QString GEOMGUI_Selection::selectionMode() const
00506 {
00507   SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( study()->application() );
00508   if ( app ) {
00509     GeometryGUI* aGeomGUI = dynamic_cast<GeometryGUI*>( app->module( "Geometry" ) );
00510     if ( aGeomGUI ) {
00511       switch ( aGeomGUI->getLocalSelectionMode() )
00512       {
00513         case GEOM_POINT      : return "VERTEX";
00514         case GEOM_EDGE       : return "EDGE";
00515         case GEOM_WIRE       : return "WIRE";
00516         case GEOM_FACE       : return "FACE";
00517         case GEOM_SHELL      : return "SHELL";
00518         case GEOM_SOLID      : return "SOLID";
00519         case GEOM_COMPOUND   : return "COMPOUND";
00520         case GEOM_ALLOBJECTS : return "ALL";
00521         default: return "";
00522       }
00523     }
00524   }
00525   return "";
00526 }
00527 
00528 bool GEOMGUI_Selection::topLevel( const int index ) const {
00529   bool res = false;
00530 
00531 #ifdef USE_VISUAL_PROP_MAP
00532   bool found = false;
00533   QVariant v = visibleProperty( entry( index ), TOP_LEVEL_PROP );
00534   if ( v.canConvert<bool>() ) {
00535     res = v.toBool();
00536     found = true;
00537   }
00538 
00539   if ( !found ) {
00540 #endif
00541     SALOME_View* view = GEOM_Displayer::GetActiveView();
00542     QString viewType = activeViewType();
00543     if ( view && viewType == OCCViewer_Viewer::Type() ) {
00544       SALOME_Prs* prs = view->CreatePrs( entry( index ).toLatin1().constData() );
00545       if ( prs ) {
00546        if ( viewType == OCCViewer_Viewer::Type() ) { // assuming OCC
00547          SOCC_Prs* occPrs = (SOCC_Prs*) prs;
00548          AIS_ListOfInteractive lst;
00549          occPrs->GetObjects( lst );
00550          if ( lst.Extent() ) {
00551            Handle(AIS_InteractiveObject) io = lst.First();
00552            if ( !io.IsNull() ) {
00553              Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(io);
00554              if ( !aSh.IsNull() )
00555               res = (bool)aSh->isTopLevel();
00556            }
00557          }
00558        }
00559       }
00560     }
00561   }
00562   return res;
00563 }
00564 
00565 bool GEOMGUI_Selection::isPhysicalMaterial( const int idx ) const{
00566    bool res = false;
00567 
00568 #ifdef USE_VISUAL_PROP_MAP
00569    bool found = false;
00570    QVariant v = visibleProperty( entry( idx ), MATERIAL_PROP );
00571    if ( v.canConvert<QString>() ) {
00572      Material_Model material;
00573      material.fromProperties( v.toString() );
00574      res = material.isPhysical();
00575      found = true;
00576    }
00577 
00578    if ( !found ) {
00579 #endif
00580      SALOME_View* view = GEOM_Displayer::GetActiveView();
00581      QString viewType = activeViewType();
00582      if ( view ) {
00583        SALOME_Prs* prs = view->CreatePrs( entry( idx ).toLatin1().constData() );
00584        if ( prs ) {
00585          if ( viewType == OCCViewer_Viewer::Type() ) { // assuming OCC
00586            SOCC_Prs* occPrs = (SOCC_Prs*) prs;
00587            AIS_ListOfInteractive lst;
00588            occPrs->GetObjects( lst );
00589            if ( lst.Extent() ) {
00590              Handle(AIS_InteractiveObject) io = lst.First();
00591              if ( !io.IsNull() ) {
00592                Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(io);
00593                if ( !aSh.IsNull() )
00594                  res = (bool) aSh->Attributes()->ShadingAspect()->
00595                       Material(Aspect_TOFM_BOTH_SIDE).MaterialType( Graphic3d_MATERIAL_PHYSIC );
00596              }
00597            }
00598          }
00599          else if ( viewType == SVTK_Viewer::Type() ) { // assuming VTK
00600                SVTK_Prs* vtkPrs = dynamic_cast<SVTK_Prs*>( prs );
00601                vtkActorCollection* lst = vtkPrs ? vtkPrs->GetObjects() : 0;
00602                if ( lst ) {
00603                  lst->InitTraversal();
00604                  vtkActor* actor = lst->GetNextActor();
00605                  if ( actor ) {
00606               GEOM_Actor* aGeomGActor = GEOM_Actor::SafeDownCast( actor );
00607                    if ( aGeomGActor ) {
00608                 GEOM_VTKPropertyMaterial* mat  = GEOM_VTKPropertyMaterial::SafeDownCast(aGeomGActor->GetProperty());
00609                 res = mat->GetPhysical();
00610                    } // if ( salome actor )
00611                  } // if ( actor )
00612           } // if ( lst == vtkPrs->GetObjects() )
00613          }
00614        }
00615      }
00616    }
00617    return res;
00618 }