21854: Add persistent dimensions

- Minor remarks: LCS from TopLoc_Location for quickness
This commit is contained in:
apl 2014-01-21 16:42:20 +00:00
parent f7284cdba3
commit 7ae44206e9
4 changed files with 15 additions and 6 deletions

View File

@ -1021,6 +1021,11 @@ void GEOM_Displayer::updateDimensions( const Handle(SALOME_InteractiveObject)& t
} }
aListOfIO.Remove( aIterateIO ); aListOfIO.Remove( aIterateIO );
if ( !aIterateIO.More() )
{
break;
}
} }
// prepare dimension styling // prepare dimension styling
@ -1333,7 +1338,7 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs )
} }
} }
updateDimensions( myIO, occPrs, GEOMUtils::GetPosition( myShape ) ); updateDimensions( myIO, occPrs, gp_Ax3().Transformed( myShape.Location().Transformation() ) );
} }
} }

View File

@ -635,7 +635,7 @@ bool MeasureGUI_CreateDimensionDlg::AddDimensionToOwner()
TopoDS_Shape anParentSh; TopoDS_Shape anParentSh;
if ( GEOMBase::GetShape( myParentObj.get(), anParentSh ) ) if ( GEOMBase::GetShape( myParentObj.get(), anParentSh ) )
{ {
aLCS = GEOMUtils::GetPosition( anParentSh ); aLCS = gp_Ax3().Transformed( anParentSh.Location().Transformation() );
} }
QString aName = getNewObjectName(); QString aName = getNewObjectName();

View File

@ -602,7 +602,9 @@ Handle(AIS_DiameterDimension) MeasureGUI_DimensionCreateTool::Diameter( const GE
TopTools_ListIteratorOfListOfShape aFaceIt( aFaces ); TopTools_ListIteratorOfListOfShape aFaceIt( aFaces );
for ( ; aFaceIt.More(); aFaceIt.Next() ) for ( ; aFaceIt.More(); aFaceIt.Next() )
{ {
Handle(Geom_Surface) aSurface = BRep_Tool::Surface( TopoDS::Face( aFaceIt.Value() ) ); TopoDS_Face aFace = TopoDS::Face( aFaceIt.Value() );
Handle(Geom_Surface) aSurface = BRep_Tool::Surface( TopoDS::Face( aFace ) );
gp_Pnt aCircCenter = aCircle->Circ().Location(); gp_Pnt aCircCenter = aCircle->Circ().Location();
Standard_Real aCircU = 0.0, aCircV = 0.0; Standard_Real aCircU = 0.0, aCircV = 0.0;
@ -619,7 +621,7 @@ Handle(AIS_DiameterDimension) MeasureGUI_DimensionCreateTool::Diameter( const GE
continue; continue;
} }
aFaceN = gp_Vec( aNorm ); aFaceN = gp_Vec( aFace.Orientation() == TopAbs_REVERSED ? -aNorm : aNorm );
} }
} }
break; break;
@ -676,7 +678,9 @@ Handle(AIS_DiameterDimension) MeasureGUI_DimensionCreateTool::Diameter( const GE
Standard_Real aCircR = aCircle->Circ().Radius(); Standard_Real aCircR = aCircle->Circ().Radius();
// construct closed circle as base for the diameter dimension // construct closed circle as base for the diameter dimension
gp_Circ aRuledCirc = gce_MakeCirc( gp_Ax2( aCircP, aCircN, aCircX ), aCircR ); Standard_Boolean isReversed = ( ( aPln.Axis().Direction() ^ aCircX ) * aCircN ) < 0.0;
gp_Circ aRuledCirc = gce_MakeCirc( gp_Ax2( aCircP, isReversed ? -aCircN : aCircN, aCircX ), aCircR );
Handle(AIS_DiameterDimension) aDimension = new AIS_DiameterDimension( aRuledCirc, aPln ); Handle(AIS_DiameterDimension) aDimension = new AIS_DiameterDimension( aRuledCirc, aPln );

View File

@ -643,7 +643,7 @@ void MeasureGUI_ManageDimensionsDlg::OnInteractionFinished( Handle(AIS_Interacti
TopoDS_Shape anParentSh; TopoDS_Shape anParentSh;
if ( GEOMBase::GetShape( myEditObject.get(), anParentSh ) ) if ( GEOMBase::GetShape( myEditObject.get(), anParentSh ) )
{ {
aLCS = GEOMUtils::GetPosition( anParentSh ); aLCS = gp_Ax3().Transformed( anParentSh.Location().Transformation() );
} }
int aDimensionId = IdFromPrs( theIO ); int aDimensionId = IdFromPrs( theIO );