From: nds Date: Wed, 4 Dec 2013 05:09:31 +0000 (+0000) Subject: OCC functionality moving out from the widget X-Git-Tag: BR_hydro_v_0_4~69 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b9df5f57ff45063307cb0e4c17b70cb77a3d4494;p=modules%2Fhydro.git OCC functionality moving out from the widget Restore selection - performance problem on 80 points. Bug #136 --- diff --git a/src/HYDROCurveCreator/CurveCreator_Widget.cxx b/src/HYDROCurveCreator/CurveCreator_Widget.cxx index 719a58a7..41f2485f 100644 --- a/src/HYDROCurveCreator/CurveCreator_Widget.cxx +++ b/src/HYDROCurveCreator/CurveCreator_Widget.cxx @@ -1303,45 +1303,49 @@ void CurveCreator_Widget::setSelectedPonts( const CurveCreator_ICurve::SectionTo return; AIS_ListOfInteractive aListToSelect; - AIS_ListOfInteractive aDisplayedList; ic->DisplayedObjects( aDisplayedList ); ic->ClearSelected( Standard_False ); + std::vector aVetexVec; + for ( AIS_ListIteratorOfListOfInteractive it( aDisplayedList ); it.More(); it.Next() ) + { + Handle(AIS_InteractiveObject) anAIS = it.Value(); + if ( anAIS.IsNull() ) + continue; + Handle(AIS_Shape) anAISShape = Handle(AIS_Shape)::DownCast( anAIS ); + if ( anAISShape.IsNull() ) + continue; + const TopoDS_Shape& aShape = anAISShape->Shape(); + TopExp_Explorer aExpV( aShape, TopAbs_VERTEX); + for ( ; aExpV.More(); aExpV.Next() ) + { + const TopoDS_Vertex& aVertex = TopoDS::Vertex( aExpV.Current() ); + aVetexVec.push_back( aVertex ); + } + } + bool isSelectedVertex = false; + + std::vector::const_iterator aVecIt = aVetexVec.begin(), aVecLast = aVetexVec.end(); CurveCreator_ICurve::SectionToPointList::const_iterator anIt = thePoints.begin(), aLast = thePoints.end(); + int aSize = aVetexVec.size(); CurveCreator_ICurve::SectionToPoint aSToPoint; - bool isSelectedVertex = false; + int anAddedSize = 0; for( ; anIt != aLast; anIt++ ) { aSToPoint = *anIt; - for ( AIS_ListIteratorOfListOfInteractive it( aDisplayedList ); it.More(); it.Next() ) + + for ( aVecIt = aVetexVec.begin(); aVecIt != aVecLast; aVecIt++ ) { - Handle(AIS_InteractiveObject) anAIS = it.Value(); - if ( anAIS.IsNull() ) - continue; - Handle(AIS_Point) anAISPoint = Handle(AIS_Point)::DownCast( anAIS ); - if ( !anAISPoint.IsNull() ) { - TopoDS_Vertex aVertex = TopoDS::Vertex( anAISPoint->Vertex() ); - if ( isIntersectVertexToPoint( aVertex, aSToPoint ) ) - aListToSelect.Append( anAIS ); - } - else { - Handle(AIS_Shape) anAISShape = Handle(AIS_Shape)::DownCast( anAIS ); - if ( anAISShape.IsNull() ) - continue; - const TopoDS_Shape& aShape = anAISShape->Shape(); - TopExp_Explorer aExpV( aShape, TopAbs_VERTEX); - for ( ; aExpV.More(); aExpV.Next() ) - { - const TopoDS_Vertex& aVertex = TopoDS::Vertex( aExpV.Current() ); - if ( isIntersectVertexToPoint( aVertex, aSToPoint ) ) { - ic->AddOrRemoveSelected( aVertex, Standard_False ); - isSelectedVertex = true; - } - } + TopoDS_Vertex aVertex = TopoDS::Vertex( *aVecIt ); + if ( isIntersectVertexToPoint( aVertex, aSToPoint ) ) { + ic->AddOrRemoveSelected( aVertex, Standard_False ); + isSelectedVertex = true; + anAddedSize++; } } } + ic->UpdateCurrentViewer(); if ( !isSelectedVertex ) setObjectsSelected( aListToSelect );