Salome HOME
refs #1278: by default objects in study are not expanded
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_ShapeImage.cxx
index 3d5199656b4476fdd4db7a80643ff37f836e7209..4f832399d26895271f03bb09d14b9c3469372d0e 100644 (file)
@@ -27,7 +27,7 @@
 #include <gp_Pnt.hxx>
 
 HYDROGUI_ShapeImage::HYDROGUI_ShapeImage( const Handle(AIS_InteractiveContext)& theContext,
-                                          const Handle_HYDROData_Image&         theImage,
+                                          const Handle(HYDROData_Image)&         theImage,
                                           const int                             theZLayer )
 : HYDROGUI_Shape( theContext, theImage, theZLayer )
 {
@@ -48,12 +48,15 @@ void HYDROGUI_ShapeImage::update( bool theIsUpdateViewer, bool isDeactivateSelec
 
 Handle(AIS_InteractiveObject) HYDROGUI_ShapeImage::createShape() const
 {
-    Handle(HYDROData_Image) anImageObj = Handle(HYDROData_Image)::DownCast( getObject() );
-    if ( anImageObj.IsNull() )
-        return Handle_AIS_InteractiveObject();
+  Handle(HYDROGUI_ImagePrs) aPrs;
 
-    Handle(HYDROGUI_ImagePrs) aPrs = new HYDROGUI_ImagePrs( imagePixMap( anImageObj ), imageContour( anImageObj ) );
-    return aPrs;
+  Handle(HYDROData_Image) anImageObj = Handle(HYDROData_Image)::DownCast( getObject() );
+  if ( !anImageObj.IsNull() )
+  {
+    aPrs = new HYDROGUI_ImagePrs( imagePixMap( anImageObj ), imageContour( anImageObj ) );
+  }
+
+  return aPrs;
 }
 
 Handle(Image_PixMap) HYDROGUI_ShapeImage::imagePixMap( const Handle(HYDROData_Image)& theImageObj ) const
@@ -81,7 +84,7 @@ Handle(Image_PixMap) HYDROGUI_ShapeImage::imagePixMap( const Handle(HYDROData_Im
     return aPix;
 }
 
-QPolygonF HYDROGUI_ShapeImage::imageContour( const Handle_HYDROData_Image& theImageObj ) const
+QPolygonF HYDROGUI_ShapeImage::imageContour( const Handle(HYDROData_Image)& theImageObj ) const
 {
     QPolygonF aContour;
     if ( !theImageObj.IsNull() )