mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-27 07:00:33 +05:00
21854: Add persistent dimensions
- Fixes for arrow orientation & angle text interaction
This commit is contained in:
parent
b351ee9fc2
commit
2ed15de5a1
@ -218,7 +218,7 @@ void GEOMGUI_DimensionProperty::Angle::Init( const Handle(AIS_AngleDimension)& t
|
|||||||
Flyout = theIO->GetFlyout();
|
Flyout = theIO->GetFlyout();
|
||||||
TextHPos = theIO->DimensionAspect()->TextHorizontalPosition();
|
TextHPos = theIO->DimensionAspect()->TextHorizontalPosition();
|
||||||
TextVPos = theIO->DimensionAspect()->TextVerticalPosition();
|
TextVPos = theIO->DimensionAspect()->TextVerticalPosition();
|
||||||
ArrowPos = theIO->DimensionAspect()->ArrowOrientation();
|
ArrowPos = theIO->DimensionAspect()->ArrowOrientation();
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
|
@ -1106,6 +1106,7 @@ void GEOM_Displayer::updateDimensions( const Handle(SALOME_InteractiveObject)& t
|
|||||||
aStyle->LineAspect()->SetWidth( aLineWidth );
|
aStyle->LineAspect()->SetWidth( aLineWidth );
|
||||||
aStyle->SetTextHorizontalPosition( aPrs->DimensionAspect()->TextHorizontalPosition() );
|
aStyle->SetTextHorizontalPosition( aPrs->DimensionAspect()->TextHorizontalPosition() );
|
||||||
aStyle->SetTextVerticalPosition( aPrs->DimensionAspect()->TextVerticalPosition() );
|
aStyle->SetTextVerticalPosition( aPrs->DimensionAspect()->TextVerticalPosition() );
|
||||||
|
aStyle->SetArrowOrientation( aPrs->DimensionAspect()->ArrowOrientation() );
|
||||||
aPrs->SetDimensionAspect( aStyle );
|
aPrs->SetDimensionAspect( aStyle );
|
||||||
aPrs->SetPolygonOffsets( Aspect_POM_Fill, -1.0, -1.0 );
|
aPrs->SetPolygonOffsets( Aspect_POM_Fill, -1.0, -1.0 );
|
||||||
aPrs->Attributes()->SetDimLengthDisplayUnits( aUnitsLength.toLatin1().data() );
|
aPrs->Attributes()->SetDimLengthDisplayUnits( aUnitsLength.toLatin1().data() );
|
||||||
|
@ -601,8 +601,15 @@ void MeasureGUI_DimensionInteractor::MoveText( const Handle(V3d_View)& theView,
|
|||||||
const gp_Pnt& aFirstPoint = anAngle->FirstPoint();
|
const gp_Pnt& aFirstPoint = anAngle->FirstPoint();
|
||||||
const gp_Pnt& aSecondPoint = anAngle->SecondPoint();
|
const gp_Pnt& aSecondPoint = anAngle->SecondPoint();
|
||||||
|
|
||||||
|
Standard_Boolean isPositive = anAngle->GetFlyout() > 0.0;
|
||||||
|
|
||||||
gp_Dir aFirstDir = gce_MakeDir( aCenterPoint, aFirstPoint );
|
gp_Dir aFirstDir = gce_MakeDir( aCenterPoint, aFirstPoint );
|
||||||
gp_Dir aSecondDir = gce_MakeDir( aCenterPoint, aSecondPoint );
|
gp_Dir aSecondDir = gce_MakeDir( aCenterPoint, aSecondPoint );
|
||||||
|
if ( anAngle->GetFlyout() < 0.0 )
|
||||||
|
{
|
||||||
|
aFirstDir.Reverse();
|
||||||
|
aSecondDir.Reverse();
|
||||||
|
}
|
||||||
|
|
||||||
Standard_Real aDirAngle = aFirstDir.Angle( aSecondDir );
|
Standard_Real aDirAngle = aFirstDir.Angle( aSecondDir );
|
||||||
|
|
||||||
@ -611,49 +618,35 @@ void MeasureGUI_DimensionInteractor::MoveText( const Handle(V3d_View)& theView,
|
|||||||
// the direction are: \ | /
|
// the direction are: \ | /
|
||||||
// first \|/ second
|
// first \|/ second
|
||||||
// dir c dir
|
// dir c dir
|
||||||
//
|
|
||||||
|
|
||||||
gp_Dir aCenterDir = aFirstDir.Rotated( gp_Ax1( aCenterPoint, aPlaneN ), -aDirAngle * 0.5 );
|
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 );
|
||||||
|
|
||||||
Standard_Real aPointAngle = aPointDir.AngleWithRef( aCenterDir, aPlaneN );
|
|
||||||
if ( !isPositive )
|
|
||||||
{
|
|
||||||
aPointAngle = ( M_PI - Abs( aPointAngle ) ) * ( -Sign( 1.0, aPointAngle ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
gp_Vec aPointVec = gp_Vec( aCenterPoint, aPointOnPlane );
|
gp_Vec aPointVec = gp_Vec( aCenterPoint, aPointOnPlane );
|
||||||
|
|
||||||
Standard_Real aPosY = 0.0;
|
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
|
// calculate flyout for each separate case of point location
|
||||||
if ( aPointAngle < -aDirAngle * 0.5 ) // outside of second dir
|
if ( aPointAngle < -aDirAngle * 0.5 ) // outside of second dir
|
||||||
{
|
{
|
||||||
aHPos = Prs3d_DTHP_Left;
|
aHPos = Prs3d_DTHP_Left;
|
||||||
aArrPos = Prs3d_DAO_External;
|
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
|
else if ( aPointAngle > aDirAngle * 0.5 ) // outside of first dir
|
||||||
{
|
{
|
||||||
aHPos = Prs3d_DTHP_Right;
|
aHPos = Prs3d_DTHP_Right;
|
||||||
aArrPos = Prs3d_DAO_External;
|
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
|
else // between first and second direction
|
||||||
{
|
{
|
||||||
aHPos = Prs3d_DTHP_Center;
|
aHPos = Prs3d_DTHP_Center;
|
||||||
aArrPos = Prs3d_DAO_Fit;
|
aArrPos = Prs3d_DAO_Fit;
|
||||||
aPosY = Abs( aPointVec.Magnitude() ) - Abs( myInteractedIO->GetFlyout() );
|
aPosY = aPointVec.Magnitude() - Abs( anAngle->GetFlyout() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( aPosY > aHeight )
|
if ( aPosY > aHeight )
|
||||||
|
Loading…
Reference in New Issue
Block a user