Salome HOME
EDF 2281 : Possibility to choose the division pattern for the cylinder and missing...
[modules/geom.git] / src / GEOMGUI / GEOMGUI_Selection.cxx
index 6079aa75e1e45b5f3a3204cc6ddf0a9c113deba1..73423426981974a01dcf79fef35cc8fd86196a54 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -64,6 +64,7 @@
 #include <AIS_ListOfInteractive.hxx>
 #include <AIS_GraphicTool.hxx>
 #include <AIS_Drawer.hxx>
+#include <Aspect_TypeOfFacingModel.hxx>
 #include <Prs3d_ShadingAspect.hxx>
 #include<Graphic3d_MaterialAspect.hxx>
 
@@ -310,7 +311,13 @@ QString GEOMGUI_Selection::displayMode( const int index ) const
          if ( lst.Extent() ) {
            Handle(AIS_InteractiveObject) io = lst.First();
            if ( !io.IsNull() ) {
-             int dm = io->DisplayMode();
+        int dm;
+        Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(io);
+        if(!aSh.IsNull()) {
+          dm = aSh->isTopLevel() ? aSh->prevDisplayMode() : aSh->DisplayMode();
+        } else {
+          dm = io->DisplayMode();
+        }
              OCC_DISPLAY_MODE_TO_STRING( res, dm );
              if ( res.isEmpty() ) { // return default display mode of AIS_InteractiveContext
                OCCViewer_Viewer* occViewer = (OCCViewer_Viewer*)SUIT_Session::session()->activeApplication()->
@@ -568,8 +575,9 @@ bool GEOMGUI_Selection::isPhysicalMaterial( const int idx ) const{
    bool found = false;
    QVariant v = visibleProperty( entry( idx ), MATERIAL_PROP );
    if ( v.canConvert<QString>() ) {
-     Material_Model* aModel = Material_Model::getMaterialModel( v.toString().split(DIGIT_SEPARATOR) );
-     res = aModel->isPhysical();
+     Material_Model material;
+     material.fromProperties( v.toString() );
+     res = material.isPhysical();
      found = true;
    }
 
@@ -589,8 +597,8 @@ bool GEOMGUI_Selection::isPhysicalMaterial( const int idx ) const{
              if ( !io.IsNull() ) {
                Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(io);
                if ( !aSh.IsNull() )
-                 res =(bool) aSh->Attributes()->ShadingAspect()->
-                      Material(Aspect_TypeOfFacingModel::Aspect_TOFM_BOTH_SIDE).MaterialType( Graphic3d_MATERIAL_PHYSIC );
+                 res = (bool) aSh->Attributes()->ShadingAspect()->
+                        Material(Aspect_TOFM_BOTH_SIDE).MaterialType( Graphic3d_MATERIAL_PHYSIC );
              }
            }
          }