//purpose :
//=======================================================================
AIS_AngleDimension::AIS_AngleDimension (const TopoDS_Edge& theFirstEdge,
- const TopoDS_Edge& theSecondEdge)
+ const TopoDS_Edge& theSecondEdge,
+ const Standard_Boolean& theUseLongestDistance)
: AIS_Dimension (AIS_KOD_PLANEANGLE)
{
Init();
- SetMeasuredGeometry (theFirstEdge, theSecondEdge);
+ SetMeasuredGeometry (theFirstEdge, theSecondEdge, theUseLongestDistance);
}
//=======================================================================
//purpose :
//=======================================================================
void AIS_AngleDimension::SetMeasuredGeometry (const TopoDS_Edge& theFirstEdge,
- const TopoDS_Edge& theSecondEdge)
+ const TopoDS_Edge& theSecondEdge,
+ const Standard_Boolean& theUseLongestDistance)
{
gp_Pln aComputedPlane;
mySecondShape = theSecondEdge;
myThirdShape = TopoDS_Shape();
myGeometryType = GeometryType_Edges;
- myIsGeometryValid = InitTwoEdgesAngle (aComputedPlane);
+ myIsGeometryValid = InitTwoEdgesAngle (aComputedPlane, theUseLongestDistance);
if (myIsGeometryValid && !myIsPlaneCustom)
{
//function : InitTwoEdgesAngle
//purpose :
//=======================================================================
-Standard_Boolean AIS_AngleDimension::InitTwoEdgesAngle (gp_Pln& theComputedPlane)
+Standard_Boolean AIS_AngleDimension::InitTwoEdgesAngle (gp_Pln& theComputedPlane,
+ const Standard_Boolean& theUseLongestDistance)
{
TopoDS_Edge aFirstEdge = TopoDS::Edge (myFirstShape);
TopoDS_Edge aSecondEdge = TopoDS::Edge (mySecondShape);
// |
// | <- dimension should be here
// *----
- myFirstPoint = myCenterPoint.Distance (aFirstPoint1) > myCenterPoint.Distance (aLastPoint1)
- ? aFirstPoint1
- : aLastPoint1;
-
- mySecondPoint = myCenterPoint.Distance (aFirstPoint2) > myCenterPoint.Distance (aLastPoint2)
- ? aFirstPoint2
- : aLastPoint2;
+ if (theUseLongestDistance) {
+ myFirstPoint = myCenterPoint.Distance (aFirstPoint1) > myCenterPoint.Distance (aLastPoint1)
+ ? aFirstPoint1
+ : aLastPoint1;
+
+ mySecondPoint = myCenterPoint.Distance (aFirstPoint2) > myCenterPoint.Distance (aLastPoint2)
+ ? aFirstPoint2
+ : aLastPoint2;
+ } else {
+ myFirstPoint = !myCenterPoint.IsEqual(aFirstPoint1, Precision::Confusion())
+ ? aFirstPoint1
+ : aLastPoint1;
+ mySecondPoint = !myCenterPoint.IsEqual(aFirstPoint2, Precision::Confusion())
+ ? aFirstPoint2
+ : aLastPoint2;
+ }
}
return IsValidPoints (myFirstPoint, myCenterPoint, mySecondPoint);
//! These two edges should be intersected by each other. Otherwise the geometry is not valid.
//! @param theFirstEdge [in] the first edge.
//! @param theSecondEdge [in] the second edge.
+ //! @param theUseLongestDistance [in] automatically fills first/second points of presentation by
+ //! the maximum distanced point of edges from the presentation center
Standard_EXPORT AIS_AngleDimension (const TopoDS_Edge& theFirstEdge,
- const TopoDS_Edge& theSecondEdge);
+ const TopoDS_Edge& theSecondEdge,
+ const Standard_Boolean& theUseLongestDistance = Standard_True);
//! Constructs the angle display object defined by three points.
//! @param theFirstPoint [in] the first point (point on first angle flyout).
//! These two edges should be intersected by each other. Otherwise the geometry is not valid.
//! @param theFirstEdge [in] the first edge.
//! @param theSecondEdge [in] the second edge.
+ //! @param theUseLongestDistance [in] automatically fills first/second points of presentation by
+ //! the maximum distanced point of edges from the presentation center
Standard_EXPORT void SetMeasuredGeometry (const TopoDS_Edge& theFirstEdge,
- const TopoDS_Edge& theSecondEdge);
+ const TopoDS_Edge& theSecondEdge,
+ const Standard_Boolean& theUseLongestDistance = Standard_True);
//! Measures angle defined by three points.
//! @param theFirstPoint [in] the first point (point on first angle flyout).
protected:
//! Init angular dimension to measure angle between two linear edges.
+ //! @param theUseLongestDistance [in] automatically fills first/second points of presentation by
+ //! the maximum distanced point of edges from the presentation center
//! @return TRUE if the angular dimension can be constructured
//! for the passed edges.
- Standard_EXPORT Standard_Boolean InitTwoEdgesAngle (gp_Pln& theComputedPlane);
+ Standard_EXPORT Standard_Boolean InitTwoEdgesAngle (gp_Pln& theComputedPlane,
+ const Standard_Boolean& theUseLongestDistance = Standard_True);
//! Init angular dimension to measure angle between two planar faces.
//! there is no user-defined poisitoning. So attach points are set
case SketcherPrs_Tools::ANGLE_DIRECT: {
SetArrowVisible(Standard_False/*first*/, Standard_True/*second*/);
- SetMeasuredGeometry(aEdge1, aEdge2);
+ SetMeasuredGeometry(aEdge1, aEdge2, Standard_False);
bool isReversedPlanes = isAnglePlaneReversedToSketchPlane();
SetAngleReversed(!isReversedPlanes);
}
SetArrowVisible(Standard_True/*first*/, Standard_False/*second*/);
// to calculate center, first and end points
SetAngleReversed(false);
- SetMeasuredGeometry(aEdge1, aEdge2);
+ SetMeasuredGeometry(aEdge1, aEdge2, Standard_False);
/// the first point will be moved, so it is necessary to find distance
/// after applying initial parameters of geometry but before correcting them
/// for the current type of angle(complementary)
case SketcherPrs_Tools::ANGLE_BACKWARD: {
SetArrowVisible(Standard_False/*first*/, Standard_True/*second*/);
- SetMeasuredGeometry(aEdge1, aEdge2);
+ SetMeasuredGeometry(aEdge1, aEdge2, Standard_False);
bool isReversedPlanes = isAnglePlaneReversedToSketchPlane();
SetAngleReversed(isReversedPlanes);
}