]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
Transparency for immersible zones correction(Bug #71).
authoradv <adv@opencascade.com>
Thu, 14 Nov 2013 08:51:54 +0000 (08:51 +0000)
committeradv <adv@opencascade.com>
Thu, 14 Nov 2013 08:51:54 +0000 (08:51 +0000)
src/HYDROGUI/HYDROGUI_Shape.cxx
src/HYDROGUI/HYDROGUI_Shape.h

index 9a6c0ca700144bd562ff588259b0508e277063a9..41cf8299ea3382dd0c9e3ac40d3942dc5de3bc96 100644 (file)
@@ -26,6 +26,7 @@
 #include "HYDROGUI_Tool.h"
 
 #include <AIS_Drawer.hxx>
+#include <AIS_TexturedShape.hxx>
 
 #include <BRepBuilderAPI_MakeEdge.hxx>
 #include <BRepBuilderAPI_MakeWire.hxx>
@@ -359,7 +360,17 @@ void HYDROGUI_Shape::buildShape()
   if ( myTopoShape.IsNull() )
     return;
 
-  myShape = new AIS_TexturedShape( myTopoShape );
+  QString aTextureFileName = getTextureFileName();
+  bool anIsTexture = !aTextureFileName.isEmpty();
+
+  if ( anIsTexture )
+  {
+    myShape = new AIS_TexturedShape( myTopoShape );
+  }
+  else
+  {
+    myShape = new AIS_Shape( myTopoShape );
+  }
 
   if ( !myObject.IsNull() )
     myShape->SetOwner( myObject );
@@ -367,12 +378,14 @@ void HYDROGUI_Shape::buildShape()
   myShape->SetTransparency( 0 );
   myShape->SetDisplayMode( (AIS_DisplayMode)myDisplayMode );
 
-  QString aTextureFileName = getTextureFileName();
-  if( !aTextureFileName.isEmpty() )
+  if( anIsTexture )
   {
-    myShape->SetTextureFileName( HYDROGUI_Tool::ToAsciiString( aTextureFileName ) );
-    myShape->SetTextureMapOn();
-    myShape->DisableTextureModulate();
+    Handle(AIS_TexturedShape) aTexturedShape = 
+      Handle(AIS_TexturedShape)::DownCast( myShape );
+
+    aTexturedShape->SetTextureFileName( HYDROGUI_Tool::ToAsciiString( aTextureFileName ) );
+    aTexturedShape->SetTextureMapOn();
+    aTexturedShape->DisableTextureModulate();
   }
 
     // Init default params for shape
index 007c3e52d20cecdbae30b027f805739d99686b51..84880112996aaa2e41e5b649475e8b043b53c953 100644 (file)
@@ -24,7 +24,7 @@
 #define HYDROGUI_SHAPE_H
 
 #include <AIS_InteractiveContext.hxx>
-#include <AIS_TexturedShape.hxx>
+#include <AIS_Shape.hxx>
 
 #include <HYDROData_Entity.h>
 
@@ -107,7 +107,7 @@ private:
 private:
   Handle(AIS_InteractiveContext) myContext;
   Handle(HYDROData_Entity)       myObject;
-  Handle(AIS_TexturedShape)      myShape;
+  Handle(AIS_Shape)              myShape;
 
   bool                           myIsToUpdate;
   bool                           myIsVisible;