Salome HOME
Initial merge of branch 'BR_HYDRO_IMPS_2016' into BR_PORTING_OCCT_7
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_CalculationOp.cxx
index 734964c9fa2199390477d3713b69ac47ae955ea6..134c3bd0b2996beb4d13914db545b34c115e382b 100644 (file)
@@ -1238,7 +1238,8 @@ void HYDROGUI_CalculationOp::createPreview( const bool theLandCoverMap )
   }
 
   // Get a boundary polyline if any
-  aSeq.Append( myEditedObject->GetBoundaryPolyline() );
+  if (Handle(HYDROData_PolylineXY) aBPoly = myEditedObject->GetBoundaryPolyline())
+    aSeq.Append( aBPoly );
 
   module()->removeViewShapes( HYDROGUI_Module::VMR_PreviewCaseZones );
 
@@ -1275,16 +1276,19 @@ void HYDROGUI_CalculationOp::createPreview( const bool theLandCoverMap )
       HYDROData_SequenceOfObjects::Iterator anIter( aSeq );
       for ( ; anIter.More(); anIter.Next() )
       {
-        setObjectVisibility( anIter.Value(), true );
+        const Handle(HYDROData_Entity)& ent = anIter.Value();
+        if (!ent.IsNull())
+          setObjectVisibility( ent, true );
       }
 
       //Process the draw events for viewer
       QApplication::processEvents( QEventLoop::ExcludeUserInputEvents );
-      if ( OCCViewer_ViewWindow* vw = (OCCViewer_ViewWindow*)myPreviewViewManager->getActiveView() )
-        vw->onTopView();
     }
 
     module()->update( UF_OCCViewer | UF_FitAll );
+
+    if ( OCCViewer_ViewWindow* vw = (OCCViewer_ViewWindow*)myPreviewViewManager->getActiveView() )
+      vw->onTopView();
   }
 }
 
@@ -1367,11 +1371,11 @@ void HYDROGUI_CalculationOp::setAvailableGroups()
   HYDROData_SequenceOfObjects anObjs = myEditedObject->GetGeometryObjects();
   for( int anIndex = 1, aLength = anObjs.Length(); anIndex <= aLength; anIndex++ )
   {
-    Handle_HYDROData_Object anObj = Handle_HYDROData_Object::DownCast( anObjs.Value( anIndex ) );
+    Handle(HYDROData_Object) anObj = Handle(HYDROData_Object)::DownCast( anObjs.Value( anIndex ) );
     HYDROData_SequenceOfObjects aGroups = anObj->GetGroups();
     for( int aGIndex = 1, aGLength = aGroups.Length(); aGIndex <= aGLength; aGIndex++ )
     {
-      Handle_HYDROData_ShapesGroup aGroup = Handle_HYDROData_ShapesGroup::DownCast( aGroups.Value( aGIndex ) );
+      Handle(HYDROData_ShapesGroup) aGroup = Handle(HYDROData_ShapesGroup)::DownCast( aGroups.Value( aGIndex ) );
       aGroupsNames.append( aGroup->GetName() );
     }
   }