From 4aea759d0f2927ce117dcbfc09af794b8a8f17c4 Mon Sep 17 00:00:00 2001 From: isn Date: Fri, 25 Nov 2016 15:20:02 +0300 Subject: [PATCH] optimization of DTM pres + auto fit in cal case dlg --- src/HYDROData/HYDROData_DTM.cxx | 12 +++++++++--- src/HYDROGUI/HYDROGUI_CalculationOp.cxx | 12 ++++++++---- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/HYDROData/HYDROData_DTM.cxx b/src/HYDROData/HYDROData_DTM.cxx index bdbac0cb..78313e36 100644 --- a/src/HYDROData/HYDROData_DTM.cxx +++ b/src/HYDROData/HYDROData_DTM.cxx @@ -49,6 +49,7 @@ #include #include +#include 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, diff --git a/src/HYDROGUI/HYDROGUI_CalculationOp.cxx b/src/HYDROGUI/HYDROGUI_CalculationOp.cxx index 734964c9..6200d72c 100644 --- a/src/HYDROGUI/HYDROGUI_CalculationOp.cxx +++ b/src/HYDROGUI/HYDROGUI_CalculationOp.cxx @@ -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(); } } -- 2.39.2