From: apl Date: Tue, 15 Nov 2016 15:33:40 +0000 (+0300) Subject: Fix bug with annotation update. X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c8f243de05288fb4cca7a9bc16c9b89c5d279a98;p=modules%2Fgeom.git Fix bug with annotation update. --- diff --git a/src/GEOMGUI/GEOMGUI_AnnotationMgr.cxx b/src/GEOMGUI/GEOMGUI_AnnotationMgr.cxx index d7e8f3249..9f085c5d1 100755 --- a/src/GEOMGUI/GEOMGUI_AnnotationMgr.cxx +++ b/src/GEOMGUI/GEOMGUI_AnnotationMgr.cxx @@ -395,6 +395,12 @@ void GEOMGUI_AnnotationMgr::UpdateVisibleAnnotations( const QString& theEntry, S SOCC_Prs* aPrs = dynamic_cast (anIt.value()); + GEOMGUI_AnnotationAttrs::Properties aProperty; + GEOM::GEOM_Object_ptr anObject; + getObject( theEntry, anIt.key(), anObject, aProperty ); + TopoDS_Shape aShape = GEOM_Client::get_client().GetShape( GeometryGUI::GetGeomGen(), anObject ); + gp_Ax3 aShapeLCS = gp_Ax3().Transformed( aShape.Location().Transformation() ); + AIS_ListOfInteractive aIObjects; aPrs->GetObjects( aIObjects ); AIS_ListOfInteractive::Iterator aIOIt( aIObjects ); @@ -407,6 +413,24 @@ void GEOMGUI_AnnotationMgr::UpdateVisibleAnnotations( const QString& theEntry, S continue; setDisplayProperties( aPresentation, aView, theEntry ); + + if ( !aShape.IsNull() ) { + + gp_Ax3 aShapeLCS = gp_Ax3().Transformed( aShape.Location().Transformation() ); + GEOMGUI_AnnotationAttrs::SetupPresentation( aPresentation, aProperty, aShapeLCS ); + if ( aProperty.ShapeType == TopAbs_SHAPE ) { + aPresentation->SetHilightShape( aShape ); + } + else if ( aProperty.ShapeIndex > 0 ) { + TopTools_IndexedMapOfShape aSubShapeMap; + TopExp::MapShapes( aShape, static_cast( aProperty.ShapeType ), aSubShapeMap ); + if ( aProperty.ShapeIndex <= aSubShapeMap.Extent() ) { + aPresentation->SetHilightShape( aSubShapeMap( aProperty.ShapeIndex ) ); + } + } + } + + aView->getAISContext()->Redisplay( aPresentation ); } } getDisplayer()->UpdateViewer(); diff --git a/src/OBJECT/GEOM_Annotation.cxx b/src/OBJECT/GEOM_Annotation.cxx index 71d92ddfd..1d966bb3d 100755 --- a/src/OBJECT/GEOM_Annotation.cxx +++ b/src/OBJECT/GEOM_Annotation.cxx @@ -64,7 +64,7 @@ GEOM_Annotation::GEOM_Annotation() : AIS_InteractiveObject() SetIsScreenFixed( Standard_False ); SetAttachPoint( gp_Pnt( 0.0, 0.0, 0.0 ) ); SetDisplayMode( 0 ); - SetZLayer( Graphic3d_ZLayerId_Top ); + SetZLayer( Graphic3d_ZLayerId_Default ); SetAutoHide( Standard_True ); SetHilightMode( HighlightAll ); SetMutable( Standard_True ); @@ -156,7 +156,7 @@ void GEOM_Annotation::SetIsScreenFixed( const Standard_Boolean theIsFixed ) AIS_InteractiveObject::SetTransformPersistence( aPersistence ); - SetZLayer( myIsScreenFixed ? Graphic3d_ZLayerId_Topmost : Graphic3d_ZLayerId_Top ); + SetZLayer( myIsScreenFixed ? Graphic3d_ZLayerId_Topmost : Graphic3d_ZLayerId_Default ); SetToUpdate(); @@ -363,7 +363,7 @@ void GEOM_Annotation::SetDepthCulling( const Standard_Boolean theToEnable ) // ======================================================================= void GEOM_Annotation::SetDefaultZLayer() { - SetZLayer( myIsScreenFixed ? Graphic3d_ZLayerId_Topmost : Graphic3d_ZLayerId_Top ); + SetZLayer( myIsScreenFixed ? Graphic3d_ZLayerId_Topmost : Graphic3d_ZLayerId_Default ); SetToUpdate(); } @@ -906,7 +906,8 @@ void GEOM_Annotation::GEOM_AnnotationOwner::HilightWithColor( const Handle(PrsMg myPrsSh->SetZLayer ( Selectable()->ZLayer() ); - thePM->Color( Selectable(), theStyle, theMode, NULL, Selectable()->ZLayer() ); + thePM->Color( Selectable(), theStyle, theMode, NULL, Graphic3d_ZLayerId_Topmost ); + thePM->Color( myPrsSh, theStyle, theMode, Selectable(), Graphic3d_ZLayerId_Topmost ); }