]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
optimization of DTM pres + auto fit in cal case dlg
authorisn <isn@opencascade.com>
Fri, 25 Nov 2016 12:20:02 +0000 (15:20 +0300)
committerisn <isn@opencascade.com>
Fri, 25 Nov 2016 12:20:02 +0000 (15:20 +0300)
src/HYDROData/HYDROData_DTM.cxx
src/HYDROGUI/HYDROGUI_CalculationOp.cxx

index bdbac0cb3c9b6d8280907a2a491dd7bce96c1d6b..78313e369503e30f90e024bd559b9a567ebd7d00 100644 (file)
@@ -49,6 +49,7 @@
 #include <ShapeAnalysis_Wire.hxx>
 #include <BRepAlgo_NormalProjection.hxx>
 
+#include <BRepBuilderAPI_MakePolygon.hxx>
 
 
 IMPLEMENT_STANDARD_HANDLE( HYDROData_DTM, HYDROData_Bathymetry )
@@ -158,7 +159,7 @@ void HYDROData_DTM::SetSpatialStep( double theSpatialStep )
 
 void HYDROData_DTM::PointToWire(const AltitudePoints& pnts, TopoDS_Wire& W )
 {
-  BRepLib_MakeWire WM;
+  /*BRepLib_MakeWire WM;
   if (pnts.empty())
     return;
   for (int i = 0; i < pnts.size() - 1; i++)
@@ -167,8 +168,13 @@ void HYDROData_DTM::PointToWire(const AltitudePoints& pnts, TopoDS_Wire& W )
     gp_Pnt p2(pnts[i+1].X, pnts[i+1].Y, pnts[i+1].Z);    
     WM.Add(BRepLib_MakeEdge(p1, p2).Edge()); 
   }
-  if (WM.IsDone())
-    W = WM.Wire();
+  if (WM.IsDone())*/
+  
+  BRepBuilderAPI_MakePolygon PM;
+  for (int i = 0; i < pnts.size(); i++)
+    PM.Add(gp_Pnt(pnts[i].X, pnts[i].Y, pnts[i].Z));
+  
+  W = PM.Wire();
 }
 
 TopTools_IndexedMapOfOrientedShape HYDROData_DTM::Create3DShape(const AltitudePoints& left,
index 734964c9fa2199390477d3713b69ac47ae955ea6..6200d72cb53b03257694069177c91c9365a76cf9 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();
   }
 }