Fix bug with annotation update.

This commit is contained in:
apl 2016-11-15 18:33:40 +03:00
parent bc8cdac69f
commit c8f243de05
2 changed files with 29 additions and 4 deletions

View File

@ -395,6 +395,12 @@ void GEOMGUI_AnnotationMgr::UpdateVisibleAnnotations( const QString& theEntry, S
SOCC_Prs* aPrs =
dynamic_cast<SOCC_Prs*> (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<TopAbs_ShapeEnum>( aProperty.ShapeType ), aSubShapeMap );
if ( aProperty.ShapeIndex <= aSubShapeMap.Extent() ) {
aPresentation->SetHilightShape( aSubShapeMap( aProperty.ShapeIndex ) );
}
}
}
aView->getAISContext()->Redisplay( aPresentation );
}
}
getDisplayer()->UpdateViewer();

View File

@ -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 );
}