From: apl Date: Tue, 21 Jan 2014 14:56:21 +0000 (+0000) Subject: 21854: Add persistent dimensions X-Git-Tag: V7_4_0a1~46 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=2ed15de5a1de56783b48ed5c1f2a3990eb58526e;p=modules%2Fgeom.git 21854: Add persistent dimensions - Fixes for arrow orientation & angle text interaction --- diff --git a/src/GEOMGUI/GEOMGUI_DimensionProperty.cxx b/src/GEOMGUI/GEOMGUI_DimensionProperty.cxx index 0191e9c23..5ce7871ac 100644 --- a/src/GEOMGUI/GEOMGUI_DimensionProperty.cxx +++ b/src/GEOMGUI/GEOMGUI_DimensionProperty.cxx @@ -218,7 +218,7 @@ void GEOMGUI_DimensionProperty::Angle::Init( const Handle(AIS_AngleDimension)& t Flyout = theIO->GetFlyout(); TextHPos = theIO->DimensionAspect()->TextHorizontalPosition(); TextVPos = theIO->DimensionAspect()->TextVerticalPosition(); - ArrowPos = theIO->DimensionAspect()->ArrowOrientation(); + ArrowPos = theIO->DimensionAspect()->ArrowOrientation(); } //================================================================================= diff --git a/src/GEOMGUI/GEOM_Displayer.cxx b/src/GEOMGUI/GEOM_Displayer.cxx index 77138e280..0272d8ef7 100644 --- a/src/GEOMGUI/GEOM_Displayer.cxx +++ b/src/GEOMGUI/GEOM_Displayer.cxx @@ -1106,6 +1106,7 @@ void GEOM_Displayer::updateDimensions( const Handle(SALOME_InteractiveObject)& t aStyle->LineAspect()->SetWidth( aLineWidth ); aStyle->SetTextHorizontalPosition( aPrs->DimensionAspect()->TextHorizontalPosition() ); aStyle->SetTextVerticalPosition( aPrs->DimensionAspect()->TextVerticalPosition() ); + aStyle->SetArrowOrientation( aPrs->DimensionAspect()->ArrowOrientation() ); aPrs->SetDimensionAspect( aStyle ); aPrs->SetPolygonOffsets( Aspect_POM_Fill, -1.0, -1.0 ); aPrs->Attributes()->SetDimLengthDisplayUnits( aUnitsLength.toLatin1().data() ); diff --git a/src/MeasureGUI/MeasureGUI_DimensionInteractor.cxx b/src/MeasureGUI/MeasureGUI_DimensionInteractor.cxx index 56b921a20..b95fde502 100644 --- a/src/MeasureGUI/MeasureGUI_DimensionInteractor.cxx +++ b/src/MeasureGUI/MeasureGUI_DimensionInteractor.cxx @@ -601,8 +601,15 @@ void MeasureGUI_DimensionInteractor::MoveText( const Handle(V3d_View)& theView, const gp_Pnt& aFirstPoint = anAngle->FirstPoint(); const gp_Pnt& aSecondPoint = anAngle->SecondPoint(); + Standard_Boolean isPositive = anAngle->GetFlyout() > 0.0; + gp_Dir aFirstDir = gce_MakeDir( aCenterPoint, aFirstPoint ); gp_Dir aSecondDir = gce_MakeDir( aCenterPoint, aSecondPoint ); + if ( anAngle->GetFlyout() < 0.0 ) + { + aFirstDir.Reverse(); + aSecondDir.Reverse(); + } Standard_Real aDirAngle = aFirstDir.Angle( aSecondDir ); @@ -611,49 +618,35 @@ void MeasureGUI_DimensionInteractor::MoveText( const Handle(V3d_View)& theView, // the direction are: \ | / // first \|/ second // dir c dir - // gp_Dir aCenterDir = aFirstDir.Rotated( gp_Ax1( aCenterPoint, aPlaneN ), -aDirAngle * 0.5 ); - gp_Dir aPointDir = gce_MakeDir( aCenterPoint, aPointOnPlane ); + gp_Dir aPointDir = gce_MakeDir( aCenterPoint, aPointOnPlane ); - Standard_Boolean isPositive = aPointDir.Dot( aCenterDir ) > 0; - - Standard_Real aPointAngle = aPointDir.AngleWithRef( aCenterDir, aPlaneN ); - if ( !isPositive ) - { - aPointAngle = ( M_PI - Abs( aPointAngle ) ) * ( -Sign( 1.0, aPointAngle ) ); - } + Standard_Real aPointAngle = aPointDir.AngleWithRef( aCenterDir, aPlaneN ); gp_Vec aPointVec = gp_Vec( aCenterPoint, aPointOnPlane ); Standard_Real aPosY = 0.0; - // the point should lie within the dimension flyout area - if ( isPositive && aPointVec.Dot( aFirstDir ) < 0.0 - || !isPositive && aPointVec.Dot( aFirstDir ) > 0.0 ) - { - return; - } - // calculate flyout for each separate case of point location if ( aPointAngle < -aDirAngle * 0.5 ) // outside of second dir { - aHPos = Prs3d_DTHP_Left; + aHPos = Prs3d_DTHP_Left; aArrPos = Prs3d_DAO_External; - aPosY = Abs( aPointVec.Dot( aFirstDir ) ) - Abs( myInteractedIO->GetFlyout() ); + aPosY = aPointVec.Dot( aFirstDir ) - Abs( anAngle->GetFlyout() ); } else if ( aPointAngle > aDirAngle * 0.5 ) // outside of first dir { - aHPos = Prs3d_DTHP_Right; + aHPos = Prs3d_DTHP_Right; aArrPos = Prs3d_DAO_External; - aPosY = Abs( aPointVec.Dot( aSecondDir ) ) - Abs( myInteractedIO->GetFlyout() ); + aPosY = aPointVec.Dot( aSecondDir ) - Abs( anAngle->GetFlyout() ); } else // between first and second direction { - aHPos = Prs3d_DTHP_Center; + aHPos = Prs3d_DTHP_Center; aArrPos = Prs3d_DAO_Fit; - aPosY = Abs( aPointVec.Magnitude() ) - Abs( myInteractedIO->GetFlyout() ); + aPosY = aPointVec.Magnitude() - Abs( anAngle->GetFlyout() ); } if ( aPosY > aHeight )