//=======================================================================
void AIS_AngleDimension::Init()
{
+ SetAngleReversed (Standard_False);
+ SetArrowVisible (Standard_True, Standard_True);
SetSpecialSymbol (THE_DEGREE_SYMBOL);
SetDisplaySpecialSymbol (AIS_DSS_After);
SetFlyout (15.0);
}
gp_Pln aPlane = aConstructPlane.Value();
+ if (myUseReverse) {
+ gp_Ax1 anAxis = aPlane.Axis();
+ gp_Dir aDir = anAxis.Direction();
+ aDir.Reverse();
+ aPlane.SetAxis(gp_Ax1(anAxis.Location(), aDir));
+ }
Standard_Real aRadius = theFirstAttach.Distance (theCenter);
}
gp_Pln aPlane = aConstructPlane.Value();
-
+ if (myUseReverse) {
+ gp_Ax1 anAxis = aPlane.Axis();
+ gp_Dir aDir = anAxis.Direction();
+ aDir.Reverse();
+ aPlane.SetAxis(gp_Ax1(anAxis.Location(), aDir));
+ }
+
// construct circle forming the arc
gce_MakeCirc aConstructCircle (theCenter, aPlane, theRadius);
if (!aConstructCircle.IsDone())
gp_Circ aCircle = aConstructCircle.Value();
// construct the arc
- GC_MakeArcOfCircle aConstructArc (aCircle, theFirstAttach, theSecondAttach, Standard_True);
+ GC_MakeArcOfCircle aConstructArc(aCircle, theFirstAttach, theSecondAttach, Standard_True);
if (!aConstructArc.IsDone())
{
return;
// compute number of discretization elements in old-fanshioned way
gp_Vec aCenterToFirstVec (theCenter, theFirstAttach);
gp_Vec aCenterToSecondVec (theCenter, theSecondAttach);
- const Standard_Real anAngle = aCenterToFirstVec.Angle (aCenterToSecondVec);
+
+ gp_Ax1 anAxis = aPlane.Axis();
+ gp_Dir aDir = anAxis.Direction();
+ gp_Vec aRefVec(aDir);
+ Standard_Real anAngle = aCenterToFirstVec.AngleWithRef (aCenterToSecondVec, aRefVec);
+ if (anAngle < 0)
+ anAngle = 2.0 * M_PI + anAngle;
const Standard_Integer aNbPoints = Max (4, Standard_Integer (50.0 * anAngle / M_PI));
GCPnts_UniformAbscissa aMakePnts (anArcAdaptor, aNbPoints);
if (theMode == ComputeMode_All || theMode == ComputeMode_Line)
{
DrawArc (thePresentation,
- isArrowsExternal ? aFirstAttach : aFirstArrowEnd,
- isArrowsExternal ? aSecondAttach : aSecondArrowEnd,
+ (isArrowsExternal || !myFirstArrowVisible) ? aFirstAttach : aFirstArrowEnd,
+ (isArrowsExternal || !mySecondArrowVisible) ? aSecondAttach : aSecondArrowEnd,
myCenterPoint,
Abs (GetFlyout()),
theMode);
{
DrawExtension (thePresentation,
anExtensionSize,
- isArrowsExternal ? aFirstArrowEnd : aFirstAttach,
+ (isArrowsExternal && myFirstArrowVisible) ? aFirstArrowEnd : aFirstAttach,
aFirstExtensionDir,
aLabelString,
aLabelWidth,
{
DrawExtension (thePresentation,
anExtensionSize,
- isArrowsExternal ? aSecondArrowEnd : aSecondAttach,
+ (isArrowsExternal && mySecondArrowVisible) ? aSecondArrowEnd : aSecondAttach,
aSecondExtensionDir,
aLabelString,
aLabelWidth,
Prs3d_Root::NewGroup (thePresentation);
DrawArc (thePresentation,
- isArrowsExternal ? aFirstAttach : aFirstArrowEnd,
- isArrowsExternal ? aSecondAttach : aSecondArrowEnd,
+ (isArrowsExternal || !myFirstArrowVisible) ? aFirstAttach : aFirstArrowEnd,
+ (isArrowsExternal || !mySecondArrowVisible) ? aSecondAttach : aSecondArrowEnd,
myCenterPoint,
Abs(GetFlyout ()),
theMode);
{
Prs3d_Root::NewGroup (thePresentation);
- DrawArrow (thePresentation, aFirstArrowBegin, gp_Dir (aFirstArrowVec));
- DrawArrow (thePresentation, aSecondArrowBegin, gp_Dir (aSecondArrowVec));
+ if (myFirstArrowVisible)
+ DrawArrow (thePresentation, aFirstArrowBegin, gp_Dir (aFirstArrowVec));
+ if (mySecondArrowVisible)
+ DrawArrow (thePresentation, aSecondArrowBegin, gp_Dir (aSecondArrowVec));
}
if ((theMode == ComputeMode_All || theMode == ComputeMode_Line) && isArrowsExternal)
{
Prs3d_Root::NewGroup (thePresentation);
- if (aHPosition != LabelPosition_Left)
+ if (aHPosition != LabelPosition_Left && myFirstArrowVisible)
{
DrawExtension (thePresentation,
aDimensionAspect->ArrowTailSize(),
LabelPosition_None);
}
- if (aHPosition != LabelPosition_Right)
+ if (aHPosition != LabelPosition_Right && mySecondArrowVisible)
{
DrawExtension (thePresentation,
aDimensionAspect->ArrowTailSize(),
// |
// | <- dimension should be here
// *----
- myFirstPoint = myCenterPoint.Distance (aFirstPoint1) > myCenterPoint.Distance (aLastPoint1)
- ? aFirstPoint1
- : aLastPoint1;
-
- mySecondPoint = myCenterPoint.Distance (aFirstPoint2) > myCenterPoint.Distance (aLastPoint2)
- ? aFirstPoint2
- : aLastPoint2;
+ myFirstPoint = !myCenterPoint.IsEqual(aFirstPoint1, Precision::Confusion())
+ ? aFirstPoint1
+ : aLastPoint1;
+ mySecondPoint = !myCenterPoint.IsEqual(aFirstPoint2, Precision::Confusion())
+ ? aFirstPoint2
+ : aLastPoint2;
}
return IsValidPoints (myFirstPoint, myCenterPoint, mySecondPoint);
myFixedTextPosition = theTextPos;
}
+//=======================================================================
+//function : SetAngleReversed
+//purpose :
+//=======================================================================
+void AIS_AngleDimension::SetAngleReversed(const Standard_Boolean& theUseReverse)
+{
+ myUseReverse = theUseReverse;
+}
+
+//=======================================================================
+//function : SetArrowVisible
+//purpose :
+//=======================================================================
+void AIS_AngleDimension::SetArrowVisible(const Standard_Boolean& theFirstArrowVisible,
+ const Standard_Boolean& theSecondArrowVisible)
+{
+ myFirstArrowVisible = theFirstArrowVisible;
+ mySecondArrowVisible = theSecondArrowVisible;
+}
+
//=======================================================================
//function : AdjustParameters
//purpose :