From: caremoli Date: Wed, 5 Jan 2011 14:29:52 +0000 (+0000) Subject: CCAR: problem with an endless loop in getAIS X-Git-Tag: Start_BR_19998_21191~98 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=08ccaeae90bafaa10d27c937559208dce69e275a;p=modules%2Fgeom.git CCAR: problem with an endless loop in getAIS --- diff --git a/src/GEOMBase/GEOMBase.cxx b/src/GEOMBase/GEOMBase.cxx index d72fc1019..018f62266 100644 --- a/src/GEOMBase/GEOMBase.cxx +++ b/src/GEOMBase/GEOMBase.cxx @@ -388,23 +388,26 @@ Handle(AIS_InteractiveObject) GEOMBase::GetAIS( const Handle(SALOME_InteractiveO foreach ( SUIT_ViewWindow* view, views ) { if ( view && view->getViewManager()->getType() == OCCViewer_Viewer::Type() ) { - Handle(AIS_InteractiveContext) anIC = ((OCCViewer_Viewer*)view->getViewManager()->getViewModel())->getAISContext(); - - AIS_ListOfInteractive displayed; - anIC->DisplayedObjects( displayed ); - anIC->ObjectsInCollector( displayed ); - - AIS_ListIteratorOfListOfInteractive it( displayed ); - while ( it.More() && aisObject.IsNull() ) { - if ( onlyGeom && !it.Value()->IsInstance( STANDARD_TYPE(GEOM_AISShape) ) ) - continue; - - Handle(SALOME_InteractiveObject) obj = - Handle(SALOME_InteractiveObject)::DownCast( it.Value()->GetOwner() ); - - if ( !obj.IsNull() && obj->isSame( IO ) ) - aisObject = it.Value(); - } + Handle(AIS_InteractiveContext) anIC = ((OCCViewer_Viewer*)view->getViewManager()->getViewModel())->getAISContext(); + + AIS_ListOfInteractive displayed; + anIC->DisplayedObjects( displayed ); + anIC->ObjectsInCollector( displayed ); + + AIS_ListIteratorOfListOfInteractive it( displayed ); + for ( ; it.More(); it.Next() ){ + if ( onlyGeom && !it.Value()->IsInstance( STANDARD_TYPE(GEOM_AISShape) ) ) + continue; + + Handle(SALOME_InteractiveObject) obj = + Handle(SALOME_InteractiveObject)::DownCast( it.Value()->GetOwner() ); + + if ( !obj.IsNull() && obj->isSame( IO ) ) + { + aisObject = it.Value(); + break; + } + } } if ( !aisObject.IsNull() ) break; } @@ -438,7 +441,7 @@ QStringList GEOMBase::ConvertListOfIOInListOfIOR( const SALOME_ListIO& IObjects for ( ; it.More(); it.Next() ) { GEOM::GEOM_Object_var geomObj = ConvertIOinGEOMObject( it.Value() ); if ( !CORBA::is_nil( geomObj ) ) - iors.append( GetIORFromObject( geomObj ) ); + iors.append( GetIORFromObject( geomObj ) ); } } return iors; @@ -460,8 +463,8 @@ GEOM::GEOM_Object_ptr GEOMBase::ConvertIOinGEOMObject( const Handle(SALOME_Inter _PTR(SObject) obj( studyDS->FindObjectID( IO->getEntry() ) ); if ( obj ) { CORBA::Object_var corbaObj = GeometryGUI::ClientSObjectToObject( obj ); - if ( !CORBA::is_nil( corbaObj ) ) - object = GEOM::GEOM_Object::_narrow( corbaObj ); + if ( !CORBA::is_nil( corbaObj ) ) + object = GEOM::GEOM_Object::_narrow( corbaObj ); } } } @@ -517,20 +520,20 @@ TopoDS_Shape GEOMBase::CreateArrowForLinearEdge( const TopoDS_Shape& shape ) Standard_Real first, last; Handle(Geom_Curve) curv = BRep_Tool::Curve( TopoDS::Edge( shape ), first, last ); if ( curv->IsCN(1) ) { - const Standard_Real param = ( first+last ) / 2.0; - gp_Pnt middleParamPoint; - gp_Vec V1; - curv->D1( param, middleParamPoint, V1 ); - if ( V1.Magnitude() > Precision::Confusion() ) { - /* Topology orientation not geom orientation */ - if ( shape.Orientation() == TopAbs_REVERSED ) - V1 *= -1.0; - - gp_Ax2 anAxis( middleParamPoint, gp_Dir( V1 ) ); - const Standard_Real radius1 = aHeight / 5.0; - if ( radius1 > 10.0 * Precision::Confusion() && aHeight > 10.0 * Precision::Confusion() ) - ArrowCone = BRepPrimAPI_MakeCone( anAxis, radius1, 0.0, aHeight ).Shape(); - } + const Standard_Real param = ( first+last ) / 2.0; + gp_Pnt middleParamPoint; + gp_Vec V1; + curv->D1( param, middleParamPoint, V1 ); + if ( V1.Magnitude() > Precision::Confusion() ) { + /* Topology orientation not geom orientation */ + if ( shape.Orientation() == TopAbs_REVERSED ) + V1 *= -1.0; + + gp_Ax2 anAxis( middleParamPoint, gp_Dir( V1 ) ); + const Standard_Real radius1 = aHeight / 5.0; + if ( radius1 > 10.0 * Precision::Confusion() && aHeight > 10.0 * Precision::Confusion() ) + ArrowCone = BRepPrimAPI_MakeCone( anAxis, radius1, 0.0, aHeight ).Shape(); + } } } catch ( Standard_Failure ) { diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx b/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx index 9efec8b19..0c95be2d2 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx +++ b/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx @@ -325,7 +325,7 @@ void GEOMToolsGUI::OnColor() for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) { aView->SetColor( It.Value(), c ); } - GeometryGUI::Modified(); + GeometryGUI::Modified(); } } // if ( isVTK ) else if ( isOCC ) { @@ -383,8 +383,8 @@ void GEOMToolsGUI::OnColor() anObject->SetColor( aSColor ); anObject->SetAutoColor( false ); } - GeometryGUI::Modified(); - } + } // for + GeometryGUI::Modified(); } // if c.isValid() } // first IO is not null } // if ( isOCC ) @@ -506,40 +506,40 @@ void GEOMToolsGUI::OnNbIsos( ActionType actionType ) int newNbVIso = -1; if ( actionType == SHOWDLG ) { - GEOMToolsGUI_NbIsosDlg * NbIsosDlg = - new GEOMToolsGUI_NbIsosDlg( SUIT_Session::session()->activeApplication()->desktop() ); + GEOMToolsGUI_NbIsosDlg * NbIsosDlg = + new GEOMToolsGUI_NbIsosDlg( SUIT_Session::session()->activeApplication()->desktop() ); - NbIsosDlg->setU( UIso ); - NbIsosDlg->setV( VIso ); + NbIsosDlg->setU( UIso ); + NbIsosDlg->setV( VIso ); - if ( NbIsosDlg->exec() ) { - SUIT_OverrideCursor(); - - newNbUIso = NbIsosDlg->getU(); + if ( NbIsosDlg->exec() ) { + SUIT_OverrideCursor(); + + newNbUIso = NbIsosDlg->getU(); newNbVIso = NbIsosDlg->getV(); - } + } } else if ( actionType == INCR || actionType == DECR ) { - int delta = 1; - if (actionType == DECR) - delta = -1; - - newNbUIso = UIso + delta; - newNbVIso = VIso + delta; - - if ( newNbUIso < 0 || newNbVIso < 0 || newNbUIso > 99 || newNbVIso > 99 ) - return; + int delta = 1; + if (actionType == DECR) + delta = -1; + + newNbUIso = UIso + delta; + newNbVIso = VIso + delta; + + if ( newNbUIso < 0 || newNbVIso < 0 || newNbUIso > 99 || newNbVIso > 99 ) + return; } for(; ic->MoreCurrent(); ic->NextCurrent()) { - CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current()); - Handle(AIS_Drawer) CurDrawer = CurObject->Attributes(); - - CurDrawer->SetUIsoAspect( new Prs3d_IsoAspect(Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 0.5 , newNbUIso) ); - CurDrawer->SetVIsoAspect( new Prs3d_IsoAspect(Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 0.5 , newNbVIso) ); - - ic->SetLocalAttributes(CurObject, CurDrawer); - ic->Redisplay(CurObject); + CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current()); + Handle(AIS_Drawer) CurDrawer = CurObject->Attributes(); + + CurDrawer->SetUIsoAspect( new Prs3d_IsoAspect(Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 0.5 , newNbUIso) ); + CurDrawer->SetVIsoAspect( new Prs3d_IsoAspect(Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 0.5 , newNbVIso) ); + + ic->SetLocalAttributes(CurObject, CurDrawer); + ic->Redisplay(CurObject); } } GeometryGUI::Modified(); @@ -599,35 +599,35 @@ void GEOMToolsGUI::OnNbIsos( ActionType actionType ) if ( actionType == SHOWDLG ) { GEOMToolsGUI_NbIsosDlg* NbIsosDlg = - new GEOMToolsGUI_NbIsosDlg( SUIT_Session::session()->activeApplication()->desktop() ); + new GEOMToolsGUI_NbIsosDlg( SUIT_Session::session()->activeApplication()->desktop() ); NbIsosDlg->setU( UIso ); NbIsosDlg->setV( VIso ); if ( NbIsosDlg->exec() ) { - SUIT_OverrideCursor(); + SUIT_OverrideCursor(); - newNbUIso = NbIsosDlg->getU(); - newNbVIso = NbIsosDlg->getV(); + newNbUIso = NbIsosDlg->getU(); + newNbVIso = NbIsosDlg->getV(); } } else if ( actionType == INCR || actionType == DECR ) { int delta = 1; if (actionType == DECR) - delta = -1; + delta = -1; newNbUIso = UIso + delta; newNbVIso = VIso + delta; if ( newNbUIso < 0 || newNbVIso < 0 || newNbUIso > 99 || newNbVIso > 99 ) - return; + return; } while( anAct!=NULL ) { if(GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct)){ - // There are no casting to needed actor. - int aIsos[2]={newNbUIso,newNbVIso}; - anActor->SetNbIsos(aIsos); + // There are no casting to needed actor. + int aIsos[2]={newNbUIso,newNbVIso}; + anActor->SetNbIsos(aIsos); } anAct = aCollection->GetNextActor(); }